-
Notifications
You must be signed in to change notification settings - Fork 2
/
react.js
87 lines (81 loc) · 2.07 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
const config = require('./config');
const base = require('./index');
const ERROR = 'error';
const OFF = 'off';
module.exports = Object.assign({}, base, {
plugins: base.plugins.concat('css-modules', 'jsx-a11y', 'react'),
settings: Object.assign({}, base.settings, {
'import/resolver': {
node: {
paths: ['node_modules', 'src']
}
}
}),
extends: (base.extends || []).concat(
'plugin:css-modules/recommended',
'plugin:jsx-a11y/recommended',
'plugin:react/recommended'
),
rules: Object.assign({}, base.rules, {
'jsx-a11y/label-has-for': [
ERROR,
{
required: {every: ['nesting']},
allowChildren: true
}
],
'react/default-props-match-prop-types': ERROR,
'react/jsx-boolean-value': [ERROR, 'never', {always: []}],
'react/jsx-curly-brace-presence': [
ERROR,
{props: 'never', children: 'ignore'}
],
'react/jsx-handler-names': [
ERROR,
{
eventHandlerPrefix: 'on',
eventHandlerPropPrefix: 'on'
}
],
'react/jsx-no-bind': [ERROR, {allowArrowFunctions: true}],
'react/jsx-no-target-blank': ERROR,
'react/jsx-sort-props': [
ERROR,
{
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-unused-prop-types': ERROR,
'react/no-unused-state': ERROR,
'react/sort-comp': [
ERROR,
{
order: [
'static-methods',
'lifecycle',
'/^on.+$/',
'getters',
'setters',
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
'everything-else',
'/^render.+$/',
'render'
]
}
],
'react/sort-prop-types': ERROR
}),
overrides: (base.overrides || []).concat({
files: config.testFiles,
rules: {
'css-modules/no-unused-class': OFF,
'react/prop-types': OFF,
'react/display-name': OFF
}
})
});