@ntnyq/eslint-config 3.0.0-beta.2 → 3.0.0-beta.3

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.js CHANGED
@@ -43,13 +43,13 @@ function getOverrides(options, key) {
43
43
 
44
44
  // src/globs.ts
45
45
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
46
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
46
+ var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
47
47
  var GLOB_JS = "**/*.?([cm])js";
48
48
  var GLOB_JSX = "**/*.?([cm])jsx";
49
49
  var GLOB_TS = "**/*.?([cm])ts";
50
50
  var GLOB_TSX = "**/*.?([cm])tsx";
51
51
  var GLOB_DTS = "**/*.d.?([cm])ts";
52
- var GLOB_TEST = "**/*.{test,spec}.?([cm])[jt]s?(x)";
52
+ var GLOB_TEST = `**/*.{test,spec,bench,benchmark}.${GLOB_SRC_EXT}`;
53
53
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
54
54
  var GLOB_CSS = "**/*.css";
55
55
  var GLOB_LESS = "**/*.less";
@@ -58,20 +58,22 @@ var GLOB_JSON = "**/*.json";
58
58
  var GLOB_JSON5 = "**/*.json5";
59
59
  var GLOB_JSONC = "**/*.jsonc";
60
60
  var GLOB_VUE = "**/*.vue";
61
- var GLOB_MARKDOWN = "**/*.md";
62
61
  var GLOB_YAML = "**/*.y?(a)ml";
63
62
  var GLOB_TOML = "**/*.toml";
64
63
  var GLOB_HTML = "**/*.htm?(l)";
64
+ var GLOB_MARKDOWN = "**/*.md";
65
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
66
+ var GLOB_MARKDOWN_NESTED = `${GLOB_MARKDOWN}/*.md`;
65
67
  var GLOB_ALL_SRC = [
66
68
  GLOB_SRC,
67
69
  GLOB_STYLE,
68
70
  GLOB_JSON,
69
71
  GLOB_JSON5,
70
- GLOB_MARKDOWN,
71
72
  GLOB_VUE,
72
73
  GLOB_YAML,
73
74
  GLOB_TOML,
74
- GLOB_HTML
75
+ GLOB_HTML,
76
+ GLOB_MARKDOWN
75
77
  ];
76
78
  var GLOB_NODE_MODULES = "**/node_modules/**";
77
79
  var GLOB_DIST = "**/dist/**";
@@ -384,7 +386,7 @@ var prettier = (options = {}) => [
384
386
  "vue/space-unary-ops": "off",
385
387
  "vue/template-curly-spacing": "off",
386
388
  ...default12.configs.recommended.rules,
387
- "prettier/prettier": "warn",
389
+ "prettier/prettier": options.level || "warn",
388
390
  // Overrides built-in rules
389
391
  ...options.overrides
390
392
  }
@@ -423,320 +425,337 @@ var comments = (options = {}) => [
423
425
  // src/configs/javascript.ts
424
426
  import globals from "globals";
425
427
  import jsConfig from "@eslint/js";
426
- var javascript = (option = {}) => [
427
- {
428
- name: "ntnyq/js/recommended",
429
- ...jsConfig.configs.recommended
430
- },
428
+ var javascript = (options = {}) => {
429
+ const strictRules = {
430
+ complexity: ["error", { max: 30 }],
431
+ "max-params": ["error", { max: 5 }],
432
+ "max-depth": ["error", { max: 5 }],
433
+ "max-nested-callbacks": ["error", { max: 10 }],
434
+ "max-lines": [
435
+ "error",
436
+ {
437
+ max: 1e3,
438
+ skipComments: true,
439
+ skipBlankLines: true
440
+ }
441
+ ],
442
+ "max-lines-per-function": [
443
+ "error",
444
+ {
445
+ max: 200,
446
+ skipComments: true,
447
+ skipBlankLines: true
448
+ }
449
+ ]
450
+ };
451
+ return [
452
+ {
453
+ ...jsConfig.configs.recommended,
454
+ name: "ntnyq/js/recommended"
455
+ },
456
+ {
457
+ name: "ntnyq/js/core",
458
+ languageOptions: {
459
+ globals: {
460
+ ...globals.browser,
461
+ ...globals.es2021,
462
+ ...globals.node
463
+ },
464
+ sourceType: "module"
465
+ },
466
+ rules: {
467
+ // standard v17.0.0
468
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
469
+ camelcase: [
470
+ "error",
471
+ {
472
+ allow: ["^UNSAFE_"],
473
+ properties: "never",
474
+ ignoreGlobals: true
475
+ }
476
+ ],
477
+ "constructor-super": "error",
478
+ curly: ["error", "multi-line"],
479
+ "default-case-last": "error",
480
+ "dot-notation": ["error", { allowKeywords: true }],
481
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
482
+ "no-array-constructor": "error",
483
+ "no-async-promise-executor": "error",
484
+ "no-caller": "error",
485
+ "no-class-assign": "error",
486
+ "no-compare-neg-zero": "error",
487
+ "no-cond-assign": "error",
488
+ "no-const-assign": "error",
489
+ "no-constant-condition": ["error", { checkLoops: false }],
490
+ "no-control-regex": "error",
491
+ "no-debugger": "error",
492
+ "no-delete-var": "error",
493
+ "no-dupe-args": "error",
494
+ "no-dupe-class-members": "error",
495
+ "no-dupe-keys": "error",
496
+ "no-duplicate-case": "error",
497
+ "no-useless-backreference": "error",
498
+ "no-empty": ["error", { allowEmptyCatch: true }],
499
+ "no-empty-character-class": "error",
500
+ "no-empty-pattern": "error",
501
+ "no-eval": "error",
502
+ "no-ex-assign": "error",
503
+ "no-extend-native": "error",
504
+ "no-extra-bind": "error",
505
+ "no-extra-boolean-cast": "error",
506
+ "no-fallthrough": "error",
507
+ "no-func-assign": "error",
508
+ "no-global-assign": "error",
509
+ "no-implied-eval": "error",
510
+ "no-import-assign": "error",
511
+ "no-invalid-regexp": "error",
512
+ "no-irregular-whitespace": "error",
513
+ "no-iterator": "error",
514
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
515
+ "no-lone-blocks": "error",
516
+ "no-loss-of-precision": "error",
517
+ "no-misleading-character-class": "error",
518
+ "no-prototype-builtins": "error",
519
+ "no-useless-catch": "error",
520
+ "no-new": "error",
521
+ "no-new-func": "error",
522
+ "no-new-wrappers": "error",
523
+ "no-obj-calls": "error",
524
+ "no-octal": "error",
525
+ "no-octal-escape": "error",
526
+ "no-proto": "error",
527
+ "no-redeclare": ["error", { builtinGlobals: false }],
528
+ "no-regex-spaces": "error",
529
+ "no-self-assign": ["error", { props: true }],
530
+ "no-self-compare": "error",
531
+ "no-sequences": "error",
532
+ "no-shadow-restricted-names": "error",
533
+ "no-sparse-arrays": "error",
534
+ "no-template-curly-in-string": "error",
535
+ "no-this-before-super": "error",
536
+ "no-throw-literal": "error",
537
+ "no-undef": "error",
538
+ "no-undef-init": "error",
539
+ "no-unexpected-multiline": "error",
540
+ "no-unmodified-loop-condition": "error",
541
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
542
+ "no-unreachable": "error",
543
+ "no-unreachable-loop": "error",
544
+ "no-unsafe-finally": "error",
545
+ "no-unsafe-negation": "error",
546
+ "no-unused-expressions": [
547
+ "error",
548
+ {
549
+ allowShortCircuit: true,
550
+ allowTernary: true,
551
+ allowTaggedTemplates: true
552
+ }
553
+ ],
554
+ "no-unused-vars": [
555
+ "error",
556
+ {
557
+ args: "none",
558
+ caughtErrors: "none",
559
+ ignoreRestSiblings: true,
560
+ vars: "all"
561
+ }
562
+ ],
563
+ "no-useless-call": "error",
564
+ "no-useless-computed-key": "error",
565
+ "no-useless-constructor": "error",
566
+ "no-useless-rename": "error",
567
+ "no-useless-return": "error",
568
+ "prefer-promise-reject-errors": "error",
569
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
570
+ "symbol-description": "error",
571
+ "unicode-bom": ["error", "never"],
572
+ "use-isnan": [
573
+ "error",
574
+ {
575
+ enforceForSwitchCase: true,
576
+ enforceForIndexOf: true
577
+ }
578
+ ],
579
+ "valid-typeof": ["error", { requireStringLiterals: true }],
580
+ yoda: ["error", "never"],
581
+ // es6+
582
+ "no-var": "error",
583
+ "prefer-rest-params": "error",
584
+ "prefer-spread": "error",
585
+ "prefer-template": "error",
586
+ "no-empty-static-block": "error",
587
+ "no-new-native-nonconstructor": "error",
588
+ "prefer-const": [
589
+ "error",
590
+ {
591
+ destructuring: "all",
592
+ ignoreReadBeforeAssign: true
593
+ }
594
+ ],
595
+ "prefer-arrow-callback": [
596
+ "error",
597
+ {
598
+ allowNamedFunctions: false,
599
+ allowUnboundThis: true
600
+ }
601
+ ],
602
+ "object-shorthand": [
603
+ "error",
604
+ "always",
605
+ {
606
+ ignoreConstructors: false,
607
+ avoidQuotes: true
608
+ }
609
+ ],
610
+ // best-practice
611
+ eqeqeq: ["error", "smart"],
612
+ "array-callback-return": "error",
613
+ "block-scoped-var": "error",
614
+ "consistent-return": "off",
615
+ "no-alert": "error",
616
+ "no-case-declarations": "error",
617
+ "no-multi-str": "error",
618
+ "no-with": "error",
619
+ "no-void": "error",
620
+ "no-useless-escape": "off",
621
+ "vars-on-top": "error",
622
+ "require-await": "off",
623
+ "no-return-assign": "off",
624
+ "one-var": ["error", "never"],
625
+ "no-use-before-define": [
626
+ "error",
627
+ {
628
+ functions: false,
629
+ classes: false,
630
+ variables: true
631
+ }
632
+ ],
633
+ "sort-imports": [
634
+ "error",
635
+ {
636
+ ignoreCase: false,
637
+ ignoreDeclarationSort: true,
638
+ ignoreMemberSort: false,
639
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
640
+ allowSeparatedGroups: false
641
+ }
642
+ ],
643
+ // Strict rules
644
+ ...options.strict ? strictRules : {},
645
+ // Overrides built-in rules
646
+ ...options.overrides
647
+ }
648
+ },
649
+ {
650
+ name: "ntnyq/js/scripts",
651
+ files: ["**/scripts/*", "**/cli.*"],
652
+ rules: {
653
+ "no-console": "off"
654
+ }
655
+ },
656
+ {
657
+ name: "ntnyq/js/test",
658
+ files: ["**/*.{test,spec}.js?(x)"],
659
+ rules: {
660
+ "no-unused-expressions": "off",
661
+ "max-lines-per-function": "off"
662
+ }
663
+ }
664
+ ];
665
+ };
666
+ var jsx = () => [
431
667
  {
432
- name: "ntnyq/js/core",
668
+ name: "ntnyq/jsx",
669
+ files: ["**/*.jsx"],
433
670
  languageOptions: {
434
- globals: {
435
- ...globals.browser,
436
- ...globals.es2021,
437
- ...globals.node
438
- },
439
- sourceType: "module"
671
+ parserOptions: {
672
+ ecmaFeatures: {
673
+ jsx: true
674
+ }
675
+ }
676
+ }
677
+ }
678
+ ];
679
+
680
+ // src/configs/typescript.ts
681
+ import process2 from "node:process";
682
+ var typescriptCore = (options = {}) => {
683
+ const isTypeAware = !!options.tsconfigPath;
684
+ const configs = tseslint.config({
685
+ name: "ntnyq/ts/core",
686
+ extends: [...tseslint.configs.recommended],
687
+ files: [GLOB_TS, GLOB_TSX],
688
+ languageOptions: {
689
+ parser: tseslint.parser,
690
+ parserOptions: {
691
+ sourceType: "module",
692
+ ...isTypeAware ? {
693
+ projectService: {
694
+ defaultProject: options.tsconfigPath
695
+ },
696
+ tsconfigRootDir: process2.cwd()
697
+ } : {}
698
+ }
440
699
  },
441
700
  rules: {
442
- // standard v17.0.0
443
- "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
444
- camelcase: [
701
+ "@typescript-eslint/no-unused-vars": [
445
702
  "error",
446
703
  {
447
- allow: ["^UNSAFE_"],
448
- properties: "never",
449
- ignoreGlobals: true
450
- }
451
- ],
452
- "constructor-super": "error",
453
- curly: ["error", "multi-line"],
454
- "default-case-last": "error",
455
- "dot-notation": ["error", { allowKeywords: true }],
456
- "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
457
- "no-array-constructor": "error",
458
- "no-async-promise-executor": "error",
459
- "no-caller": "error",
460
- "no-class-assign": "error",
461
- "no-compare-neg-zero": "error",
462
- "no-cond-assign": "error",
463
- "no-const-assign": "error",
464
- "no-constant-condition": ["error", { checkLoops: false }],
465
- "no-control-regex": "error",
466
- "no-debugger": "error",
467
- "no-delete-var": "error",
468
- "no-dupe-args": "error",
469
- "no-dupe-class-members": "error",
470
- "no-dupe-keys": "error",
471
- "no-duplicate-case": "error",
472
- "no-useless-backreference": "error",
473
- "no-empty": ["error", { allowEmptyCatch: true }],
474
- "no-empty-character-class": "error",
475
- "no-empty-pattern": "error",
476
- "no-eval": "error",
477
- "no-ex-assign": "error",
478
- "no-extend-native": "error",
479
- "no-extra-bind": "error",
480
- "no-extra-boolean-cast": "error",
481
- "no-fallthrough": "error",
482
- "no-func-assign": "error",
483
- "no-global-assign": "error",
484
- "no-implied-eval": "error",
485
- "no-import-assign": "error",
486
- "no-invalid-regexp": "error",
487
- "no-irregular-whitespace": "error",
488
- "no-iterator": "error",
489
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
490
- "no-lone-blocks": "error",
491
- "no-loss-of-precision": "error",
492
- "no-misleading-character-class": "error",
493
- "no-prototype-builtins": "error",
494
- "no-useless-catch": "error",
495
- "no-new": "error",
496
- "no-new-func": "error",
497
- "no-new-wrappers": "error",
498
- "no-obj-calls": "error",
499
- "no-octal": "error",
500
- "no-octal-escape": "error",
501
- "no-proto": "error",
502
- "no-redeclare": ["error", { builtinGlobals: false }],
503
- "no-regex-spaces": "error",
504
- "no-self-assign": ["error", { props: true }],
505
- "no-self-compare": "error",
506
- "no-sequences": "error",
507
- "no-shadow-restricted-names": "error",
508
- "no-sparse-arrays": "error",
509
- "no-template-curly-in-string": "error",
510
- "no-this-before-super": "error",
511
- "no-throw-literal": "error",
512
- "no-undef": "error",
513
- "no-undef-init": "error",
514
- "no-unexpected-multiline": "error",
515
- "no-unmodified-loop-condition": "error",
516
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
517
- "no-unreachable": "error",
518
- "no-unreachable-loop": "error",
519
- "no-unsafe-finally": "error",
520
- "no-unsafe-negation": "error",
521
- "no-unused-expressions": [
522
- "error",
523
- {
524
- allowShortCircuit: true,
525
- allowTernary: true,
526
- allowTaggedTemplates: true
527
- }
528
- ],
529
- "no-unused-vars": [
530
- "error",
531
- {
532
- args: "none",
533
- caughtErrors: "none",
534
- ignoreRestSiblings: true,
535
- vars: "all"
536
- }
537
- ],
538
- "no-useless-call": "error",
539
- "no-useless-computed-key": "error",
540
- "no-useless-constructor": "error",
541
- "no-useless-rename": "error",
542
- "no-useless-return": "error",
543
- "prefer-promise-reject-errors": "error",
544
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
545
- "symbol-description": "error",
546
- "unicode-bom": ["error", "never"],
547
- "use-isnan": [
548
- "error",
549
- {
550
- enforceForSwitchCase: true,
551
- enforceForIndexOf: true
552
- }
553
- ],
554
- "valid-typeof": ["error", { requireStringLiterals: true }],
555
- yoda: ["error", "never"],
556
- // es6+
557
- "no-var": "error",
558
- "prefer-rest-params": "error",
559
- "prefer-spread": "error",
560
- "prefer-template": "error",
561
- "no-empty-static-block": "error",
562
- "no-new-native-nonconstructor": "error",
563
- "prefer-const": [
564
- "error",
565
- {
566
- destructuring: "all",
567
- ignoreReadBeforeAssign: true
568
- }
569
- ],
570
- "prefer-arrow-callback": [
571
- "error",
572
- {
573
- allowNamedFunctions: false,
574
- allowUnboundThis: true
575
- }
576
- ],
577
- "object-shorthand": [
578
- "error",
579
- "always",
580
- {
581
- ignoreConstructors: false,
582
- avoidQuotes: true
583
- }
584
- ],
585
- // best-practice
586
- eqeqeq: ["error", "smart"],
587
- complexity: ["error", { max: 30 }],
588
- "array-callback-return": "error",
589
- "block-scoped-var": "error",
590
- "consistent-return": "off",
591
- "no-alert": "error",
592
- "no-case-declarations": "error",
593
- "no-multi-str": "error",
594
- "no-with": "error",
595
- "no-void": "error",
596
- "no-useless-escape": "off",
597
- "vars-on-top": "error",
598
- "require-await": "off",
599
- "no-return-assign": "off",
600
- "one-var": ["error", "never"],
601
- "max-params": ["error", { max: 5 }],
602
- "max-depth": ["error", { max: 5 }],
603
- "max-nested-callbacks": ["error", { max: 10 }],
604
- "max-lines": [
605
- "error",
606
- {
607
- max: 1e3,
608
- skipComments: true,
609
- skipBlankLines: true
704
+ // Args after the last used will be reported
705
+ args: "after-used",
706
+ argsIgnorePattern: "^_",
707
+ caughtErrors: "all",
708
+ caughtErrorsIgnorePattern: "^_",
709
+ destructuredArrayIgnorePattern: "^_",
710
+ varsIgnorePattern: "^_",
711
+ ignoreRestSiblings: true
610
712
  }
611
713
  ],
612
- "max-lines-per-function": [
714
+ "@typescript-eslint/no-redeclare": "error",
715
+ "@typescript-eslint/consistent-type-imports": [
613
716
  "error",
614
717
  {
615
- max: 200,
616
- skipComments: true,
617
- skipBlankLines: true
718
+ prefer: "type-imports",
719
+ fixStyle: "separate-type-imports",
720
+ disallowTypeAnnotations: false
618
721
  }
619
722
  ],
620
- "no-use-before-define": [
723
+ "@typescript-eslint/no-empty-object-type": [
621
724
  "error",
622
725
  {
623
- functions: false,
624
- classes: false,
625
- variables: true
726
+ allowInterfaces: "always",
727
+ allowObjectTypes: "always"
626
728
  }
627
729
  ],
628
- "sort-imports": [
730
+ "@typescript-eslint/consistent-type-assertions": [
629
731
  "error",
630
732
  {
631
- ignoreCase: false,
632
- ignoreDeclarationSort: true,
633
- ignoreMemberSort: false,
634
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
635
- allowSeparatedGroups: false
733
+ assertionStyle: "as",
734
+ objectLiteralTypeAssertions: "allow-as-parameter"
636
735
  }
637
736
  ],
638
- // Overrides built-in rules
639
- ...option.overrides
640
- }
641
- },
642
- {
643
- name: "ntnyq/js/script",
644
- files: ["**/scripts/*", "**/cli.*"],
645
- rules: {
646
- "no-console": "off"
647
- }
648
- },
649
- {
650
- name: "ntnyq/js/test",
651
- files: ["**/*.{test,spec}.js?(x)"],
652
- rules: {
653
- "no-unused-expressions": "off",
654
- "max-lines-per-function": "off"
655
- }
656
- }
657
- ];
658
- var jsx = () => [
659
- {
660
- name: "ntnyq/jsx",
661
- files: ["**/*.jsx"],
662
- languageOptions: {
663
- parserOptions: {
664
- ecmaFeatures: {
665
- jsx: true
666
- }
667
- }
668
- }
669
- }
670
- ];
671
-
672
- // src/configs/typescript.ts
673
- var typescriptCore = (options = {}) => tseslint.config({
674
- name: "ntnyq/ts/core",
675
- extends: [...tseslint.configs.recommended],
676
- files: [GLOB_TS, GLOB_TSX],
677
- languageOptions: {
678
- parser: tseslint.parser,
679
- parserOptions: {
680
- sourceType: "module"
681
- }
682
- },
683
- rules: {
684
- "@typescript-eslint/no-unused-vars": [
685
- "error",
686
- {
687
- // Args after the last used will be reported
688
- args: "after-used",
689
- argsIgnorePattern: "^_",
690
- caughtErrors: "all",
691
- caughtErrorsIgnorePattern: "^_",
692
- destructuredArrayIgnorePattern: "^_",
693
- varsIgnorePattern: "^_",
694
- ignoreRestSiblings: true
695
- }
696
- ],
697
- "@typescript-eslint/no-redeclare": "error",
698
- "@typescript-eslint/consistent-type-imports": [
699
- "error",
700
- {
701
- prefer: "type-imports",
702
- fixStyle: "separate-type-imports",
703
- disallowTypeAnnotations: false
704
- }
705
- ],
706
- "@typescript-eslint/no-empty-object-type": [
707
- "error",
708
- {
709
- allowInterfaces: "always",
710
- allowObjectTypes: "always"
711
- }
712
- ],
713
- "@typescript-eslint/consistent-type-assertions": [
714
- "error",
715
- {
716
- assertionStyle: "as",
717
- objectLiteralTypeAssertions: "allow-as-parameter"
718
- }
719
- ],
720
- "@typescript-eslint/prefer-as-const": "warn",
721
- "@typescript-eslint/ban-types": "off",
722
- "@typescript-eslint/camelcase": "off",
723
- "@typescript-eslint/no-namespace": "off",
724
- "@typescript-eslint/ban-ts-ignore": "off",
725
- "@typescript-eslint/ban-ts-comment": "off",
726
- "@typescript-eslint/no-explicit-any": "off",
727
- "@typescript-eslint/no-empty-function": "off",
728
- "@typescript-eslint/naming-convention": "off",
729
- "@typescript-eslint/no-non-null-assertion": "off",
730
- "@typescript-eslint/triple-slash-reference": "off",
731
- "@typescript-eslint/no-parameter-properties": "off",
732
- "@typescript-eslint/explicit-member-accessibility": "off",
733
- "@typescript-eslint/explicit-function-return-type": "off",
734
- "@typescript-eslint/explicit-module-boundary-types": "off",
735
- "@typescript-eslint/consistent-indexed-object-style": "off"
736
- },
737
- // Overrides built-in rules
738
- ...options.overrides
739
- });
737
+ "@typescript-eslint/prefer-as-const": "warn",
738
+ "@typescript-eslint/ban-types": "off",
739
+ "@typescript-eslint/camelcase": "off",
740
+ "@typescript-eslint/no-namespace": "off",
741
+ "@typescript-eslint/ban-ts-ignore": "off",
742
+ "@typescript-eslint/ban-ts-comment": "off",
743
+ "@typescript-eslint/no-explicit-any": "off",
744
+ "@typescript-eslint/no-empty-function": "off",
745
+ "@typescript-eslint/naming-convention": "off",
746
+ "@typescript-eslint/no-non-null-assertion": "off",
747
+ "@typescript-eslint/triple-slash-reference": "off",
748
+ "@typescript-eslint/no-parameter-properties": "off",
749
+ "@typescript-eslint/explicit-member-accessibility": "off",
750
+ "@typescript-eslint/explicit-function-return-type": "off",
751
+ "@typescript-eslint/explicit-module-boundary-types": "off",
752
+ "@typescript-eslint/consistent-indexed-object-style": "off"
753
+ },
754
+ // Overrides built-in rules
755
+ ...options.overrides
756
+ });
757
+ return configs;
758
+ };
740
759
  var typescript = (options = {}) => [
741
760
  ...typescriptCore(options),
742
761
  {
@@ -870,7 +889,7 @@ var command = () => [
870
889
  // src/configs/vitest.ts
871
890
  var vitest = (options = {}) => [
872
891
  {
873
- name: "ntnyq/test",
892
+ name: "ntnyq/vitest",
874
893
  plugins: {
875
894
  vitest: default9
876
895
  },
@@ -884,16 +903,6 @@ var vitest = (options = {}) => [
884
903
  ];
885
904
 
886
905
  // src/configs/vue.ts
887
- import process2 from "node:process";
888
- import { getPackageInfoSync } from "local-pkg";
889
- function getVueVersion() {
890
- const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
891
- if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
892
- return +pkg.version[0];
893
- }
894
- return 3;
895
- }
896
- var isVue3 = getVueVersion() === 3;
897
906
  var vue2Rules = {
898
907
  ...default3.configs.base.rules,
899
908
  ...default3.configs.essential.rules,
@@ -906,250 +915,253 @@ var vue3Rules = {
906
915
  ...default3.configs["vue3-strongly-recommended"].rules,
907
916
  ...default3.configs["vue3-recommended"].rules
908
917
  };
909
- var vue = (options = {}) => [
910
- ...tseslint.config({
911
- name: "ntnyq/vue/ts",
912
- files: [GLOB_VUE],
913
- extends: typescriptCore()
914
- }),
915
- {
916
- name: "ntnyq/vue/core",
917
- files: [GLOB_VUE],
918
- plugins: {
919
- vue: default3,
920
- "@typescript-eslint": tseslint.plugin
921
- },
922
- languageOptions: {
923
- parser: parserVue,
924
- parserOptions: {
925
- parser: "@typescript-eslint/parser",
926
- sourceType: "module",
927
- extraFileExtensions: [".vue"],
928
- ecmaFeatures: {
929
- jsx: true
918
+ var vue = (options = {}) => {
919
+ const isVue3 = options.vueVersion !== 2;
920
+ return [
921
+ ...tseslint.config({
922
+ name: "ntnyq/vue/ts",
923
+ files: [GLOB_VUE],
924
+ extends: typescriptCore()
925
+ }),
926
+ {
927
+ name: "ntnyq/vue/core",
928
+ files: [GLOB_VUE],
929
+ plugins: {
930
+ vue: default3,
931
+ "@typescript-eslint": tseslint.plugin
932
+ },
933
+ languageOptions: {
934
+ parser: parserVue,
935
+ parserOptions: {
936
+ parser: "@typescript-eslint/parser",
937
+ sourceType: "module",
938
+ extraFileExtensions: [".vue"],
939
+ ecmaFeatures: {
940
+ jsx: true
941
+ }
930
942
  }
943
+ },
944
+ processor: default3.processors[".vue"],
945
+ rules: {
946
+ ...isVue3 ? vue3Rules : vue2Rules,
947
+ // OFF
948
+ "vue/no-v-html": "off",
949
+ "vue/require-prop-types": "off",
950
+ "vue/require-default-prop": "off",
951
+ "vue/multi-word-component-names": "off",
952
+ "vue/no-setup-props-reactivity-loss": "off",
953
+ "vue/html-self-closing": [
954
+ "error",
955
+ {
956
+ html: {
957
+ void: "always",
958
+ normal: "always",
959
+ component: "always"
960
+ },
961
+ svg: "always",
962
+ math: "always"
963
+ }
964
+ ],
965
+ "vue/block-tag-newline": [
966
+ "error",
967
+ {
968
+ singleline: "always",
969
+ multiline: "always"
970
+ }
971
+ ],
972
+ "vue/component-name-in-template-casing": [
973
+ "error",
974
+ "PascalCase",
975
+ {
976
+ // Force auto-import components to be PascalCase
977
+ registeredComponentsOnly: false,
978
+ ignores: ["slot", "component"]
979
+ }
980
+ ],
981
+ "vue/component-options-name-casing": ["error", "PascalCase"],
982
+ "vue/custom-event-name-casing": ["error", "camelCase"],
983
+ "vue/define-macros-order": [
984
+ "error",
985
+ {
986
+ order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
987
+ }
988
+ ],
989
+ "vue/html-comment-content-spacing": [
990
+ "error",
991
+ "always",
992
+ {
993
+ exceptions: ["-"]
994
+ }
995
+ ],
996
+ "vue/array-bracket-spacing": ["error", "never"],
997
+ "vue/arrow-spacing": ["error", { before: true, after: true }],
998
+ "vue/block-spacing": ["error", "always"],
999
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
1000
+ "vue/comma-dangle": ["error", "always-multiline"],
1001
+ "vue/comma-spacing": ["error", { before: false, after: true }],
1002
+ "vue/comma-style": ["error", "last"],
1003
+ "vue/dot-location": ["error", "property"],
1004
+ "vue/dot-notation": ["error", { allowKeywords: true }],
1005
+ "vue/eqeqeq": ["error", "smart"],
1006
+ "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
1007
+ "vue/keyword-spacing": ["error", { before: true, after: true }],
1008
+ "vue/no-empty-pattern": "error",
1009
+ "vue/no-loss-of-precision": "error",
1010
+ "vue/no-irregular-whitespace": "error",
1011
+ "vue/no-use-v-else-with-v-for": "error",
1012
+ "vue/require-typed-object-prop": "error",
1013
+ "vue/no-extra-parens": ["error", "functions"],
1014
+ "vue/no-restricted-syntax": [
1015
+ "error",
1016
+ "DebuggerStatement",
1017
+ "LabeledStatement",
1018
+ "WithStatement"
1019
+ ],
1020
+ "vue/no-sparse-arrays": "error",
1021
+ "vue/no-deprecated-model-definition": [
1022
+ "error",
1023
+ {
1024
+ allowVue3Compat: true
1025
+ }
1026
+ ],
1027
+ "vue/object-curly-newline": [
1028
+ "error",
1029
+ {
1030
+ multiline: true,
1031
+ consistent: true
1032
+ }
1033
+ ],
1034
+ "vue/no-static-inline-styles": [
1035
+ "error",
1036
+ {
1037
+ allowBinding: true
1038
+ }
1039
+ ],
1040
+ "vue/object-curly-spacing": ["error", "always"],
1041
+ "vue/object-property-newline": [
1042
+ "error",
1043
+ {
1044
+ allowMultiplePropertiesPerLine: true
1045
+ }
1046
+ ],
1047
+ "vue/object-shorthand": [
1048
+ "error",
1049
+ "always",
1050
+ {
1051
+ ignoreConstructors: false,
1052
+ avoidQuotes: true
1053
+ }
1054
+ ],
1055
+ "vue/operator-linebreak": ["error", "before"],
1056
+ "vue/prefer-template": "error",
1057
+ "vue/prop-name-casing": ["error", "camelCase"],
1058
+ "vue/quote-props": ["error", "consistent-as-needed"],
1059
+ "vue/space-in-parens": ["error", "never"],
1060
+ "vue/space-infix-ops": "error",
1061
+ "vue/space-unary-ops": [
1062
+ "error",
1063
+ {
1064
+ words: true,
1065
+ nonwords: false
1066
+ }
1067
+ ],
1068
+ "vue/template-curly-spacing": "error",
1069
+ "vue/block-order": [
1070
+ "error",
1071
+ {
1072
+ order: ["script", "template", "style"]
1073
+ }
1074
+ ],
1075
+ "vue/attributes-order": [
1076
+ "error",
1077
+ {
1078
+ order: [
1079
+ "EVENTS",
1080
+ // `@click="functionCall"`, `v-on="event"`
1081
+ "TWO_WAY_BINDING",
1082
+ // `v-model`
1083
+ "OTHER_DIRECTIVES",
1084
+ // `v-custom-directive`
1085
+ "LIST_RENDERING",
1086
+ // `v-for item in items`
1087
+ "CONDITIONALS",
1088
+ // `v-if`, `v-show`, `v-cloak`
1089
+ "CONTENT",
1090
+ // `v-text`, `v-html`
1091
+ "SLOT",
1092
+ // `v-slot`, `slot`
1093
+ "UNIQUE",
1094
+ // `ref`, `key`
1095
+ "DEFINITION",
1096
+ // `is`, `v-is`
1097
+ "ATTR_DYNAMIC",
1098
+ // `v-bind:prop="foo"`, `:prop="foo"`
1099
+ // `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
1100
+ "RENDER_MODIFIERS",
1101
+ // `v-once`, `v-pre`
1102
+ "GLOBAL",
1103
+ // `id`
1104
+ "ATTR_STATIC",
1105
+ // `prop="foo", `static attributes
1106
+ "ATTR_SHORTHAND_BOOL"
1107
+ // `disabled`, prop shorthand
1108
+ ],
1109
+ alphabetical: false
1110
+ }
1111
+ ],
1112
+ "vue/order-in-components": [
1113
+ "error",
1114
+ {
1115
+ order: [
1116
+ "el",
1117
+ "name",
1118
+ "key",
1119
+ "parent",
1120
+ "functional",
1121
+ ["provide", "inject"],
1122
+ ["delimiters", "comments"],
1123
+ ["components", "directives", "filters"],
1124
+ "extends",
1125
+ "mixins",
1126
+ "layout",
1127
+ "middleware",
1128
+ "validate",
1129
+ "scrollToTop",
1130
+ "transition",
1131
+ "loading",
1132
+ "inheritAttrs",
1133
+ "model",
1134
+ ["props", "propsData"],
1135
+ "emits",
1136
+ "setup",
1137
+ "asyncData",
1138
+ "computed",
1139
+ "data",
1140
+ "fetch",
1141
+ "head",
1142
+ "methods",
1143
+ ["template", "render"],
1144
+ "watch",
1145
+ "watchQuery",
1146
+ "LIFECYCLE_HOOKS",
1147
+ "renderError",
1148
+ "ROUTER_GUARDS"
1149
+ ]
1150
+ }
1151
+ ],
1152
+ "vue/max-attributes-per-line": [
1153
+ "error",
1154
+ {
1155
+ singleline: 1,
1156
+ multiline: 1
1157
+ }
1158
+ ],
1159
+ // Overrides built-in rules
1160
+ ...options.overrides
931
1161
  }
932
- },
933
- processor: default3.processors[".vue"],
934
- rules: {
935
- ...isVue3 ? vue3Rules : vue2Rules,
936
- // OFF
937
- "vue/no-v-html": "off",
938
- "vue/require-prop-types": "off",
939
- "vue/require-default-prop": "off",
940
- "vue/multi-word-component-names": "off",
941
- "vue/no-setup-props-reactivity-loss": "off",
942
- "vue/html-self-closing": [
943
- "error",
944
- {
945
- html: {
946
- void: "always",
947
- normal: "always",
948
- component: "always"
949
- },
950
- svg: "always",
951
- math: "always"
952
- }
953
- ],
954
- "vue/block-tag-newline": [
955
- "error",
956
- {
957
- singleline: "always",
958
- multiline: "always"
959
- }
960
- ],
961
- "vue/component-name-in-template-casing": [
962
- "error",
963
- "PascalCase",
964
- {
965
- // Force auto-import components to be PascalCase
966
- registeredComponentsOnly: false,
967
- ignores: ["slot", "component"]
968
- }
969
- ],
970
- "vue/component-options-name-casing": ["error", "PascalCase"],
971
- "vue/custom-event-name-casing": ["error", "camelCase"],
972
- "vue/define-macros-order": [
973
- "error",
974
- {
975
- order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
976
- }
977
- ],
978
- "vue/html-comment-content-spacing": [
979
- "error",
980
- "always",
981
- {
982
- exceptions: ["-"]
983
- }
984
- ],
985
- "vue/array-bracket-spacing": ["error", "never"],
986
- "vue/arrow-spacing": ["error", { before: true, after: true }],
987
- "vue/block-spacing": ["error", "always"],
988
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
989
- "vue/comma-dangle": ["error", "always-multiline"],
990
- "vue/comma-spacing": ["error", { before: false, after: true }],
991
- "vue/comma-style": ["error", "last"],
992
- "vue/dot-location": ["error", "property"],
993
- "vue/dot-notation": ["error", { allowKeywords: true }],
994
- "vue/eqeqeq": ["error", "smart"],
995
- "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
996
- "vue/keyword-spacing": ["error", { before: true, after: true }],
997
- "vue/no-empty-pattern": "error",
998
- "vue/no-loss-of-precision": "error",
999
- "vue/no-irregular-whitespace": "error",
1000
- "vue/no-use-v-else-with-v-for": "error",
1001
- "vue/require-typed-object-prop": "error",
1002
- "vue/no-extra-parens": ["error", "functions"],
1003
- "vue/no-restricted-syntax": [
1004
- "error",
1005
- "DebuggerStatement",
1006
- "LabeledStatement",
1007
- "WithStatement"
1008
- ],
1009
- "vue/no-sparse-arrays": "error",
1010
- "vue/no-deprecated-model-definition": [
1011
- "error",
1012
- {
1013
- allowVue3Compat: true
1014
- }
1015
- ],
1016
- "vue/object-curly-newline": [
1017
- "error",
1018
- {
1019
- multiline: true,
1020
- consistent: true
1021
- }
1022
- ],
1023
- "vue/no-static-inline-styles": [
1024
- "error",
1025
- {
1026
- allowBinding: true
1027
- }
1028
- ],
1029
- "vue/object-curly-spacing": ["error", "always"],
1030
- "vue/object-property-newline": [
1031
- "error",
1032
- {
1033
- allowMultiplePropertiesPerLine: true
1034
- }
1035
- ],
1036
- "vue/object-shorthand": [
1037
- "error",
1038
- "always",
1039
- {
1040
- ignoreConstructors: false,
1041
- avoidQuotes: true
1042
- }
1043
- ],
1044
- "vue/operator-linebreak": ["error", "before"],
1045
- "vue/prefer-template": "error",
1046
- "vue/prop-name-casing": ["error", "camelCase"],
1047
- "vue/quote-props": ["error", "consistent-as-needed"],
1048
- "vue/space-in-parens": ["error", "never"],
1049
- "vue/space-infix-ops": "error",
1050
- "vue/space-unary-ops": [
1051
- "error",
1052
- {
1053
- words: true,
1054
- nonwords: false
1055
- }
1056
- ],
1057
- "vue/template-curly-spacing": "error",
1058
- "vue/block-order": [
1059
- "error",
1060
- {
1061
- order: ["script", "template", "style"]
1062
- }
1063
- ],
1064
- "vue/attributes-order": [
1065
- "error",
1066
- {
1067
- order: [
1068
- "EVENTS",
1069
- // `@click="functionCall"`, `v-on="event"`
1070
- "TWO_WAY_BINDING",
1071
- // `v-model`
1072
- "OTHER_DIRECTIVES",
1073
- // `v-custom-directive`
1074
- "LIST_RENDERING",
1075
- // `v-for item in items`
1076
- "CONDITIONALS",
1077
- // `v-if`, `v-show`, `v-cloak`
1078
- "CONTENT",
1079
- // `v-text`, `v-html`
1080
- "SLOT",
1081
- // `v-slot`, `slot`
1082
- "UNIQUE",
1083
- // `ref`, `key`
1084
- "DEFINITION",
1085
- // `is`, `v-is`
1086
- "ATTR_DYNAMIC",
1087
- // `v-bind:prop="foo"`, `:prop="foo"`
1088
- // `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
1089
- "RENDER_MODIFIERS",
1090
- // `v-once`, `v-pre`
1091
- "GLOBAL",
1092
- // `id`
1093
- "ATTR_STATIC",
1094
- // `prop="foo", `static attributes
1095
- "ATTR_SHORTHAND_BOOL"
1096
- // `disabled`, prop shorthand
1097
- ],
1098
- alphabetical: false
1099
- }
1100
- ],
1101
- "vue/order-in-components": [
1102
- "error",
1103
- {
1104
- order: [
1105
- "el",
1106
- "name",
1107
- "key",
1108
- "parent",
1109
- "functional",
1110
- ["provide", "inject"],
1111
- ["delimiters", "comments"],
1112
- ["components", "directives", "filters"],
1113
- "extends",
1114
- "mixins",
1115
- "layout",
1116
- "middleware",
1117
- "validate",
1118
- "scrollToTop",
1119
- "transition",
1120
- "loading",
1121
- "inheritAttrs",
1122
- "model",
1123
- ["props", "propsData"],
1124
- "emits",
1125
- "setup",
1126
- "asyncData",
1127
- "computed",
1128
- "data",
1129
- "fetch",
1130
- "head",
1131
- "methods",
1132
- ["template", "render"],
1133
- "watch",
1134
- "watchQuery",
1135
- "LIFECYCLE_HOOKS",
1136
- "renderError",
1137
- "ROUTER_GUARDS"
1138
- ]
1139
- }
1140
- ],
1141
- "vue/max-attributes-per-line": [
1142
- "error",
1143
- {
1144
- singleline: 1,
1145
- multiline: 1
1146
- }
1147
- ],
1148
- // Overrides built-in rules
1149
- ...options.overrides
1150
1162
  }
1151
- }
1152
- ];
1163
+ ];
1164
+ };
1153
1165
 
1154
1166
  // src/configs/yml.ts
1155
1167
  var yml = (options = {}) => [
@@ -1426,6 +1438,20 @@ var sortTsConfig = () => [
1426
1438
  }
1427
1439
  }
1428
1440
  ];
1441
+ var sortI18nLocale = () => [
1442
+ {
1443
+ files: ["**/{locales,i18n}/*.json", "**/{locales,i18n}/*.y?(a)ml"],
1444
+ rules: {
1445
+ "jsonc/sort-keys": [
1446
+ "error",
1447
+ {
1448
+ pathPattern: ".*",
1449
+ order: { type: "asc" }
1450
+ }
1451
+ ]
1452
+ }
1453
+ }
1454
+ ];
1429
1455
 
1430
1456
  // src/configs/jsonc.ts
1431
1457
  var jsonc = (options = {}) => [
@@ -1517,6 +1543,7 @@ function ntnyq(options = {}, customConfig = []) {
1517
1543
  overrides: getOverrides(options, "imports")
1518
1544
  }),
1519
1545
  ...javascript({
1546
+ ...resolveSubOptions(options, "javascript"),
1520
1547
  overrides: getOverrides(options, "javascript")
1521
1548
  })
1522
1549
  ];
@@ -1551,10 +1578,14 @@ function ntnyq(options = {}, customConfig = []) {
1551
1578
  if (options.typescript ?? hasTypeScript) {
1552
1579
  configs.push(
1553
1580
  ...typescript({
1581
+ ...resolveSubOptions(options, "typescript"),
1554
1582
  overrides: getOverrides(options, "typescript")
1555
1583
  })
1556
1584
  );
1557
1585
  }
1586
+ if (options.sortI18nLocale ?? true) {
1587
+ configs.push(...sortI18nLocale());
1588
+ }
1558
1589
  if (options.sortTsConfig ?? true) {
1559
1590
  configs.push(...sortTsConfig());
1560
1591
  }
@@ -1585,6 +1616,7 @@ function ntnyq(options = {}, customConfig = []) {
1585
1616
  if (options.vue ?? hasVue) {
1586
1617
  configs.push(
1587
1618
  ...vue({
1619
+ ...resolveSubOptions(options, "vue"),
1588
1620
  overrides: getOverrides(options, "vue")
1589
1621
  })
1590
1622
  );
@@ -1617,6 +1649,7 @@ function ntnyq(options = {}, customConfig = []) {
1617
1649
  if (options.prettier ?? true) {
1618
1650
  configs.push(
1619
1651
  ...prettier({
1652
+ ...resolveSubOptions(options, "prettier"),
1620
1653
  overrides: getOverrides(options, "prettier")
1621
1654
  })
1622
1655
  );
@@ -1638,6 +1671,8 @@ export {
1638
1671
  GLOB_LESS,
1639
1672
  GLOB_LOCKFILE,
1640
1673
  GLOB_MARKDOWN,
1674
+ GLOB_MARKDOWN_CODE,
1675
+ GLOB_MARKDOWN_NESTED,
1641
1676
  GLOB_NODE_MODULES,
1642
1677
  GLOB_SCSS,
1643
1678
  GLOB_SRC,
@@ -1652,7 +1687,6 @@ export {
1652
1687
  command,
1653
1688
  comments,
1654
1689
  getOverrides,
1655
- getVueVersion,
1656
1690
  hasTypeScript,
1657
1691
  hasUnoCSS,
1658
1692
  hasVitest,
@@ -1692,6 +1726,7 @@ export {
1692
1726
  prettier,
1693
1727
  regexp,
1694
1728
  resolveSubOptions,
1729
+ sortI18nLocale,
1695
1730
  sortPackageJson,
1696
1731
  sortTsConfig,
1697
1732
  toArray,