@aiou/eslint-config 1.5.0 → 2.0.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.mjs CHANGED
@@ -1,23 +1,24 @@
1
+ import { FlatConfigComposer } from 'eslint-flat-config-utils';
1
2
  import { isPackageExists } from 'local-pkg';
2
- import pluginComments from 'eslint-plugin-eslint-comments';
3
+ import configComments from '@eslint-community/eslint-plugin-eslint-comments';
3
4
  import ignoreGlobs from '@aiou/eslint-ignore';
4
- import pluginImport from 'eslint-plugin-i';
5
5
  import pluginImportNewlines from 'eslint-plugin-import-newlines';
6
+ import pluginImport from 'eslint-plugin-import-x';
6
7
  import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
7
8
  import pluginUnsedImports from 'eslint-plugin-unused-imports';
8
9
  import pluginN from 'eslint-plugin-n';
9
10
  import pluginPromise from 'eslint-plugin-promise';
10
- import globals$1 from 'globals';
11
+ import globals from 'globals';
11
12
  import pluginJsonc from 'eslint-plugin-jsonc';
12
13
  import jsoncParser from 'jsonc-eslint-parser';
13
- import pluginMarkdown from 'eslint-plugin-markdown';
14
+ import pluginMarkdown from '@eslint/markdown';
14
15
  import pluginNext from '@next/eslint-plugin-next';
15
16
  import pluginProgress from '@aiou/eslint-plugin-progress';
16
- import pluginReact from 'eslint-plugin-react';
17
+ import pluginReact from '@eslint-react/eslint-plugin';
17
18
  import pluginReactHooks from 'eslint-plugin-react-hooks';
18
19
  import pluginReactRefresh from 'eslint-plugin-react-refresh';
19
20
  import pluginSSRFriendly from 'eslint-plugin-ssr-friendly';
20
- import pluginRegexp from 'eslint-plugin-regexp';
21
+ import { configs } from 'eslint-plugin-regexp';
21
22
  import pluginStylistic from '@stylistic/eslint-plugin';
22
23
  import { createRequire } from 'node:module';
23
24
  import pluginTypeScript from '@typescript-eslint/eslint-plugin';
@@ -30,12 +31,11 @@ import yamlParser from 'yaml-eslint-parser';
30
31
  const comments = () => {
31
32
  const config = [
32
33
  {
33
- plugins: {
34
- "eslint-comments": pluginComments
35
- },
34
+ ...configComments.recommended
35
+ },
36
+ {
36
37
  rules: {
37
- ...pluginComments.configs.recommended.rules,
38
- "eslint-comments/disable-enable-pair": "off"
38
+ "@eslint-community/eslint-comments/disable-enable-pair": "off"
39
39
  }
40
40
  }
41
41
  ];
@@ -78,7 +78,6 @@ const imports = () => {
78
78
  "unused-imports": pluginUnsedImports
79
79
  },
80
80
  rules: {
81
- ...pluginImport.configs.recommended.rules,
82
81
  // import
83
82
  // off: controlled by import/order
84
83
  "import/order": "off",
@@ -193,633 +192,14 @@ const imports = () => {
193
192
  return config;
194
193
  };
195
194
 
196
- function getDefaultExportFromCjs (x) {
197
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
198
- }
199
-
200
- var eslintConfigStandardExports = {};
201
- var eslintConfigStandard = {
202
- get exports(){ return eslintConfigStandardExports; },
203
- set exports(v){ eslintConfigStandardExports = v; },
204
- };
205
-
206
- var parserOptions = {
207
- ecmaVersion: 2022,
208
- ecmaFeatures: {
209
- jsx: true
210
- },
211
- sourceType: "module"
212
- };
213
- var env = {
214
- es2021: true,
215
- node: true
216
- };
217
- var plugins = [
218
- "import",
219
- "n",
220
- "promise"
221
- ];
222
- var globals = {
223
- document: "readonly",
224
- navigator: "readonly",
225
- window: "readonly"
226
- };
227
- var rules = {
228
- "no-var": "warn",
229
- "object-shorthand": [
230
- "warn",
231
- "properties"
232
- ],
233
- "accessor-pairs": [
234
- "error",
235
- {
236
- setWithoutGet: true,
237
- enforceForClassMembers: true
238
- }
239
- ],
240
- "array-bracket-spacing": [
241
- "error",
242
- "never"
243
- ],
244
- "array-callback-return": [
245
- "error",
246
- {
247
- allowImplicit: false,
248
- checkForEach: false
249
- }
250
- ],
251
- "arrow-spacing": [
252
- "error",
253
- {
254
- before: true,
255
- after: true
256
- }
257
- ],
258
- "block-spacing": [
259
- "error",
260
- "always"
261
- ],
262
- "brace-style": [
263
- "error",
264
- "1tbs",
265
- {
266
- allowSingleLine: true
267
- }
268
- ],
269
- camelcase: [
270
- "error",
271
- {
272
- allow: [
273
- "^UNSAFE_"
274
- ],
275
- properties: "never",
276
- ignoreGlobals: true
277
- }
278
- ],
279
- "comma-dangle": [
280
- "error",
281
- {
282
- arrays: "never",
283
- objects: "never",
284
- imports: "never",
285
- exports: "never",
286
- functions: "never"
287
- }
288
- ],
289
- "comma-spacing": [
290
- "error",
291
- {
292
- before: false,
293
- after: true
294
- }
295
- ],
296
- "comma-style": [
297
- "error",
298
- "last"
299
- ],
300
- "computed-property-spacing": [
301
- "error",
302
- "never",
303
- {
304
- enforceForClassMembers: true
305
- }
306
- ],
307
- "constructor-super": "error",
308
- curly: [
309
- "error",
310
- "multi-line"
311
- ],
312
- "default-case-last": "error",
313
- "dot-location": [
314
- "error",
315
- "property"
316
- ],
317
- "dot-notation": [
318
- "error",
319
- {
320
- allowKeywords: true
321
- }
322
- ],
323
- "eol-last": "error",
324
- eqeqeq: [
325
- "error",
326
- "always",
327
- {
328
- "null": "ignore"
329
- }
330
- ],
331
- "func-call-spacing": [
332
- "error",
333
- "never"
334
- ],
335
- "generator-star-spacing": [
336
- "error",
337
- {
338
- before: true,
339
- after: true
340
- }
341
- ],
342
- indent: [
343
- "error",
344
- 2,
345
- {
346
- SwitchCase: 1,
347
- VariableDeclarator: 1,
348
- outerIIFEBody: 1,
349
- MemberExpression: 1,
350
- FunctionDeclaration: {
351
- parameters: 1,
352
- body: 1
353
- },
354
- FunctionExpression: {
355
- parameters: 1,
356
- body: 1
357
- },
358
- CallExpression: {
359
- "arguments": 1
360
- },
361
- ArrayExpression: 1,
362
- ObjectExpression: 1,
363
- ImportDeclaration: 1,
364
- flatTernaryExpressions: false,
365
- ignoreComments: false,
366
- ignoredNodes: [
367
- "TemplateLiteral *",
368
- "JSXElement",
369
- "JSXElement > *",
370
- "JSXAttribute",
371
- "JSXIdentifier",
372
- "JSXNamespacedName",
373
- "JSXMemberExpression",
374
- "JSXSpreadAttribute",
375
- "JSXExpressionContainer",
376
- "JSXOpeningElement",
377
- "JSXClosingElement",
378
- "JSXFragment",
379
- "JSXOpeningFragment",
380
- "JSXClosingFragment",
381
- "JSXText",
382
- "JSXEmptyExpression",
383
- "JSXSpreadChild"
384
- ],
385
- offsetTernaryExpressions: true
386
- }
387
- ],
388
- "key-spacing": [
389
- "error",
390
- {
391
- beforeColon: false,
392
- afterColon: true
393
- }
394
- ],
395
- "keyword-spacing": [
396
- "error",
397
- {
398
- before: true,
399
- after: true
400
- }
401
- ],
402
- "lines-between-class-members": [
403
- "error",
404
- "always",
405
- {
406
- exceptAfterSingleLine: true
407
- }
408
- ],
409
- "multiline-ternary": [
410
- "error",
411
- "always-multiline"
412
- ],
413
- "new-cap": [
414
- "error",
415
- {
416
- newIsCap: true,
417
- capIsNew: false,
418
- properties: true
419
- }
420
- ],
421
- "new-parens": "error",
422
- "no-array-constructor": "error",
423
- "no-async-promise-executor": "error",
424
- "no-caller": "error",
425
- "no-case-declarations": "error",
426
- "no-class-assign": "error",
427
- "no-compare-neg-zero": "error",
428
- "no-cond-assign": "error",
429
- "no-const-assign": "error",
430
- "no-constant-condition": [
431
- "error",
432
- {
433
- checkLoops: false
434
- }
435
- ],
436
- "no-control-regex": "error",
437
- "no-debugger": "error",
438
- "no-delete-var": "error",
439
- "no-dupe-args": "error",
440
- "no-dupe-class-members": "error",
441
- "no-dupe-keys": "error",
442
- "no-duplicate-case": "error",
443
- "no-useless-backreference": "error",
444
- "no-empty": [
445
- "error",
446
- {
447
- allowEmptyCatch: true
448
- }
449
- ],
450
- "no-empty-character-class": "error",
451
- "no-empty-pattern": "error",
452
- "no-eval": "error",
453
- "no-ex-assign": "error",
454
- "no-extend-native": "error",
455
- "no-extra-bind": "error",
456
- "no-extra-boolean-cast": "error",
457
- "no-extra-parens": [
458
- "error",
459
- "functions"
460
- ],
461
- "no-fallthrough": "error",
462
- "no-floating-decimal": "error",
463
- "no-func-assign": "error",
464
- "no-global-assign": "error",
465
- "no-implied-eval": "error",
466
- "no-import-assign": "error",
467
- "no-invalid-regexp": "error",
468
- "no-irregular-whitespace": "error",
469
- "no-iterator": "error",
470
- "no-labels": [
471
- "error",
472
- {
473
- allowLoop: false,
474
- allowSwitch: false
475
- }
476
- ],
477
- "no-lone-blocks": "error",
478
- "no-loss-of-precision": "error",
479
- "no-misleading-character-class": "error",
480
- "no-prototype-builtins": "error",
481
- "no-useless-catch": "error",
482
- "no-mixed-operators": [
483
- "error",
484
- {
485
- groups: [
486
- [
487
- "==",
488
- "!=",
489
- "===",
490
- "!==",
491
- ">",
492
- ">=",
493
- "<",
494
- "<="
495
- ],
496
- [
497
- "&&",
498
- "||"
499
- ],
500
- [
501
- "in",
502
- "instanceof"
503
- ]
504
- ],
505
- allowSamePrecedence: true
506
- }
507
- ],
508
- "no-mixed-spaces-and-tabs": "error",
509
- "no-multi-spaces": "error",
510
- "no-multi-str": "error",
511
- "no-multiple-empty-lines": [
512
- "error",
513
- {
514
- max: 1,
515
- maxBOF: 0,
516
- maxEOF: 0
517
- }
518
- ],
519
- "no-new": "error",
520
- "no-new-func": "error",
521
- "no-new-object": "error",
522
- "no-new-symbol": "error",
523
- "no-new-wrappers": "error",
524
- "no-obj-calls": "error",
525
- "no-octal": "error",
526
- "no-octal-escape": "error",
527
- "no-proto": "error",
528
- "no-redeclare": [
529
- "error",
530
- {
531
- builtinGlobals: false
532
- }
533
- ],
534
- "no-regex-spaces": "error",
535
- "no-return-assign": [
536
- "error",
537
- "except-parens"
538
- ],
539
- "no-self-assign": [
540
- "error",
541
- {
542
- props: true
543
- }
544
- ],
545
- "no-self-compare": "error",
546
- "no-sequences": "error",
547
- "no-shadow-restricted-names": "error",
548
- "no-sparse-arrays": "error",
549
- "no-tabs": "error",
550
- "no-template-curly-in-string": "error",
551
- "no-this-before-super": "error",
552
- "no-throw-literal": "error",
553
- "no-trailing-spaces": "error",
554
- "no-undef": "error",
555
- "no-undef-init": "error",
556
- "no-unexpected-multiline": "error",
557
- "no-unmodified-loop-condition": "error",
558
- "no-unneeded-ternary": [
559
- "error",
560
- {
561
- defaultAssignment: false
562
- }
563
- ],
564
- "no-unreachable": "error",
565
- "no-unreachable-loop": "error",
566
- "no-unsafe-finally": "error",
567
- "no-unsafe-negation": "error",
568
- "no-unused-expressions": [
569
- "error",
570
- {
571
- allowShortCircuit: true,
572
- allowTernary: true,
573
- allowTaggedTemplates: true
574
- }
575
- ],
576
- "no-unused-vars": [
577
- "error",
578
- {
579
- args: "none",
580
- caughtErrors: "none",
581
- ignoreRestSiblings: true,
582
- vars: "all"
583
- }
584
- ],
585
- "no-use-before-define": [
586
- "error",
587
- {
588
- functions: false,
589
- classes: false,
590
- variables: false
591
- }
592
- ],
593
- "no-useless-call": "error",
594
- "no-useless-computed-key": "error",
595
- "no-useless-constructor": "error",
596
- "no-useless-escape": "error",
597
- "no-useless-rename": "error",
598
- "no-useless-return": "error",
599
- "no-void": "error",
600
- "no-whitespace-before-property": "error",
601
- "no-with": "error",
602
- "object-curly-newline": [
603
- "error",
604
- {
605
- multiline: true,
606
- consistent: true
607
- }
608
- ],
609
- "object-curly-spacing": [
610
- "error",
611
- "always"
612
- ],
613
- "object-property-newline": [
614
- "error",
615
- {
616
- allowMultiplePropertiesPerLine: true
617
- }
618
- ],
619
- "one-var": [
620
- "error",
621
- {
622
- initialized: "never"
623
- }
624
- ],
625
- "operator-linebreak": [
626
- "error",
627
- "after",
628
- {
629
- overrides: {
630
- "?": "before",
631
- ":": "before",
632
- "|>": "before"
633
- }
634
- }
635
- ],
636
- "padded-blocks": [
637
- "error",
638
- {
639
- blocks: "never",
640
- switches: "never",
641
- classes: "never"
642
- }
643
- ],
644
- "prefer-const": [
645
- "error",
646
- {
647
- destructuring: "all"
648
- }
649
- ],
650
- "prefer-promise-reject-errors": "error",
651
- "prefer-regex-literals": [
652
- "error",
653
- {
654
- disallowRedundantWrapping: true
655
- }
656
- ],
657
- "quote-props": [
658
- "error",
659
- "as-needed"
660
- ],
661
- quotes: [
662
- "error",
663
- "single",
664
- {
665
- avoidEscape: true,
666
- allowTemplateLiterals: false
667
- }
668
- ],
669
- "rest-spread-spacing": [
670
- "error",
671
- "never"
672
- ],
673
- semi: [
674
- "error",
675
- "never"
676
- ],
677
- "semi-spacing": [
678
- "error",
679
- {
680
- before: false,
681
- after: true
682
- }
683
- ],
684
- "space-before-blocks": [
685
- "error",
686
- "always"
687
- ],
688
- "space-before-function-paren": [
689
- "error",
690
- "always"
691
- ],
692
- "space-in-parens": [
693
- "error",
694
- "never"
695
- ],
696
- "space-infix-ops": "error",
697
- "space-unary-ops": [
698
- "error",
699
- {
700
- words: true,
701
- nonwords: false
702
- }
703
- ],
704
- "spaced-comment": [
705
- "error",
706
- "always",
707
- {
708
- line: {
709
- markers: [
710
- "*package",
711
- "!",
712
- "/",
713
- ",",
714
- "="
715
- ]
716
- },
717
- block: {
718
- balanced: true,
719
- markers: [
720
- "*package",
721
- "!",
722
- ",",
723
- ":",
724
- "::",
725
- "flow-include"
726
- ],
727
- exceptions: [
728
- "*"
729
- ]
730
- }
731
- }
732
- ],
733
- "symbol-description": "error",
734
- "template-curly-spacing": [
735
- "error",
736
- "never"
737
- ],
738
- "template-tag-spacing": [
739
- "error",
740
- "never"
741
- ],
742
- "unicode-bom": [
743
- "error",
744
- "never"
745
- ],
746
- "use-isnan": [
747
- "error",
748
- {
749
- enforceForSwitchCase: true,
750
- enforceForIndexOf: true
751
- }
752
- ],
753
- "valid-typeof": [
754
- "error",
755
- {
756
- requireStringLiterals: true
757
- }
758
- ],
759
- "wrap-iife": [
760
- "error",
761
- "any",
762
- {
763
- functionPrototypeMethods: true
764
- }
765
- ],
766
- "yield-star-spacing": [
767
- "error",
768
- "both"
769
- ],
770
- yoda: [
771
- "error",
772
- "never"
773
- ],
774
- "import/export": "error",
775
- "import/first": "error",
776
- "import/no-absolute-path": [
777
- "error",
778
- {
779
- esmodule: true,
780
- commonjs: true,
781
- amd: false
782
- }
783
- ],
784
- "import/no-duplicates": "error",
785
- "import/no-named-default": "error",
786
- "import/no-webpack-loader-syntax": "error",
787
- "n/handle-callback-err": [
788
- "error",
789
- "^(err|error)$"
790
- ],
791
- "n/no-callback-literal": "error",
792
- "n/no-deprecated-api": "error",
793
- "n/no-exports-assign": "error",
794
- "n/no-new-require": "error",
795
- "n/no-path-concat": "error",
796
- "n/process-exit-as-throw": "error",
797
- "promise/param-names": "error"
798
- };
799
- var require$$0 = {
800
- parserOptions: parserOptions,
801
- env: env,
802
- plugins: plugins,
803
- globals: globals,
804
- rules: rules
805
- };
806
-
807
- /*! eslint-config-standard. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
808
-
809
- (function (module) {
810
- module.exports = require$$0;
811
- } (eslintConfigStandard));
812
-
813
- var pluginStandard = /*@__PURE__*/getDefaultExportFromCjs(eslintConfigStandardExports);
814
-
815
195
  const javascript = () => {
816
196
  const config = [
817
197
  {
818
198
  languageOptions: {
819
199
  globals: {
820
- ...globals$1.browser,
821
- ...globals$1.es2021,
822
- ...globals$1.node
200
+ ...globals.browser,
201
+ ...globals.es2021,
202
+ ...globals.node
823
203
  },
824
204
  parserOptions: {
825
205
  ecmaFeatures: {
@@ -846,7 +226,219 @@ const javascript = () => {
846
226
  promise: pluginPromise
847
227
  },
848
228
  rules: {
849
- ...pluginStandard.rules,
229
+ // from standard
230
+ // "no-var": "warn",
231
+ // "object-shorthand": ["warn", "properties"],
232
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
233
+ "array-bracket-spacing": ["error", "never"],
234
+ // "array-callback-return": ["error", {
235
+ // "allowImplicit": false,
236
+ // "checkForEach": false
237
+ // }],
238
+ "arrow-spacing": ["error", { before: true, after: true }],
239
+ "block-spacing": ["error", "always"],
240
+ "brace-style": ["error", "1tbs", { allowSingleLine: true }],
241
+ // "camelcase": ["error", {
242
+ // "allow": ["^UNSAFE_"],
243
+ // "properties": "never",
244
+ // "ignoreGlobals": true
245
+ // }],
246
+ "comma-dangle": ["error", {
247
+ arrays: "never",
248
+ objects: "never",
249
+ imports: "never",
250
+ exports: "never",
251
+ functions: "never"
252
+ }],
253
+ "comma-spacing": ["error", { before: false, after: true }],
254
+ "comma-style": ["error", "last"],
255
+ "computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
256
+ "constructor-super": "error",
257
+ // "curly": ["error", "multi-line"],
258
+ "default-case-last": "error",
259
+ "dot-location": ["error", "property"],
260
+ "dot-notation": ["error", { allowKeywords: true }],
261
+ "eol-last": "error",
262
+ // "eqeqeq": ["error", "always", { "null": "ignore" }],
263
+ "func-call-spacing": ["error", "never"],
264
+ "generator-star-spacing": ["error", { before: true, after: true }],
265
+ indent: ["error", 2, {
266
+ SwitchCase: 1,
267
+ VariableDeclarator: 1,
268
+ outerIIFEBody: 1,
269
+ MemberExpression: 1,
270
+ FunctionDeclaration: { parameters: 1, body: 1 },
271
+ FunctionExpression: { parameters: 1, body: 1 },
272
+ CallExpression: { arguments: 1 },
273
+ ArrayExpression: 1,
274
+ ObjectExpression: 1,
275
+ ImportDeclaration: 1,
276
+ flatTernaryExpressions: false,
277
+ ignoreComments: false,
278
+ ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
279
+ offsetTernaryExpressions: true
280
+ }],
281
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
282
+ "keyword-spacing": ["error", { before: true, after: true }],
283
+ "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
284
+ "multiline-ternary": ["error", "always-multiline"],
285
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
286
+ "new-parens": "error",
287
+ "no-array-constructor": "error",
288
+ "no-async-promise-executor": "error",
289
+ "no-caller": "error",
290
+ // "no-case-declarations": "error",
291
+ "no-class-assign": "error",
292
+ "no-compare-neg-zero": "error",
293
+ // "no-cond-assign": "error",
294
+ "no-const-assign": "error",
295
+ // "no-constant-condition": ["error", { "checkLoops": false }],
296
+ "no-control-regex": "error",
297
+ // "no-debugger": "error",
298
+ "no-delete-var": "error",
299
+ "no-dupe-args": "error",
300
+ "no-dupe-class-members": "error",
301
+ "no-dupe-keys": "error",
302
+ "no-duplicate-case": "error",
303
+ "no-useless-backreference": "error",
304
+ "no-empty": ["error", { allowEmptyCatch: true }],
305
+ "no-empty-character-class": "error",
306
+ "no-empty-pattern": "error",
307
+ "no-eval": "error",
308
+ "no-ex-assign": "error",
309
+ "no-extend-native": "error",
310
+ "no-extra-bind": "error",
311
+ "no-extra-boolean-cast": "error",
312
+ "no-extra-parens": ["error", "functions"],
313
+ "no-fallthrough": "error",
314
+ "no-floating-decimal": "error",
315
+ "no-func-assign": "error",
316
+ "no-global-assign": "error",
317
+ "no-implied-eval": "error",
318
+ "no-import-assign": "error",
319
+ "no-invalid-regexp": "error",
320
+ "no-irregular-whitespace": "error",
321
+ "no-iterator": "error",
322
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
323
+ "no-lone-blocks": "error",
324
+ "no-loss-of-precision": "error",
325
+ "no-misleading-character-class": "error",
326
+ "no-prototype-builtins": "error",
327
+ "no-useless-catch": "error",
328
+ "no-mixed-operators": ["error", {
329
+ groups: [
330
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
331
+ ["&&", "||"],
332
+ ["in", "instanceof"]
333
+ ],
334
+ allowSamePrecedence: true
335
+ }],
336
+ "no-mixed-spaces-and-tabs": "error",
337
+ "no-multi-spaces": "error",
338
+ // "no-multi-str": "error",
339
+ "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
340
+ "no-new": "error",
341
+ "no-new-func": "error",
342
+ "no-new-object": "error",
343
+ "no-new-symbol": "error",
344
+ "no-new-wrappers": "error",
345
+ "no-obj-calls": "error",
346
+ "no-octal": "error",
347
+ "no-octal-escape": "error",
348
+ "no-proto": "error",
349
+ "no-redeclare": ["error", { builtinGlobals: false }],
350
+ "no-regex-spaces": "error",
351
+ // "no-return-assign": ["error", "except-parens"],
352
+ "no-self-assign": ["error", { props: true }],
353
+ "no-self-compare": "error",
354
+ "no-sequences": "error",
355
+ "no-shadow-restricted-names": "error",
356
+ "no-sparse-arrays": "error",
357
+ "no-tabs": "error",
358
+ "no-template-curly-in-string": "error",
359
+ "no-this-before-super": "error",
360
+ "no-throw-literal": "error",
361
+ "no-trailing-spaces": "error",
362
+ "no-undef": "error",
363
+ "no-undef-init": "error",
364
+ "no-unexpected-multiline": "error",
365
+ "no-unmodified-loop-condition": "error",
366
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
367
+ "no-unreachable": "error",
368
+ "no-unreachable-loop": "error",
369
+ "no-unsafe-finally": "error",
370
+ "no-unsafe-negation": "error",
371
+ "no-unused-expressions": ["error", {
372
+ allowShortCircuit: true,
373
+ allowTernary: true,
374
+ allowTaggedTemplates: true
375
+ }],
376
+ // "no-unused-vars": ["error", {
377
+ // "args": "none",
378
+ // "caughtErrors": "none",
379
+ // "ignoreRestSiblings": true,
380
+ // "vars": "all"
381
+ // }],
382
+ "no-use-before-define": ["error", { functions: false, classes: false, variables: false }],
383
+ "no-useless-call": "error",
384
+ "no-useless-computed-key": "error",
385
+ "no-useless-constructor": "error",
386
+ // "no-useless-escape": "error",
387
+ "no-useless-rename": "error",
388
+ "no-useless-return": "error",
389
+ // "no-void": "error",
390
+ "no-whitespace-before-property": "error",
391
+ "no-with": "error",
392
+ "object-curly-newline": ["error", { multiline: true, consistent: true }],
393
+ "object-curly-spacing": ["error", "always"],
394
+ "object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
395
+ "one-var": ["error", { initialized: "never" }],
396
+ "operator-linebreak": ["error", "after", { overrides: { "?": "before", ":": "before", "|>": "before" } }],
397
+ "padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
398
+ // "prefer-const": ["error", {"destructuring": "all"}],
399
+ "prefer-promise-reject-errors": "error",
400
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
401
+ "quote-props": ["error", "as-needed"],
402
+ quotes: ["error", "single", { avoidEscape: true, allowTemplateLiterals: false }],
403
+ "rest-spread-spacing": ["error", "never"],
404
+ semi: ["error", "never"],
405
+ "semi-spacing": ["error", { before: false, after: true }],
406
+ "space-before-blocks": ["error", "always"],
407
+ "space-before-function-paren": ["error", "always"],
408
+ "space-in-parens": ["error", "never"],
409
+ "space-infix-ops": "error",
410
+ "space-unary-ops": ["error", { words: true, nonwords: false }],
411
+ "spaced-comment": ["error", "always", {
412
+ line: { markers: ["*package", "!", "/", ",", "="] },
413
+ block: { balanced: true, markers: ["*package", "!", ",", ":", "::", "flow-include"], exceptions: ["*"] }
414
+ }],
415
+ "symbol-description": "error",
416
+ "template-curly-spacing": ["error", "never"],
417
+ "template-tag-spacing": ["error", "never"],
418
+ "unicode-bom": ["error", "never"],
419
+ "use-isnan": ["error", {
420
+ enforceForSwitchCase: true,
421
+ enforceForIndexOf: true
422
+ }],
423
+ "valid-typeof": ["error", { requireStringLiterals: true }],
424
+ "wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
425
+ "yield-star-spacing": ["error", "both"],
426
+ yoda: ["error", "never"],
427
+ "import/export": "error",
428
+ "import/first": "error",
429
+ "import/no-absolute-path": ["error", { esmodule: true, commonjs: true, amd: false }],
430
+ "import/no-duplicates": "error",
431
+ "import/no-named-default": "error",
432
+ "import/no-webpack-loader-syntax": "error",
433
+ "n/handle-callback-err": ["error", "^(err|error)$"],
434
+ "n/no-callback-literal": "error",
435
+ "n/no-deprecated-api": "error",
436
+ "n/no-exports-assign": "error",
437
+ "n/no-new-require": "error",
438
+ "n/no-path-concat": "error",
439
+ "n/process-exit-as-throw": "error",
440
+ "promise/param-names": "error",
441
+ // override
850
442
  curly: ["error", "all"],
851
443
  "no-unused-vars": "warn",
852
444
  "no-param-reassign": "off",
@@ -900,7 +492,7 @@ const javascript = () => {
900
492
  "no-alert": "warn",
901
493
  "no-case-declarations": "error",
902
494
  "no-multi-str": "error",
903
- "no-with": "error",
495
+ // 'no-with': 'error',
904
496
  "no-void": "error",
905
497
  "no-useless-escape": "off",
906
498
  "vars-on-top": "error",
@@ -1007,7 +599,8 @@ const jsonc = () => {
1007
599
  {
1008
600
  pathPattern: "^exports.*$",
1009
601
  // According to webpack, default condition should be last item
1010
- order: ["import", "require", "types", "node", "browser", "default"]
602
+ // Typescript bugs: types should be first one
603
+ order: ["types", "import", "require", "node", "browser", "default"]
1011
604
  },
1012
605
  {
1013
606
  order: { type: "asc" },
@@ -1147,30 +740,13 @@ const jsonc = () => {
1147
740
 
1148
741
  const markdown = () => {
1149
742
  const config = [
1150
- {
1151
- // Enable the Markdown processor for all .md files.
1152
- files: [GLOB_MARKDOWN],
1153
- processor: "markdown/markdown",
1154
- plugins: {
1155
- markdown: pluginMarkdown
1156
- }
1157
- },
743
+ ...pluginMarkdown.configs.processor.map((config2) => ({
744
+ ...config2
745
+ })),
1158
746
  {
1159
747
  // Code blocks in markdown file
1160
748
  files: [`${GLOB_MARKDOWN}/*.${GLOB_SCRIPT_EXT}`],
1161
- languageOptions: {
1162
- parserOptions: {
1163
- ecmaFeatures: {
1164
- // Adding a "use strict" directive at the top of
1165
- // every code block is tedious and distracting, so
1166
- // opt into strict mode parsing without the
1167
- // directive.
1168
- impliedStrict: true
1169
- }
1170
- }
1171
- },
1172
749
  rules: {
1173
- ...pluginMarkdown.configs.recommended.overrides[1].rules,
1174
750
  "react/display-name": "off",
1175
751
  "@typescript-eslint/no-redeclare": "off",
1176
752
  "@typescript-eslint/no-unused-vars": "off",
@@ -3978,14 +3554,17 @@ function mapValues(object, iteratee) {
3978
3554
  }
3979
3555
 
3980
3556
  const react = () => {
3557
+ const plugins = pluginReact.configs.all.plugins;
3981
3558
  const config = [
3982
3559
  {
3983
3560
  files: [GLOB_JSX, GLOB_TSX],
3984
3561
  languageOptions: {
3985
3562
  parserOptions: {
3986
- ...pluginReact.configs.recommended.parserOptions,
3987
- ...pluginReact.configs["jsx-runtime"].parserOptions
3988
- }
3563
+ ecmaFeatures: {
3564
+ jsx: true
3565
+ }
3566
+ },
3567
+ sourceType: "module"
3989
3568
  },
3990
3569
  settings: {
3991
3570
  react: {
@@ -3994,14 +3573,15 @@ const react = () => {
3994
3573
  }
3995
3574
  },
3996
3575
  plugins: {
3997
- react: pluginReact,
3576
+ react: plugins["@eslint-react"],
3577
+ "react-dom": plugins["@eslint-react/dom"],
3998
3578
  "react-hooks": pluginReactHooks,
3999
- "react-refresh": pluginReactRefresh
3579
+ "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
3580
+ "react-naming-convention": plugins["@eslint-react/naming-convention"],
3581
+ "react-refresh": pluginReactRefresh,
3582
+ "react-web-api": plugins["@eslint-react/web-api"]
4000
3583
  },
4001
3584
  rules: {
4002
- ...pluginReact.configs.recommended.rules,
4003
- ...pluginReact.configs["jsx-runtime"].rules,
4004
- ...pluginReactHooks.configs.recommended.rules,
4005
3585
  "react/prop-types": "off",
4006
3586
  "react/no-unescaped-entities": "off",
4007
3587
  "react/no-unknown-property": "off",
@@ -4037,9 +3617,11 @@ const ssrReact = () => {
4037
3617
  files: [GLOB_JSX, GLOB_TSX],
4038
3618
  languageOptions: {
4039
3619
  parserOptions: {
4040
- ...pluginReact.configs.recommended.parserOptions,
4041
- ...pluginReact.configs["jsx-runtime"].parserOptions
4042
- }
3620
+ ecmaFeatures: {
3621
+ jsx: true
3622
+ }
3623
+ },
3624
+ sourceType: "module"
4043
3625
  },
4044
3626
  settings: {
4045
3627
  react: {
@@ -4073,38 +3655,7 @@ const ssrReact = () => {
4073
3655
  const regexp = () => {
4074
3656
  const config = [
4075
3657
  {
4076
- languageOptions: {
4077
- globals: {
4078
- ...globals$1.browser,
4079
- ...globals$1.es2021,
4080
- ...globals$1.node
4081
- },
4082
- parserOptions: {
4083
- ecmaFeatures: {
4084
- jsx: true
4085
- },
4086
- // Eslint doesn't supply ecmaVersion in `parser.js` `context.parserOptions`
4087
- // This is required to avoid ecmaVersion < 2015 error or 'import' / 'export' error
4088
- ecmaVersion: "latest",
4089
- sourceType: "module"
4090
- },
4091
- sourceType: "module"
4092
- },
4093
- settings: {
4094
- // This will do the trick
4095
- "import/parsers": {
4096
- espree: [".js", ".cjs", ".mjs", ".jsx"]
4097
- },
4098
- "import/resolver": {
4099
- node: true
4100
- }
4101
- },
4102
- plugins: {
4103
- regexp: pluginRegexp
4104
- },
4105
- rules: {
4106
- ...pluginRegexp.configs.recommended.rules
4107
- }
3658
+ ...configs["flat/recommended"]
4108
3659
  }
4109
3660
  ];
4110
3661
  return config;
@@ -4119,7 +3670,7 @@ const stylistic = () => {
4119
3670
  semi: false
4120
3671
  });
4121
3672
  const off = {};
4122
- Object.keys(config.rules).forEach((key) => {
3673
+ Object.keys(config.rules ?? {}).forEach((key) => {
4123
3674
  off[key.replace("@stylistic/", "")] = "off";
4124
3675
  });
4125
3676
  const configs = [
@@ -4244,17 +3795,8 @@ const require = createRequire(import.meta.url);
4244
3795
  const tailwindcss = () => {
4245
3796
  const pluginTailwindcss = require("eslint-plugin-tailwindcss");
4246
3797
  const config = [
3798
+ ...pluginTailwindcss.configs["flat/recommended"],
4247
3799
  {
4248
- plugins: {
4249
- tailwindcss: pluginTailwindcss
4250
- },
4251
- languageOptions: {
4252
- parserOptions: {
4253
- ecmaFeatures: {
4254
- jsx: true
4255
- }
4256
- }
4257
- },
4258
3800
  rules: {
4259
3801
  ...pluginTailwindcss.configs.recommended.rules,
4260
3802
  "tailwindcss/no-custom-classname": "off"
@@ -4378,33 +3920,21 @@ const unicorn = () => {
4378
3920
  unicorn: pluginUnicorn
4379
3921
  },
4380
3922
  rules: {
4381
- // unicorns
4382
- // Pass error message when throwing errors
3923
+ "unicorn/consistent-empty-array-spread": "error",
4383
3924
  "unicorn/error-message": "error",
4384
- // Uppercase regex escapes
4385
3925
  "unicorn/escape-case": "error",
4386
- // Array.isArray instead of instanceof
4387
- "unicorn/no-array-instanceof": "error",
4388
- // Prevent deprecated `new Buffer()`
3926
+ "unicorn/new-for-builtins": "error",
3927
+ "unicorn/no-instanceof-builtins": "error",
3928
+ "unicorn/no-new-array": "error",
4389
3929
  "unicorn/no-new-buffer": "error",
4390
- // Keep regex literals safe!
4391
- "unicorn/no-unsafe-regex": "off",
4392
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
4393
3930
  "unicorn/number-literal-case": "error",
4394
- // ** instead of Math.pow()
4395
- "unicorn/prefer-exponentiation-operator": "error",
4396
- // includes over indexOf when checking for existence
3931
+ "unicorn/prefer-dom-node-text-content": "error",
4397
3932
  "unicorn/prefer-includes": "error",
4398
- // String methods startsWith/endsWith instead of more complicated stuff
4399
- "unicorn/prefer-starts-ends-with": "error",
4400
- // textContent instead of innerText
4401
- "unicorn/prefer-text-content": "error",
4402
- // Enforce throwing type error when throwing error while checking typeof
3933
+ "unicorn/prefer-node-protocol": "error",
3934
+ "unicorn/prefer-number-properties": "error",
3935
+ "unicorn/prefer-string-starts-ends-with": "error",
4403
3936
  "unicorn/prefer-type-error": "error",
4404
- // Use new when throwing error
4405
- "unicorn/throw-new-error": "error",
4406
- // Use `node:` for built-in node modules
4407
- "unicorn/prefer-node-protocol": "warn"
3937
+ "unicorn/throw-new-error": "error"
4408
3938
  }
4409
3939
  }
4410
3940
  ];
@@ -4468,7 +3998,14 @@ const presetDefault = [
4468
3998
  ...presetLangsExtensions,
4469
3999
  ...progress()
4470
4000
  ];
4471
- const aiou = ({ ssr = true, regexp: regexp$1 = true } = { ssr: true, regexp: true }, config = []) => {
4001
+ const all = [
4002
+ ...presetDefault,
4003
+ ...tailwindcss(),
4004
+ ...next(),
4005
+ ...ssrReact(),
4006
+ ...regexp()
4007
+ ];
4008
+ const aiou = ({ ssr = true, regexp: regexp$1 = true } = { ssr: true, regexp: true }, ...userConfigs) => {
4472
4009
  const configs = [...presetDefault];
4473
4010
  if (isPackageExists("tailwindcss")) {
4474
4011
  configs.push(...tailwindcss());
@@ -4482,10 +4019,11 @@ const aiou = ({ ssr = true, regexp: regexp$1 = true } = { ssr: true, regexp: tru
4482
4019
  if (regexp$1) {
4483
4020
  configs.push(...regexp());
4484
4021
  }
4485
- if (Object.keys(config).length > 0) {
4486
- configs.push(...Array.isArray(config) ? config : [config]);
4487
- }
4488
- return configs;
4022
+ const composer = new FlatConfigComposer(
4023
+ ...configs,
4024
+ ...userConfigs
4025
+ );
4026
+ return composer;
4489
4027
  };
4490
4028
 
4491
- export { aiou };
4029
+ export { aiou, all };