eslint-config-decent 1.0.0 → 1.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.
package/dist/index.cjs CHANGED
@@ -7,6 +7,10 @@ const prettier = require('eslint-plugin-prettier/recommended');
7
7
  const jsdoc = require('eslint-plugin-jsdoc');
8
8
  const mocha = require('eslint-plugin-mocha');
9
9
  const promise = require('eslint-plugin-promise');
10
+ const a11y = require('eslint-plugin-jsx-a11y');
11
+ const react = require('eslint-plugin-react');
12
+ const reactHooks = require('eslint-plugin-react-hooks');
13
+ const testingLibrary = require('eslint-plugin-testing-library');
10
14
  const security = require('eslint-plugin-security');
11
15
  const unicorn = require('eslint-plugin-unicorn');
12
16
 
@@ -19,10 +23,14 @@ const prettier__default = /*#__PURE__*/_interopDefaultCompat(prettier);
19
23
  const jsdoc__default = /*#__PURE__*/_interopDefaultCompat(jsdoc);
20
24
  const mocha__default = /*#__PURE__*/_interopDefaultCompat(mocha);
21
25
  const promise__default = /*#__PURE__*/_interopDefaultCompat(promise);
26
+ const a11y__default = /*#__PURE__*/_interopDefaultCompat(a11y);
27
+ const react__default = /*#__PURE__*/_interopDefaultCompat(react);
28
+ const reactHooks__default = /*#__PURE__*/_interopDefaultCompat(reactHooks);
29
+ const testingLibrary__default = /*#__PURE__*/_interopDefaultCompat(testingLibrary);
22
30
  const security__default = /*#__PURE__*/_interopDefaultCompat(security);
23
31
  const unicorn__default = /*#__PURE__*/_interopDefaultCompat(unicorn);
24
32
 
25
- const base$6 = {
33
+ const base$7 = {
26
34
  rules: {
27
35
  "array-callback-return": ["error", { allowImplicit: true }],
28
36
  "block-scoped-var": "error",
@@ -269,13 +277,13 @@ const cjs = {
269
277
  strict: ["error", "global"]
270
278
  }
271
279
  };
272
- const configs$6 = {
273
- base: base$6,
280
+ const configs$7 = {
281
+ base: base$7,
274
282
  cjsAndEsm,
275
283
  cjs
276
284
  };
277
285
 
278
- const base$5 = {
286
+ const base$6 = {
279
287
  settings: {
280
288
  jsdoc: {
281
289
  preferredTypes: {
@@ -300,11 +308,11 @@ const base$5 = {
300
308
  "unicorn/prefer-set-has": "error"
301
309
  }
302
310
  };
303
- const configs$5 = {
304
- base: base$5
311
+ const configs$6 = {
312
+ base: base$6
305
313
  };
306
314
 
307
- const base$4 = {
315
+ const base$5 = {
308
316
  plugins: {
309
317
  mocha: mocha__default
310
318
  },
@@ -322,11 +330,11 @@ const base$4 = {
322
330
  "mocha/no-mocha-arrows": "off"
323
331
  }
324
332
  };
325
- const configs$4 = {
326
- base: base$4
333
+ const configs$5 = {
334
+ base: base$5
327
335
  };
328
336
 
329
- const base$3 = {
337
+ const base$4 = {
330
338
  plugins: {
331
339
  promise: promise__default
332
340
  },
@@ -343,6 +351,70 @@ const base$3 = {
343
351
  "promise/param-names": "error"
344
352
  }
345
353
  };
354
+ const configs$4 = {
355
+ base: base$4
356
+ };
357
+
358
+ const base$3 = {
359
+ plugins: {
360
+ "jsx-a11y": a11y__default,
361
+ react: react__default,
362
+ "react-hooks": reactHooks__default,
363
+ "testing-library": testingLibrary__default
364
+ },
365
+ rules: {
366
+ ...a11y__default.configs.recommended.rules,
367
+ "jsx-a11y/aria-proptypes": "error",
368
+ "jsx-a11y/aria-role": ["error", { ignoreNonDOM: true }],
369
+ "jsx-a11y/aria-unsupported-elements": "error",
370
+ "jsx-a11y/role-has-required-aria-props": "error",
371
+ ...react__default.configs.recommended.rules,
372
+ "react/default-props-match-prop-types": "error",
373
+ "react/display-name": ["error", { ignoreTranspilerName: false }],
374
+ "react/forbid-foreign-prop-types": ["error", { allowInPropTypes: true }],
375
+ "react/iframe-missing-sandbox": "warn",
376
+ "react/jsx-closing-bracket-location": "error",
377
+ "react/jsx-fragments": "error",
378
+ "react/jsx-no-leaked-render": ["error", { validStrategies: ["ternary"] }],
379
+ "react/jsx-no-script-url": "error",
380
+ "react/jsx-no-target-blank": "error",
381
+ "react/jsx-no-undef": "error",
382
+ "react/jsx-no-useless-fragment": "error",
383
+ "react/jsx-pascal-case": [
384
+ "error",
385
+ {
386
+ allowAllCaps: true,
387
+ ignore: []
388
+ }
389
+ ],
390
+ "react/jsx-props-no-multi-spaces": "error",
391
+ "react/no-access-state-in-setstate": "error",
392
+ "react/no-arrow-function-lifecycle": "error",
393
+ "react/no-danger-with-children": "error",
394
+ "react/no-deprecated": "error",
395
+ "react/no-did-mount-set-state": "error",
396
+ "react/no-did-update-set-state": "error",
397
+ "react/no-direct-mutation-state": "error",
398
+ "react/no-invalid-html-attribute": "error",
399
+ "react/no-namespace": "error",
400
+ "react/no-redundant-should-component-update": "error",
401
+ "react/no-this-in-sfc": "error",
402
+ "react/no-typos": "error",
403
+ "react/no-unsafe": "error",
404
+ "react/no-unstable-nested-components": "error",
405
+ "react/no-unused-class-component-methods": "error",
406
+ "react/no-unused-prop-types": "error",
407
+ "react/no-unused-state": "error",
408
+ "react/no-will-update-set-state": "error",
409
+ "react/prefer-stateless-function": "error",
410
+ "react/require-render-return": "error",
411
+ "react/self-closing-comp": "error",
412
+ "react/style-prop-object": "error",
413
+ "react-hooks/rules-of-hooks": "error",
414
+ "react-hooks/exhaustive-deps": "error",
415
+ ...testingLibrary__default.configs.react.rules
416
+ }
417
+ };
346
418
  const configs$3 = {
347
419
  base: base$3
348
420
  };
@@ -486,21 +558,21 @@ function defaultConfig(parserOptions) {
486
558
  {
487
559
  languageOptions,
488
560
  settings: {
489
- ...configs$5.base.settings
561
+ ...configs$6.base.settings
490
562
  }
491
563
  },
492
564
  {
493
- files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs"],
565
+ files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"],
494
566
  plugins: {
495
- ...configs$5.base.plugins,
496
- ...configs$3.base.plugins,
567
+ ...configs$6.base.plugins,
568
+ ...configs$4.base.plugins,
497
569
  ...configs$2.base.plugins,
498
570
  ...configs.base.plugins
499
571
  },
500
572
  rules: {
573
+ ...configs$7.base.rules,
501
574
  ...configs$6.base.rules,
502
- ...configs$5.base.rules,
503
- ...configs$3.base.rules,
575
+ ...configs$4.base.rules,
504
576
  ...configs$2.base.rules,
505
577
  ...configs.base.rules
506
578
  }
@@ -510,31 +582,36 @@ function defaultConfig(parserOptions) {
510
582
  languageOptions: {
511
583
  sourceType: "script"
512
584
  },
513
- ...configs$6.cjsAndEsm
585
+ ...configs$7.cjsAndEsm
514
586
  },
515
587
  {
516
588
  files: ["**/*.js", "**/*.cjs"],
517
589
  languageOptions: {
518
590
  sourceType: "script"
519
591
  },
520
- ...configs$6.cjs
592
+ ...configs$7.cjs
521
593
  },
522
594
  {
523
- files: ["**/*.ts"],
595
+ files: ["**/*.ts", "**/*.tsx"],
524
596
  ...configs$1.base
525
597
  },
598
+ {
599
+ files: ["**/*.tsx"],
600
+ ...configs$3.base
601
+ },
526
602
  {
527
603
  files: ["**/*.tests.ts", "tests/tests.ts"],
528
- ...configs$4.base
604
+ ...configs$5.base
529
605
  },
530
606
  prettier__default
531
607
  ];
532
608
  }
533
609
 
534
610
  exports.defaultConfig = defaultConfig;
535
- exports.eslintConfigs = configs$6;
536
- exports.jsdocConfigs = configs$5;
537
- exports.promiseConfigs = configs$3;
611
+ exports.eslintConfigs = configs$7;
612
+ exports.jsdocConfigs = configs$6;
613
+ exports.promiseConfigs = configs$4;
614
+ exports.reactConfigs = configs$3;
538
615
  exports.securityConfigs = configs$2;
539
616
  exports.typescriptEslintConfigs = configs$1;
540
617
  exports.unicornConfigs = configs;
package/dist/index.d.cts CHANGED
@@ -1,11 +1,15 @@
1
1
  import { ConfigWithExtends } from 'typescript-eslint';
2
2
 
3
- declare const configs$5: {
3
+ declare const configs$6: {
4
4
  base: ConfigWithExtends;
5
5
  cjsAndEsm: ConfigWithExtends;
6
6
  cjs: ConfigWithExtends;
7
7
  };
8
8
 
9
+ declare const configs$5: {
10
+ base: ConfigWithExtends;
11
+ };
12
+
9
13
  declare const configs$4: {
10
14
  base: ConfigWithExtends;
11
15
  };
@@ -28,4 +32,4 @@ declare const configs: {
28
32
 
29
33
  declare function defaultConfig(parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions']): ConfigWithExtends[];
30
34
 
31
- export { defaultConfig, configs$5 as eslintConfigs, configs$4 as jsdocConfigs, configs$3 as promiseConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
35
+ export { defaultConfig, configs$6 as eslintConfigs, configs$5 as jsdocConfigs, configs$4 as promiseConfigs, configs$3 as reactConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
package/dist/index.d.mts CHANGED
@@ -1,11 +1,15 @@
1
1
  import { ConfigWithExtends } from 'typescript-eslint';
2
2
 
3
- declare const configs$5: {
3
+ declare const configs$6: {
4
4
  base: ConfigWithExtends;
5
5
  cjsAndEsm: ConfigWithExtends;
6
6
  cjs: ConfigWithExtends;
7
7
  };
8
8
 
9
+ declare const configs$5: {
10
+ base: ConfigWithExtends;
11
+ };
12
+
9
13
  declare const configs$4: {
10
14
  base: ConfigWithExtends;
11
15
  };
@@ -28,4 +32,4 @@ declare const configs: {
28
32
 
29
33
  declare function defaultConfig(parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions']): ConfigWithExtends[];
30
34
 
31
- export { defaultConfig, configs$5 as eslintConfigs, configs$4 as jsdocConfigs, configs$3 as promiseConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
35
+ export { defaultConfig, configs$6 as eslintConfigs, configs$5 as jsdocConfigs, configs$4 as promiseConfigs, configs$3 as reactConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,15 @@
1
1
  import { ConfigWithExtends } from 'typescript-eslint';
2
2
 
3
- declare const configs$5: {
3
+ declare const configs$6: {
4
4
  base: ConfigWithExtends;
5
5
  cjsAndEsm: ConfigWithExtends;
6
6
  cjs: ConfigWithExtends;
7
7
  };
8
8
 
9
+ declare const configs$5: {
10
+ base: ConfigWithExtends;
11
+ };
12
+
9
13
  declare const configs$4: {
10
14
  base: ConfigWithExtends;
11
15
  };
@@ -28,4 +32,4 @@ declare const configs: {
28
32
 
29
33
  declare function defaultConfig(parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions']): ConfigWithExtends[];
30
34
 
31
- export { defaultConfig, configs$5 as eslintConfigs, configs$4 as jsdocConfigs, configs$3 as promiseConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
35
+ export { defaultConfig, configs$6 as eslintConfigs, configs$5 as jsdocConfigs, configs$4 as promiseConfigs, configs$3 as reactConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
package/dist/index.mjs CHANGED
@@ -5,10 +5,14 @@ import prettier from 'eslint-plugin-prettier/recommended';
5
5
  import jsdoc from 'eslint-plugin-jsdoc';
6
6
  import mocha from 'eslint-plugin-mocha';
7
7
  import promise from 'eslint-plugin-promise';
8
+ import a11y from 'eslint-plugin-jsx-a11y';
9
+ import react from 'eslint-plugin-react';
10
+ import reactHooks from 'eslint-plugin-react-hooks';
11
+ import testingLibrary from 'eslint-plugin-testing-library';
8
12
  import security from 'eslint-plugin-security';
9
13
  import unicorn from 'eslint-plugin-unicorn';
10
14
 
11
- const base$6 = {
15
+ const base$7 = {
12
16
  rules: {
13
17
  "array-callback-return": ["error", { allowImplicit: true }],
14
18
  "block-scoped-var": "error",
@@ -255,13 +259,13 @@ const cjs = {
255
259
  strict: ["error", "global"]
256
260
  }
257
261
  };
258
- const configs$6 = {
259
- base: base$6,
262
+ const configs$7 = {
263
+ base: base$7,
260
264
  cjsAndEsm,
261
265
  cjs
262
266
  };
263
267
 
264
- const base$5 = {
268
+ const base$6 = {
265
269
  settings: {
266
270
  jsdoc: {
267
271
  preferredTypes: {
@@ -286,11 +290,11 @@ const base$5 = {
286
290
  "unicorn/prefer-set-has": "error"
287
291
  }
288
292
  };
289
- const configs$5 = {
290
- base: base$5
293
+ const configs$6 = {
294
+ base: base$6
291
295
  };
292
296
 
293
- const base$4 = {
297
+ const base$5 = {
294
298
  plugins: {
295
299
  mocha
296
300
  },
@@ -308,11 +312,11 @@ const base$4 = {
308
312
  "mocha/no-mocha-arrows": "off"
309
313
  }
310
314
  };
311
- const configs$4 = {
312
- base: base$4
315
+ const configs$5 = {
316
+ base: base$5
313
317
  };
314
318
 
315
- const base$3 = {
319
+ const base$4 = {
316
320
  plugins: {
317
321
  promise
318
322
  },
@@ -329,6 +333,70 @@ const base$3 = {
329
333
  "promise/param-names": "error"
330
334
  }
331
335
  };
336
+ const configs$4 = {
337
+ base: base$4
338
+ };
339
+
340
+ const base$3 = {
341
+ plugins: {
342
+ "jsx-a11y": a11y,
343
+ react,
344
+ "react-hooks": reactHooks,
345
+ "testing-library": testingLibrary
346
+ },
347
+ rules: {
348
+ ...a11y.configs.recommended.rules,
349
+ "jsx-a11y/aria-proptypes": "error",
350
+ "jsx-a11y/aria-role": ["error", { ignoreNonDOM: true }],
351
+ "jsx-a11y/aria-unsupported-elements": "error",
352
+ "jsx-a11y/role-has-required-aria-props": "error",
353
+ ...react.configs.recommended.rules,
354
+ "react/default-props-match-prop-types": "error",
355
+ "react/display-name": ["error", { ignoreTranspilerName: false }],
356
+ "react/forbid-foreign-prop-types": ["error", { allowInPropTypes: true }],
357
+ "react/iframe-missing-sandbox": "warn",
358
+ "react/jsx-closing-bracket-location": "error",
359
+ "react/jsx-fragments": "error",
360
+ "react/jsx-no-leaked-render": ["error", { validStrategies: ["ternary"] }],
361
+ "react/jsx-no-script-url": "error",
362
+ "react/jsx-no-target-blank": "error",
363
+ "react/jsx-no-undef": "error",
364
+ "react/jsx-no-useless-fragment": "error",
365
+ "react/jsx-pascal-case": [
366
+ "error",
367
+ {
368
+ allowAllCaps: true,
369
+ ignore: []
370
+ }
371
+ ],
372
+ "react/jsx-props-no-multi-spaces": "error",
373
+ "react/no-access-state-in-setstate": "error",
374
+ "react/no-arrow-function-lifecycle": "error",
375
+ "react/no-danger-with-children": "error",
376
+ "react/no-deprecated": "error",
377
+ "react/no-did-mount-set-state": "error",
378
+ "react/no-did-update-set-state": "error",
379
+ "react/no-direct-mutation-state": "error",
380
+ "react/no-invalid-html-attribute": "error",
381
+ "react/no-namespace": "error",
382
+ "react/no-redundant-should-component-update": "error",
383
+ "react/no-this-in-sfc": "error",
384
+ "react/no-typos": "error",
385
+ "react/no-unsafe": "error",
386
+ "react/no-unstable-nested-components": "error",
387
+ "react/no-unused-class-component-methods": "error",
388
+ "react/no-unused-prop-types": "error",
389
+ "react/no-unused-state": "error",
390
+ "react/no-will-update-set-state": "error",
391
+ "react/prefer-stateless-function": "error",
392
+ "react/require-render-return": "error",
393
+ "react/self-closing-comp": "error",
394
+ "react/style-prop-object": "error",
395
+ "react-hooks/rules-of-hooks": "error",
396
+ "react-hooks/exhaustive-deps": "error",
397
+ ...testingLibrary.configs.react.rules
398
+ }
399
+ };
332
400
  const configs$3 = {
333
401
  base: base$3
334
402
  };
@@ -472,21 +540,21 @@ function defaultConfig(parserOptions) {
472
540
  {
473
541
  languageOptions,
474
542
  settings: {
475
- ...configs$5.base.settings
543
+ ...configs$6.base.settings
476
544
  }
477
545
  },
478
546
  {
479
- files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs"],
547
+ files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"],
480
548
  plugins: {
481
- ...configs$5.base.plugins,
482
- ...configs$3.base.plugins,
549
+ ...configs$6.base.plugins,
550
+ ...configs$4.base.plugins,
483
551
  ...configs$2.base.plugins,
484
552
  ...configs.base.plugins
485
553
  },
486
554
  rules: {
555
+ ...configs$7.base.rules,
487
556
  ...configs$6.base.rules,
488
- ...configs$5.base.rules,
489
- ...configs$3.base.rules,
557
+ ...configs$4.base.rules,
490
558
  ...configs$2.base.rules,
491
559
  ...configs.base.rules
492
560
  }
@@ -496,25 +564,29 @@ function defaultConfig(parserOptions) {
496
564
  languageOptions: {
497
565
  sourceType: "script"
498
566
  },
499
- ...configs$6.cjsAndEsm
567
+ ...configs$7.cjsAndEsm
500
568
  },
501
569
  {
502
570
  files: ["**/*.js", "**/*.cjs"],
503
571
  languageOptions: {
504
572
  sourceType: "script"
505
573
  },
506
- ...configs$6.cjs
574
+ ...configs$7.cjs
507
575
  },
508
576
  {
509
- files: ["**/*.ts"],
577
+ files: ["**/*.ts", "**/*.tsx"],
510
578
  ...configs$1.base
511
579
  },
580
+ {
581
+ files: ["**/*.tsx"],
582
+ ...configs$3.base
583
+ },
512
584
  {
513
585
  files: ["**/*.tests.ts", "tests/tests.ts"],
514
- ...configs$4.base
586
+ ...configs$5.base
515
587
  },
516
588
  prettier
517
589
  ];
518
590
  }
519
591
 
520
- export { defaultConfig, configs$6 as eslintConfigs, configs$5 as jsdocConfigs, configs$3 as promiseConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
592
+ export { defaultConfig, configs$7 as eslintConfigs, configs$6 as jsdocConfigs, configs$4 as promiseConfigs, configs$3 as reactConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-decent",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A decent ESLint configuration",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -78,7 +78,11 @@
78
78
  "eslint-plugin-mocha": "^10.4.3",
79
79
  "eslint-plugin-prettier": "^5.1.3",
80
80
  "eslint-plugin-promise": "^6.2.0",
81
+ "eslint-plugin-jsx-a11y": "^6.8.0",
82
+ "eslint-plugin-react": "^7.34.2",
83
+ "eslint-plugin-react-hooks": "^4.6.2",
81
84
  "eslint-plugin-security": "^3.0.0",
85
+ "eslint-plugin-testing-library": "^6.2.2",
82
86
  "eslint-plugin-unicorn": "^53.0.0",
83
87
  "globals": "^15.3.0",
84
88
  "typescript-eslint": "^8.0.0-alpha.25"
@@ -96,5 +100,19 @@
96
100
  "rimraf": "^5.0.7",
97
101
  "typescript": "^5.4.5",
98
102
  "unbuild": "2.0.0"
103
+ },
104
+ "overrides": {
105
+ "eslint-plugin-jsx-a11y": {
106
+ "eslint": "$eslint"
107
+ },
108
+ "eslint-plugin-react": {
109
+ "eslint": "$eslint"
110
+ },
111
+ "eslint-plugin-react-hooks": {
112
+ "eslint": "$eslint"
113
+ },
114
+ "eslint-plugin-testing-library": {
115
+ "eslint": "$eslint"
116
+ }
99
117
  }
100
118
  }
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ import { configs as eslintConfigs } from './eslint.js';
6
6
  import { configs as jsdocConfigs } from './jsdoc.js';
7
7
  import { configs as mochaConfigs } from './mocha.js';
8
8
  import { configs as promiseConfigs } from './promise.js';
9
+ import { configs as reactConfigs } from './react.js';
9
10
  import { configs as securityConfigs } from './security.js';
10
11
  import { configs as typescriptEslintConfigs } from './typescriptEslint.js';
11
12
  import { configs as unicornConfigs } from './unicorn.js';
@@ -14,6 +15,7 @@ export {
14
15
  eslintConfigs, //
15
16
  jsdocConfigs,
16
17
  promiseConfigs,
18
+ reactConfigs,
17
19
  securityConfigs,
18
20
  typescriptEslintConfigs,
19
21
  unicornConfigs,
@@ -49,7 +51,7 @@ export function defaultConfig(parserOptions?: NonNullable<ConfigWithExtends['lan
49
51
  },
50
52
  },
51
53
  {
52
- files: ['**/*.ts', '**/*.js', '**/*.cjs', '**/*.mjs'],
54
+ files: ['**/*.ts', '**/*.js', '**/*.cjs', '**/*.mjs', '**/*.tsx'],
53
55
  plugins: {
54
56
  ...jsdocConfigs.base.plugins,
55
57
  ...promiseConfigs.base.plugins,
@@ -79,9 +81,13 @@ export function defaultConfig(parserOptions?: NonNullable<ConfigWithExtends['lan
79
81
  ...eslintConfigs.cjs,
80
82
  },
81
83
  {
82
- files: ['**/*.ts'],
84
+ files: ['**/*.ts', '**/*.tsx'],
83
85
  ...typescriptEslintConfigs.base,
84
86
  },
87
+ {
88
+ files: ['**/*.tsx'],
89
+ ...reactConfigs.base,
90
+ },
85
91
  {
86
92
  files: ['**/*.tests.ts', 'tests/tests.ts'],
87
93
 
package/src/react.ts ADDED
@@ -0,0 +1,77 @@
1
+ import a11y from 'eslint-plugin-jsx-a11y';
2
+ import react from 'eslint-plugin-react';
3
+ import reactHooks from 'eslint-plugin-react-hooks';
4
+ import testingLibrary from 'eslint-plugin-testing-library';
5
+ import type { ConfigWithExtends } from 'typescript-eslint';
6
+
7
+ const base: ConfigWithExtends = {
8
+ plugins: {
9
+ 'jsx-a11y': a11y,
10
+ react,
11
+ 'react-hooks': reactHooks,
12
+ 'testing-library': testingLibrary,
13
+ },
14
+ rules: {
15
+ ...a11y.configs.recommended.rules,
16
+ 'jsx-a11y/aria-proptypes': 'error',
17
+ 'jsx-a11y/aria-role': ['error', { ignoreNonDOM: true }],
18
+ 'jsx-a11y/aria-unsupported-elements': 'error',
19
+ 'jsx-a11y/role-has-required-aria-props': 'error',
20
+
21
+ ...react.configs.recommended.rules,
22
+ 'react/default-props-match-prop-types': 'error',
23
+ 'react/display-name': ['error', { ignoreTranspilerName: false }],
24
+ 'react/forbid-foreign-prop-types': ['error', { allowInPropTypes: true }],
25
+ 'react/iframe-missing-sandbox': 'warn',
26
+ 'react/jsx-closing-bracket-location': 'error',
27
+ 'react/jsx-fragments': 'error',
28
+ 'react/jsx-no-leaked-render': ['error', { validStrategies: ['ternary'] }],
29
+ 'react/jsx-no-script-url': 'error',
30
+ 'react/jsx-no-target-blank': 'error',
31
+ 'react/jsx-no-undef': 'error',
32
+ 'react/jsx-no-useless-fragment': 'error',
33
+ 'react/jsx-pascal-case': [
34
+ 'error',
35
+ {
36
+ allowAllCaps: true,
37
+ ignore: [],
38
+ },
39
+ ],
40
+ 'react/jsx-props-no-multi-spaces': 'error',
41
+ 'react/no-access-state-in-setstate': 'error',
42
+ 'react/no-arrow-function-lifecycle': 'error',
43
+ 'react/no-danger-with-children': 'error',
44
+ 'react/no-deprecated': 'error',
45
+ 'react/no-did-mount-set-state': 'error',
46
+ 'react/no-did-update-set-state': 'error',
47
+ 'react/no-direct-mutation-state': 'error',
48
+ 'react/no-invalid-html-attribute': 'error',
49
+ 'react/no-namespace': 'error',
50
+ 'react/no-redundant-should-component-update': 'error',
51
+ 'react/no-this-in-sfc': 'error',
52
+ 'react/no-typos': 'error',
53
+ 'react/no-unsafe': 'error',
54
+ 'react/no-unstable-nested-components': 'error',
55
+ 'react/no-unused-class-component-methods': 'error',
56
+ 'react/no-unused-prop-types': 'error',
57
+ 'react/no-unused-state': 'error',
58
+ 'react/no-will-update-set-state': 'error',
59
+ 'react/prefer-stateless-function': 'error',
60
+ 'react/require-render-return': 'error',
61
+ 'react/self-closing-comp': 'error',
62
+ 'react/style-prop-object': 'error',
63
+
64
+ 'react-hooks/rules-of-hooks': 'error',
65
+ 'react-hooks/exhaustive-deps': 'error',
66
+
67
+ ...testingLibrary.configs.react.rules,
68
+ },
69
+ };
70
+
71
+ export const configs = {
72
+ base,
73
+ };
74
+
75
+ export default {
76
+ configs,
77
+ };
@@ -0,0 +1,9 @@
1
+ declare module 'eslint-plugin-jsx-a11y' {
2
+ import type { ESLint, Linter } from 'eslint';
3
+ const value: ESLint.Plugin & {
4
+ configs: {
5
+ recommended: Linter.FlatConfig;
6
+ };
7
+ };
8
+ export default value;
9
+ }
@@ -0,0 +1,5 @@
1
+ declare module 'eslint-plugin-react-hooks' {
2
+ import type { ESLint } from 'eslint';
3
+ const value: ESLint.Plugin;
4
+ export default value;
5
+ }
@@ -0,0 +1,9 @@
1
+ declare module 'eslint-plugin-react' {
2
+ import type { ESLint, Linter } from 'eslint';
3
+ const value: ESLint.Plugin & {
4
+ configs: {
5
+ recommended: Linter.FlatConfig;
6
+ };
7
+ };
8
+ export default value;
9
+ }
@@ -0,0 +1,9 @@
1
+ declare module 'eslint-plugin-testing-library' {
2
+ import type { ESLint, Linter } from 'eslint';
3
+ const value: ESLint.Plugin & {
4
+ configs: {
5
+ react: Linter.FlatConfig;
6
+ };
7
+ };
8
+ export default value;
9
+ }