@ntnyq/eslint-config 3.0.0-beta.9 → 3.0.1

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,259 @@ 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
+ plugins: {
917
+ jsonc: import_eslint_plugin_jsonc.default,
918
+ yml: import_eslint_plugin_yml.default
919
+ },
920
+ rules: {
921
+ "jsonc/sort-keys": [
922
+ "error",
923
+ {
924
+ pathPattern: ".*",
925
+ order: { type: "asc" }
926
+ }
927
+ ],
928
+ "yml/sort-keys": [
929
+ "error",
930
+ {
931
+ pathPattern: ".*",
932
+ order: { type: "asc" }
933
+ }
934
+ ]
935
+ }
936
+ });
892
937
  }
893
- ];
938
+ return configs;
939
+ };
894
940
 
895
941
  // src/configs/toml.ts
896
942
  var toml = (options = {}) => [
@@ -923,11 +969,39 @@ var toml = (options = {}) => [
923
969
  "toml/quoted-keys": "error",
924
970
  "toml/spaced-comment": "error",
925
971
  "toml/table-bracket-spacing": "error",
926
- // Overrides built-in rules
972
+ // Overrides rules
973
+ ...options.overrides
974
+ }
975
+ }
976
+ ];
977
+
978
+ // src/configs/test.ts
979
+ var test = (options = {}) => [
980
+ {
981
+ name: "ntnyq/test",
982
+ files: [...GLOB_TEST],
983
+ rules: {
984
+ "no-unused-expressions": "off",
985
+ "max-lines-per-function": "off",
986
+ // Overrides rules
927
987
  ...options.overrides
928
988
  }
929
989
  }
930
990
  ];
991
+ var vitest = (options = {}) => [
992
+ {
993
+ name: "ntnyq/vitest",
994
+ plugins: {
995
+ vitest: import_eslint_plugin2.default
996
+ },
997
+ files: [...GLOB_TEST],
998
+ rules: {
999
+ ...import_eslint_plugin2.default.configs.recommended.rules,
1000
+ // Overrides rules
1001
+ ...options.overridesVitestRules
1002
+ }
1003
+ }
1004
+ ];
931
1005
 
932
1006
  // src/configs/antfu.ts
933
1007
  var antfu = (options = {}) => [
@@ -941,6 +1015,7 @@ var antfu = (options = {}) => [
941
1015
  // 'antfu/consistent-list-newline': 'error',
942
1016
  "antfu/import-dedupe": "error",
943
1017
  "antfu/top-level-function": "error",
1018
+ // Overrides rules
944
1019
  ...options.overrides
945
1020
  }
946
1021
  }
@@ -971,7 +1046,7 @@ var jsdoc = (options = {}) => [
971
1046
  "jsdoc/require-yields-check": "warn",
972
1047
  "jsdoc/check-alignment": "warn",
973
1048
  "jsdoc/multiline-blocks": "warn",
974
- // Overrides built-in rules
1049
+ // Overrides rules
975
1050
  ...options.overrides
976
1051
  }
977
1052
  }
@@ -1016,7 +1091,22 @@ var jsonc = (options = {}) => [
1016
1091
  allowMultiplePropertiesPerLine: true
1017
1092
  }
1018
1093
  ],
1019
- // Overrides built-in rules
1094
+ // Overrides rules
1095
+ ...options.overrides
1096
+ }
1097
+ }
1098
+ ];
1099
+
1100
+ // src/configs/ntnyq.ts
1101
+ var ntnyq = (options = {}) => [
1102
+ {
1103
+ name: "ntnyq/ntnyq",
1104
+ plugins: {
1105
+ ntnyq: import_eslint_plugin_ntnyq.default
1106
+ },
1107
+ rules: {
1108
+ "ntnyq/no-member-accessibility": "error",
1109
+ // Overrides rules
1020
1110
  ...options.overrides
1021
1111
  }
1022
1112
  }
@@ -1030,7 +1120,7 @@ var regexp = (options = {}) => [
1030
1120
  {
1031
1121
  name: "ntnyq/regexp",
1032
1122
  ...pluginRegexp.configs["flat/recommended"],
1033
- // Overrides built-in rules
1123
+ // Overrides rules
1034
1124
  ...options.overrides
1035
1125
  }
1036
1126
  ];
@@ -1046,23 +1136,7 @@ var unocss = (options = {}) => [
1046
1136
  "unocss/order": "error",
1047
1137
  // We don't use this
1048
1138
  "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
1139
+ // Overrides rules
1066
1140
  ...options.overrides
1067
1141
  }
1068
1142
  }
@@ -1105,14 +1179,16 @@ var imports = (options = {}) => [
1105
1179
  "import/no-unresolved": "off",
1106
1180
  "import/no-absolute-path": "off",
1107
1181
  "import/no-named-as-default-member": "off",
1108
- // 'import/no-named-default': 'error',
1182
+ "import/no-named-default": "off",
1183
+ // disabled in favor or `perfectionist/sort-imports`
1184
+ "import/order": "off",
1109
1185
  "import/first": "error",
1110
1186
  "import/export": "error",
1111
1187
  "import/no-self-import": "error",
1112
1188
  "import/no-duplicates": "error",
1113
1189
  "import/no-mutable-exports": "error",
1114
1190
  "import/newline-after-import": "error",
1115
- // Overrides built-in rules
1191
+ // Overrides rules
1116
1192
  ...options.overrides
1117
1193
  }
1118
1194
  }
@@ -1131,6 +1207,10 @@ var unicorn = (options = {}) => [
1131
1207
  "unicorn/prefer-top-level-await": "off",
1132
1208
  "unicorn/explicit-length-check": "off",
1133
1209
  "unicorn/no-array-callback-reference": "off",
1210
+ /**
1211
+ * @see https://caniuse.com/?search=globalThis
1212
+ */
1213
+ "unicorn/prefer-global-this": "off",
1134
1214
  "unicorn/error-message": "error",
1135
1215
  "unicorn/escape-case": "error",
1136
1216
  "unicorn/no-new-buffer": "error",
@@ -1160,6 +1240,8 @@ var unicorn = (options = {}) => [
1160
1240
  "unicorn/prefer-optional-catch-binding": "error",
1161
1241
  "unicorn/prefer-prototype-methods": "error",
1162
1242
  "unicorn/prefer-reflect-apply": "error",
1243
+ "unicorn/prefer-math-min-max": "error",
1244
+ "unicorn/consistent-existence-index-check": "error",
1163
1245
  "unicorn/catch-error-name": [
1164
1246
  "error",
1165
1247
  {
@@ -1190,12 +1272,50 @@ var unicorn = (options = {}) => [
1190
1272
  "unicorn/prefer-array-some": "error",
1191
1273
  "unicorn/prefer-array-flat-map": "error",
1192
1274
  "unicorn/prefer-array-index-of": "error",
1193
- // Overrides built-in rules
1275
+ // Overrides rules
1194
1276
  ...options.overrides
1195
1277
  }
1196
1278
  }
1197
1279
  ];
1198
1280
 
1281
+ // src/configs/specials.ts
1282
+ var import_globals = __toESM(require("globals"), 1);
1283
+ var specials = () => [
1284
+ {
1285
+ name: "ntnyq/specials/scripts",
1286
+ files: [`**/scripts/${GLOB_SRC}`],
1287
+ rules: {
1288
+ "no-console": "off",
1289
+ "@typescript-eslint/explicit-function-return-type": "off"
1290
+ }
1291
+ },
1292
+ {
1293
+ name: "ntnyq/specials/cli",
1294
+ files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1295
+ rules: {
1296
+ "no-console": "off",
1297
+ "@typescript-eslint/explicit-function-return-type": "off"
1298
+ }
1299
+ },
1300
+ {
1301
+ name: "ntnyq/specials/userscript",
1302
+ files: [`**/*.user.${GLOB_SRC_EXT}`],
1303
+ languageOptions: {
1304
+ globals: {
1305
+ ...import_globals.default.greasemonkey
1306
+ }
1307
+ },
1308
+ rules: {
1309
+ camelcase: [
1310
+ "error",
1311
+ {
1312
+ allow: ["^GM_.+"]
1313
+ }
1314
+ ]
1315
+ }
1316
+ }
1317
+ ];
1318
+
1199
1319
  // src/configs/comments.ts
1200
1320
  var comments = (options = {}) => [
1201
1321
  {
@@ -1206,7 +1326,7 @@ var comments = (options = {}) => [
1206
1326
  rules: {
1207
1327
  ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
1208
1328
  "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
1209
- // Overrides built-in rules
1329
+ // Overrides rules
1210
1330
  ...options.overrides
1211
1331
  }
1212
1332
  }
@@ -1244,7 +1364,7 @@ var markdown = (options = {}) => {
1244
1364
  "@typescript-eslint/no-use-before-define": "off",
1245
1365
  "@typescript-eslint/no-unused-expressions": "off",
1246
1366
  "@typescript-eslint/consistent-type-imports": "off",
1247
- // Overrides built-in rules
1367
+ // Overrides rules
1248
1368
  ...options.overrides
1249
1369
  }
1250
1370
  }
@@ -1298,7 +1418,7 @@ var prettier = (options = {}) => [
1298
1418
  "vue/template-curly-spacing": "off",
1299
1419
  ...import_eslint_plugin_prettier.default.configs.recommended.rules,
1300
1420
  "prettier/prettier": options.level || "warn",
1301
- // Overrides built-in rules
1421
+ // Overrides rules
1302
1422
  ...options.overrides
1303
1423
  }
1304
1424
  },
@@ -1307,7 +1427,7 @@ var prettier = (options = {}) => [
1307
1427
  */
1308
1428
  {
1309
1429
  name: "ntnyq/prettier/disabled",
1310
- files: [GLOB_TOML],
1430
+ files: [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
1311
1431
  plugins: {
1312
1432
  prettier: import_eslint_plugin_prettier.default
1313
1433
  },
@@ -1328,7 +1448,7 @@ var gitignore = (options = {}) => [
1328
1448
 
1329
1449
  // src/configs/javascript.ts
1330
1450
  var import_js = __toESM(require("@eslint/js"), 1);
1331
- var import_globals = __toESM(require("globals"), 1);
1451
+ var import_globals2 = __toESM(require("globals"), 1);
1332
1452
  var javascript = (options = {}) => {
1333
1453
  const strictRules = {
1334
1454
  complexity: ["error", { max: 30 }],
@@ -1361,13 +1481,19 @@ var javascript = (options = {}) => {
1361
1481
  name: "ntnyq/js/core",
1362
1482
  languageOptions: {
1363
1483
  globals: {
1364
- ...import_globals.default.browser,
1365
- ...import_globals.default.es2021,
1366
- ...import_globals.default.node
1484
+ ...import_globals2.default.browser,
1485
+ ...import_globals2.default.es2021,
1486
+ ...import_globals2.default.node
1367
1487
  },
1368
1488
  sourceType: "module"
1369
1489
  },
1370
1490
  rules: {
1491
+ "require-await": "off",
1492
+ "no-return-assign": "off",
1493
+ "no-useless-escape": "off",
1494
+ "consistent-return": "off",
1495
+ // disabled in favor of `perfectionist/sort-named-imports`
1496
+ "sort-imports": "off",
1371
1497
  // standard v17.0.0
1372
1498
  "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
1373
1499
  camelcase: [
@@ -1515,55 +1641,27 @@ var javascript = (options = {}) => {
1515
1641
  eqeqeq: ["error", "smart"],
1516
1642
  "array-callback-return": "error",
1517
1643
  "block-scoped-var": "error",
1518
- "consistent-return": "off",
1519
1644
  "no-alert": "error",
1520
1645
  "no-case-declarations": "error",
1521
1646
  "no-multi-str": "error",
1522
1647
  "no-with": "error",
1523
1648
  "no-void": "error",
1524
- "no-useless-escape": "off",
1525
1649
  "vars-on-top": "error",
1526
- "require-await": "off",
1527
- "no-return-assign": "off",
1528
1650
  "one-var": ["error", "never"],
1529
1651
  "no-use-before-define": [
1530
1652
  "error",
1531
1653
  {
1532
1654
  functions: false,
1533
1655
  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
1656
+ variables: true,
1657
+ allowNamedExports: false
1545
1658
  }
1546
1659
  ],
1547
1660
  // Strict rules
1548
1661
  ...options.strict ? strictRules : {},
1549
- // Overrides built-in rules
1662
+ // Overrides rules
1550
1663
  ...options.overrides
1551
1664
  }
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
1665
  }
1568
1666
  ];
1569
1667
  };
@@ -1628,8 +1726,8 @@ var perfectionist = (options = {}) => [
1628
1726
  */
1629
1727
  "unknown"
1630
1728
  ],
1631
- order: "asc",
1632
- type: "natural",
1729
+ order: options.imports?.order || "asc",
1730
+ type: options.imports?.type || "natural",
1633
1731
  ignoreCase: true,
1634
1732
  internalPattern: ["~/**", "@/**", "#**"],
1635
1733
  newlinesBetween: "ignore"
@@ -1638,13 +1736,30 @@ var perfectionist = (options = {}) => [
1638
1736
  "perfectionist/sort-exports": [
1639
1737
  "error",
1640
1738
  {
1641
- order: "asc",
1642
- type: "line-length"
1739
+ order: options.exports?.order || "asc",
1740
+ type: options.exports?.type || "line-length"
1741
+ }
1742
+ ],
1743
+ "perfectionist/sort-named-exports": [
1744
+ "error",
1745
+ {
1746
+ type: options.namedExports?.type || "alphabetical",
1747
+ order: options.namedExports?.order || "asc",
1748
+ ignoreCase: true,
1749
+ groupKind: "values-first"
1643
1750
  }
1644
1751
  ],
1645
- "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
1646
- "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }],
1647
- // Overrides built-in rules
1752
+ "perfectionist/sort-named-imports": [
1753
+ "error",
1754
+ {
1755
+ type: options.namedImports?.type || "alphabetical",
1756
+ order: options.namedImports?.order || "asc",
1757
+ ignoreCase: true,
1758
+ ignoreAlias: false,
1759
+ groupKind: "values-first"
1760
+ }
1761
+ ],
1762
+ // Overrides rules
1648
1763
  ...options.overrides
1649
1764
  }
1650
1765
  }
@@ -1661,15 +1776,19 @@ var unusedImports = (options = {}) => [
1661
1776
  "@typescript-eslint/no-unused-vars": "off",
1662
1777
  "unused-imports/no-unused-imports": "error",
1663
1778
  "unused-imports/no-unused-vars": [
1664
- "warn",
1779
+ "error",
1665
1780
  {
1666
1781
  vars: "all",
1667
1782
  varsIgnorePattern: "^_",
1668
1783
  args: "after-used",
1669
- argsIgnorePattern: "^_"
1784
+ argsIgnorePattern: "^_",
1785
+ ignoreRestSiblings: true,
1786
+ destructuredArrayIgnorePattern: "^_",
1787
+ caughtErrors: "all",
1788
+ caughtErrorsIgnorePattern: "^_"
1670
1789
  }
1671
1790
  ],
1672
- // Overrides built-in rules
1791
+ // Overrides rules
1673
1792
  ...options.overrides
1674
1793
  }
1675
1794
  }
@@ -1719,7 +1838,7 @@ function getOverrides(options, key) {
1719
1838
  }
1720
1839
 
1721
1840
  // src/core.ts
1722
- function ntnyq(options = {}, userConfigs = []) {
1841
+ function defineESLintConfig(options = {}, userConfigs = []) {
1723
1842
  const configs = [];
1724
1843
  if (options.gitignore ?? true) {
1725
1844
  configs.push(
@@ -1745,6 +1864,7 @@ function ntnyq(options = {}, userConfigs = []) {
1745
1864
  if (options.perfectionist ?? true) {
1746
1865
  configs.push(
1747
1866
  ...perfectionist({
1867
+ ...resolveSubOptions(options, "perfectionist"),
1748
1868
  overrides: getOverrides(options, "perfectionist")
1749
1869
  })
1750
1870
  );
@@ -1785,15 +1905,6 @@ function ntnyq(options = {}, userConfigs = []) {
1785
1905
  })
1786
1906
  );
1787
1907
  }
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
1908
  if (options.yml ?? true) {
1798
1909
  configs.push(
1799
1910
  ...yml({
@@ -1815,6 +1926,13 @@ function ntnyq(options = {}, userConfigs = []) {
1815
1926
  })
1816
1927
  );
1817
1928
  }
1929
+ if (options.sort ?? true) {
1930
+ configs.push(
1931
+ ...sort({
1932
+ ...resolveSubOptions(options, "sort")
1933
+ })
1934
+ );
1935
+ }
1818
1936
  if (options.vue ?? hasVue) {
1819
1937
  configs.push(
1820
1938
  ...vue({
@@ -1823,10 +1941,13 @@ function ntnyq(options = {}, userConfigs = []) {
1823
1941
  })
1824
1942
  );
1825
1943
  }
1826
- if (options.vitest ?? hasVitest) {
1944
+ if (options.test ?? hasVitest) {
1827
1945
  configs.push(
1946
+ ...test({
1947
+ overrides: getOverrides(options, "test")
1948
+ }),
1828
1949
  ...vitest({
1829
- overrides: getOverrides(options, "vitest")
1950
+ overrides: getOverrides(options, "test")
1830
1951
  })
1831
1952
  );
1832
1953
  }
@@ -1851,6 +1972,7 @@ function ntnyq(options = {}, userConfigs = []) {
1851
1972
  })
1852
1973
  );
1853
1974
  }
1975
+ const configSpecials = specials();
1854
1976
  const configPrettier = options.prettier ?? true ? prettier({
1855
1977
  ...resolveSubOptions(options, "prettier"),
1856
1978
  overrides: getOverrides(options, "prettier")
@@ -1859,6 +1981,7 @@ function ntnyq(options = {}, userConfigs = []) {
1859
1981
  composer.append(
1860
1982
  ...configs,
1861
1983
  ...toArray(userConfigs),
1984
+ ...configSpecials,
1862
1985
  ...configPrettier
1863
1986
  );
1864
1987
  return composer;
@@ -1866,6 +1989,7 @@ function ntnyq(options = {}, userConfigs = []) {
1866
1989
  // Annotate the CommonJS export names for ESM import in node:
1867
1990
  0 && (module.exports = {
1868
1991
  GLOB_ALL_SRC,
1992
+ GLOB_ASTRO,
1869
1993
  GLOB_CSS,
1870
1994
  GLOB_DIST,
1871
1995
  GLOB_DTS,
@@ -1886,6 +2010,7 @@ function ntnyq(options = {}, userConfigs = []) {
1886
2010
  GLOB_SRC,
1887
2011
  GLOB_SRC_EXT,
1888
2012
  GLOB_STYLE,
2013
+ GLOB_SVELTE,
1889
2014
  GLOB_TEST,
1890
2015
  GLOB_TOML,
1891
2016
  GLOB_TS,
@@ -1895,6 +2020,7 @@ function ntnyq(options = {}, userConfigs = []) {
1895
2020
  antfu,
1896
2021
  command,
1897
2022
  comments,
2023
+ defineESLintConfig,
1898
2024
  getOverrides,
1899
2025
  gitignore,
1900
2026
  hasTypeScript,
@@ -1924,6 +2050,7 @@ function ntnyq(options = {}, userConfigs = []) {
1924
2050
  pluginJsonc,
1925
2051
  pluginMarkdown,
1926
2052
  pluginNode,
2053
+ pluginNtnyq,
1927
2054
  pluginPerfectionist,
1928
2055
  pluginPrettier,
1929
2056
  pluginRegexp,
@@ -1937,9 +2064,9 @@ function ntnyq(options = {}, userConfigs = []) {
1937
2064
  prettier,
1938
2065
  regexp,
1939
2066
  resolveSubOptions,
1940
- sortI18nLocale,
1941
- sortPackageJson,
1942
- sortTsConfig,
2067
+ sort,
2068
+ specials,
2069
+ test,
1943
2070
  toArray,
1944
2071
  toml,
1945
2072
  tseslint,