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