eslint-config-airbnb-extended 0.0.6 → 0.0.8

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