eslint-config-airbnb-extended 0.0.9 → 0.1.0

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