eser 2.1.8 → 3.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +6 -0
- package/deno.lock +41 -0
- package/hizli-api.js +90 -0
- package/main.js +5 -0
- package/mod.js +3 -0
- package/mod_test.js +5 -0
- package/package.json +8 -37
- package/.editorconfig +0 -14
- package/.gitattributes +0 -11
- package/.github/FUNDING.yml +0 -5
- package/LICENSE +0 -22
- package/README.md +0 -3794
- package/css-in-javascript/README.md +0 -432
- package/linters/.eslintrc +0 -6
- package/linters/.markdownlint.json +0 -154
- package/packages/eslint-config-eser/.editorconfig +0 -14
- package/packages/eslint-config-eser/.eslintrc +0 -3
- package/packages/eslint-config-eser/README.md +0 -19
- package/packages/eslint-config-eser/index.js +0 -20
- package/packages/eslint-config-eser/package.json +0 -49
- package/packages/eslint-config-eser/rules/best-practices.js +0 -381
- package/packages/eslint-config-eser/rules/errors.js +0 -146
- package/packages/eslint-config-eser/rules/es6.js +0 -203
- package/packages/eslint-config-eser/rules/imports.js +0 -291
- package/packages/eslint-config-eser/rules/node.js +0 -43
- package/packages/eslint-config-eser/rules/strict.js +0 -5
- package/packages/eslint-config-eser/rules/style.js +0 -597
- package/packages/eslint-config-eser/rules/variables.js +0 -53
- package/packages/eslint-config-eser-react/.editorconfig +0 -14
- package/packages/eslint-config-eser-react/.eslintrc +0 -3
- package/packages/eslint-config-eser-react/README.md +0 -19
- package/packages/eslint-config-eser-react/index.js +0 -11
- package/packages/eslint-config-eser-react/package.json +0 -59
- package/packages/eslint-config-eser-react/rules/react-a11y.js +0 -275
- package/packages/eslint-config-eser-react/rules/react-hooks.js +0 -21
- package/packages/eslint-config-eser-react/rules/react.js +0 -600
- package/react/README.md +0 -717
|
@@ -1,600 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: [
|
|
3
|
-
'react',
|
|
4
|
-
],
|
|
5
|
-
|
|
6
|
-
parserOptions: {
|
|
7
|
-
ecmaFeatures: {
|
|
8
|
-
jsx: true,
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
settings: {
|
|
13
|
-
'import/resolver': {
|
|
14
|
-
node: {
|
|
15
|
-
extensions: [ '.js', '.jsx', '.ts', '.tsx', '.json' ],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
react: {
|
|
20
|
-
pragma: 'React',
|
|
21
|
-
version: 'detect',
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
propWrapperFunctions: [
|
|
25
|
-
'forbidExtraProps', // https://www.npmjs.com/package/airbnb-prop-types
|
|
26
|
-
'exact', // https://www.npmjs.com/package/prop-types-exact
|
|
27
|
-
'Object.freeze', // https://tc39.github.io/ecma262/#sec-object.freeze
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
// View link below for react rules documentation
|
|
32
|
-
// https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
|
|
33
|
-
rules: {
|
|
34
|
-
// Specify whether double or single quotes should be used in JSX attributes
|
|
35
|
-
// https://eslint.org/docs/rules/jsx-quotes
|
|
36
|
-
'jsx-quotes': [ 'error', 'prefer-double' ],
|
|
37
|
-
|
|
38
|
-
'class-methods-use-this': [
|
|
39
|
-
'error',
|
|
40
|
-
{
|
|
41
|
-
exceptMethods: [
|
|
42
|
-
'render',
|
|
43
|
-
'getInitialState',
|
|
44
|
-
'getDefaultProps',
|
|
45
|
-
'getChildContext',
|
|
46
|
-
'componentWillMount',
|
|
47
|
-
'UNSAFE_componentWillMount',
|
|
48
|
-
'componentDidMount',
|
|
49
|
-
'componentWillReceiveProps',
|
|
50
|
-
'UNSAFE_componentWillReceiveProps',
|
|
51
|
-
'shouldComponentUpdate',
|
|
52
|
-
'componentWillUpdate',
|
|
53
|
-
'UNSAFE_componentWillUpdate',
|
|
54
|
-
'componentDidUpdate',
|
|
55
|
-
'componentWillUnmount',
|
|
56
|
-
'componentDidCatch',
|
|
57
|
-
'getSnapshotBeforeUpdate',
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
|
|
62
|
-
// Prevent missing displayName in a React component definition
|
|
63
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
64
|
-
'react/display-name': [ 'off', { ignoreTranspilerName: false } ],
|
|
65
|
-
|
|
66
|
-
// Forbid certain propTypes (any, array, object)
|
|
67
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-prop-types.md
|
|
68
|
-
'react/forbid-prop-types': [
|
|
69
|
-
'error',
|
|
70
|
-
{
|
|
71
|
-
forbid: [ 'any', 'array', 'object' ],
|
|
72
|
-
checkContextTypes: true,
|
|
73
|
-
checkChildContextTypes: true,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
|
|
77
|
-
// Forbid certain props on DOM Nodes
|
|
78
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md
|
|
79
|
-
'react/forbid-dom-props': [ 'off', { forbid: [] } ],
|
|
80
|
-
|
|
81
|
-
// Enforce boolean attributes notation in JSX
|
|
82
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
83
|
-
'react/jsx-boolean-value': [
|
|
84
|
-
'off',
|
|
85
|
-
'always',
|
|
86
|
-
{ never: [] },
|
|
87
|
-
],
|
|
88
|
-
|
|
89
|
-
// Validate closing bracket location in JSX
|
|
90
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
|
|
91
|
-
'react/jsx-closing-bracket-location': [ 'error', 'line-aligned' ],
|
|
92
|
-
|
|
93
|
-
// Validate closing tag location in JSX
|
|
94
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
|
|
95
|
-
'react/jsx-closing-tag-location': 'error',
|
|
96
|
-
|
|
97
|
-
// Enforce or disallow spaces inside of curly braces in JSX attributes
|
|
98
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
|
|
99
|
-
'react/jsx-curly-spacing': [ 'error', 'never', { allowMultiline: true } ],
|
|
100
|
-
|
|
101
|
-
// Enforce event handler naming conventions in JSX
|
|
102
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
103
|
-
'react/jsx-handler-names': [
|
|
104
|
-
'off',
|
|
105
|
-
{
|
|
106
|
-
eventHandlerPrefix: 'handle',
|
|
107
|
-
eventHandlerPropPrefix: 'on',
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
|
|
111
|
-
// Validate props indentation in JSX
|
|
112
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
|
|
113
|
-
'react/jsx-indent-props': [ 'error', 4 ],
|
|
114
|
-
|
|
115
|
-
// Validate JSX has key prop when in array or iterator
|
|
116
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
|
|
117
|
-
'react/jsx-key': 'off',
|
|
118
|
-
|
|
119
|
-
// Limit maximum of props on a single line in JSX
|
|
120
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
|
|
121
|
-
'react/jsx-max-props-per-line': [ 'error', { maximum: 1, when: 'multiline' } ],
|
|
122
|
-
|
|
123
|
-
// Prevent usage of .bind() in JSX props
|
|
124
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
|
|
125
|
-
'react/jsx-no-bind': [
|
|
126
|
-
'error',
|
|
127
|
-
{
|
|
128
|
-
ignoreRefs: true,
|
|
129
|
-
allowArrowFunctions: true,
|
|
130
|
-
allowFunctions: false,
|
|
131
|
-
allowBind: false,
|
|
132
|
-
ignoreDOMComponents: true,
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
|
|
136
|
-
// Prevent duplicate props in JSX
|
|
137
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
|
|
138
|
-
'react/jsx-no-duplicate-props': [ 'error', { ignoreCase: true } ],
|
|
139
|
-
|
|
140
|
-
// Prevent usage of unwrapped JSX strings
|
|
141
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
|
|
142
|
-
'react/jsx-no-literals': [ 'off', { noStrings: true } ],
|
|
143
|
-
|
|
144
|
-
// Disallow undeclared variables in JSX
|
|
145
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
146
|
-
'react/jsx-no-undef': 'error',
|
|
147
|
-
|
|
148
|
-
// Enforce PascalCase for user-defined JSX components
|
|
149
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
150
|
-
'react/jsx-pascal-case': [
|
|
151
|
-
'error',
|
|
152
|
-
{
|
|
153
|
-
allowAllCaps: true,
|
|
154
|
-
ignore: [],
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
|
|
158
|
-
// Enforce propTypes declarations alphabetical sorting
|
|
159
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
|
|
160
|
-
'react/sort-prop-types': [
|
|
161
|
-
'off',
|
|
162
|
-
{
|
|
163
|
-
ignoreCase: true,
|
|
164
|
-
callbacksLast: false,
|
|
165
|
-
requiredFirst: false,
|
|
166
|
-
sortShapeProp: true,
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
|
|
170
|
-
// Deprecated in favor of react/jsx-sort-props
|
|
171
|
-
'react/jsx-sort-prop-types': 'off',
|
|
172
|
-
|
|
173
|
-
// Enforce props alphabetical sorting
|
|
174
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
175
|
-
'react/jsx-sort-props': [
|
|
176
|
-
'off',
|
|
177
|
-
{
|
|
178
|
-
ignoreCase: true,
|
|
179
|
-
callbacksLast: false,
|
|
180
|
-
shorthandFirst: false,
|
|
181
|
-
shorthandLast: false,
|
|
182
|
-
noSortAlphabetically: false,
|
|
183
|
-
reservedFirst: true,
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
|
|
187
|
-
// Enforce defaultProps declarations alphabetical sorting
|
|
188
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
|
|
189
|
-
'react/jsx-sort-default-props': [
|
|
190
|
-
'off',
|
|
191
|
-
{
|
|
192
|
-
ignoreCase: true,
|
|
193
|
-
},
|
|
194
|
-
],
|
|
195
|
-
|
|
196
|
-
// Prevent React to be incorrectly marked as unused
|
|
197
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
|
|
198
|
-
'react/jsx-uses-react': [ 'error' ],
|
|
199
|
-
|
|
200
|
-
// Prevent variables used in JSX to be incorrectly marked as unused
|
|
201
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
|
|
202
|
-
'react/jsx-uses-vars': 'error',
|
|
203
|
-
|
|
204
|
-
// Prevent usage of dangerous JSX properties
|
|
205
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
|
|
206
|
-
'react/no-danger': 'warn',
|
|
207
|
-
|
|
208
|
-
// Prevent usage of deprecated methods
|
|
209
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
|
|
210
|
-
'react/no-deprecated': [ 'error' ],
|
|
211
|
-
|
|
212
|
-
// Prevent usage of setState in componentDidMount
|
|
213
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
|
|
214
|
-
// this is necessary for server-rendering
|
|
215
|
-
'react/no-did-mount-set-state': 'off',
|
|
216
|
-
|
|
217
|
-
// Prevent usage of setState in componentDidUpdate
|
|
218
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
|
|
219
|
-
'react/no-did-update-set-state': 'error',
|
|
220
|
-
|
|
221
|
-
// Prevent usage of setState in componentWillUpdate
|
|
222
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
|
|
223
|
-
'react/no-will-update-set-state': 'error',
|
|
224
|
-
|
|
225
|
-
// Prevent direct mutation of this.state
|
|
226
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
227
|
-
'react/no-direct-mutation-state': 'off',
|
|
228
|
-
|
|
229
|
-
// Prevent usage of isMounted
|
|
230
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
|
|
231
|
-
'react/no-is-mounted': 'error',
|
|
232
|
-
|
|
233
|
-
// Prevent multiple component definition per file
|
|
234
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
|
|
235
|
-
'react/no-multi-comp': 'off',
|
|
236
|
-
|
|
237
|
-
// Prevent usage of setState
|
|
238
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
|
|
239
|
-
'react/no-set-state': 'off',
|
|
240
|
-
|
|
241
|
-
// Prevent using string references
|
|
242
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
|
|
243
|
-
'react/no-string-refs': 'error',
|
|
244
|
-
|
|
245
|
-
// Prevent usage of unknown DOM property
|
|
246
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
|
|
247
|
-
'react/no-unknown-property': 'error',
|
|
248
|
-
|
|
249
|
-
// Require ES6 class declarations over React.createClass
|
|
250
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
251
|
-
'react/prefer-es6-class': [ 'error', 'always' ],
|
|
252
|
-
|
|
253
|
-
// Require stateless functions when not using lifecycle methods, setState or ref
|
|
254
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
255
|
-
'react/prefer-stateless-function': [ 'error', { ignorePureComponents: true } ],
|
|
256
|
-
|
|
257
|
-
// Prevent missing props validation in a React component definition
|
|
258
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
|
|
259
|
-
'react/prop-types': [
|
|
260
|
-
'off',
|
|
261
|
-
{
|
|
262
|
-
ignore: [],
|
|
263
|
-
customValidators: [],
|
|
264
|
-
skipUndeclared: false,
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
|
|
268
|
-
// Prevent missing React when using JSX
|
|
269
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
|
|
270
|
-
'react/react-in-jsx-scope': 'error',
|
|
271
|
-
|
|
272
|
-
// Require render() methods to return something
|
|
273
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
|
|
274
|
-
'react/require-render-return': 'error',
|
|
275
|
-
|
|
276
|
-
// Prevent extra closing tags for components without children
|
|
277
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
278
|
-
'react/self-closing-comp': 'error',
|
|
279
|
-
|
|
280
|
-
// Enforce component methods order
|
|
281
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
|
|
282
|
-
'react/sort-comp': [
|
|
283
|
-
'error',
|
|
284
|
-
{
|
|
285
|
-
order: [
|
|
286
|
-
'static-variables',
|
|
287
|
-
'static-methods',
|
|
288
|
-
'instance-variables',
|
|
289
|
-
'lifecycle',
|
|
290
|
-
'/^on.+$/',
|
|
291
|
-
'getters',
|
|
292
|
-
'setters',
|
|
293
|
-
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
|
|
294
|
-
'instance-methods',
|
|
295
|
-
'everything-else',
|
|
296
|
-
'rendering',
|
|
297
|
-
],
|
|
298
|
-
groups: {
|
|
299
|
-
lifecycle: [
|
|
300
|
-
'displayName',
|
|
301
|
-
'propTypes',
|
|
302
|
-
'contextTypes',
|
|
303
|
-
'childContextTypes',
|
|
304
|
-
'mixins',
|
|
305
|
-
'statics',
|
|
306
|
-
'defaultProps',
|
|
307
|
-
'constructor',
|
|
308
|
-
'getDefaultProps',
|
|
309
|
-
'getInitialState',
|
|
310
|
-
'state',
|
|
311
|
-
'getChildContext',
|
|
312
|
-
'getDerivedStateFromProps',
|
|
313
|
-
'componentWillMount',
|
|
314
|
-
'UNSAFE_componentWillMount',
|
|
315
|
-
'componentDidMount',
|
|
316
|
-
'componentWillReceiveProps',
|
|
317
|
-
'UNSAFE_componentWillReceiveProps',
|
|
318
|
-
'shouldComponentUpdate',
|
|
319
|
-
'componentWillUpdate',
|
|
320
|
-
'UNSAFE_componentWillUpdate',
|
|
321
|
-
'getSnapshotBeforeUpdate',
|
|
322
|
-
'componentDidUpdate',
|
|
323
|
-
'componentDidCatch',
|
|
324
|
-
'componentWillUnmount',
|
|
325
|
-
],
|
|
326
|
-
rendering: [
|
|
327
|
-
'/^render.+$/',
|
|
328
|
-
'render',
|
|
329
|
-
],
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
],
|
|
333
|
-
|
|
334
|
-
// Prevent missing parentheses around multilines JSX
|
|
335
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
|
|
336
|
-
'react/jsx-wrap-multilines': [
|
|
337
|
-
'error',
|
|
338
|
-
{
|
|
339
|
-
'declaration': 'parens-new-line',
|
|
340
|
-
'assignment': 'parens-new-line',
|
|
341
|
-
'return': 'parens-new-line',
|
|
342
|
-
'arrow': 'parens-new-line',
|
|
343
|
-
'condition': 'parens-new-line',
|
|
344
|
-
'logical': 'parens-new-line',
|
|
345
|
-
'prop': 'parens-new-line',
|
|
346
|
-
},
|
|
347
|
-
],
|
|
348
|
-
|
|
349
|
-
// Require that the first prop in a JSX element be on a new line when
|
|
350
|
-
// the element is multiline
|
|
351
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
|
|
352
|
-
'react/jsx-first-prop-new-line': [ 'error', 'multiline-multiprop' ],
|
|
353
|
-
|
|
354
|
-
// Enforce spacing around jsx equals signs
|
|
355
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
|
|
356
|
-
'react/jsx-equals-spacing': [ 'error', 'never' ],
|
|
357
|
-
|
|
358
|
-
// Enforce JSX indentation
|
|
359
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
|
|
360
|
-
'react/jsx-indent': [ 'error', 4 ],
|
|
361
|
-
|
|
362
|
-
// Disallow target="_blank" on links
|
|
363
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
|
|
364
|
-
'react/jsx-no-target-blank': [ 'error', { enforceDynamicLinks: 'always' } ],
|
|
365
|
-
|
|
366
|
-
// only .jsx files may have JSX
|
|
367
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
368
|
-
'react/jsx-filename-extension': [ 'error', { extensions: [ '.jsx', '.tsx' ] } ],
|
|
369
|
-
|
|
370
|
-
// prevent accidental JS comments from being injected into JSX as text
|
|
371
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
372
|
-
'react/jsx-no-comment-textnodes': 'error',
|
|
373
|
-
|
|
374
|
-
// disallow using React.render/ReactDOM.render's return value
|
|
375
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
|
|
376
|
-
'react/no-render-return-value': 'error',
|
|
377
|
-
|
|
378
|
-
// require a shouldComponentUpdate method, or PureRenderMixin
|
|
379
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
|
|
380
|
-
'react/require-optimization': [ 'off', { allowDecorators: [] } ],
|
|
381
|
-
|
|
382
|
-
// warn against using findDOMNode()
|
|
383
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
|
|
384
|
-
'react/no-find-dom-node': 'error',
|
|
385
|
-
|
|
386
|
-
// Forbid certain props on Components
|
|
387
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
|
|
388
|
-
'react/forbid-component-props': [ 'off', { forbid: [] } ],
|
|
389
|
-
|
|
390
|
-
// Forbid certain elements
|
|
391
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
|
|
392
|
-
'react/forbid-elements': [ 'off', { forbid: [] } ],
|
|
393
|
-
|
|
394
|
-
// Prevent problem with children and props.dangerouslySetInnerHTML
|
|
395
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
|
|
396
|
-
'react/no-danger-with-children': 'error',
|
|
397
|
-
|
|
398
|
-
// Prevent unused propType definitions
|
|
399
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
|
|
400
|
-
'react/no-unused-prop-types': [
|
|
401
|
-
'error',
|
|
402
|
-
{
|
|
403
|
-
customValidators: [],
|
|
404
|
-
skipShapeProps: true,
|
|
405
|
-
},
|
|
406
|
-
],
|
|
407
|
-
|
|
408
|
-
// Require style prop value be an object or var
|
|
409
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
410
|
-
'react/style-prop-object': 'error',
|
|
411
|
-
|
|
412
|
-
// Prevent invalid characters from appearing in markup
|
|
413
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
|
|
414
|
-
'react/no-unescaped-entities': [
|
|
415
|
-
'error',
|
|
416
|
-
{
|
|
417
|
-
forbid: [
|
|
418
|
-
{
|
|
419
|
-
'char': '>',
|
|
420
|
-
'alternatives': [ '>' ],
|
|
421
|
-
},
|
|
422
|
-
// {
|
|
423
|
-
// 'char': '"',
|
|
424
|
-
// 'alternatives': [ '"', '“', '"', '”' ],
|
|
425
|
-
// },
|
|
426
|
-
// {
|
|
427
|
-
// 'char': '\'',
|
|
428
|
-
// 'alternatives': [ ''', '‘', ''', '’' ],
|
|
429
|
-
// },
|
|
430
|
-
{
|
|
431
|
-
'char': '}',
|
|
432
|
-
'alternatives': [ '}' ],
|
|
433
|
-
},
|
|
434
|
-
],
|
|
435
|
-
},
|
|
436
|
-
],
|
|
437
|
-
|
|
438
|
-
// Prevent passing of children as props
|
|
439
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
|
|
440
|
-
'react/no-children-prop': 'error',
|
|
441
|
-
|
|
442
|
-
// Validate whitespace in and around the JSX opening and closing brackets
|
|
443
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
|
|
444
|
-
'react/jsx-tag-spacing': [
|
|
445
|
-
'error',
|
|
446
|
-
{
|
|
447
|
-
closingSlash: 'never',
|
|
448
|
-
beforeSelfClosing: 'always',
|
|
449
|
-
afterOpening: 'never',
|
|
450
|
-
beforeClosing: 'never',
|
|
451
|
-
},
|
|
452
|
-
],
|
|
453
|
-
|
|
454
|
-
// Enforce spaces before the closing bracket of self-closing JSX elements
|
|
455
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
|
|
456
|
-
// Deprecated in favor of jsx-tag-spacing
|
|
457
|
-
'react/jsx-space-before-closing': [ 'off', 'always' ],
|
|
458
|
-
|
|
459
|
-
// Prevent usage of Array index in keys
|
|
460
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
461
|
-
'react/no-array-index-key': 'error',
|
|
462
|
-
|
|
463
|
-
// Enforce a defaultProps definition for every prop that is not a required prop
|
|
464
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md
|
|
465
|
-
'react/require-default-props': [
|
|
466
|
-
'error',
|
|
467
|
-
{
|
|
468
|
-
forbidDefaultForRequired: true,
|
|
469
|
-
},
|
|
470
|
-
],
|
|
471
|
-
|
|
472
|
-
// Forbids using non-exported propTypes
|
|
473
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
|
|
474
|
-
// this is intentionally set to "warn". it would be "error",
|
|
475
|
-
// but it's only critical if you're stripping propTypes in production.
|
|
476
|
-
'react/forbid-foreign-prop-types': [ 'warn', { allowInPropTypes: true } ],
|
|
477
|
-
|
|
478
|
-
// Prevent void DOM elements from receiving children
|
|
479
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
|
|
480
|
-
'react/void-dom-elements-no-children': 'error',
|
|
481
|
-
|
|
482
|
-
// Enforce all defaultProps have a corresponding non-required PropType
|
|
483
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md
|
|
484
|
-
'react/default-props-match-prop-types': [ 'error', { allowRequiredDefaults: false } ],
|
|
485
|
-
|
|
486
|
-
// Prevent usage of shouldComponentUpdate when extending React.PureComponent
|
|
487
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
|
|
488
|
-
'react/no-redundant-should-component-update': 'error',
|
|
489
|
-
|
|
490
|
-
// Prevent unused state values
|
|
491
|
-
// https://github.com/yannickcr/eslint-plugin-react/pull/1103/
|
|
492
|
-
'react/no-unused-state': 'error',
|
|
493
|
-
|
|
494
|
-
// Enforces consistent naming for boolean props
|
|
495
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
|
|
496
|
-
'react/boolean-prop-naming': [
|
|
497
|
-
'off',
|
|
498
|
-
{
|
|
499
|
-
propTypeNames: [ 'bool', 'mutuallyExclusiveTrueProps' ],
|
|
500
|
-
rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
|
|
501
|
-
message: '',
|
|
502
|
-
},
|
|
503
|
-
],
|
|
504
|
-
|
|
505
|
-
// Prevents common casing typos
|
|
506
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md
|
|
507
|
-
'react/no-typos': 'error',
|
|
508
|
-
|
|
509
|
-
// Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
|
|
510
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
511
|
-
'react/jsx-curly-brace-presence': [
|
|
512
|
-
'error',
|
|
513
|
-
{ props: 'never', children: 'never' },
|
|
514
|
-
],
|
|
515
|
-
|
|
516
|
-
// One JSX Element Per Line
|
|
517
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
|
|
518
|
-
'react/jsx-one-expression-per-line': [
|
|
519
|
-
'error',
|
|
520
|
-
{ allow: 'single-child' },
|
|
521
|
-
],
|
|
522
|
-
|
|
523
|
-
// Enforce consistent usage of destructuring assignment of props, state, and context
|
|
524
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
|
|
525
|
-
'react/destructuring-assignment': [ 'error', 'never' ],
|
|
526
|
-
|
|
527
|
-
// Prevent using this.state within a this.setState
|
|
528
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md
|
|
529
|
-
'react/no-access-state-in-setstate': 'error',
|
|
530
|
-
|
|
531
|
-
// Prevent usage of button elements without an explicit type attribute
|
|
532
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
|
|
533
|
-
'react/button-has-type': [
|
|
534
|
-
'error',
|
|
535
|
-
{
|
|
536
|
-
button: true,
|
|
537
|
-
submit: true,
|
|
538
|
-
reset: false,
|
|
539
|
-
},
|
|
540
|
-
],
|
|
541
|
-
|
|
542
|
-
// Ensures inline tags are not rendered without spaces between them
|
|
543
|
-
'react/jsx-child-element-spacing': 'off',
|
|
544
|
-
|
|
545
|
-
// Prevent this from being used in stateless functional components
|
|
546
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
|
|
547
|
-
'react/no-this-in-sfc': 'error',
|
|
548
|
-
|
|
549
|
-
// Validate JSX maximum depth
|
|
550
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
|
|
551
|
-
'react/jsx-max-depth': 'off',
|
|
552
|
-
|
|
553
|
-
// Disallow multiple spaces between inline JSX props
|
|
554
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
|
|
555
|
-
'react/jsx-props-no-multi-spaces': 'error',
|
|
556
|
-
|
|
557
|
-
// Prevent usage of UNSAFE_ methods
|
|
558
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/157cc932be2cfaa56b3f5b45df6f6d4322a2f660/docs/rules/no-unsafe.md
|
|
559
|
-
'react/no-unsafe': 'off',
|
|
560
|
-
|
|
561
|
-
// Enforce shorthand or standard form for React fragments
|
|
562
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
|
|
563
|
-
'react/jsx-fragments': [ 'error', 'syntax' ],
|
|
564
|
-
|
|
565
|
-
// Enforce linebreaks in curly braces in JSX attributes and expressions.
|
|
566
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
|
|
567
|
-
'react/jsx-curly-newline': [
|
|
568
|
-
'error',
|
|
569
|
-
{
|
|
570
|
-
multiline: 'consistent',
|
|
571
|
-
singleline: 'consistent',
|
|
572
|
-
},
|
|
573
|
-
],
|
|
574
|
-
|
|
575
|
-
// Enforce state initialization style
|
|
576
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
|
|
577
|
-
// TODO: set to "never" once babel-preset-airbnb supports public class fields
|
|
578
|
-
'react/state-in-constructor': [ 'error', 'always' ],
|
|
579
|
-
|
|
580
|
-
// Enforces where React component static properties should be positioned
|
|
581
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
|
|
582
|
-
// TODO: set to "static public field" once babel-preset-airbnb supports public class fields
|
|
583
|
-
'react/static-property-placement': [ 'error', 'property assignment' ],
|
|
584
|
-
|
|
585
|
-
// Disallow JSX props spreading
|
|
586
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
|
|
587
|
-
'react/jsx-props-no-spreading': [
|
|
588
|
-
'off',
|
|
589
|
-
{
|
|
590
|
-
html: 'enforce',
|
|
591
|
-
custom: 'enforce',
|
|
592
|
-
exceptions: [],
|
|
593
|
-
},
|
|
594
|
-
],
|
|
595
|
-
|
|
596
|
-
// Enforce that props are read-only
|
|
597
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
|
|
598
|
-
'react/prefer-read-only-props': 'off',
|
|
599
|
-
},
|
|
600
|
-
};
|