-
Notifications
You must be signed in to change notification settings - Fork 2
/
react.js
104 lines (99 loc) · 2.68 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const {ERROR, OFF, testFiles} = require('./config');
module.exports = {
plugins: ['jsx-a11y', 'react', 'react-hooks', 'sort-destructure-keys'],
settings: {
react: {
version: 'detect'
},
'import/resolver': {
node: {
paths: ['node_modules', 'src']
}
}
},
extends: ['plugin:jsx-a11y/recommended', 'plugin:react/recommended'],
rules: {
'jsx-a11y/label-has-associated-control': ERROR,
'react/button-has-type': ERROR,
'react/default-props-match-prop-types': ERROR,
'react-hooks/rules-of-hooks': ERROR,
'react-hooks/exhaustive-deps': [
ERROR,
// Since we throw on missing deps, it's not a question of whether or not
// the deps are added, but rather if you have to do it manually or
// automatically. Therefore go for the automatic fix.
{enableDangerousAutofixThisMayCauseInfiniteLoops: true}
],
'react/react-in-jsx-scope': OFF,
'react/jsx-boolean-value': [ERROR, 'never', {always: []}],
'react/jsx-curly-brace-presence': [
ERROR,
{props: 'never', children: 'ignore'}
],
'react/function-component-definition': [
ERROR,
{
namedComponents: 'function-declaration',
unnamedComponents: 'arrow-function'
}
],
'react/jsx-handler-names': [
ERROR,
{
eventHandlerPrefix: 'on',
eventHandlerPropPrefix: 'on'
}
],
'react/jsx-no-bind': [
ERROR,
{allowArrowFunctions: true, allowFunctions: true}
],
'react/jsx-no-target-blank': ERROR,
'react/jsx-sort-props': [
ERROR,
{
locale: 'en',
ignoreCase: true,
reservedFirst: ['key', 'ref']
}
],
'react/no-access-state-in-setstate': ERROR,
'react/no-direct-mutation-state': ERROR,
'react/no-this-in-sfc': ERROR,
'react/no-typos': ERROR,
'react/no-unstable-nested-components': [ERROR, {allowAsProps: true}],
'react/no-unused-prop-types': ERROR,
'react/no-unused-state': ERROR,
'react/self-closing-comp': ERROR,
'react/sort-comp': [
ERROR,
{
order: [
'type-annotations',
'static-variables',
'static-methods',
'instance-variables',
'lifecycle',
'/^on.+$/',
'getters',
'setters',
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
'everything-else',
'/^render.+$/',
'render'
]
}
],
'react/sort-prop-types': ERROR,
'sort-destructure-keys/sort-destructure-keys': ERROR
},
overrides: [
{
files: testFiles,
rules: {
'react/prop-types': OFF,
'react/display-name': OFF
}
}
]
};