@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.cjs CHANGED
@@ -1,25 +1,26 @@
1
1
  'use strict';
2
2
 
3
+ var eslintFlatConfigUtils = require('eslint-flat-config-utils');
3
4
  var localPkg = require('local-pkg');
4
- var pluginComments = require('eslint-plugin-eslint-comments');
5
+ var configComments = require('@eslint-community/eslint-plugin-eslint-comments');
5
6
  var ignoreGlobs = require('@aiou/eslint-ignore');
6
- var pluginImport = require('eslint-plugin-i');
7
7
  var pluginImportNewlines = require('eslint-plugin-import-newlines');
8
+ var pluginImport = require('eslint-plugin-import-x');
8
9
  var pluginSimpleImportSort = require('eslint-plugin-simple-import-sort');
9
10
  var pluginUnsedImports = require('eslint-plugin-unused-imports');
10
11
  var pluginN = require('eslint-plugin-n');
11
12
  var pluginPromise = require('eslint-plugin-promise');
12
- var globals$1 = require('globals');
13
+ var globals = require('globals');
13
14
  var pluginJsonc = require('eslint-plugin-jsonc');
14
15
  var jsoncParser = require('jsonc-eslint-parser');
15
- var pluginMarkdown = require('eslint-plugin-markdown');
16
+ var pluginMarkdown = require('@eslint/markdown');
16
17
  var pluginNext = require('@next/eslint-plugin-next');
17
18
  var pluginProgress = require('@aiou/eslint-plugin-progress');
18
- var pluginReact = require('eslint-plugin-react');
19
+ var pluginReact = require('@eslint-react/eslint-plugin');
19
20
  var pluginReactHooks = require('eslint-plugin-react-hooks');
20
21
  var pluginReactRefresh = require('eslint-plugin-react-refresh');
21
22
  var pluginSSRFriendly = require('eslint-plugin-ssr-friendly');
22
- var pluginRegexp = require('eslint-plugin-regexp');
23
+ var eslintPluginRegexp = require('eslint-plugin-regexp');
23
24
  var pluginStylistic = require('@stylistic/eslint-plugin');
24
25
  var node_module = require('node:module');
25
26
  var pluginTypeScript = require('@typescript-eslint/eslint-plugin');
@@ -29,15 +30,42 @@ var pluginUnicorn = require('eslint-plugin-unicorn');
29
30
  var pluginYaml = require('eslint-plugin-yml');
30
31
  var yamlParser = require('yaml-eslint-parser');
31
32
 
33
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
34
+
35
+ var configComments__default = /*#__PURE__*/_interopDefault(configComments);
36
+ var ignoreGlobs__default = /*#__PURE__*/_interopDefault(ignoreGlobs);
37
+ var pluginImportNewlines__default = /*#__PURE__*/_interopDefault(pluginImportNewlines);
38
+ var pluginImport__default = /*#__PURE__*/_interopDefault(pluginImport);
39
+ var pluginSimpleImportSort__default = /*#__PURE__*/_interopDefault(pluginSimpleImportSort);
40
+ var pluginUnsedImports__default = /*#__PURE__*/_interopDefault(pluginUnsedImports);
41
+ var pluginN__default = /*#__PURE__*/_interopDefault(pluginN);
42
+ var pluginPromise__default = /*#__PURE__*/_interopDefault(pluginPromise);
43
+ var globals__default = /*#__PURE__*/_interopDefault(globals);
44
+ var pluginJsonc__default = /*#__PURE__*/_interopDefault(pluginJsonc);
45
+ var jsoncParser__default = /*#__PURE__*/_interopDefault(jsoncParser);
46
+ var pluginMarkdown__default = /*#__PURE__*/_interopDefault(pluginMarkdown);
47
+ var pluginNext__default = /*#__PURE__*/_interopDefault(pluginNext);
48
+ var pluginProgress__default = /*#__PURE__*/_interopDefault(pluginProgress);
49
+ var pluginReact__default = /*#__PURE__*/_interopDefault(pluginReact);
50
+ var pluginReactHooks__default = /*#__PURE__*/_interopDefault(pluginReactHooks);
51
+ var pluginReactRefresh__default = /*#__PURE__*/_interopDefault(pluginReactRefresh);
52
+ var pluginSSRFriendly__default = /*#__PURE__*/_interopDefault(pluginSSRFriendly);
53
+ var pluginStylistic__default = /*#__PURE__*/_interopDefault(pluginStylistic);
54
+ var pluginTypeScript__default = /*#__PURE__*/_interopDefault(pluginTypeScript);
55
+ var tsParser__default = /*#__PURE__*/_interopDefault(tsParser);
56
+ var pluginETC__default = /*#__PURE__*/_interopDefault(pluginETC);
57
+ var pluginUnicorn__default = /*#__PURE__*/_interopDefault(pluginUnicorn);
58
+ var pluginYaml__default = /*#__PURE__*/_interopDefault(pluginYaml);
59
+ var yamlParser__default = /*#__PURE__*/_interopDefault(yamlParser);
60
+
32
61
  const comments = () => {
33
62
  const config = [
34
63
  {
35
- plugins: {
36
- "eslint-comments": pluginComments
37
- },
64
+ ...configComments__default.default.recommended
65
+ },
66
+ {
38
67
  rules: {
39
- ...pluginComments.configs.recommended.rules,
40
- "eslint-comments/disable-enable-pair": "off"
68
+ "@eslint-community/eslint-comments/disable-enable-pair": "off"
41
69
  }
42
70
  }
43
71
  ];
@@ -47,7 +75,7 @@ const comments = () => {
47
75
  const ignores = () => {
48
76
  const config = [
49
77
  {
50
- ignores: ignoreGlobs
78
+ ignores: ignoreGlobs__default.default
51
79
  }
52
80
  ];
53
81
  return config;
@@ -74,13 +102,12 @@ const imports = () => {
74
102
  const config = [
75
103
  {
76
104
  plugins: {
77
- import: pluginImport,
78
- "simple-import-sort": pluginSimpleImportSort,
79
- "import-newlines": pluginImportNewlines,
80
- "unused-imports": pluginUnsedImports
105
+ import: pluginImport__default.default,
106
+ "simple-import-sort": pluginSimpleImportSort__default.default,
107
+ "import-newlines": pluginImportNewlines__default.default,
108
+ "unused-imports": pluginUnsedImports__default.default
81
109
  },
82
110
  rules: {
83
- ...pluginImport.configs.recommended.rules,
84
111
  // import
85
112
  // off: controlled by import/order
86
113
  "import/order": "off",
@@ -195,633 +222,14 @@ const imports = () => {
195
222
  return config;
196
223
  };
197
224
 
198
- function getDefaultExportFromCjs (x) {
199
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
200
- }
201
-
202
- var eslintConfigStandardExports = {};
203
- var eslintConfigStandard = {
204
- get exports(){ return eslintConfigStandardExports; },
205
- set exports(v){ eslintConfigStandardExports = v; },
206
- };
207
-
208
- var parserOptions = {
209
- ecmaVersion: 2022,
210
- ecmaFeatures: {
211
- jsx: true
212
- },
213
- sourceType: "module"
214
- };
215
- var env = {
216
- es2021: true,
217
- node: true
218
- };
219
- var plugins = [
220
- "import",
221
- "n",
222
- "promise"
223
- ];
224
- var globals = {
225
- document: "readonly",
226
- navigator: "readonly",
227
- window: "readonly"
228
- };
229
- var rules = {
230
- "no-var": "warn",
231
- "object-shorthand": [
232
- "warn",
233
- "properties"
234
- ],
235
- "accessor-pairs": [
236
- "error",
237
- {
238
- setWithoutGet: true,
239
- enforceForClassMembers: true
240
- }
241
- ],
242
- "array-bracket-spacing": [
243
- "error",
244
- "never"
245
- ],
246
- "array-callback-return": [
247
- "error",
248
- {
249
- allowImplicit: false,
250
- checkForEach: false
251
- }
252
- ],
253
- "arrow-spacing": [
254
- "error",
255
- {
256
- before: true,
257
- after: true
258
- }
259
- ],
260
- "block-spacing": [
261
- "error",
262
- "always"
263
- ],
264
- "brace-style": [
265
- "error",
266
- "1tbs",
267
- {
268
- allowSingleLine: true
269
- }
270
- ],
271
- camelcase: [
272
- "error",
273
- {
274
- allow: [
275
- "^UNSAFE_"
276
- ],
277
- properties: "never",
278
- ignoreGlobals: true
279
- }
280
- ],
281
- "comma-dangle": [
282
- "error",
283
- {
284
- arrays: "never",
285
- objects: "never",
286
- imports: "never",
287
- exports: "never",
288
- functions: "never"
289
- }
290
- ],
291
- "comma-spacing": [
292
- "error",
293
- {
294
- before: false,
295
- after: true
296
- }
297
- ],
298
- "comma-style": [
299
- "error",
300
- "last"
301
- ],
302
- "computed-property-spacing": [
303
- "error",
304
- "never",
305
- {
306
- enforceForClassMembers: true
307
- }
308
- ],
309
- "constructor-super": "error",
310
- curly: [
311
- "error",
312
- "multi-line"
313
- ],
314
- "default-case-last": "error",
315
- "dot-location": [
316
- "error",
317
- "property"
318
- ],
319
- "dot-notation": [
320
- "error",
321
- {
322
- allowKeywords: true
323
- }
324
- ],
325
- "eol-last": "error",
326
- eqeqeq: [
327
- "error",
328
- "always",
329
- {
330
- "null": "ignore"
331
- }
332
- ],
333
- "func-call-spacing": [
334
- "error",
335
- "never"
336
- ],
337
- "generator-star-spacing": [
338
- "error",
339
- {
340
- before: true,
341
- after: true
342
- }
343
- ],
344
- indent: [
345
- "error",
346
- 2,
347
- {
348
- SwitchCase: 1,
349
- VariableDeclarator: 1,
350
- outerIIFEBody: 1,
351
- MemberExpression: 1,
352
- FunctionDeclaration: {
353
- parameters: 1,
354
- body: 1
355
- },
356
- FunctionExpression: {
357
- parameters: 1,
358
- body: 1
359
- },
360
- CallExpression: {
361
- "arguments": 1
362
- },
363
- ArrayExpression: 1,
364
- ObjectExpression: 1,
365
- ImportDeclaration: 1,
366
- flatTernaryExpressions: false,
367
- ignoreComments: false,
368
- ignoredNodes: [
369
- "TemplateLiteral *",
370
- "JSXElement",
371
- "JSXElement > *",
372
- "JSXAttribute",
373
- "JSXIdentifier",
374
- "JSXNamespacedName",
375
- "JSXMemberExpression",
376
- "JSXSpreadAttribute",
377
- "JSXExpressionContainer",
378
- "JSXOpeningElement",
379
- "JSXClosingElement",
380
- "JSXFragment",
381
- "JSXOpeningFragment",
382
- "JSXClosingFragment",
383
- "JSXText",
384
- "JSXEmptyExpression",
385
- "JSXSpreadChild"
386
- ],
387
- offsetTernaryExpressions: true
388
- }
389
- ],
390
- "key-spacing": [
391
- "error",
392
- {
393
- beforeColon: false,
394
- afterColon: true
395
- }
396
- ],
397
- "keyword-spacing": [
398
- "error",
399
- {
400
- before: true,
401
- after: true
402
- }
403
- ],
404
- "lines-between-class-members": [
405
- "error",
406
- "always",
407
- {
408
- exceptAfterSingleLine: true
409
- }
410
- ],
411
- "multiline-ternary": [
412
- "error",
413
- "always-multiline"
414
- ],
415
- "new-cap": [
416
- "error",
417
- {
418
- newIsCap: true,
419
- capIsNew: false,
420
- properties: true
421
- }
422
- ],
423
- "new-parens": "error",
424
- "no-array-constructor": "error",
425
- "no-async-promise-executor": "error",
426
- "no-caller": "error",
427
- "no-case-declarations": "error",
428
- "no-class-assign": "error",
429
- "no-compare-neg-zero": "error",
430
- "no-cond-assign": "error",
431
- "no-const-assign": "error",
432
- "no-constant-condition": [
433
- "error",
434
- {
435
- checkLoops: false
436
- }
437
- ],
438
- "no-control-regex": "error",
439
- "no-debugger": "error",
440
- "no-delete-var": "error",
441
- "no-dupe-args": "error",
442
- "no-dupe-class-members": "error",
443
- "no-dupe-keys": "error",
444
- "no-duplicate-case": "error",
445
- "no-useless-backreference": "error",
446
- "no-empty": [
447
- "error",
448
- {
449
- allowEmptyCatch: true
450
- }
451
- ],
452
- "no-empty-character-class": "error",
453
- "no-empty-pattern": "error",
454
- "no-eval": "error",
455
- "no-ex-assign": "error",
456
- "no-extend-native": "error",
457
- "no-extra-bind": "error",
458
- "no-extra-boolean-cast": "error",
459
- "no-extra-parens": [
460
- "error",
461
- "functions"
462
- ],
463
- "no-fallthrough": "error",
464
- "no-floating-decimal": "error",
465
- "no-func-assign": "error",
466
- "no-global-assign": "error",
467
- "no-implied-eval": "error",
468
- "no-import-assign": "error",
469
- "no-invalid-regexp": "error",
470
- "no-irregular-whitespace": "error",
471
- "no-iterator": "error",
472
- "no-labels": [
473
- "error",
474
- {
475
- allowLoop: false,
476
- allowSwitch: false
477
- }
478
- ],
479
- "no-lone-blocks": "error",
480
- "no-loss-of-precision": "error",
481
- "no-misleading-character-class": "error",
482
- "no-prototype-builtins": "error",
483
- "no-useless-catch": "error",
484
- "no-mixed-operators": [
485
- "error",
486
- {
487
- groups: [
488
- [
489
- "==",
490
- "!=",
491
- "===",
492
- "!==",
493
- ">",
494
- ">=",
495
- "<",
496
- "<="
497
- ],
498
- [
499
- "&&",
500
- "||"
501
- ],
502
- [
503
- "in",
504
- "instanceof"
505
- ]
506
- ],
507
- allowSamePrecedence: true
508
- }
509
- ],
510
- "no-mixed-spaces-and-tabs": "error",
511
- "no-multi-spaces": "error",
512
- "no-multi-str": "error",
513
- "no-multiple-empty-lines": [
514
- "error",
515
- {
516
- max: 1,
517
- maxBOF: 0,
518
- maxEOF: 0
519
- }
520
- ],
521
- "no-new": "error",
522
- "no-new-func": "error",
523
- "no-new-object": "error",
524
- "no-new-symbol": "error",
525
- "no-new-wrappers": "error",
526
- "no-obj-calls": "error",
527
- "no-octal": "error",
528
- "no-octal-escape": "error",
529
- "no-proto": "error",
530
- "no-redeclare": [
531
- "error",
532
- {
533
- builtinGlobals: false
534
- }
535
- ],
536
- "no-regex-spaces": "error",
537
- "no-return-assign": [
538
- "error",
539
- "except-parens"
540
- ],
541
- "no-self-assign": [
542
- "error",
543
- {
544
- props: true
545
- }
546
- ],
547
- "no-self-compare": "error",
548
- "no-sequences": "error",
549
- "no-shadow-restricted-names": "error",
550
- "no-sparse-arrays": "error",
551
- "no-tabs": "error",
552
- "no-template-curly-in-string": "error",
553
- "no-this-before-super": "error",
554
- "no-throw-literal": "error",
555
- "no-trailing-spaces": "error",
556
- "no-undef": "error",
557
- "no-undef-init": "error",
558
- "no-unexpected-multiline": "error",
559
- "no-unmodified-loop-condition": "error",
560
- "no-unneeded-ternary": [
561
- "error",
562
- {
563
- defaultAssignment: false
564
- }
565
- ],
566
- "no-unreachable": "error",
567
- "no-unreachable-loop": "error",
568
- "no-unsafe-finally": "error",
569
- "no-unsafe-negation": "error",
570
- "no-unused-expressions": [
571
- "error",
572
- {
573
- allowShortCircuit: true,
574
- allowTernary: true,
575
- allowTaggedTemplates: true
576
- }
577
- ],
578
- "no-unused-vars": [
579
- "error",
580
- {
581
- args: "none",
582
- caughtErrors: "none",
583
- ignoreRestSiblings: true,
584
- vars: "all"
585
- }
586
- ],
587
- "no-use-before-define": [
588
- "error",
589
- {
590
- functions: false,
591
- classes: false,
592
- variables: false
593
- }
594
- ],
595
- "no-useless-call": "error",
596
- "no-useless-computed-key": "error",
597
- "no-useless-constructor": "error",
598
- "no-useless-escape": "error",
599
- "no-useless-rename": "error",
600
- "no-useless-return": "error",
601
- "no-void": "error",
602
- "no-whitespace-before-property": "error",
603
- "no-with": "error",
604
- "object-curly-newline": [
605
- "error",
606
- {
607
- multiline: true,
608
- consistent: true
609
- }
610
- ],
611
- "object-curly-spacing": [
612
- "error",
613
- "always"
614
- ],
615
- "object-property-newline": [
616
- "error",
617
- {
618
- allowMultiplePropertiesPerLine: true
619
- }
620
- ],
621
- "one-var": [
622
- "error",
623
- {
624
- initialized: "never"
625
- }
626
- ],
627
- "operator-linebreak": [
628
- "error",
629
- "after",
630
- {
631
- overrides: {
632
- "?": "before",
633
- ":": "before",
634
- "|>": "before"
635
- }
636
- }
637
- ],
638
- "padded-blocks": [
639
- "error",
640
- {
641
- blocks: "never",
642
- switches: "never",
643
- classes: "never"
644
- }
645
- ],
646
- "prefer-const": [
647
- "error",
648
- {
649
- destructuring: "all"
650
- }
651
- ],
652
- "prefer-promise-reject-errors": "error",
653
- "prefer-regex-literals": [
654
- "error",
655
- {
656
- disallowRedundantWrapping: true
657
- }
658
- ],
659
- "quote-props": [
660
- "error",
661
- "as-needed"
662
- ],
663
- quotes: [
664
- "error",
665
- "single",
666
- {
667
- avoidEscape: true,
668
- allowTemplateLiterals: false
669
- }
670
- ],
671
- "rest-spread-spacing": [
672
- "error",
673
- "never"
674
- ],
675
- semi: [
676
- "error",
677
- "never"
678
- ],
679
- "semi-spacing": [
680
- "error",
681
- {
682
- before: false,
683
- after: true
684
- }
685
- ],
686
- "space-before-blocks": [
687
- "error",
688
- "always"
689
- ],
690
- "space-before-function-paren": [
691
- "error",
692
- "always"
693
- ],
694
- "space-in-parens": [
695
- "error",
696
- "never"
697
- ],
698
- "space-infix-ops": "error",
699
- "space-unary-ops": [
700
- "error",
701
- {
702
- words: true,
703
- nonwords: false
704
- }
705
- ],
706
- "spaced-comment": [
707
- "error",
708
- "always",
709
- {
710
- line: {
711
- markers: [
712
- "*package",
713
- "!",
714
- "/",
715
- ",",
716
- "="
717
- ]
718
- },
719
- block: {
720
- balanced: true,
721
- markers: [
722
- "*package",
723
- "!",
724
- ",",
725
- ":",
726
- "::",
727
- "flow-include"
728
- ],
729
- exceptions: [
730
- "*"
731
- ]
732
- }
733
- }
734
- ],
735
- "symbol-description": "error",
736
- "template-curly-spacing": [
737
- "error",
738
- "never"
739
- ],
740
- "template-tag-spacing": [
741
- "error",
742
- "never"
743
- ],
744
- "unicode-bom": [
745
- "error",
746
- "never"
747
- ],
748
- "use-isnan": [
749
- "error",
750
- {
751
- enforceForSwitchCase: true,
752
- enforceForIndexOf: true
753
- }
754
- ],
755
- "valid-typeof": [
756
- "error",
757
- {
758
- requireStringLiterals: true
759
- }
760
- ],
761
- "wrap-iife": [
762
- "error",
763
- "any",
764
- {
765
- functionPrototypeMethods: true
766
- }
767
- ],
768
- "yield-star-spacing": [
769
- "error",
770
- "both"
771
- ],
772
- yoda: [
773
- "error",
774
- "never"
775
- ],
776
- "import/export": "error",
777
- "import/first": "error",
778
- "import/no-absolute-path": [
779
- "error",
780
- {
781
- esmodule: true,
782
- commonjs: true,
783
- amd: false
784
- }
785
- ],
786
- "import/no-duplicates": "error",
787
- "import/no-named-default": "error",
788
- "import/no-webpack-loader-syntax": "error",
789
- "n/handle-callback-err": [
790
- "error",
791
- "^(err|error)$"
792
- ],
793
- "n/no-callback-literal": "error",
794
- "n/no-deprecated-api": "error",
795
- "n/no-exports-assign": "error",
796
- "n/no-new-require": "error",
797
- "n/no-path-concat": "error",
798
- "n/process-exit-as-throw": "error",
799
- "promise/param-names": "error"
800
- };
801
- var require$$0 = {
802
- parserOptions: parserOptions,
803
- env: env,
804
- plugins: plugins,
805
- globals: globals,
806
- rules: rules
807
- };
808
-
809
- /*! eslint-config-standard. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
810
-
811
- (function (module) {
812
- module.exports = require$$0;
813
- } (eslintConfigStandard));
814
-
815
- var pluginStandard = /*@__PURE__*/getDefaultExportFromCjs(eslintConfigStandardExports);
816
-
817
225
  const javascript = () => {
818
226
  const config = [
819
227
  {
820
228
  languageOptions: {
821
229
  globals: {
822
- ...globals$1.browser,
823
- ...globals$1.es2021,
824
- ...globals$1.node
230
+ ...globals__default.default.browser,
231
+ ...globals__default.default.es2021,
232
+ ...globals__default.default.node
825
233
  },
826
234
  parserOptions: {
827
235
  ecmaFeatures: {
@@ -844,11 +252,223 @@ const javascript = () => {
844
252
  }
845
253
  },
846
254
  plugins: {
847
- n: pluginN,
848
- promise: pluginPromise
255
+ n: pluginN__default.default,
256
+ promise: pluginPromise__default.default
849
257
  },
850
258
  rules: {
851
- ...pluginStandard.rules,
259
+ // from standard
260
+ // "no-var": "warn",
261
+ // "object-shorthand": ["warn", "properties"],
262
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
263
+ "array-bracket-spacing": ["error", "never"],
264
+ // "array-callback-return": ["error", {
265
+ // "allowImplicit": false,
266
+ // "checkForEach": false
267
+ // }],
268
+ "arrow-spacing": ["error", { before: true, after: true }],
269
+ "block-spacing": ["error", "always"],
270
+ "brace-style": ["error", "1tbs", { allowSingleLine: true }],
271
+ // "camelcase": ["error", {
272
+ // "allow": ["^UNSAFE_"],
273
+ // "properties": "never",
274
+ // "ignoreGlobals": true
275
+ // }],
276
+ "comma-dangle": ["error", {
277
+ arrays: "never",
278
+ objects: "never",
279
+ imports: "never",
280
+ exports: "never",
281
+ functions: "never"
282
+ }],
283
+ "comma-spacing": ["error", { before: false, after: true }],
284
+ "comma-style": ["error", "last"],
285
+ "computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
286
+ "constructor-super": "error",
287
+ // "curly": ["error", "multi-line"],
288
+ "default-case-last": "error",
289
+ "dot-location": ["error", "property"],
290
+ "dot-notation": ["error", { allowKeywords: true }],
291
+ "eol-last": "error",
292
+ // "eqeqeq": ["error", "always", { "null": "ignore" }],
293
+ "func-call-spacing": ["error", "never"],
294
+ "generator-star-spacing": ["error", { before: true, after: true }],
295
+ indent: ["error", 2, {
296
+ SwitchCase: 1,
297
+ VariableDeclarator: 1,
298
+ outerIIFEBody: 1,
299
+ MemberExpression: 1,
300
+ FunctionDeclaration: { parameters: 1, body: 1 },
301
+ FunctionExpression: { parameters: 1, body: 1 },
302
+ CallExpression: { arguments: 1 },
303
+ ArrayExpression: 1,
304
+ ObjectExpression: 1,
305
+ ImportDeclaration: 1,
306
+ flatTernaryExpressions: false,
307
+ ignoreComments: false,
308
+ ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
309
+ offsetTernaryExpressions: true
310
+ }],
311
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
312
+ "keyword-spacing": ["error", { before: true, after: true }],
313
+ "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
314
+ "multiline-ternary": ["error", "always-multiline"],
315
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
316
+ "new-parens": "error",
317
+ "no-array-constructor": "error",
318
+ "no-async-promise-executor": "error",
319
+ "no-caller": "error",
320
+ // "no-case-declarations": "error",
321
+ "no-class-assign": "error",
322
+ "no-compare-neg-zero": "error",
323
+ // "no-cond-assign": "error",
324
+ "no-const-assign": "error",
325
+ // "no-constant-condition": ["error", { "checkLoops": false }],
326
+ "no-control-regex": "error",
327
+ // "no-debugger": "error",
328
+ "no-delete-var": "error",
329
+ "no-dupe-args": "error",
330
+ "no-dupe-class-members": "error",
331
+ "no-dupe-keys": "error",
332
+ "no-duplicate-case": "error",
333
+ "no-useless-backreference": "error",
334
+ "no-empty": ["error", { allowEmptyCatch: true }],
335
+ "no-empty-character-class": "error",
336
+ "no-empty-pattern": "error",
337
+ "no-eval": "error",
338
+ "no-ex-assign": "error",
339
+ "no-extend-native": "error",
340
+ "no-extra-bind": "error",
341
+ "no-extra-boolean-cast": "error",
342
+ "no-extra-parens": ["error", "functions"],
343
+ "no-fallthrough": "error",
344
+ "no-floating-decimal": "error",
345
+ "no-func-assign": "error",
346
+ "no-global-assign": "error",
347
+ "no-implied-eval": "error",
348
+ "no-import-assign": "error",
349
+ "no-invalid-regexp": "error",
350
+ "no-irregular-whitespace": "error",
351
+ "no-iterator": "error",
352
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
353
+ "no-lone-blocks": "error",
354
+ "no-loss-of-precision": "error",
355
+ "no-misleading-character-class": "error",
356
+ "no-prototype-builtins": "error",
357
+ "no-useless-catch": "error",
358
+ "no-mixed-operators": ["error", {
359
+ groups: [
360
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
361
+ ["&&", "||"],
362
+ ["in", "instanceof"]
363
+ ],
364
+ allowSamePrecedence: true
365
+ }],
366
+ "no-mixed-spaces-and-tabs": "error",
367
+ "no-multi-spaces": "error",
368
+ // "no-multi-str": "error",
369
+ "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
370
+ "no-new": "error",
371
+ "no-new-func": "error",
372
+ "no-new-object": "error",
373
+ "no-new-symbol": "error",
374
+ "no-new-wrappers": "error",
375
+ "no-obj-calls": "error",
376
+ "no-octal": "error",
377
+ "no-octal-escape": "error",
378
+ "no-proto": "error",
379
+ "no-redeclare": ["error", { builtinGlobals: false }],
380
+ "no-regex-spaces": "error",
381
+ // "no-return-assign": ["error", "except-parens"],
382
+ "no-self-assign": ["error", { props: true }],
383
+ "no-self-compare": "error",
384
+ "no-sequences": "error",
385
+ "no-shadow-restricted-names": "error",
386
+ "no-sparse-arrays": "error",
387
+ "no-tabs": "error",
388
+ "no-template-curly-in-string": "error",
389
+ "no-this-before-super": "error",
390
+ "no-throw-literal": "error",
391
+ "no-trailing-spaces": "error",
392
+ "no-undef": "error",
393
+ "no-undef-init": "error",
394
+ "no-unexpected-multiline": "error",
395
+ "no-unmodified-loop-condition": "error",
396
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
397
+ "no-unreachable": "error",
398
+ "no-unreachable-loop": "error",
399
+ "no-unsafe-finally": "error",
400
+ "no-unsafe-negation": "error",
401
+ "no-unused-expressions": ["error", {
402
+ allowShortCircuit: true,
403
+ allowTernary: true,
404
+ allowTaggedTemplates: true
405
+ }],
406
+ // "no-unused-vars": ["error", {
407
+ // "args": "none",
408
+ // "caughtErrors": "none",
409
+ // "ignoreRestSiblings": true,
410
+ // "vars": "all"
411
+ // }],
412
+ "no-use-before-define": ["error", { functions: false, classes: false, variables: false }],
413
+ "no-useless-call": "error",
414
+ "no-useless-computed-key": "error",
415
+ "no-useless-constructor": "error",
416
+ // "no-useless-escape": "error",
417
+ "no-useless-rename": "error",
418
+ "no-useless-return": "error",
419
+ // "no-void": "error",
420
+ "no-whitespace-before-property": "error",
421
+ "no-with": "error",
422
+ "object-curly-newline": ["error", { multiline: true, consistent: true }],
423
+ "object-curly-spacing": ["error", "always"],
424
+ "object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
425
+ "one-var": ["error", { initialized: "never" }],
426
+ "operator-linebreak": ["error", "after", { overrides: { "?": "before", ":": "before", "|>": "before" } }],
427
+ "padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
428
+ // "prefer-const": ["error", {"destructuring": "all"}],
429
+ "prefer-promise-reject-errors": "error",
430
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
431
+ "quote-props": ["error", "as-needed"],
432
+ quotes: ["error", "single", { avoidEscape: true, allowTemplateLiterals: false }],
433
+ "rest-spread-spacing": ["error", "never"],
434
+ semi: ["error", "never"],
435
+ "semi-spacing": ["error", { before: false, after: true }],
436
+ "space-before-blocks": ["error", "always"],
437
+ "space-before-function-paren": ["error", "always"],
438
+ "space-in-parens": ["error", "never"],
439
+ "space-infix-ops": "error",
440
+ "space-unary-ops": ["error", { words: true, nonwords: false }],
441
+ "spaced-comment": ["error", "always", {
442
+ line: { markers: ["*package", "!", "/", ",", "="] },
443
+ block: { balanced: true, markers: ["*package", "!", ",", ":", "::", "flow-include"], exceptions: ["*"] }
444
+ }],
445
+ "symbol-description": "error",
446
+ "template-curly-spacing": ["error", "never"],
447
+ "template-tag-spacing": ["error", "never"],
448
+ "unicode-bom": ["error", "never"],
449
+ "use-isnan": ["error", {
450
+ enforceForSwitchCase: true,
451
+ enforceForIndexOf: true
452
+ }],
453
+ "valid-typeof": ["error", { requireStringLiterals: true }],
454
+ "wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
455
+ "yield-star-spacing": ["error", "both"],
456
+ yoda: ["error", "never"],
457
+ "import/export": "error",
458
+ "import/first": "error",
459
+ "import/no-absolute-path": ["error", { esmodule: true, commonjs: true, amd: false }],
460
+ "import/no-duplicates": "error",
461
+ "import/no-named-default": "error",
462
+ "import/no-webpack-loader-syntax": "error",
463
+ "n/handle-callback-err": ["error", "^(err|error)$"],
464
+ "n/no-callback-literal": "error",
465
+ "n/no-deprecated-api": "error",
466
+ "n/no-exports-assign": "error",
467
+ "n/no-new-require": "error",
468
+ "n/no-path-concat": "error",
469
+ "n/process-exit-as-throw": "error",
470
+ "promise/param-names": "error",
471
+ // override
852
472
  curly: ["error", "all"],
853
473
  "no-unused-vars": "warn",
854
474
  "no-param-reassign": "off",
@@ -902,7 +522,7 @@ const javascript = () => {
902
522
  "no-alert": "warn",
903
523
  "no-case-declarations": "error",
904
524
  "no-multi-str": "error",
905
- "no-with": "error",
525
+ // 'no-with': 'error',
906
526
  "no-void": "error",
907
527
  "no-useless-escape": "off",
908
528
  "vars-on-top": "error",
@@ -919,16 +539,16 @@ const jsonc = () => {
919
539
  {
920
540
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
921
541
  languageOptions: {
922
- parser: jsoncParser
542
+ parser: jsoncParser__default.default
923
543
  },
924
544
  plugins: {
925
- jsonc: pluginJsonc
545
+ jsonc: pluginJsonc__default.default
926
546
  }
927
547
  },
928
548
  {
929
549
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
930
550
  rules: {
931
- ...pluginJsonc.configs["recommended-with-jsonc"].rules,
551
+ ...pluginJsonc__default.default.configs["recommended-with-jsonc"].rules,
932
552
  // refs: https://ota-meshi.github.io/eslint-plugin-jsonc/rules/indent.html
933
553
  "jsonc/array-bracket-newline": [
934
554
  "error",
@@ -1009,7 +629,8 @@ const jsonc = () => {
1009
629
  {
1010
630
  pathPattern: "^exports.*$",
1011
631
  // According to webpack, default condition should be last item
1012
- order: ["import", "require", "types", "node", "browser", "default"]
632
+ // Typescript bugs: types should be first one
633
+ order: ["types", "import", "require", "node", "browser", "default"]
1013
634
  },
1014
635
  {
1015
636
  order: { type: "asc" },
@@ -1149,30 +770,13 @@ const jsonc = () => {
1149
770
 
1150
771
  const markdown = () => {
1151
772
  const config = [
1152
- {
1153
- // Enable the Markdown processor for all .md files.
1154
- files: [GLOB_MARKDOWN],
1155
- processor: "markdown/markdown",
1156
- plugins: {
1157
- markdown: pluginMarkdown
1158
- }
1159
- },
773
+ ...pluginMarkdown__default.default.configs.processor.map((config2) => ({
774
+ ...config2
775
+ })),
1160
776
  {
1161
777
  // Code blocks in markdown file
1162
778
  files: [`${GLOB_MARKDOWN}/*.${GLOB_SCRIPT_EXT}`],
1163
- languageOptions: {
1164
- parserOptions: {
1165
- ecmaFeatures: {
1166
- // Adding a "use strict" directive at the top of
1167
- // every code block is tedious and distracting, so
1168
- // opt into strict mode parsing without the
1169
- // directive.
1170
- impliedStrict: true
1171
- }
1172
- }
1173
- },
1174
779
  rules: {
1175
- ...pluginMarkdown.configs.recommended.overrides[1].rules,
1176
780
  "react/display-name": "off",
1177
781
  "@typescript-eslint/no-redeclare": "off",
1178
782
  "@typescript-eslint/no-unused-vars": "off",
@@ -1207,11 +811,11 @@ const next = () => {
1207
811
  {
1208
812
  files: [GLOB_JSX, GLOB_TSX],
1209
813
  plugins: {
1210
- "@next/next": pluginNext
814
+ "@next/next": pluginNext__default.default
1211
815
  },
1212
816
  rules: {
1213
817
  // Enable rules for next project
1214
- ...pluginNext.configs.recommended.rules
818
+ ...pluginNext__default.default.configs.recommended.rules
1215
819
  }
1216
820
  }
1217
821
  ];
@@ -1222,7 +826,7 @@ const progress = () => {
1222
826
  const config = [
1223
827
  {
1224
828
  plugins: {
1225
- progress: pluginProgress
829
+ progress: pluginProgress__default.default
1226
830
  },
1227
831
  rules: {
1228
832
  "progress/activate": 1
@@ -3980,14 +3584,17 @@ function mapValues(object, iteratee) {
3980
3584
  }
3981
3585
 
3982
3586
  const react = () => {
3587
+ const plugins = pluginReact__default.default.configs.all.plugins;
3983
3588
  const config = [
3984
3589
  {
3985
3590
  files: [GLOB_JSX, GLOB_TSX],
3986
3591
  languageOptions: {
3987
3592
  parserOptions: {
3988
- ...pluginReact.configs.recommended.parserOptions,
3989
- ...pluginReact.configs["jsx-runtime"].parserOptions
3990
- }
3593
+ ecmaFeatures: {
3594
+ jsx: true
3595
+ }
3596
+ },
3597
+ sourceType: "module"
3991
3598
  },
3992
3599
  settings: {
3993
3600
  react: {
@@ -3996,14 +3603,15 @@ const react = () => {
3996
3603
  }
3997
3604
  },
3998
3605
  plugins: {
3999
- react: pluginReact,
4000
- "react-hooks": pluginReactHooks,
4001
- "react-refresh": pluginReactRefresh
3606
+ react: plugins["@eslint-react"],
3607
+ "react-dom": plugins["@eslint-react/dom"],
3608
+ "react-hooks": pluginReactHooks__default.default,
3609
+ "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
3610
+ "react-naming-convention": plugins["@eslint-react/naming-convention"],
3611
+ "react-refresh": pluginReactRefresh__default.default,
3612
+ "react-web-api": plugins["@eslint-react/web-api"]
4002
3613
  },
4003
3614
  rules: {
4004
- ...pluginReact.configs.recommended.rules,
4005
- ...pluginReact.configs["jsx-runtime"].rules,
4006
- ...pluginReactHooks.configs.recommended.rules,
4007
3615
  "react/prop-types": "off",
4008
3616
  "react/no-unescaped-entities": "off",
4009
3617
  "react/no-unknown-property": "off",
@@ -4039,9 +3647,11 @@ const ssrReact = () => {
4039
3647
  files: [GLOB_JSX, GLOB_TSX],
4040
3648
  languageOptions: {
4041
3649
  parserOptions: {
4042
- ...pluginReact.configs.recommended.parserOptions,
4043
- ...pluginReact.configs["jsx-runtime"].parserOptions
4044
- }
3650
+ ecmaFeatures: {
3651
+ jsx: true
3652
+ }
3653
+ },
3654
+ sourceType: "module"
4045
3655
  },
4046
3656
  settings: {
4047
3657
  react: {
@@ -4050,10 +3660,10 @@ const ssrReact = () => {
4050
3660
  }
4051
3661
  },
4052
3662
  plugins: {
4053
- "ssr-friendly": pluginSSRFriendly
3663
+ "ssr-friendly": pluginSSRFriendly__default.default
4054
3664
  },
4055
3665
  rules: {
4056
- ...pluginSSRFriendly.configs.recommended.rules
3666
+ ...pluginSSRFriendly__default.default.configs.recommended.rules
4057
3667
  }
4058
3668
  },
4059
3669
  {
@@ -4065,7 +3675,7 @@ const ssrReact = () => {
4065
3675
  GLOB_TEST_DIRS
4066
3676
  ],
4067
3677
  rules: {
4068
- ...mapValues(pluginSSRFriendly.configs.recommended.rules, () => "off")
3678
+ ...mapValues(pluginSSRFriendly__default.default.configs.recommended.rules, () => "off")
4069
3679
  }
4070
3680
  }
4071
3681
  ];
@@ -4075,45 +3685,14 @@ const ssrReact = () => {
4075
3685
  const regexp = () => {
4076
3686
  const config = [
4077
3687
  {
4078
- languageOptions: {
4079
- globals: {
4080
- ...globals$1.browser,
4081
- ...globals$1.es2021,
4082
- ...globals$1.node
4083
- },
4084
- parserOptions: {
4085
- ecmaFeatures: {
4086
- jsx: true
4087
- },
4088
- // Eslint doesn't supply ecmaVersion in `parser.js` `context.parserOptions`
4089
- // This is required to avoid ecmaVersion < 2015 error or 'import' / 'export' error
4090
- ecmaVersion: "latest",
4091
- sourceType: "module"
4092
- },
4093
- sourceType: "module"
4094
- },
4095
- settings: {
4096
- // This will do the trick
4097
- "import/parsers": {
4098
- espree: [".js", ".cjs", ".mjs", ".jsx"]
4099
- },
4100
- "import/resolver": {
4101
- node: true
4102
- }
4103
- },
4104
- plugins: {
4105
- regexp: pluginRegexp
4106
- },
4107
- rules: {
4108
- ...pluginRegexp.configs.recommended.rules
4109
- }
3688
+ ...eslintPluginRegexp.configs["flat/recommended"]
4110
3689
  }
4111
3690
  ];
4112
3691
  return config;
4113
3692
  };
4114
3693
 
4115
3694
  const stylistic = () => {
4116
- const config = pluginStylistic.configs.customize({
3695
+ const config = pluginStylistic__default.default.configs.customize({
4117
3696
  flat: true,
4118
3697
  indent: 2,
4119
3698
  jsx: true,
@@ -4121,7 +3700,7 @@ const stylistic = () => {
4121
3700
  semi: false
4122
3701
  });
4123
3702
  const off = {};
4124
- Object.keys(config.rules).forEach((key) => {
3703
+ Object.keys(config.rules ?? {}).forEach((key) => {
4125
3704
  off[key.replace("@stylistic/", "")] = "off";
4126
3705
  });
4127
3706
  const configs = [
@@ -4246,17 +3825,8 @@ const require$1 = node_module.createRequire((typeof document === 'undefined' ? r
4246
3825
  const tailwindcss = () => {
4247
3826
  const pluginTailwindcss = require$1("eslint-plugin-tailwindcss");
4248
3827
  const config = [
3828
+ ...pluginTailwindcss.configs["flat/recommended"],
4249
3829
  {
4250
- plugins: {
4251
- tailwindcss: pluginTailwindcss
4252
- },
4253
- languageOptions: {
4254
- parserOptions: {
4255
- ecmaFeatures: {
4256
- jsx: true
4257
- }
4258
- }
4259
- },
4260
3830
  rules: {
4261
3831
  ...pluginTailwindcss.configs.recommended.rules,
4262
3832
  "tailwindcss/no-custom-classname": "off"
@@ -4271,7 +3841,7 @@ const typescript = () => {
4271
3841
  {
4272
3842
  files: [GLOB_TSX, GLOB_TS, GLOB_TEST_SCRIPT],
4273
3843
  languageOptions: {
4274
- parser: tsParser,
3844
+ parser: tsParser__default.default,
4275
3845
  parserOptions: {
4276
3846
  sourceType: "module"
4277
3847
  }
@@ -4282,11 +3852,11 @@ const typescript = () => {
4282
3852
  }
4283
3853
  },
4284
3854
  plugins: {
4285
- "@typescript-eslint": pluginTypeScript,
4286
- etc: pluginETC
3855
+ "@typescript-eslint": pluginTypeScript__default.default,
3856
+ etc: pluginETC__default.default
4287
3857
  },
4288
3858
  rules: {
4289
- ...pluginTypeScript.configs.recommended.rules,
3859
+ ...pluginTypeScript__default.default.configs.recommended.rules,
4290
3860
  // https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/troubleshooting/Performance.md#eslint-plugin-import
4291
3861
  "import/named": "off",
4292
3862
  "import/namespace": "off",
@@ -4377,36 +3947,24 @@ const unicorn = () => {
4377
3947
  const config = [
4378
3948
  {
4379
3949
  plugins: {
4380
- unicorn: pluginUnicorn
3950
+ unicorn: pluginUnicorn__default.default
4381
3951
  },
4382
3952
  rules: {
4383
- // unicorns
4384
- // Pass error message when throwing errors
3953
+ "unicorn/consistent-empty-array-spread": "error",
4385
3954
  "unicorn/error-message": "error",
4386
- // Uppercase regex escapes
4387
3955
  "unicorn/escape-case": "error",
4388
- // Array.isArray instead of instanceof
4389
- "unicorn/no-array-instanceof": "error",
4390
- // Prevent deprecated `new Buffer()`
3956
+ "unicorn/new-for-builtins": "error",
3957
+ "unicorn/no-instanceof-builtins": "error",
3958
+ "unicorn/no-new-array": "error",
4391
3959
  "unicorn/no-new-buffer": "error",
4392
- // Keep regex literals safe!
4393
- "unicorn/no-unsafe-regex": "off",
4394
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
4395
3960
  "unicorn/number-literal-case": "error",
4396
- // ** instead of Math.pow()
4397
- "unicorn/prefer-exponentiation-operator": "error",
4398
- // includes over indexOf when checking for existence
3961
+ "unicorn/prefer-dom-node-text-content": "error",
4399
3962
  "unicorn/prefer-includes": "error",
4400
- // String methods startsWith/endsWith instead of more complicated stuff
4401
- "unicorn/prefer-starts-ends-with": "error",
4402
- // textContent instead of innerText
4403
- "unicorn/prefer-text-content": "error",
4404
- // Enforce throwing type error when throwing error while checking typeof
3963
+ "unicorn/prefer-node-protocol": "error",
3964
+ "unicorn/prefer-number-properties": "error",
3965
+ "unicorn/prefer-string-starts-ends-with": "error",
4405
3966
  "unicorn/prefer-type-error": "error",
4406
- // Use new when throwing error
4407
- "unicorn/throw-new-error": "error",
4408
- // Use `node:` for built-in node modules
4409
- "unicorn/prefer-node-protocol": "warn"
3967
+ "unicorn/throw-new-error": "error"
4410
3968
  }
4411
3969
  }
4412
3970
  ];
@@ -4418,13 +3976,13 @@ const yml = () => {
4418
3976
  {
4419
3977
  files: [GLOB_YAML],
4420
3978
  languageOptions: {
4421
- parser: yamlParser
3979
+ parser: yamlParser__default.default
4422
3980
  },
4423
3981
  plugins: {
4424
- yml: pluginYaml
3982
+ yml: pluginYaml__default.default
4425
3983
  },
4426
3984
  rules: {
4427
- ...pluginYaml.configs.standard.rules,
3985
+ ...pluginYaml__default.default.configs.standard.rules,
4428
3986
  // yml
4429
3987
  "spaced-comment": "off",
4430
3988
  "yml/quotes": ["error", { prefer: "double", avoidEscape: false }],
@@ -4470,7 +4028,14 @@ const presetDefault = [
4470
4028
  ...presetLangsExtensions,
4471
4029
  ...progress()
4472
4030
  ];
4473
- const aiou = ({ ssr = true, regexp: regexp$1 = true } = { ssr: true, regexp: true }, config = []) => {
4031
+ const all = [
4032
+ ...presetDefault,
4033
+ ...tailwindcss(),
4034
+ ...next(),
4035
+ ...ssrReact(),
4036
+ ...regexp()
4037
+ ];
4038
+ const aiou = ({ ssr = true, regexp: regexp$1 = true } = { ssr: true, regexp: true }, ...userConfigs) => {
4474
4039
  const configs = [...presetDefault];
4475
4040
  if (localPkg.isPackageExists("tailwindcss")) {
4476
4041
  configs.push(...tailwindcss());
@@ -4484,10 +4049,12 @@ const aiou = ({ ssr = true, regexp: regexp$1 = true } = { ssr: true, regexp: tru
4484
4049
  if (regexp$1) {
4485
4050
  configs.push(...regexp());
4486
4051
  }
4487
- if (Object.keys(config).length > 0) {
4488
- configs.push(...Array.isArray(config) ? config : [config]);
4489
- }
4490
- return configs;
4052
+ const composer = new eslintFlatConfigUtils.FlatConfigComposer(
4053
+ ...configs,
4054
+ ...userConfigs
4055
+ );
4056
+ return composer;
4491
4057
  };
4492
4058
 
4493
4059
  exports.aiou = aiou;
4060
+ exports.all = all;