1 | const OFF = 0
|
2 | const ERROR = 2
|
3 |
|
4 | module.exports = {
|
5 | plugins: ['react'],
|
6 | parserOptions: {
|
7 | ecmaFeatures: {
|
8 | jsx: true
|
9 | }
|
10 | },
|
11 | rules: {
|
12 |
|
13 | 'class-methods-use-this': [
|
14 | ERROR,
|
15 | {
|
16 | exceptMethods: [
|
17 | 'render',
|
18 | 'getInitialState',
|
19 | 'getDefaultProps',
|
20 | 'getChildContext',
|
21 | 'componentWillMount',
|
22 | 'componentDidMount',
|
23 | 'componentWillReceiveProps',
|
24 | 'shouldComponentUpdate',
|
25 | 'componentWillUpdate',
|
26 | 'componentDidUpdate',
|
27 | 'componentWillUnmount'
|
28 | ]
|
29 | }
|
30 | ],
|
31 | 'react/no-unused-state': ERROR,
|
32 | 'react/boolean-prop-naming': [
|
33 | ERROR,
|
34 | {
|
35 | propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
|
36 | rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+'
|
37 | }
|
38 | ],
|
39 | 'react/default-props-match-prop-types': [ERROR, { allowRequiredDefaults: false }],
|
40 | 'react/display-name': [OFF, { ignoreTranspilerName: false }],
|
41 | 'react/forbid-component-props': [OFF, { forbid: ['className', 'style'] }],
|
42 | 'react/forbid-elements': [OFF, { forbid: [] }],
|
43 | 'react/forbid-prop-types': [OFF, { forbid: ['any', 'array', 'object'] }],
|
44 | 'react/forbid-foreign-prop-types': OFF,
|
45 | 'react/no-array-index-key': ERROR,
|
46 | 'react/no-children-prop': ERROR,
|
47 | 'react/no-danger': OFF,
|
48 | 'react/no-danger-with-children': OFF,
|
49 | 'react/no-deprecated': [ERROR],
|
50 | 'react/no-did-mount-set-state': OFF,
|
51 | 'react/no-did-update-set-state': ERROR,
|
52 | 'react/no-direct-mutation-state': ERROR,
|
53 | 'react/no-find-dom-node': ERROR,
|
54 | 'react/no-is-mounted': ERROR,
|
55 | 'react/no-multi-comp': [ERROR, { ignoreStateless: true }],
|
56 | 'react/no-redundant-should-component-update': ERROR,
|
57 | 'react/no-render-return-value': ERROR,
|
58 | 'react/no-set-state': OFF,
|
59 | 'react/no-typos': ERROR,
|
60 | 'react/no-string-refs': ERROR,
|
61 | 'react/no-unescaped-entities': ERROR,
|
62 | 'react/no-unknown-property': ERROR,
|
63 | 'react/no-unused-prop-types': ERROR,
|
64 | 'react/no-will-update-set-state': ERROR,
|
65 | 'react/prefer-es6-class': [ERROR, 'always'],
|
66 | 'react/prefer-stateless-function': [ERROR, { ignorePureComponents: true }],
|
67 | 'react/prop-types': [ERROR, { ignore: [], customValidators: [], skipUndeclared: false }],
|
68 | 'react/react-in-jsx-scope': ERROR,
|
69 | 'react/require-default-props': ERROR,
|
70 | 'react/require-optimization': ERROR,
|
71 | 'react/require-render-return': ERROR,
|
72 | 'react/self-closing-comp': ERROR,
|
73 | 'react/sort-comp': [
|
74 | ERROR,
|
75 | {
|
76 | order: [
|
77 | 'static-methods',
|
78 | 'lifecycle',
|
79 | '/^on.+$/',
|
80 | 'getters',
|
81 | 'setters',
|
82 | '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
|
83 | 'everything-else',
|
84 | '/^render.+$/',
|
85 | 'render'
|
86 | ]
|
87 | }
|
88 | ],
|
89 | 'react/sort-prop-types': [
|
90 | ERROR,
|
91 | {
|
92 | ignoreCase: true,
|
93 | callbacksLast: false,
|
94 | requiredFirst: true
|
95 | }
|
96 | ],
|
97 | 'react/style-prop-object': ERROR,
|
98 | 'react/void-dom-elements-no-children': ERROR,
|
99 | 'react/jsx-boolean-value': [ERROR, 'never', { always: [] }],
|
100 |
|
101 |
|
102 | 'react/jsx-curly-brace-presence': [ERROR, { props: 'never', children: 'never' }],
|
103 |
|
104 |
|
105 | 'react/jsx-filename-extension': OFF,
|
106 |
|
107 | 'react/jsx-handler-names': [
|
108 | OFF,
|
109 | {
|
110 | eventHandlerPrefix: 'handle',
|
111 | eventHandlerPropPrefix: 'on'
|
112 | }
|
113 | ],
|
114 |
|
115 |
|
116 | 'react/jsx-key': OFF,
|
117 |
|
118 | 'react/jsx-no-bind': [
|
119 | ERROR,
|
120 | {
|
121 | ignoreRefs: true,
|
122 | allowArrowFunctions: true,
|
123 | allowBind: false
|
124 | }
|
125 | ],
|
126 | 'react/jsx-no-comment-textnodes': ERROR,
|
127 | 'react/jsx-no-duplicate-props': [ERROR, { ignoreCase: true }],
|
128 | 'react/jsx-no-literals': [OFF, { noStrings: true }],
|
129 | 'react/jsx-no-target-blank': ERROR,
|
130 | 'react/jsx-no-undef': ERROR,
|
131 | 'react/jsx-pascal-case': [
|
132 | ERROR,
|
133 | {
|
134 | allowAllCaps: true,
|
135 | ignore: []
|
136 | }
|
137 | ],
|
138 | 'react/jsx-sort-props': [
|
139 | OFF,
|
140 | {
|
141 | ignoreCase: true,
|
142 | callbacksLast: false,
|
143 | shorthandFirst: false,
|
144 | shorthandLast: false,
|
145 | noSortAlphabetically: false,
|
146 | reservedFirst: true
|
147 | }
|
148 | ],
|
149 | 'react/jsx-space-before-closing': [OFF, 'always'],
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 | 'react/jsx-uses-react': [ERROR],
|
156 | 'react/jsx-uses-vars': ERROR
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | },
|
164 |
|
165 | settings: {
|
166 | 'import/resolver': {
|
167 | node: {
|
168 | extensions: ['.js', '.jsx', '.json']
|
169 | }
|
170 | },
|
171 | react: {
|
172 | pragma: 'React',
|
173 | version: '15.0'
|
174 | },
|
175 | propWrapperFunctions: ['forbidExtraProps', 'exact', 'Object.freeze']
|
176 | }
|
177 | }
|