@ntnyq/eslint-config 3.0.0-beta.9 → 3.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
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
33
  GLOB_ALL_SRC: () => GLOB_ALL_SRC,
34
+ GLOB_ASTRO: () => GLOB_ASTRO,
34
35
  GLOB_CSS: () => GLOB_CSS,
35
36
  GLOB_DIST: () => GLOB_DIST,
36
37
  GLOB_DTS: () => GLOB_DTS,
@@ -51,6 +52,7 @@ __export(src_exports, {
51
52
  GLOB_SRC: () => GLOB_SRC,
52
53
  GLOB_SRC_EXT: () => GLOB_SRC_EXT,
53
54
  GLOB_STYLE: () => GLOB_STYLE,
55
+ GLOB_SVELTE: () => GLOB_SVELTE,
54
56
  GLOB_TEST: () => GLOB_TEST,
55
57
  GLOB_TOML: () => GLOB_TOML,
56
58
  GLOB_TS: () => GLOB_TS,
@@ -60,6 +62,7 @@ __export(src_exports, {
60
62
  antfu: () => antfu,
61
63
  command: () => command,
62
64
  comments: () => comments,
65
+ defineESLintConfig: () => defineESLintConfig,
63
66
  getOverrides: () => getOverrides,
64
67
  gitignore: () => gitignore,
65
68
  hasTypeScript: () => hasTypeScript,
@@ -89,6 +92,7 @@ __export(src_exports, {
89
92
  pluginJsonc: () => import_eslint_plugin_jsonc.default,
90
93
  pluginMarkdown: () => import_markdown.default,
91
94
  pluginNode: () => import_eslint_plugin_n.default,
95
+ pluginNtnyq: () => import_eslint_plugin_ntnyq.default,
92
96
  pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
93
97
  pluginPrettier: () => import_eslint_plugin_prettier.default,
94
98
  pluginRegexp: () => pluginRegexp,
@@ -102,9 +106,9 @@ __export(src_exports, {
102
106
  prettier: () => prettier,
103
107
  regexp: () => regexp,
104
108
  resolveSubOptions: () => resolveSubOptions,
105
- sortI18nLocale: () => sortI18nLocale,
106
- sortPackageJson: () => sortPackageJson,
107
- sortTsConfig: () => sortTsConfig,
109
+ sort: () => sort,
110
+ specials: () => specials,
111
+ test: () => test,
108
112
  toArray: () => toArray,
109
113
  toml: () => toml,
110
114
  tseslint: () => import_typescript_eslint.default,
@@ -126,11 +130,16 @@ var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
126
130
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
127
131
  var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
128
132
  var GLOB_JS = "**/*.?([cm])js";
129
- var GLOB_JSX = "**/*.?([cm])jsx";
133
+ var GLOB_JSX = `${GLOB_JS}x`;
130
134
  var GLOB_TS = "**/*.?([cm])ts";
131
- var GLOB_TSX = "**/*.?([cm])tsx";
135
+ var GLOB_TSX = `${GLOB_TS}x`;
132
136
  var GLOB_DTS = "**/*.d.?([cm])ts";
133
- var GLOB_TEST = `**/*.{test,spec,bench,benchmark}.${GLOB_SRC_EXT}`;
137
+ var GLOB_TEST = [
138
+ `**/*.test.${GLOB_SRC_EXT}`,
139
+ `**/*.spec.${GLOB_SRC_EXT}`,
140
+ `**/*.bench.${GLOB_SRC_EXT}`,
141
+ `**/*.benchmark.${GLOB_SRC_EXT}`
142
+ ];
134
143
  var GLOB_STYLE = "**/*.{c,le,sc}ss";
135
144
  var GLOB_CSS = "**/*.css";
136
145
  var GLOB_LESS = "**/*.less";
@@ -142,6 +151,8 @@ var GLOB_VUE = "**/*.vue";
142
151
  var GLOB_YAML = "**/*.y?(a)ml";
143
152
  var GLOB_TOML = "**/*.toml";
144
153
  var GLOB_HTML = "**/*.htm?(l)";
154
+ var GLOB_ASTRO = "**/*.astro";
155
+ var GLOB_SVELTE = "**/*.svelte";
145
156
  var GLOB_MARKDOWN = "**/*.md";
146
157
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
147
158
  var GLOB_MARKDOWN_NESTED = `${GLOB_MARKDOWN}/*.md`;
@@ -221,6 +232,7 @@ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
221
232
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
222
233
  var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
223
234
  var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
235
+ var import_eslint_plugin_ntnyq = __toESM(require("eslint-plugin-ntnyq"), 1);
224
236
  var import_markdown = __toESM(require("@eslint/markdown"), 1);
225
237
  var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
226
238
  var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
@@ -255,6 +267,29 @@ var typescriptCore = (options = {}) => {
255
267
  }
256
268
  },
257
269
  rules: {
270
+ // Disabled in favor of ts rules
271
+ "no-redeclare": "off",
272
+ "no-use-before-define": "off",
273
+ "no-unused-vars": "off",
274
+ "@typescript-eslint/no-redeclare": [
275
+ "error",
276
+ {
277
+ builtinGlobals: false,
278
+ ignoreDeclarationMerge: true
279
+ }
280
+ ],
281
+ "@typescript-eslint/no-use-before-define": [
282
+ "error",
283
+ {
284
+ functions: false,
285
+ classes: false,
286
+ variables: true,
287
+ allowNamedExports: false,
288
+ enums: true,
289
+ typedefs: false,
290
+ ignoreTypeReferences: false
291
+ }
292
+ ],
258
293
  "@typescript-eslint/no-unused-vars": [
259
294
  "error",
260
295
  {
@@ -268,7 +303,14 @@ var typescriptCore = (options = {}) => {
268
303
  ignoreRestSiblings: true
269
304
  }
270
305
  ],
271
- "@typescript-eslint/no-redeclare": "error",
306
+ "@typescript-eslint/no-unused-expressions": [
307
+ "error",
308
+ {
309
+ allowShortCircuit: true,
310
+ allowTernary: true,
311
+ allowTaggedTemplates: true
312
+ }
313
+ ],
272
314
  "@typescript-eslint/consistent-type-imports": [
273
315
  "error",
274
316
  {
@@ -306,37 +348,25 @@ var typescriptCore = (options = {}) => {
306
348
  "@typescript-eslint/explicit-member-accessibility": "off",
307
349
  "@typescript-eslint/explicit-function-return-type": "off",
308
350
  "@typescript-eslint/explicit-module-boundary-types": "off",
309
- "@typescript-eslint/consistent-indexed-object-style": "off"
310
- },
311
- // Overrides built-in rules
312
- ...options.overrides
351
+ "@typescript-eslint/consistent-indexed-object-style": "off",
352
+ // Overrides rules
353
+ ...options.overrides
354
+ }
313
355
  });
314
356
  return configs;
315
357
  };
316
358
  var typescript = (options = {}) => [
317
359
  ...typescriptCore(options),
318
360
  {
319
- name: "ntnyq/ts/dts",
320
- files: [GLOB_DTS],
361
+ name: "ntnyq/ts/types",
362
+ files: [GLOB_DTS, "**/types/**/*.ts"],
321
363
  rules: {
322
364
  "no-use-before-define": "off",
323
365
  "no-restricted-syntax": "off",
324
366
  "import/no-duplicates": "off",
325
- "import/newline-after-import": "off"
326
- }
327
- },
328
- {
329
- name: "ntnyq/ts/test",
330
- files: ["**/*.{spec,test}.ts?(x)"],
331
- rules: {
332
- "no-unused-expressions": "off",
333
- "max-lines-per-function": "off"
367
+ "import/newline-after-import": "off",
368
+ "@typescript-eslint/no-use-before-define": "off"
334
369
  }
335
- },
336
- {
337
- name: "ntnyq/ts/cjs",
338
- files: [GLOB_JS],
339
- rules: {}
340
370
  }
341
371
  ];
342
372
 
@@ -462,6 +492,7 @@ var vue = (options = {}) => {
462
492
  "vue/no-irregular-whitespace": "error",
463
493
  "vue/no-use-v-else-with-v-for": "error",
464
494
  "vue/require-typed-object-prop": "error",
495
+ "vue/no-deprecated-delete-set": "error",
465
496
  "vue/no-extra-parens": ["error", "functions"],
466
497
  "vue/no-restricted-syntax": [
467
498
  "error",
@@ -608,7 +639,7 @@ var vue = (options = {}) => {
608
639
  multiline: 1
609
640
  }
610
641
  ],
611
- // Overrides built-in rules
642
+ // Overrides rules
612
643
  ...options.overrides
613
644
  }
614
645
  }
@@ -631,7 +662,7 @@ var yml = (options = {}) => [
631
662
  ...import_eslint_plugin_yml.default.configs.prettier.rules,
632
663
  "yml/no-empty-mapping-value": "off",
633
664
  "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
634
- // Overrides built-in rules
665
+ // Overrides rules
635
666
  ...options.overrides
636
667
  }
637
668
  }
@@ -653,244 +684,255 @@ var node = (options = {}) => [
653
684
  "node/prefer-global/buffer": ["error", "never"],
654
685
  "node/prefer-global/process": ["error", "never"],
655
686
  "node/process-exit-as-throw": "error",
656
- // Overrides built-in rules
687
+ // Overrides rules
657
688
  ...options.overrides
658
689
  }
659
690
  }
660
691
  ];
661
692
 
662
693
  // src/configs/sort.ts
663
- var sortPackageJson = () => [
664
- {
665
- name: "ntnyq/sort/package-json",
666
- files: ["**/package.json"],
667
- rules: {
668
- "jsonc/sort-keys": [
669
- "error",
670
- {
671
- pathPattern: "^$",
672
- order: [
673
- "publisher",
674
- "name",
675
- "displayName",
676
- "preview",
677
- "type",
678
- "version",
679
- "private",
680
- "packageManager",
681
- "description",
682
- "keywords",
683
- "license",
684
- "author",
685
- "homepage",
686
- "repository",
687
- "funding",
688
- "exports",
689
- "main",
690
- "module",
691
- "unpkg",
692
- "jsdelivr",
693
- // workaround for `type: "module"` with TS `moduleResolution: "node16"`
694
- "types",
695
- "typesVersions",
696
- "bin",
697
- "icon",
698
- "files",
699
- "sideEffects",
700
- "scripts",
701
- "peerDependencies",
702
- "peerDependenciesMeta",
703
- "dependencies",
704
- "optionalDependencies",
705
- "devDependencies",
706
- "activationEvents",
707
- "contributes",
708
- "categories",
709
- "engines",
710
- "pnpm",
711
- "overrides",
712
- "resolutions",
713
- "husky",
714
- "prettier",
715
- "nano-staged",
716
- "lint-staged",
717
- "eslintConfig"
718
- ]
719
- },
720
- {
721
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
722
- order: { type: "asc" }
723
- },
724
- {
725
- order: { type: "asc" },
726
- pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
727
- },
728
- {
729
- pathPattern: "^exports.*$",
730
- order: ["types", "import", "require", "default"]
731
- },
732
- {
733
- pathPattern: "^scripts$",
734
- order: { type: "asc" }
735
- },
736
- {
737
- order: [
738
- // client hooks only
739
- "pre-commit",
740
- "prepare-commit-msg",
741
- "commit-msg",
742
- "post-commit",
743
- "pre-rebase",
744
- "post-rewrite",
745
- "post-checkout",
746
- "post-merge",
747
- "pre-push",
748
- "pre-auto-gc"
749
- ],
750
- pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
751
- }
752
- ],
753
- "jsonc/sort-array-values": [
754
- "error",
755
- {
756
- pathPattern: "^files$",
757
- order: { type: "asc" }
758
- }
759
- ]
760
- }
694
+ var sort = (options = {}) => {
695
+ const configs = [];
696
+ if (options.tsconfig ?? true) {
697
+ configs.push({
698
+ name: "ntnyq/sort/tsconfig",
699
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
700
+ rules: {
701
+ "jsonc/sort-keys": [
702
+ "error",
703
+ {
704
+ order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
705
+ pathPattern: "^$"
706
+ },
707
+ {
708
+ order: [
709
+ /* Projects */
710
+ "incremental",
711
+ "composite",
712
+ "tsBuildInfoFile",
713
+ "disableSourceOfProjectReferenceRedirect",
714
+ "disableSolutionSearching",
715
+ "disableReferencedProjectLoad",
716
+ /* Language and Environment */
717
+ "target",
718
+ "lib",
719
+ "jsx",
720
+ "experimentalDecorators",
721
+ "emitDecoratorMetadata",
722
+ "jsxFactory",
723
+ "jsxFragmentFactory",
724
+ "jsxImportSource",
725
+ "reactNamespace",
726
+ "noLib",
727
+ "useDefineForClassFields",
728
+ "moduleDetection",
729
+ /* Modules */
730
+ "module",
731
+ "rootDir",
732
+ "moduleResolution",
733
+ "baseUrl",
734
+ "paths",
735
+ "rootDirs",
736
+ "typeRoots",
737
+ "types",
738
+ "allowUmdGlobalAccess",
739
+ "moduleSuffixes",
740
+ "allowImportingTsExtensions",
741
+ "resolvePackageJsonExports",
742
+ "resolvePackageJsonImports",
743
+ "customConditions",
744
+ "resolveJsonModule",
745
+ "allowArbitraryExtensions",
746
+ "noResolve",
747
+ /* JavaScript Support */
748
+ "allowJs",
749
+ "checkJs",
750
+ "maxNodeModuleJsDepth",
751
+ /* Emit */
752
+ "declaration",
753
+ "declarationMap",
754
+ "emitDeclarationOnly",
755
+ "sourceMap",
756
+ "inlineSourceMap",
757
+ "outFile",
758
+ "outDir",
759
+ "removeComments",
760
+ "noEmit",
761
+ "importHelpers",
762
+ "importsNotUsedAsValues",
763
+ "downlevelIteration",
764
+ "sourceRoot",
765
+ "mapRoot",
766
+ "inlineSources",
767
+ "emitBOM",
768
+ "newLine",
769
+ "stripInternal",
770
+ "noEmitHelpers",
771
+ "noEmitOnError",
772
+ "preserveConstEnums",
773
+ "declarationDir",
774
+ "preserveValueImports",
775
+ /* Interop Constraints */
776
+ "isolatedModules",
777
+ "verbatimModuleSyntax",
778
+ "allowSyntheticDefaultImports",
779
+ "esModuleInterop",
780
+ "preserveSymlinks",
781
+ "forceConsistentCasingInFileNames",
782
+ /* Type Checking */
783
+ "strict",
784
+ "strictBindCallApply",
785
+ "strictFunctionTypes",
786
+ "strictNullChecks",
787
+ "strictPropertyInitialization",
788
+ "allowUnreachableCode",
789
+ "allowUnusedLabels",
790
+ "alwaysStrict",
791
+ "exactOptionalPropertyTypes",
792
+ "noFallthroughCasesInSwitch",
793
+ "noImplicitAny",
794
+ "noImplicitOverride",
795
+ "noImplicitReturns",
796
+ "noImplicitThis",
797
+ "noPropertyAccessFromIndexSignature",
798
+ "noUncheckedIndexedAccess",
799
+ "noUnusedLocals",
800
+ "noUnusedParameters",
801
+ "useUnknownInCatchVariables",
802
+ /* Completeness */
803
+ "skipDefaultLibCheck",
804
+ "skipLibCheck"
805
+ ],
806
+ pathPattern: "^compilerOptions$"
807
+ }
808
+ ]
809
+ }
810
+ });
761
811
  }
762
- ];
763
- var sortTsConfig = () => [
764
- {
765
- name: "ntnyq/sort/tsconfig",
766
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
767
- rules: {
768
- "jsonc/sort-keys": [
769
- "error",
770
- {
771
- order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
772
- pathPattern: "^$"
773
- },
774
- {
775
- order: [
776
- /* Projects */
777
- "incremental",
778
- "composite",
779
- "tsBuildInfoFile",
780
- "disableSourceOfProjectReferenceRedirect",
781
- "disableSolutionSearching",
782
- "disableReferencedProjectLoad",
783
- /* Language and Environment */
784
- "target",
785
- "lib",
786
- "jsx",
787
- "experimentalDecorators",
788
- "emitDecoratorMetadata",
789
- "jsxFactory",
790
- "jsxFragmentFactory",
791
- "jsxImportSource",
792
- "reactNamespace",
793
- "noLib",
794
- "useDefineForClassFields",
795
- "moduleDetection",
796
- /* Modules */
797
- "module",
798
- "rootDir",
799
- "moduleResolution",
800
- "baseUrl",
801
- "paths",
802
- "rootDirs",
803
- "typeRoots",
804
- "types",
805
- "allowUmdGlobalAccess",
806
- "moduleSuffixes",
807
- "allowImportingTsExtensions",
808
- "resolvePackageJsonExports",
809
- "resolvePackageJsonImports",
810
- "customConditions",
811
- "resolveJsonModule",
812
- "allowArbitraryExtensions",
813
- "noResolve",
814
- /* JavaScript Support */
815
- "allowJs",
816
- "checkJs",
817
- "maxNodeModuleJsDepth",
818
- /* Emit */
819
- "declaration",
820
- "declarationMap",
821
- "emitDeclarationOnly",
822
- "sourceMap",
823
- "inlineSourceMap",
824
- "outFile",
825
- "outDir",
826
- "removeComments",
827
- "noEmit",
828
- "importHelpers",
829
- "importsNotUsedAsValues",
830
- "downlevelIteration",
831
- "sourceRoot",
832
- "mapRoot",
833
- "inlineSources",
834
- "emitBOM",
835
- "newLine",
836
- "stripInternal",
837
- "noEmitHelpers",
838
- "noEmitOnError",
839
- "preserveConstEnums",
840
- "declarationDir",
841
- "preserveValueImports",
842
- /* Interop Constraints */
843
- "isolatedModules",
844
- "verbatimModuleSyntax",
845
- "allowSyntheticDefaultImports",
846
- "esModuleInterop",
847
- "preserveSymlinks",
848
- "forceConsistentCasingInFileNames",
849
- /* Type Checking */
850
- "strict",
851
- "strictBindCallApply",
852
- "strictFunctionTypes",
853
- "strictNullChecks",
854
- "strictPropertyInitialization",
855
- "allowUnreachableCode",
856
- "allowUnusedLabels",
857
- "alwaysStrict",
858
- "exactOptionalPropertyTypes",
859
- "noFallthroughCasesInSwitch",
860
- "noImplicitAny",
861
- "noImplicitOverride",
862
- "noImplicitReturns",
863
- "noImplicitThis",
864
- "noPropertyAccessFromIndexSignature",
865
- "noUncheckedIndexedAccess",
866
- "noUnusedLocals",
867
- "noUnusedParameters",
868
- "useUnknownInCatchVariables",
869
- /* Completeness */
870
- "skipDefaultLibCheck",
871
- "skipLibCheck"
872
- ],
873
- pathPattern: "^compilerOptions$"
874
- }
875
- ]
876
- }
812
+ if (options.packageJson ?? true) {
813
+ configs.push({
814
+ name: "ntnyq/sort/package-json",
815
+ files: ["**/package.json"],
816
+ rules: {
817
+ "jsonc/sort-keys": [
818
+ "error",
819
+ {
820
+ pathPattern: "^$",
821
+ order: [
822
+ "publisher",
823
+ "name",
824
+ "displayName",
825
+ "preview",
826
+ "type",
827
+ "version",
828
+ "private",
829
+ "packageManager",
830
+ "description",
831
+ "keywords",
832
+ "license",
833
+ "author",
834
+ "homepage",
835
+ "repository",
836
+ "funding",
837
+ "exports",
838
+ "main",
839
+ "module",
840
+ "unpkg",
841
+ "jsdelivr",
842
+ // workaround for `type: "module"` with TS `moduleResolution: "node16"`
843
+ "types",
844
+ "typesVersions",
845
+ "bin",
846
+ "icon",
847
+ "files",
848
+ "sideEffects",
849
+ "scripts",
850
+ "peerDependencies",
851
+ "peerDependenciesMeta",
852
+ "dependencies",
853
+ "optionalDependencies",
854
+ "devDependencies",
855
+ "activationEvents",
856
+ "contributes",
857
+ "categories",
858
+ "engines",
859
+ "pnpm",
860
+ "overrides",
861
+ "resolutions",
862
+ "husky",
863
+ "prettier",
864
+ "nano-staged",
865
+ "lint-staged",
866
+ "eslintConfig"
867
+ ]
868
+ },
869
+ {
870
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
871
+ order: { type: "asc" }
872
+ },
873
+ {
874
+ order: { type: "asc" },
875
+ pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
876
+ },
877
+ {
878
+ pathPattern: "^exports.*$",
879
+ order: ["types", "import", "require", "default"]
880
+ },
881
+ {
882
+ pathPattern: "^scripts$",
883
+ order: { type: "asc" }
884
+ },
885
+ {
886
+ order: [
887
+ // client hooks only
888
+ "pre-commit",
889
+ "prepare-commit-msg",
890
+ "commit-msg",
891
+ "post-commit",
892
+ "pre-rebase",
893
+ "post-rewrite",
894
+ "post-checkout",
895
+ "post-merge",
896
+ "pre-push",
897
+ "pre-auto-gc"
898
+ ],
899
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
900
+ }
901
+ ],
902
+ "jsonc/sort-array-values": [
903
+ "error",
904
+ {
905
+ pathPattern: "^files$",
906
+ order: { type: "asc" }
907
+ }
908
+ ]
909
+ }
910
+ });
877
911
  }
878
- ];
879
- var sortI18nLocale = () => [
880
- {
881
- name: "ntnyq/sort/i18n-locale",
882
- files: ["**/{locales,i18n}/*.json", "**/{locales,i18n}/*.y?(a)ml"],
883
- rules: {
884
- "jsonc/sort-keys": [
885
- "error",
886
- {
887
- pathPattern: ".*",
888
- order: { type: "asc" }
889
- }
890
- ]
891
- }
912
+ if (options.i18nLocale ?? true) {
913
+ configs.push({
914
+ name: "ntnyq/sort/i18n-locale",
915
+ files: ["**/{locales,i18n}/*.json", "**/{locales,i18n}/*.y?(a)ml"],
916
+ rules: {
917
+ "jsonc/sort-keys": [
918
+ "error",
919
+ {
920
+ pathPattern: ".*",
921
+ order: { type: "asc" }
922
+ }
923
+ ],
924
+ "yml/sort-keys": [
925
+ "error",
926
+ {
927
+ pathPattern: ".*",
928
+ order: { type: "asc" }
929
+ }
930
+ ]
931
+ }
932
+ });
892
933
  }
893
- ];
934
+ return configs;
935
+ };
894
936
 
895
937
  // src/configs/toml.ts
896
938
  var toml = (options = {}) => [
@@ -923,11 +965,39 @@ var toml = (options = {}) => [
923
965
  "toml/quoted-keys": "error",
924
966
  "toml/spaced-comment": "error",
925
967
  "toml/table-bracket-spacing": "error",
926
- // Overrides built-in rules
968
+ // Overrides rules
969
+ ...options.overrides
970
+ }
971
+ }
972
+ ];
973
+
974
+ // src/configs/test.ts
975
+ var test = (options = {}) => [
976
+ {
977
+ name: "ntnyq/test",
978
+ files: [...GLOB_TEST],
979
+ rules: {
980
+ "no-unused-expressions": "off",
981
+ "max-lines-per-function": "off",
982
+ // Overrides rules
927
983
  ...options.overrides
928
984
  }
929
985
  }
930
986
  ];
987
+ var vitest = (options = {}) => [
988
+ {
989
+ name: "ntnyq/vitest",
990
+ plugins: {
991
+ vitest: import_eslint_plugin2.default
992
+ },
993
+ files: [...GLOB_TEST],
994
+ rules: {
995
+ ...import_eslint_plugin2.default.configs.recommended.rules,
996
+ // Overrides rules
997
+ ...options.overridesVitestRules
998
+ }
999
+ }
1000
+ ];
931
1001
 
932
1002
  // src/configs/antfu.ts
933
1003
  var antfu = (options = {}) => [
@@ -941,6 +1011,7 @@ var antfu = (options = {}) => [
941
1011
  // 'antfu/consistent-list-newline': 'error',
942
1012
  "antfu/import-dedupe": "error",
943
1013
  "antfu/top-level-function": "error",
1014
+ // Overrides rules
944
1015
  ...options.overrides
945
1016
  }
946
1017
  }
@@ -971,7 +1042,7 @@ var jsdoc = (options = {}) => [
971
1042
  "jsdoc/require-yields-check": "warn",
972
1043
  "jsdoc/check-alignment": "warn",
973
1044
  "jsdoc/multiline-blocks": "warn",
974
- // Overrides built-in rules
1045
+ // Overrides rules
975
1046
  ...options.overrides
976
1047
  }
977
1048
  }
@@ -1016,7 +1087,22 @@ var jsonc = (options = {}) => [
1016
1087
  allowMultiplePropertiesPerLine: true
1017
1088
  }
1018
1089
  ],
1019
- // Overrides built-in rules
1090
+ // Overrides rules
1091
+ ...options.overrides
1092
+ }
1093
+ }
1094
+ ];
1095
+
1096
+ // src/configs/ntnyq.ts
1097
+ var ntnyq = (options = {}) => [
1098
+ {
1099
+ name: "ntnyq/ntnyq",
1100
+ plugins: {
1101
+ ntnyq: import_eslint_plugin_ntnyq.default
1102
+ },
1103
+ rules: {
1104
+ "ntnyq/no-member-accessibility": "error",
1105
+ // Overrides rules
1020
1106
  ...options.overrides
1021
1107
  }
1022
1108
  }
@@ -1030,7 +1116,7 @@ var regexp = (options = {}) => [
1030
1116
  {
1031
1117
  name: "ntnyq/regexp",
1032
1118
  ...pluginRegexp.configs["flat/recommended"],
1033
- // Overrides built-in rules
1119
+ // Overrides rules
1034
1120
  ...options.overrides
1035
1121
  }
1036
1122
  ];
@@ -1046,23 +1132,7 @@ var unocss = (options = {}) => [
1046
1132
  "unocss/order": "error",
1047
1133
  // We don't use this
1048
1134
  "unocss/order-attributify": "off",
1049
- // Overrides built-in rules
1050
- ...options.overrides
1051
- }
1052
- }
1053
- ];
1054
-
1055
- // src/configs/vitest.ts
1056
- var vitest = (options = {}) => [
1057
- {
1058
- name: "ntnyq/vitest",
1059
- plugins: {
1060
- vitest: import_eslint_plugin2.default
1061
- },
1062
- files: [GLOB_TEST],
1063
- rules: {
1064
- ...import_eslint_plugin2.default.configs.recommended.rules,
1065
- // Overrides built-in rules
1135
+ // Overrides rules
1066
1136
  ...options.overrides
1067
1137
  }
1068
1138
  }
@@ -1105,14 +1175,16 @@ var imports = (options = {}) => [
1105
1175
  "import/no-unresolved": "off",
1106
1176
  "import/no-absolute-path": "off",
1107
1177
  "import/no-named-as-default-member": "off",
1108
- // 'import/no-named-default': 'error',
1178
+ "import/no-named-default": "off",
1179
+ // disabled in favor or `perfectionist/sort-imports`
1180
+ "import/order": "off",
1109
1181
  "import/first": "error",
1110
1182
  "import/export": "error",
1111
1183
  "import/no-self-import": "error",
1112
1184
  "import/no-duplicates": "error",
1113
1185
  "import/no-mutable-exports": "error",
1114
1186
  "import/newline-after-import": "error",
1115
- // Overrides built-in rules
1187
+ // Overrides rules
1116
1188
  ...options.overrides
1117
1189
  }
1118
1190
  }
@@ -1131,6 +1203,10 @@ var unicorn = (options = {}) => [
1131
1203
  "unicorn/prefer-top-level-await": "off",
1132
1204
  "unicorn/explicit-length-check": "off",
1133
1205
  "unicorn/no-array-callback-reference": "off",
1206
+ /**
1207
+ * @see https://caniuse.com/?search=globalThis
1208
+ */
1209
+ "unicorn/prefer-global-this": "off",
1134
1210
  "unicorn/error-message": "error",
1135
1211
  "unicorn/escape-case": "error",
1136
1212
  "unicorn/no-new-buffer": "error",
@@ -1160,6 +1236,8 @@ var unicorn = (options = {}) => [
1160
1236
  "unicorn/prefer-optional-catch-binding": "error",
1161
1237
  "unicorn/prefer-prototype-methods": "error",
1162
1238
  "unicorn/prefer-reflect-apply": "error",
1239
+ "unicorn/prefer-math-min-max": "error",
1240
+ "unicorn/consistent-existence-index-check": "error",
1163
1241
  "unicorn/catch-error-name": [
1164
1242
  "error",
1165
1243
  {
@@ -1190,12 +1268,50 @@ var unicorn = (options = {}) => [
1190
1268
  "unicorn/prefer-array-some": "error",
1191
1269
  "unicorn/prefer-array-flat-map": "error",
1192
1270
  "unicorn/prefer-array-index-of": "error",
1193
- // Overrides built-in rules
1271
+ // Overrides rules
1194
1272
  ...options.overrides
1195
1273
  }
1196
1274
  }
1197
1275
  ];
1198
1276
 
1277
+ // src/configs/specials.ts
1278
+ var import_globals = __toESM(require("globals"), 1);
1279
+ var specials = () => [
1280
+ {
1281
+ name: "ntnyq/specials/scripts",
1282
+ files: [`**/scripts/${GLOB_SRC}`],
1283
+ rules: {
1284
+ "no-console": "off",
1285
+ "@typescript-eslint/explicit-function-return-type": "off"
1286
+ }
1287
+ },
1288
+ {
1289
+ name: "ntnyq/specials/cli",
1290
+ files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1291
+ rules: {
1292
+ "no-console": "off",
1293
+ "@typescript-eslint/explicit-function-return-type": "off"
1294
+ }
1295
+ },
1296
+ {
1297
+ name: "ntnyq/specials/userscript",
1298
+ files: [`**/*.user.${GLOB_SRC_EXT}`],
1299
+ languageOptions: {
1300
+ globals: {
1301
+ ...import_globals.default.greasemonkey
1302
+ }
1303
+ },
1304
+ rules: {
1305
+ camelcase: [
1306
+ "error",
1307
+ {
1308
+ allow: ["^GM_.+"]
1309
+ }
1310
+ ]
1311
+ }
1312
+ }
1313
+ ];
1314
+
1199
1315
  // src/configs/comments.ts
1200
1316
  var comments = (options = {}) => [
1201
1317
  {
@@ -1206,7 +1322,7 @@ var comments = (options = {}) => [
1206
1322
  rules: {
1207
1323
  ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
1208
1324
  "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
1209
- // Overrides built-in rules
1325
+ // Overrides rules
1210
1326
  ...options.overrides
1211
1327
  }
1212
1328
  }
@@ -1244,7 +1360,7 @@ var markdown = (options = {}) => {
1244
1360
  "@typescript-eslint/no-use-before-define": "off",
1245
1361
  "@typescript-eslint/no-unused-expressions": "off",
1246
1362
  "@typescript-eslint/consistent-type-imports": "off",
1247
- // Overrides built-in rules
1363
+ // Overrides rules
1248
1364
  ...options.overrides
1249
1365
  }
1250
1366
  }
@@ -1298,7 +1414,7 @@ var prettier = (options = {}) => [
1298
1414
  "vue/template-curly-spacing": "off",
1299
1415
  ...import_eslint_plugin_prettier.default.configs.recommended.rules,
1300
1416
  "prettier/prettier": options.level || "warn",
1301
- // Overrides built-in rules
1417
+ // Overrides rules
1302
1418
  ...options.overrides
1303
1419
  }
1304
1420
  },
@@ -1307,7 +1423,7 @@ var prettier = (options = {}) => [
1307
1423
  */
1308
1424
  {
1309
1425
  name: "ntnyq/prettier/disabled",
1310
- files: [GLOB_TOML],
1426
+ files: [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
1311
1427
  plugins: {
1312
1428
  prettier: import_eslint_plugin_prettier.default
1313
1429
  },
@@ -1328,7 +1444,7 @@ var gitignore = (options = {}) => [
1328
1444
 
1329
1445
  // src/configs/javascript.ts
1330
1446
  var import_js = __toESM(require("@eslint/js"), 1);
1331
- var import_globals = __toESM(require("globals"), 1);
1447
+ var import_globals2 = __toESM(require("globals"), 1);
1332
1448
  var javascript = (options = {}) => {
1333
1449
  const strictRules = {
1334
1450
  complexity: ["error", { max: 30 }],
@@ -1361,13 +1477,19 @@ var javascript = (options = {}) => {
1361
1477
  name: "ntnyq/js/core",
1362
1478
  languageOptions: {
1363
1479
  globals: {
1364
- ...import_globals.default.browser,
1365
- ...import_globals.default.es2021,
1366
- ...import_globals.default.node
1480
+ ...import_globals2.default.browser,
1481
+ ...import_globals2.default.es2021,
1482
+ ...import_globals2.default.node
1367
1483
  },
1368
1484
  sourceType: "module"
1369
1485
  },
1370
1486
  rules: {
1487
+ "require-await": "off",
1488
+ "no-return-assign": "off",
1489
+ "no-useless-escape": "off",
1490
+ "consistent-return": "off",
1491
+ // disabled in favor of `perfectionist/sort-named-imports`
1492
+ "sort-imports": "off",
1371
1493
  // standard v17.0.0
1372
1494
  "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
1373
1495
  camelcase: [
@@ -1515,55 +1637,27 @@ var javascript = (options = {}) => {
1515
1637
  eqeqeq: ["error", "smart"],
1516
1638
  "array-callback-return": "error",
1517
1639
  "block-scoped-var": "error",
1518
- "consistent-return": "off",
1519
1640
  "no-alert": "error",
1520
1641
  "no-case-declarations": "error",
1521
1642
  "no-multi-str": "error",
1522
1643
  "no-with": "error",
1523
1644
  "no-void": "error",
1524
- "no-useless-escape": "off",
1525
1645
  "vars-on-top": "error",
1526
- "require-await": "off",
1527
- "no-return-assign": "off",
1528
1646
  "one-var": ["error", "never"],
1529
1647
  "no-use-before-define": [
1530
1648
  "error",
1531
1649
  {
1532
1650
  functions: false,
1533
1651
  classes: false,
1534
- variables: true
1535
- }
1536
- ],
1537
- "sort-imports": [
1538
- "error",
1539
- {
1540
- ignoreCase: false,
1541
- ignoreDeclarationSort: true,
1542
- ignoreMemberSort: false,
1543
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
1544
- allowSeparatedGroups: false
1652
+ variables: true,
1653
+ allowNamedExports: false
1545
1654
  }
1546
1655
  ],
1547
1656
  // Strict rules
1548
1657
  ...options.strict ? strictRules : {},
1549
- // Overrides built-in rules
1658
+ // Overrides rules
1550
1659
  ...options.overrides
1551
1660
  }
1552
- },
1553
- {
1554
- name: "ntnyq/js/scripts",
1555
- files: ["**/scripts/*", "**/cli.*"],
1556
- rules: {
1557
- "no-console": "off"
1558
- }
1559
- },
1560
- {
1561
- name: "ntnyq/js/test",
1562
- files: ["**/*.{test,spec}.js?(x)"],
1563
- rules: {
1564
- "no-unused-expressions": "off",
1565
- "max-lines-per-function": "off"
1566
- }
1567
1661
  }
1568
1662
  ];
1569
1663
  };
@@ -1628,8 +1722,8 @@ var perfectionist = (options = {}) => [
1628
1722
  */
1629
1723
  "unknown"
1630
1724
  ],
1631
- order: "asc",
1632
- type: "natural",
1725
+ order: options.imports?.order || "asc",
1726
+ type: options.imports?.type || "natural",
1633
1727
  ignoreCase: true,
1634
1728
  internalPattern: ["~/**", "@/**", "#**"],
1635
1729
  newlinesBetween: "ignore"
@@ -1638,13 +1732,30 @@ var perfectionist = (options = {}) => [
1638
1732
  "perfectionist/sort-exports": [
1639
1733
  "error",
1640
1734
  {
1641
- order: "asc",
1642
- type: "line-length"
1735
+ order: options.exports?.order || "asc",
1736
+ type: options.exports?.type || "line-length"
1737
+ }
1738
+ ],
1739
+ "perfectionist/sort-named-exports": [
1740
+ "error",
1741
+ {
1742
+ type: options.namedExports?.type || "alphabetical",
1743
+ order: options.namedExports?.order || "asc",
1744
+ ignoreCase: true,
1745
+ groupKind: "values-first"
1643
1746
  }
1644
1747
  ],
1645
- "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
1646
- "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }],
1647
- // Overrides built-in rules
1748
+ "perfectionist/sort-named-imports": [
1749
+ "error",
1750
+ {
1751
+ type: options.namedImports?.type || "alphabetical",
1752
+ order: options.namedImports?.order || "asc",
1753
+ ignoreCase: true,
1754
+ ignoreAlias: false,
1755
+ groupKind: "values-first"
1756
+ }
1757
+ ],
1758
+ // Overrides rules
1648
1759
  ...options.overrides
1649
1760
  }
1650
1761
  }
@@ -1661,15 +1772,19 @@ var unusedImports = (options = {}) => [
1661
1772
  "@typescript-eslint/no-unused-vars": "off",
1662
1773
  "unused-imports/no-unused-imports": "error",
1663
1774
  "unused-imports/no-unused-vars": [
1664
- "warn",
1775
+ "error",
1665
1776
  {
1666
1777
  vars: "all",
1667
1778
  varsIgnorePattern: "^_",
1668
1779
  args: "after-used",
1669
- argsIgnorePattern: "^_"
1780
+ argsIgnorePattern: "^_",
1781
+ ignoreRestSiblings: true,
1782
+ destructuredArrayIgnorePattern: "^_",
1783
+ caughtErrors: "all",
1784
+ caughtErrorsIgnorePattern: "^_"
1670
1785
  }
1671
1786
  ],
1672
- // Overrides built-in rules
1787
+ // Overrides rules
1673
1788
  ...options.overrides
1674
1789
  }
1675
1790
  }
@@ -1719,7 +1834,7 @@ function getOverrides(options, key) {
1719
1834
  }
1720
1835
 
1721
1836
  // src/core.ts
1722
- function ntnyq(options = {}, userConfigs = []) {
1837
+ function defineESLintConfig(options = {}, userConfigs = []) {
1723
1838
  const configs = [];
1724
1839
  if (options.gitignore ?? true) {
1725
1840
  configs.push(
@@ -1745,6 +1860,7 @@ function ntnyq(options = {}, userConfigs = []) {
1745
1860
  if (options.perfectionist ?? true) {
1746
1861
  configs.push(
1747
1862
  ...perfectionist({
1863
+ ...resolveSubOptions(options, "perfectionist"),
1748
1864
  overrides: getOverrides(options, "perfectionist")
1749
1865
  })
1750
1866
  );
@@ -1785,15 +1901,6 @@ function ntnyq(options = {}, userConfigs = []) {
1785
1901
  })
1786
1902
  );
1787
1903
  }
1788
- if (options.sortI18nLocale ?? true) {
1789
- configs.push(...sortI18nLocale());
1790
- }
1791
- if (options.sortTsConfig ?? true) {
1792
- configs.push(...sortTsConfig());
1793
- }
1794
- if (options.sortPackageJson ?? true) {
1795
- configs.push(...sortPackageJson());
1796
- }
1797
1904
  if (options.yml ?? true) {
1798
1905
  configs.push(
1799
1906
  ...yml({
@@ -1815,6 +1922,13 @@ function ntnyq(options = {}, userConfigs = []) {
1815
1922
  })
1816
1923
  );
1817
1924
  }
1925
+ if (options.sort ?? true) {
1926
+ configs.push(
1927
+ ...sort({
1928
+ ...resolveSubOptions(options, "sort")
1929
+ })
1930
+ );
1931
+ }
1818
1932
  if (options.vue ?? hasVue) {
1819
1933
  configs.push(
1820
1934
  ...vue({
@@ -1823,10 +1937,13 @@ function ntnyq(options = {}, userConfigs = []) {
1823
1937
  })
1824
1938
  );
1825
1939
  }
1826
- if (options.vitest ?? hasVitest) {
1940
+ if (options.test ?? hasVitest) {
1827
1941
  configs.push(
1942
+ ...test({
1943
+ overrides: getOverrides(options, "test")
1944
+ }),
1828
1945
  ...vitest({
1829
- overrides: getOverrides(options, "vitest")
1946
+ overrides: getOverrides(options, "test")
1830
1947
  })
1831
1948
  );
1832
1949
  }
@@ -1851,6 +1968,7 @@ function ntnyq(options = {}, userConfigs = []) {
1851
1968
  })
1852
1969
  );
1853
1970
  }
1971
+ const configSpecials = specials();
1854
1972
  const configPrettier = options.prettier ?? true ? prettier({
1855
1973
  ...resolveSubOptions(options, "prettier"),
1856
1974
  overrides: getOverrides(options, "prettier")
@@ -1859,6 +1977,7 @@ function ntnyq(options = {}, userConfigs = []) {
1859
1977
  composer.append(
1860
1978
  ...configs,
1861
1979
  ...toArray(userConfigs),
1980
+ ...configSpecials,
1862
1981
  ...configPrettier
1863
1982
  );
1864
1983
  return composer;
@@ -1866,6 +1985,7 @@ function ntnyq(options = {}, userConfigs = []) {
1866
1985
  // Annotate the CommonJS export names for ESM import in node:
1867
1986
  0 && (module.exports = {
1868
1987
  GLOB_ALL_SRC,
1988
+ GLOB_ASTRO,
1869
1989
  GLOB_CSS,
1870
1990
  GLOB_DIST,
1871
1991
  GLOB_DTS,
@@ -1886,6 +2006,7 @@ function ntnyq(options = {}, userConfigs = []) {
1886
2006
  GLOB_SRC,
1887
2007
  GLOB_SRC_EXT,
1888
2008
  GLOB_STYLE,
2009
+ GLOB_SVELTE,
1889
2010
  GLOB_TEST,
1890
2011
  GLOB_TOML,
1891
2012
  GLOB_TS,
@@ -1895,6 +2016,7 @@ function ntnyq(options = {}, userConfigs = []) {
1895
2016
  antfu,
1896
2017
  command,
1897
2018
  comments,
2019
+ defineESLintConfig,
1898
2020
  getOverrides,
1899
2021
  gitignore,
1900
2022
  hasTypeScript,
@@ -1924,6 +2046,7 @@ function ntnyq(options = {}, userConfigs = []) {
1924
2046
  pluginJsonc,
1925
2047
  pluginMarkdown,
1926
2048
  pluginNode,
2049
+ pluginNtnyq,
1927
2050
  pluginPerfectionist,
1928
2051
  pluginPrettier,
1929
2052
  pluginRegexp,
@@ -1937,9 +2060,9 @@ function ntnyq(options = {}, userConfigs = []) {
1937
2060
  prettier,
1938
2061
  regexp,
1939
2062
  resolveSubOptions,
1940
- sortI18nLocale,
1941
- sortPackageJson,
1942
- sortTsConfig,
2063
+ sort,
2064
+ specials,
2065
+ test,
1943
2066
  toArray,
1944
2067
  toml,
1945
2068
  tseslint,