-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact.js
69 lines (67 loc) · 2.89 KB
/
react.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
module.exports = {
extends: [
'airbnb',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],
rules: {
'react/default-props-match-prop-types': 'off', // unnecessary with TypeScript
'react/destructuring-assignment': 'off',
'react/forbid-prop-types': 'off', // unnecessary with TypeScript
'react/forbid-foreign-prop-types': 'off', // unnecessary with TypeScript
'react/function-component-definition': [
'error',
{
namedComponents: [
'function-declaration', // top-level components
'function-expression', // top-level components conforming to a component type
'arrow-function', // for dynamically created components
],
},
],
'react/jsx-closing-tag-location': 'off',
'react/jsx-curly-brace-presence': [
'error',
{ props: 'never', children: 'never', propElementValues: 'always' },
],
'react/jsx-filename-extension': 'off',
'react/jsx-first-prop-new-line': ['error', 'multiline'],
'react/jsx-no-target-blank': 'off',
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md#allowexpressions
'react/jsx-props-no-spreading': 'off',
'react/jsx-uses-vars': 'error',
'react/no-access-state-in-setstate': 'error',
'react/no-danger': 'error',
'react/no-direct-mutation-state': 'error',
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
'react/no-unused-prop-types': 'off', // unnecessary with TypeScript
'react/no-unused-state': 'error',
'react/prop-types': 'off', // unnecessary with TypeScript
'react/require-default-props': 'off', // unnecessary with function components
'react/require-extension': 'off',
'react/self-closing-comp': 'off',
'react/sort-comp': 'off',
'react/sort-prop-types': 'off',
'react/state-in-constructor': 'off',
'react/static-property-placement': ['error', 'static public field'],
// Not always accurate, but should be explicitly ignored in order to not trash the log
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
'jsx-a11y/aria-props': 'error',
'jsx-a11y/control-has-associated-label': 'off',
'jsx-a11y/heading-has-content': 'off',
'jsx-a11y/label-has-associated-control': [
'error',
{
// NOTE: If this error triggers, either disable it or add
// your custom components, labels and attributes via these options
// See https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-associated-control.md
controlComponents: ['Input'],
},
],
'jsx-a11y/label-has-for': 'off',
'jsx-a11y/mouse-events-have-key-events': 'error',
'jsx-a11y/role-has-required-aria-props': 'error',
'jsx-a11y/role-supports-aria-props': 'error',
},
};