@ntnyq/eslint-config 7.0.0-beta.3 → 7.0.0-beta.31

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.
Files changed (4) hide show
  1. package/README.md +153 -206
  2. package/dist/index.d.mts +5442 -1642
  3. package/dist/index.mjs +674 -382
  4. package/package.json +63 -62
package/dist/index.mjs CHANGED
@@ -6,6 +6,7 @@ import * as parserToml from "toml-eslint-parser";
6
6
  import * as parserYaml from "yaml-eslint-parser";
7
7
  import * as parserPlain from "eslint-parser-plain";
8
8
  import * as parserJsonc from "jsonc-eslint-parser";
9
+ import pluginShell from "@eslint/shell";
9
10
  import pluginNode from "eslint-plugin-n";
10
11
  import pluginVue from "eslint-plugin-vue";
11
12
  import pluginYml from "eslint-plugin-yml";
@@ -29,6 +30,7 @@ import pluginDeMorgan from "eslint-plugin-de-morgan";
29
30
  import pluginNoOnlyTests from "eslint-plugin-no-only-tests";
30
31
  import pluginGitHubAction from "eslint-plugin-github-action";
31
32
  import pluginPerfectionist from "eslint-plugin-perfectionist";
33
+ import pluginVuePerfectionist from "eslint-plugin-vue-perfectionist";
32
34
  import * as pluginESLintComments from "@eslint-community/eslint-plugin-eslint-comments";
33
35
  import processorVueBlocks from "eslint-processor-vue-blocks";
34
36
  import { resolve } from "node:path";
@@ -40,7 +42,7 @@ import { createTypeScriptImportResolver } from "eslint-import-resolver-typescrip
40
42
  import globals from "globals";
41
43
  import createGitIgnoreConfig from "eslint-config-flat-gitignore";
42
44
  import jsConfig from "@eslint/js";
43
- //#region src/globs.ts
45
+ // src/globs.ts
44
46
  /**
45
47
  * @file globs constants
46
48
  */
@@ -58,6 +60,9 @@ const GLOB_TYPES = [
58
60
  `**/types/${GLOB_TS}`,
59
61
  `**/types.ts`
60
62
  ];
63
+ const GLOB_VUE = "**/*.vue";
64
+ const GLOB_PINIA_STORE = `**/store?(s)/*.${GLOB_SRC_EXT}`;
65
+ const GLOB_VUE_COMPOSABLES = [`**/composables/*.${GLOB_SRC_EXT}`, `**/use*${GLOB_SRC_EXT}`];
61
66
  const GLOB_TYPE_TEST = [`**/*.test-d.${GLOB_SRC_EXT}`, `**/*.spec-d.${GLOB_SRC_EXT}`];
62
67
  const GLOB_TEST = [
63
68
  `**/*.test.${GLOB_SRC_EXT}`,
@@ -79,10 +84,11 @@ const GLOB_JSON_SCHEMA = ["**/*.schema.json", "**/schemas/*.json"];
79
84
  const GLOB_TSCONFIG_JSON = ["**/tsconfig.json", "**/tsconfig.*.json"];
80
85
  const GLOB_YAML = "**/*.y?(a)ml";
81
86
  const GLOB_PNPM_WORKSPACE_YAML = "**/pnpm-workspace.yaml";
87
+ const GLOB_GITHUB_ACTION = "**/.github/workflows/*.y?(a)ml";
82
88
  const GLOB_SVG = "**/*.svg";
83
- const GLOB_VUE = "**/*.vue";
84
89
  const GLOB_SVELTE = "**/*.svelte?(.{js,ts})";
85
90
  const GLOB_TOML = "**/*.toml";
91
+ const GLOB_SHELL = "**/*.{sh,bash}";
86
92
  const GLOB_HTML = "**/*.htm?(l)";
87
93
  const GLOB_ASTRO = "**/*.astro";
88
94
  const GLOB_ASTRO_TS = "**/*.astro/*.ts";
@@ -103,8 +109,6 @@ const GLOB_ALL_SRC = [
103
109
  GLOB_VUE,
104
110
  ...GLOB_SRC_EXTENSIONS
105
111
  ];
106
- const GLOB_PINIA_STORE = `**/store?(s)/*.${GLOB_SRC_EXT}`;
107
- const GLOB_GITHUB_ACTION = "**/.github/workflows/*.y?(a)ml";
108
112
  const GLOB_NODE_MODULES = "**/node_modules/**";
109
113
  const GLOB_DIST = "**/dist/**";
110
114
  const GLOB_LOCKFILE = [
@@ -154,6 +158,9 @@ const GLOB_EXCLUDE = [
154
158
  "**/.npmrc",
155
159
  "**/.yarnrc",
156
160
  "**/.husky",
161
+ "**/test-results/**",
162
+ "**/playwright-report/**",
163
+ "**/.playwright-cli/**",
157
164
  "**/src-tauri/gen",
158
165
  "**/src-tauri/target",
159
166
  "**/*.context",
@@ -161,8 +168,126 @@ const GLOB_EXCLUDE = [
161
168
  "**/*.agents",
162
169
  "**/.*/skills"
163
170
  ];
164
- //#endregion
165
- //#region src/configs/vue.ts
171
+ // src/utils/env.ts
172
+ /**
173
+ * Check whether Pinia is available in the current project.
174
+ */
175
+ const hasPinia = () => isPackageExists("pinia");
176
+ /**
177
+ * Check whether Vitest is available in the current project.
178
+ */
179
+ const hasVitest = () => isPackageExists("vitest");
180
+ /**
181
+ * Check whether TypeScript runtime or preview package is available.
182
+ */
183
+ const hasTypeScript = () => isPackageExists("typescript") || isPackageExists("@typescript/native-preview");
184
+ /**
185
+ * Check whether shadcn-vue related dependencies are available.
186
+ */
187
+ const hasShadcnVue = () => (isPackageExists("radix-vue") || isPackageExists("reka-ui")) && isPackageExists("class-variance-authority") && isPackageExists("clsx");
188
+ /**
189
+ * Check whether UnoCSS runtime packages are available.
190
+ */
191
+ const hasUnoCSS = () => isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
192
+ /**
193
+ * Check whether Vue ecosystem packages are available.
194
+ */
195
+ const hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", { paths: [resolve(process.cwd(), "playground"), resolve(process.cwd(), "docs")] });
196
+ /**
197
+ * Check whether oxfmt is available in the current project.
198
+ */
199
+ const hasOxfmt = () => isPackageExists("oxfmt");
200
+ /**
201
+ * Check whether Prettier is available in the current project.
202
+ */
203
+ const hasPrettier = () => isPackageExists("prettier");
204
+ /**
205
+ * Check whether AutoImport is available in the current project.
206
+ */
207
+ const hasAutoImport = () => isPackageExists("unplugin-auto-import");
208
+ // src/utils/resolveSubOptions.ts
209
+ /**
210
+ * Normalize a sub-option value to an object.
211
+ *
212
+ * Boolean `true` means enabled with default options and returns an empty
213
+ * object; falsy values also fall back to an empty object.
214
+ *
215
+ * @param options - Options object that contains sub-options.
216
+ * @param key - Sub-option key to resolve.
217
+ * @returns Normalized sub-options object.
218
+ */
219
+ function resolveSubOptions(options, key) {
220
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
221
+ }
222
+ // src/utils/getOverrides.ts
223
+ /**
224
+ * Read rule overrides from a config sub-option.
225
+ *
226
+ * @param options - Top-level config options.
227
+ * @param key - Sub-option key to read.
228
+ * @returns Rule override map when provided, otherwise an empty object.
229
+ */
230
+ function getOverrides(options, key) {
231
+ const subOptions = resolveSubOptions(options, key);
232
+ return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
233
+ }
234
+ // src/utils/isInGitHooksOrRunBySpecifyPackages.ts
235
+ const CHECKED_RUNNER_PACKAGES = [
236
+ "nano-staged",
237
+ "lint-staged",
238
+ "lefthook",
239
+ "tsx"
240
+ ];
241
+ /**
242
+ * Detect whether current execution is triggered by git hook tooling.
243
+ */
244
+ function isInGitHooksOrRunBySpecifyPackages() {
245
+ return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || CHECKED_RUNNER_PACKAGES.some((packageName) => process.env.npm_lifecycle_script?.startsWith(packageName)));
246
+ }
247
+ // src/utils/ensurePackages.ts
248
+ /**
249
+ * @copyright {@link https://github.com/antfu/eslint-config}
250
+ */
251
+ const isCwdInScope = isPackageExists("@ntnyq/eslint-config");
252
+ /**
253
+ * Check whether a package can be resolved from this config package scope.
254
+ */
255
+ function isPackageInScope(name) {
256
+ return isPackageExists(name, { paths: [import.meta.dirname] });
257
+ }
258
+ /**
259
+ * Ensure required packages are installed for optional config features.
260
+ *
261
+ * Skips installation prompts in CI, non-TTY environments, git hooks, and
262
+ * when the current project is outside the config usage scope.
263
+ *
264
+ * @param packages - Package names to verify and optionally install.
265
+ */
266
+ async function ensurePackages(packages) {
267
+ if (process.env.CI || !process.stdout.isTTY || isInGitHooksOrRunBySpecifyPackages() || !isCwdInScope) return;
268
+ const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
269
+ if (nonExistingPackages.length === 0) return;
270
+ const { confirm, isCancel } = await import("@clack/prompts");
271
+ const confirmInstall = await confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` });
272
+ if (isCancel(confirmInstall) || !confirmInstall) return;
273
+ try {
274
+ const { installPackage } = await import("@antfu/install-pkg");
275
+ await installPackage(nonExistingPackages, { dev: true });
276
+ } catch (error) {
277
+ throw new Error(`Failed to install required packages: ${nonExistingPackages.join(", ")}`, { cause: error });
278
+ }
279
+ }
280
+ // src/utils/interopDefault.ts
281
+ /**
282
+ * Interop default export from a module
283
+ * @param mod - The module
284
+ * @returns The default export
285
+ */
286
+ async function interopDefault(mod) {
287
+ const resolved = await mod;
288
+ return resolved.default || resolved;
289
+ }
290
+ // src/configs/vue.ts
166
291
  const sharedRules = {
167
292
  ...pluginVue.configs.base.rules,
168
293
  ...pluginVue.configs.essential.rules,
@@ -342,7 +467,10 @@ const unCategorizedRules = {
342
467
  * @returns ESLint configs
343
468
  */
344
469
  const configVue = (options = {}) => {
345
- const { files = [GLOB_VUE], ecmaVersion = "latest", extraFileExtensions = [] } = options;
470
+ const { files = [GLOB_VUE], ecmaVersion = "latest", extraFileExtensions = [], typescript = false, vuePerfectionist: enableVuePerfectionist = false } = options;
471
+ const vuePerfectionistOptions = resolveSubOptions(options, "vuePerfectionist");
472
+ const enableAutoImport = vuePerfectionistOptions.autoImport ?? hasAutoImport();
473
+ const enableVueuseFunctions = vuePerfectionistOptions.vueuse ?? false;
346
474
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
347
475
  function getVueProcessor() {
348
476
  const processorVueSFC = pluginVue.processors[".vue"];
@@ -355,10 +483,10 @@ const configVue = (options = {}) => {
355
483
  }
356
484
  })]);
357
485
  }
358
- return [{
486
+ const configs = [{
359
487
  name: "ntnyq/vue/setup",
360
488
  plugins: {
361
- "@typescript-eslint": pluginTypeScript,
489
+ ...typescript ? { "@typescript-eslint": pluginTypeScript } : {},
362
490
  vue: pluginVue
363
491
  }
364
492
  }, {
@@ -370,9 +498,9 @@ const configVue = (options = {}) => {
370
498
  parserOptions: {
371
499
  ecmaVersion,
372
500
  extraFileExtensions,
373
- parser: parserTypeScript,
374
501
  sourceType: "module",
375
- ecmaFeatures: { jsx: true }
502
+ ecmaFeatures: { jsx: true },
503
+ ...typescript ? { parser: parserTypeScript } : {}
376
504
  }
377
505
  },
378
506
  rules: {
@@ -409,6 +537,9 @@ const configVue = (options = {}) => {
409
537
  multiline: 1,
410
538
  singleline: 1
411
539
  }],
540
+ "vue/no-content-outside-block": "error",
541
+ "vue/no-define-model-default": "error",
542
+ "vue/no-props-shadow": "error",
412
543
  "vue/order-in-components": ["error", { order: [
413
544
  "el",
414
545
  "name",
@@ -502,9 +633,63 @@ const configVue = (options = {}) => {
502
633
  ...options.overrides
503
634
  }
504
635
  }];
636
+ if (enableVuePerfectionist) configs.push({
637
+ name: "ntnyq/vue/vue-perfectionist",
638
+ files: vuePerfectionistOptions.files ?? [
639
+ "**/*.vue",
640
+ "**/store?(s)/*.?([cm])[jt]s?(x)",
641
+ ...GLOB_VUE_COMPOSABLES
642
+ ],
643
+ plugins: { "vue-perfectionist": pluginVuePerfectionist },
644
+ settings: { "vue-perfectionist": {
645
+ autoImport: enableAutoImport,
646
+ vueuse: enableVueuseFunctions
647
+ } },
648
+ rules: {
649
+ "vue-perfectionist/prefer-define-model": "warn",
650
+ "vue-perfectionist/callback-style": "error",
651
+ "vue-perfectionist/consistent-template-ref-name": "error",
652
+ "vue-perfectionist/define-macros-newline": "error",
653
+ "vue-perfectionist/no-complex-template-expression": "error",
654
+ "vue-perfectionist/no-complex-v-for-source": "error",
655
+ "vue-perfectionist/prefer-ref-pattern": "error",
656
+ "vue-perfectionist/prefer-simple-event-handler": ["error", {
657
+ allowConditional: true,
658
+ allowInlineFunctions: false,
659
+ allowLogical: true
660
+ }],
661
+ "vue-perfectionist/prefer-watch-effect-alias": "error",
662
+ "vue-perfectionist/require-composable-return-bindings": "error",
663
+ "vue-perfectionist/sort-script-setup": ["error", {
664
+ newlinesBetween: 1,
665
+ groups: [
666
+ ["interface", "type"],
667
+ "define-props",
668
+ "define-emits",
669
+ "define-options",
670
+ "define-slots",
671
+ "define-model",
672
+ "constant",
673
+ "inject",
674
+ "composable",
675
+ "template-ref",
676
+ ["ref", "reactive"],
677
+ "computed",
678
+ "variable",
679
+ ["enum", "class"],
680
+ "function",
681
+ "watch",
682
+ "lifecycle-hook",
683
+ "provide",
684
+ "define-expose"
685
+ ]
686
+ }],
687
+ ...vuePerfectionistOptions.overrides
688
+ }
689
+ });
690
+ return configs;
505
691
  };
506
- //#endregion
507
- //#region src/configs/yml.ts
692
+ // src/configs/yml.ts
508
693
  /**
509
694
  * @see {@link https://github.com/ota-meshi/eslint-plugin-yml/blob/master/src/configs/base.ts}
510
695
  */
@@ -571,129 +756,7 @@ const configYml = (options = {}) => {
571
756
  }
572
757
  }];
573
758
  };
574
- //#endregion
575
- //#region src/utils/env.ts
576
- /**
577
- * Check whether Pinia is available in the current project.
578
- */
579
- const hasPinia = () => isPackageExists("pinia");
580
- /**
581
- * Check whether Vitest is available in the current project.
582
- */
583
- const hasVitest = () => isPackageExists("vitest");
584
- /**
585
- * Check whether TypeScript runtime or preview package is available.
586
- */
587
- const hasTypeScript = () => isPackageExists("typescript") || isPackageExists("@typescript/native-preview");
588
- /**
589
- * Check whether shadcn-vue related dependencies are available.
590
- */
591
- const hasShadcnVue = () => (isPackageExists("radix-vue") || isPackageExists("reka-ui")) && isPackageExists("class-variance-authority") && isPackageExists("clsx");
592
- /**
593
- * Check whether UnoCSS runtime packages are available.
594
- */
595
- const hasUnoCSS = () => isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
596
- /**
597
- * Check whether Vue ecosystem packages are available.
598
- */
599
- const hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", { paths: [resolve(process.cwd(), "playground"), resolve(process.cwd(), "docs")] });
600
- /**
601
- * Check whether oxfmt is available in the current project.
602
- */
603
- const hasOxfmt = () => isPackageExists("oxfmt");
604
- /**
605
- * Check whether Prettier is available in the current project.
606
- */
607
- const hasPrettier = () => isPackageExists("prettier");
608
- //#endregion
609
- //#region src/utils/resolveSubOptions.ts
610
- /**
611
- * Normalize a sub-option value to an object.
612
- *
613
- * Boolean `true` means enabled with default options and returns an empty
614
- * object; falsy values also fall back to an empty object.
615
- *
616
- * @param options - Options object that contains sub-options.
617
- * @param key - Sub-option key to resolve.
618
- * @returns Normalized sub-options object.
619
- */
620
- function resolveSubOptions(options, key) {
621
- return typeof options[key] === "boolean" ? {} : options[key] || {};
622
- }
623
- //#endregion
624
- //#region src/utils/getOverrides.ts
625
- /**
626
- * Read rule overrides from a config sub-option.
627
- *
628
- * @param options - Top-level config options.
629
- * @param key - Sub-option key to read.
630
- * @returns Rule override map when provided, otherwise an empty object.
631
- */
632
- function getOverrides(options, key) {
633
- const subOptions = resolveSubOptions(options, key);
634
- return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
635
- }
636
- //#endregion
637
- //#region src/utils/isInGitHooksOrRunBySpecifyPackages.ts
638
- const CHECKED_RUNNER_PACKAGES = [
639
- "nano-staged",
640
- "lint-staged",
641
- "lefthook",
642
- "tsx"
643
- ];
644
- /**
645
- * Detect whether current execution is triggered by git hook tooling.
646
- */
647
- function isInGitHooksOrRunBySpecifyPackages() {
648
- return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || CHECKED_RUNNER_PACKAGES.some((packageName) => process.env.npm_lifecycle_script?.startsWith(packageName)));
649
- }
650
- //#endregion
651
- //#region src/utils/ensurePackages.ts
652
- /**
653
- * @copyright {@link https://github.com/antfu/eslint-config}
654
- */
655
- const isCwdInScope = isPackageExists("@ntnyq/eslint-config");
656
- /**
657
- * Check whether a package can be resolved from this config package scope.
658
- */
659
- function isPackageInScope(name) {
660
- return isPackageExists(name, { paths: [import.meta.dirname] });
661
- }
662
- /**
663
- * Ensure required packages are installed for optional config features.
664
- *
665
- * Skips installation prompts in CI, non-TTY environments, git hooks, and
666
- * when the current project is outside the config usage scope.
667
- *
668
- * @param packages - Package names to verify and optionally install.
669
- */
670
- async function ensurePackages(packages) {
671
- if (process.env.CI || !process.stdout.isTTY || isInGitHooksOrRunBySpecifyPackages() || !isCwdInScope) return;
672
- const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
673
- if (nonExistingPackages.length === 0) return;
674
- const { confirm, isCancel } = await import("@clack/prompts");
675
- const confirmInstall = await confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` });
676
- if (isCancel(confirmInstall) || confirmInstall !== true) return;
677
- try {
678
- const { installPackage } = await import("@antfu/install-pkg");
679
- await installPackage(nonExistingPackages, { dev: true });
680
- } catch (err) {
681
- throw new Error(`Failed to install required packages: ${nonExistingPackages.join(", ")}`, { cause: err });
682
- }
683
- }
684
- //#endregion
685
- //#region src/utils/interopDefault.ts
686
- /**
687
- * Interop default export from a module
688
- * @param mod - The module
689
- * @returns The default export
690
- */
691
- async function interopDefault(mod) {
692
- const resolved = await mod;
693
- return resolved.default || resolved;
694
- }
695
- //#endregion
696
- //#region src/configs/html.ts
759
+ // src/configs/html.ts
697
760
  /**
698
761
  * Config for html files
699
762
  *
@@ -717,7 +780,7 @@ const configHtml = async (options = {}) => {
717
780
  "@html-eslint/indent": "error",
718
781
  "@html-eslint/no-duplicate-attrs": "error",
719
782
  "@html-eslint/no-duplicate-id": "error",
720
- "@html-eslint/no-extra-spacing-attrs": "error",
783
+ "@html-eslint/no-extra-spacing-tags": "error",
721
784
  "@html-eslint/no-multiple-h1": "error",
722
785
  "@html-eslint/no-obsolete-tags": "error",
723
786
  "@html-eslint/quotes": "error",
@@ -732,8 +795,7 @@ const configHtml = async (options = {}) => {
732
795
  }
733
796
  }];
734
797
  };
735
- //#endregion
736
- //#region src/configs/node.ts
798
+ // src/configs/node.ts
737
799
  /**
738
800
  * Config for common files
739
801
  *
@@ -753,12 +815,13 @@ const configNode = (options = {}) => [{
753
815
  "node/no-path-concat": "error",
754
816
  "node/prefer-global/buffer": ["error", "never"],
755
817
  "node/prefer-global/process": ["error", "never"],
818
+ "node/prefer-import/assert-strict": "error",
819
+ "node/prefer-process-get-builtin-module": "error",
756
820
  "node/process-exit-as-throw": "error",
757
821
  ...options.overrides
758
822
  }
759
823
  }];
760
- //#endregion
761
- //#region src/configs/pnpm.ts
824
+ // src/configs/pnpm.ts
762
825
  /**
763
826
  * Config for pnpm package manager
764
827
  *
@@ -768,33 +831,38 @@ const configNode = (options = {}) => [{
768
831
  * @returns ESLint configs
769
832
  */
770
833
  const configPnpm = async (options = {}) => {
834
+ const { json: enableJson = true, yaml: enableYaml = true } = options;
835
+ const jsonOptions = resolveSubOptions(options, "json");
836
+ const yamlOptions = resolveSubOptions(options, "yaml");
837
+ if (!enableJson && !enableYaml) return [];
771
838
  await ensurePackages(["eslint-plugin-pnpm"]);
772
839
  const pluginPnpm = await interopDefault(import("eslint-plugin-pnpm"));
773
- const { filesJson = [GLOB_PACKAGE_JSON], filesYaml = [GLOB_PNPM_WORKSPACE_YAML] } = options;
774
- return [{
840
+ const configs = [];
841
+ if (enableJson) configs.push({
775
842
  name: "ntnyq/pnpm/package-json",
776
- files: filesJson,
843
+ files: jsonOptions.files ?? ["**/package.json"],
777
844
  plugins: { pnpm: pluginPnpm },
778
845
  languageOptions: { parser: parserJsonc },
779
846
  rules: {
780
847
  "pnpm/json-enforce-catalog": ["error", { autofix: true }],
781
848
  "pnpm/json-valid-catalog": "error",
782
- ...options.overridesJsonRules
849
+ ...jsonOptions.overrides
783
850
  }
784
- }, {
851
+ });
852
+ if (enableYaml) configs.push({
785
853
  name: "ntnyq/pnpm/pnpm-workspace-yaml",
786
- files: filesYaml,
854
+ files: yamlOptions.files ?? ["**/pnpm-workspace.yaml"],
787
855
  plugins: { pnpm: pluginPnpm },
788
856
  languageOptions: { parser: parserYaml },
789
857
  rules: {
790
858
  "pnpm/yaml-no-duplicate-catalog-item": "error",
791
859
  "pnpm/yaml-no-unused-catalog-item": "error",
792
- ...options.overridesYamlRules
860
+ ...yamlOptions.overrides
793
861
  }
794
- }];
862
+ });
863
+ return configs;
795
864
  };
796
- //#endregion
797
- //#region src/configs/sort.ts
865
+ // src/configs/sort.ts
798
866
  /**
799
867
  * Config for sort keys and values
800
868
  *
@@ -1188,8 +1256,7 @@ const configSort = (options = {}) => {
1188
1256
  });
1189
1257
  return configs;
1190
1258
  };
1191
- //#endregion
1192
- //#region src/configs/svgo.ts
1259
+ // src/configs/svgo.ts
1193
1260
  /**
1194
1261
  * Config for svg files
1195
1262
  *
@@ -1218,8 +1285,7 @@ const configSVGO = (options = {}) => {
1218
1285
  }
1219
1286
  }];
1220
1287
  };
1221
- //#endregion
1222
- //#region src/configs/test.ts
1288
+ // src/configs/test.ts
1223
1289
  /**
1224
1290
  * Config for test files
1225
1291
  *
@@ -1229,23 +1295,26 @@ const configSVGO = (options = {}) => {
1229
1295
  * @returns ESLint configs
1230
1296
  */
1231
1297
  const configTest = (options = {}) => {
1232
- const { files = [...GLOB_TEST], vitest: enableVitest = hasVitest() } = options;
1233
- const configs = [{
1298
+ const { files = [...GLOB_TEST], base: enableBase = true, vitest: enableVitest = hasVitest() } = options;
1299
+ const baseOptions = resolveSubOptions(options, "base");
1300
+ const vitestOptions = resolveSubOptions(options, "vitest");
1301
+ const configs = [];
1302
+ if (enableBase) configs.push({
1234
1303
  name: "ntnyq/test/setup",
1235
1304
  plugins: { "no-only-tests": pluginNoOnlyTests }
1236
1305
  }, {
1237
1306
  name: "ntnyq/test/base",
1238
- files,
1307
+ files: baseOptions.files ?? files,
1239
1308
  rules: {
1240
1309
  "max-lines-per-function": "off",
1241
1310
  "no-unused-expressions": "off",
1242
1311
  "no-only-tests/no-only-tests": "error",
1243
- ...options.overrides
1312
+ ...baseOptions.overrides
1244
1313
  }
1245
- }];
1314
+ });
1246
1315
  if (enableVitest) configs.push({
1247
1316
  name: "ntnyq/test/vitest",
1248
- files,
1317
+ files: vitestOptions.files ?? files,
1249
1318
  plugins: { vitest: pluginVitest },
1250
1319
  settings: {},
1251
1320
  rules: {
@@ -1256,13 +1325,12 @@ const configTest = (options = {}) => {
1256
1325
  "expectTypeOf",
1257
1326
  "assertType"
1258
1327
  ] }],
1259
- ...options.overridesVitestRules
1328
+ ...vitestOptions.overrides
1260
1329
  }
1261
1330
  });
1262
1331
  return configs;
1263
1332
  };
1264
- //#endregion
1265
- //#region src/configs/toml.ts
1333
+ // src/configs/toml.ts
1266
1334
  /**
1267
1335
  * Config for toml files
1268
1336
  *
@@ -1302,8 +1370,7 @@ const configToml = (options = {}) => {
1302
1370
  }
1303
1371
  }];
1304
1372
  };
1305
- //#endregion
1306
- //#region src/configs/antfu.ts
1373
+ // src/configs/antfu.ts
1307
1374
  /**
1308
1375
  * Config for common files
1309
1376
  *
@@ -1323,8 +1390,7 @@ const configAntfu = (options = {}) => [{
1323
1390
  ...options.overrides
1324
1391
  }
1325
1392
  }];
1326
- //#endregion
1327
- //#region src/configs/astro.ts
1393
+ // src/configs/astro.ts
1328
1394
  /**
1329
1395
  * Config for astro files
1330
1396
  *
@@ -1336,7 +1402,7 @@ const configAntfu = (options = {}) => [{
1336
1402
  const configAstro = async (options = {}) => {
1337
1403
  await ensurePackages(["astro-eslint-parser", "eslint-plugin-astro"]);
1338
1404
  const [parserAstro, pluginAstro] = await Promise.all([interopDefault(import("astro-eslint-parser")), interopDefault(import("eslint-plugin-astro"))]);
1339
- const { files = [GLOB_ASTRO], extraFileExtensions = [] } = options;
1405
+ const { files = [GLOB_ASTRO], ecmaVersion = "latest", extraFileExtensions = [], typescript = false } = options;
1340
1406
  return [{
1341
1407
  name: "ntnyq/astro",
1342
1408
  files,
@@ -1347,8 +1413,9 @@ const configAstro = async (options = {}) => {
1347
1413
  sourceType: "module",
1348
1414
  globals: { ...pluginAstro.environments.astro.globals },
1349
1415
  parserOptions: {
1416
+ ecmaVersion,
1350
1417
  extraFileExtensions,
1351
- parser: parserTypeScript
1418
+ ...typescript ? { parser: parserTypeScript } : {}
1352
1419
  }
1353
1420
  },
1354
1421
  rules: {
@@ -1359,13 +1426,11 @@ const configAstro = async (options = {}) => {
1359
1426
  "astro/no-deprecated-astro-resolve": "error",
1360
1427
  "astro/no-deprecated-getentrybyslug": "error",
1361
1428
  "astro/no-unused-define-vars-in-style": "error",
1362
- "astro/valid-compile": "error",
1363
1429
  ...options.overrides
1364
1430
  }
1365
1431
  }];
1366
1432
  };
1367
- //#endregion
1368
- //#region src/configs/jsdoc.ts
1433
+ // src/configs/jsdoc.ts
1369
1434
  const SPECIAL_CHAR = {
1370
1435
  emptyString: "",
1371
1436
  singleSpace: " "
@@ -1410,9 +1475,7 @@ const configJsdoc = (options = {}) => {
1410
1475
  "jsdoc/require-next-description": "warn",
1411
1476
  "jsdoc/require-next-type": "warn",
1412
1477
  "jsdoc/require-throws-description": "warn",
1413
- "jsdoc/require-throws-type": "warn",
1414
1478
  "jsdoc/require-yields-description": "warn",
1415
- "jsdoc/require-yields-type": "warn",
1416
1479
  "jsdoc/ts-method-signature-style": "warn",
1417
1480
  "jsdoc/ts-no-empty-object-type": "warn",
1418
1481
  "jsdoc/ts-no-unnecessary-template-expression": "warn",
@@ -1435,6 +1498,7 @@ const configJsdoc = (options = {}) => {
1435
1498
  "internal"
1436
1499
  ] }],
1437
1500
  "jsdoc/check-types": "error",
1501
+ "jsdoc/escape-inline-tags": "error",
1438
1502
  /**
1439
1503
  * @pg Fixable rules
1440
1504
  */
@@ -1469,12 +1533,12 @@ const configJsdoc = (options = {}) => {
1469
1533
  stringQuotes: "single",
1470
1534
  typeBracketSpacing: SPECIAL_CHAR.emptyString,
1471
1535
  unionSpacing: SPECIAL_CHAR.singleSpace
1472
- }]
1473
- },
1474
- ...options.overrides
1536
+ }],
1537
+ ...options.overrides
1538
+ }
1475
1539
  },
1476
1540
  {
1477
- name: "ntnyq/jsdoc/js-rules",
1541
+ name: "ntnyq/jsdoc/javascript",
1478
1542
  files: [GLOB_JS, GLOB_JSX],
1479
1543
  rules: {
1480
1544
  "jsdoc/no-types": "off",
@@ -1482,25 +1546,28 @@ const configJsdoc = (options = {}) => {
1482
1546
  "jsdoc/require-param-type": "error",
1483
1547
  "jsdoc/require-property-type": "error",
1484
1548
  "jsdoc/require-returns-type": "error",
1549
+ "jsdoc/require-throws-type": "error",
1550
+ "jsdoc/require-yields-type": "error",
1485
1551
  ...options.overrides
1486
1552
  }
1487
1553
  },
1488
1554
  {
1489
- name: "ntnyq/jsdoc/ts-rules",
1555
+ name: "ntnyq/jsdoc/typescript",
1490
1556
  files: [GLOB_TS, GLOB_TSX],
1491
1557
  rules: {
1492
1558
  "jsdoc/no-undefined-types": "off",
1493
1559
  "jsdoc/require-param-type": "off",
1494
1560
  "jsdoc/require-property-type": "off",
1495
1561
  "jsdoc/require-returns-type": "off",
1562
+ "jsdoc/require-throws-type": "off",
1563
+ "jsdoc/require-yields-type": "off",
1496
1564
  "jsdoc/no-types": "error",
1497
1565
  ...options.overrides
1498
1566
  }
1499
1567
  }
1500
1568
  ];
1501
1569
  };
1502
- //#endregion
1503
- //#region src/configs/jsonc.ts
1570
+ // src/configs/jsonc.ts
1504
1571
  /**
1505
1572
  * @see {@link https://github.com/ota-meshi/eslint-plugin-jsonc/blob/master/lib/configs/base.ts}
1506
1573
  */
@@ -1529,6 +1596,7 @@ const configJsonc = (options = {}) => {
1529
1596
  plugins: { jsonc: pluginJsonc },
1530
1597
  languageOptions: { parser: parserJsonc },
1531
1598
  rules: {
1599
+ "no-irregular-whitespace": "off",
1532
1600
  "jsonc/array-bracket-spacing": ["error", "never"],
1533
1601
  "jsonc/comma-dangle": ["error", "never"],
1534
1602
  "jsonc/comma-style": ["error", "last"],
@@ -1545,6 +1613,7 @@ const configJsonc = (options = {}) => {
1545
1613
  "jsonc/no-floating-decimal": "error",
1546
1614
  "jsonc/no-hexadecimal-numeric-literals": "error",
1547
1615
  "jsonc/no-infinity": "error",
1616
+ "jsonc/no-irregular-whitespace": "error",
1548
1617
  "jsonc/no-multi-str": "error",
1549
1618
  "jsonc/no-nan": "error",
1550
1619
  "jsonc/no-number-props": "error",
@@ -1592,8 +1661,7 @@ const configJsonc = (options = {}) => {
1592
1661
  }
1593
1662
  }];
1594
1663
  };
1595
- //#endregion
1596
- //#region src/configs/ntnyq.ts
1664
+ // src/configs/ntnyq.ts
1597
1665
  /**
1598
1666
  * Config for common files
1599
1667
  *
@@ -1607,12 +1675,100 @@ const configNtnyq = (options = {}) => [{
1607
1675
  plugins: { ntnyq: pluginNtnyq },
1608
1676
  rules: {
1609
1677
  "ntnyq/no-duplicate-exports": "error",
1678
+ "ntnyq/no-explicit-void-return-type": "error",
1679
+ "ntnyq/no-restricted-bindings": ["error", { restrictions: [{
1680
+ message: "Use a domain name such as requestError; reserve error for catch parameters.",
1681
+ names: ["error"],
1682
+ except: ["catch-parameter"],
1683
+ regions: [
1684
+ "script",
1685
+ "vue-script",
1686
+ "vue-script-setup"
1687
+ ],
1688
+ scope: "top-level"
1689
+ }] }],
1690
+ "ntnyq/padding-line-between-statements": [
1691
+ "error",
1692
+ {
1693
+ blankLine: "always",
1694
+ prev: "*",
1695
+ next: [
1696
+ "if",
1697
+ "for",
1698
+ "while",
1699
+ "do",
1700
+ "switch",
1701
+ "try",
1702
+ "return",
1703
+ "throw"
1704
+ ]
1705
+ },
1706
+ {
1707
+ blankLine: "always",
1708
+ next: "*",
1709
+ prev: [
1710
+ "if",
1711
+ "for",
1712
+ "while",
1713
+ "do",
1714
+ "switch",
1715
+ "try"
1716
+ ]
1717
+ },
1718
+ {
1719
+ blankLine: "always",
1720
+ next: "*",
1721
+ prev: [
1722
+ "const",
1723
+ "let",
1724
+ "var"
1725
+ ]
1726
+ },
1727
+ {
1728
+ blankLine: "any",
1729
+ next: [
1730
+ "const",
1731
+ "let",
1732
+ "var"
1733
+ ],
1734
+ prev: [
1735
+ "const",
1736
+ "let",
1737
+ "var"
1738
+ ]
1739
+ },
1740
+ {
1741
+ blankLine: "always",
1742
+ next: ["function", "class"],
1743
+ prev: "*"
1744
+ },
1745
+ {
1746
+ blankLine: "always",
1747
+ next: "*",
1748
+ prev: ["function", "class"]
1749
+ },
1750
+ {
1751
+ blankLine: "always",
1752
+ next: "*",
1753
+ prev: "import"
1754
+ },
1755
+ {
1756
+ blankLine: "never",
1757
+ next: "import",
1758
+ prev: "import"
1759
+ }
1760
+ ],
1610
1761
  "ntnyq/prefer-newline-after-file-header": "error",
1762
+ "ntnyq/prefer-object-method-syntax": ["error", {
1763
+ allowArrowFunctions: "singleLineOnly",
1764
+ avoidQuotes: true,
1765
+ fix: true
1766
+ }],
1767
+ "ntnyq/return-object-multiline": "error",
1611
1768
  ...options.overrides
1612
1769
  }
1613
1770
  }];
1614
- //#endregion
1615
- //#region src/configs/oxfmt.ts
1771
+ // src/configs/oxfmt.ts
1616
1772
  /**
1617
1773
  * Config for using oxfmt
1618
1774
  *
@@ -1621,7 +1777,7 @@ const configNtnyq = (options = {}) => [{
1621
1777
  * @returns ESLint configs
1622
1778
  */
1623
1779
  const configOxfmt = (options = {}) => {
1624
- const { files: filesWithoutParser = [
1780
+ const { files: nativeFiles = [
1625
1781
  GLOB_SRC,
1626
1782
  GLOB_VUE,
1627
1783
  GLOB_JSON,
@@ -1630,10 +1786,10 @@ const configOxfmt = (options = {}) => {
1630
1786
  GLOB_YAML,
1631
1787
  GLOB_TOML,
1632
1788
  GLOB_MARKDOWN
1633
- ], ignores: ignoresWithoutParser = [], filesExtensions: filesWithParser = [GLOB_STYLE, GLOB_HTML] } = options;
1789
+ ], ignores: ignoresWithoutParser = [], filesExtensions: plainParserFiles = [GLOB_STYLE, GLOB_HTML] } = options;
1634
1790
  return [{
1635
- name: "ntnyq/oxfmt/without-parser",
1636
- files: filesWithoutParser,
1791
+ name: "ntnyq/oxfmt/native-files",
1792
+ files: nativeFiles,
1637
1793
  ignores: ignoresWithoutParser,
1638
1794
  plugins: { oxfmt: pluginOxfmt },
1639
1795
  rules: {
@@ -1641,9 +1797,9 @@ const configOxfmt = (options = {}) => {
1641
1797
  ...options.overrides
1642
1798
  }
1643
1799
  }, {
1644
- name: "ntnyq/oxfmt/with-parser",
1645
- files: filesWithParser,
1646
- ignores: filesWithoutParser.flat(),
1800
+ name: "ntnyq/oxfmt/plain-parser-files",
1801
+ files: plainParserFiles,
1802
+ ignores: [...nativeFiles.flat(), ...ignoresWithoutParser],
1647
1803
  plugins: { oxfmt: pluginOxfmt },
1648
1804
  languageOptions: { parser: parserPlain },
1649
1805
  rules: {
@@ -1652,8 +1808,7 @@ const configOxfmt = (options = {}) => {
1652
1808
  }
1653
1809
  }];
1654
1810
  };
1655
- //#endregion
1656
- //#region src/configs/pinia.ts
1811
+ // src/configs/pinia.ts
1657
1812
  /**
1658
1813
  * Config for pinia store
1659
1814
  *
@@ -1683,8 +1838,38 @@ const configPinia = (options = {}) => {
1683
1838
  }
1684
1839
  }];
1685
1840
  };
1686
- //#endregion
1687
- //#region src/configs/depend.ts
1841
+ // src/configs/shell.ts
1842
+ /**
1843
+ * Config for shell scripts
1844
+ *
1845
+ * @see {@link https://github.com/eslint/shell}
1846
+ *
1847
+ * @param options - {@link ConfigShellOptions}
1848
+ * @returns ESLint configs
1849
+ */
1850
+ const configShell = (options = {}) => {
1851
+ const { files = [GLOB_SHELL], language = "bash" } = options;
1852
+ return [{
1853
+ name: "ntnyq/shell",
1854
+ files,
1855
+ plugins: { shell: pluginShell },
1856
+ language: `shell/${language}`,
1857
+ rules: {
1858
+ "shell/no-expansions-in-single-quotes": "warn",
1859
+ "shell/no-backticks": "error",
1860
+ "shell/no-ls-iteration": "error",
1861
+ "shell/no-unquoted-expansions": "error",
1862
+ "shell/no-unused-vars": "error",
1863
+ "shell/no-useless-cat": "error",
1864
+ "shell/no-useless-echo": "error",
1865
+ "shell/no-variables-in-printf-format": "error",
1866
+ "shell/require-cd-guard": "error",
1867
+ "shell/require-read-r": "error",
1868
+ ...options.overrides
1869
+ }
1870
+ }];
1871
+ };
1872
+ // src/configs/depend.ts
1688
1873
  /**
1689
1874
  * Config for optimisations dependency
1690
1875
  *
@@ -1723,8 +1908,7 @@ const configDepend = (options = {}) => {
1723
1908
  });
1724
1909
  return configs;
1725
1910
  };
1726
- //#endregion
1727
- //#region src/configs/regexp.ts
1911
+ // src/configs/regexp.ts
1728
1912
  /**
1729
1913
  * @file config for plugin regexp
1730
1914
  * @see {@link https://github.com/ota-meshi/eslint-plugin-regexp}
@@ -1752,8 +1936,7 @@ const configRegexp = (options = {}) => {
1752
1936
  }
1753
1937
  }];
1754
1938
  };
1755
- //#endregion
1756
- //#region src/configs/svelte.ts
1939
+ // src/configs/svelte.ts
1757
1940
  /**
1758
1941
  * Config for svelte files
1759
1942
  *
@@ -1765,7 +1948,7 @@ const configRegexp = (options = {}) => {
1765
1948
  const configSvelte = async (options = {}) => {
1766
1949
  await ensurePackages(["svelte-eslint-parser", "eslint-plugin-svelte"]);
1767
1950
  const [parserSvelte, pluginSvelte] = await Promise.all([interopDefault(import("svelte-eslint-parser")), interopDefault(import("eslint-plugin-svelte"))]);
1768
- const { files = [GLOB_SVELTE], extraFileExtensions = [] } = options;
1951
+ const { files = [GLOB_SVELTE], ecmaVersion = "latest", extraFileExtensions = [], typescript = false } = options;
1769
1952
  return [{
1770
1953
  name: "ntnyq/svelte",
1771
1954
  files,
@@ -1775,8 +1958,9 @@ const configSvelte = async (options = {}) => {
1775
1958
  parser: parserSvelte,
1776
1959
  sourceType: "module",
1777
1960
  parserOptions: {
1961
+ ecmaVersion,
1778
1962
  extraFileExtensions,
1779
- parser: parserTypeScript
1963
+ ...typescript ? { parser: parserTypeScript } : {}
1780
1964
  }
1781
1965
  },
1782
1966
  rules: {
@@ -1838,8 +2022,7 @@ const configSvelte = async (options = {}) => {
1838
2022
  }
1839
2023
  }];
1840
2024
  };
1841
- //#endregion
1842
- //#region src/configs/unocss.ts
2025
+ // src/configs/unocss.ts
1843
2026
  /**
1844
2027
  * Config for UnoCSS
1845
2028
  *
@@ -1857,8 +2040,7 @@ const configUnoCSS = (options = {}) => [{
1857
2040
  ...options.overrides
1858
2041
  }
1859
2042
  }];
1860
- //#endregion
1861
- //#region src/commands/index.ts
2043
+ // src/commands/index.ts
1862
2044
  const commands = [defineCommand({
1863
2045
  name: "regexper",
1864
2046
  match: /(\b|\s|^)(@regexper)(\s\S+)?(\b|\s|$)/,
@@ -1883,8 +2065,7 @@ const commands = [defineCommand({
1883
2065
  });
1884
2066
  }
1885
2067
  })];
1886
- //#endregion
1887
- //#region src/configs/command.ts
2068
+ // src/configs/command.ts
1888
2069
  /**
1889
2070
  * Config for using comments as codemod
1890
2071
  *
@@ -1904,8 +2085,7 @@ const configCommand = (options = {}) => [{
1904
2085
  }),
1905
2086
  name: "ntnyq/command"
1906
2087
  }];
1907
- //#endregion
1908
- //#region src/configs/ignores.ts
2088
+ // src/configs/ignores.ts
1909
2089
  /**
1910
2090
  * Config for ignore files from linting
1911
2091
  *
@@ -1923,8 +2103,7 @@ const configIgnores = (customIgnores = []) => {
1923
2103
  ignores
1924
2104
  }];
1925
2105
  };
1926
- //#endregion
1927
- //#region src/configs/importX.ts
2106
+ // src/configs/importX.ts
1928
2107
  /**
1929
2108
  * Config for imports and exports
1930
2109
  *
@@ -1971,8 +2150,7 @@ const configImportX = (options = {}) => {
1971
2150
  }
1972
2151
  }];
1973
2152
  };
1974
- //#endregion
1975
- //#region src/configs/unicorn.ts
2153
+ // src/configs/unicorn.ts
1976
2154
  /**
1977
2155
  * Built-in presets of `eslint-plugin-unicorn`
1978
2156
  */
@@ -2002,70 +2180,123 @@ const configUnicorn = (options = {}) => {
2002
2180
  name: "ntnyq/unicorn",
2003
2181
  plugins: { unicorn: pluginUnicorn },
2004
2182
  rules: {
2183
+ /**
2184
+ * @pg Compatibility
2185
+ */
2005
2186
  "unicorn/explicit-length-check": "off",
2006
2187
  /**
2188
+ * Conditional mutations
2189
+ */
2190
+ "unicorn/no-immediate-mutation": "off",
2191
+ /**
2007
2192
  * @see https://caniuse.com/?search=globalThis
2008
2193
  */
2009
2194
  "unicorn/prefer-global-this": "off",
2010
2195
  "unicorn/prefer-top-level-await": "off",
2196
+ /**
2197
+ * @pg Assertion
2198
+ */
2011
2199
  "unicorn/consistent-assert": "error",
2012
- "unicorn/consistent-existence-index-check": "error",
2013
- "unicorn/consistent-json-file-read": "error",
2014
- "unicorn/error-message": "error",
2015
- "unicorn/escape-case": "error",
2200
+ /**
2201
+ * @pg Built-in
2202
+ */
2016
2203
  "unicorn/new-for-builtins": "error",
2017
- "unicorn/no-accessor-recursion": "error",
2018
- "unicorn/no-blob-to-file": "error",
2019
- "unicorn/no-canvas-to-image": "error",
2020
2204
  "unicorn/no-console-spaces": "error",
2021
- "unicorn/no-for-loop": "error",
2022
- "unicorn/no-hex-escape": "error",
2023
- "unicorn/no-immediate-mutation": "error",
2024
2205
  "unicorn/no-instanceof-builtins": "error",
2025
- "unicorn/no-invalid-file-input-accept": "error",
2026
- "unicorn/no-late-current-target-access": "error",
2027
- "unicorn/no-lonely-if": "error",
2206
+ "unicorn/no-invalid-intl-options": "error",
2028
2207
  "unicorn/no-new-buffer": "error",
2208
+ "unicorn/no-typeof-undefined": "error",
2209
+ "unicorn/no-unnecessary-global-this": "error",
2210
+ "unicorn/no-unused-builtin-method-return": "error",
2211
+ "unicorn/no-using-resource-escape": "error",
2212
+ /**
2213
+ * @pg Class
2214
+ */
2215
+ "unicorn/no-accessor-recursion": "error",
2216
+ "unicorn/no-incomplete-accessor-override": "error",
2029
2217
  "unicorn/no-static-only-class": "error",
2030
2218
  "unicorn/no-this-outside-of-class": "error",
2031
- "unicorn/no-typeof-undefined": "error",
2032
- "unicorn/no-unnecessary-await": "error",
2219
+ "unicorn/no-useless-override": "error",
2220
+ "unicorn/prefer-class-fields": "error",
2221
+ /**
2222
+ * @pg Control Flow
2223
+ */
2224
+ "unicorn/no-accidental-bitwise-operator": "error",
2225
+ "unicorn/no-chained-comparison": "error",
2226
+ "unicorn/no-constant-zero-expression": "error",
2227
+ "unicorn/no-double-comparison": "error",
2228
+ "unicorn/no-duplicate-logical-operands": "error",
2229
+ "unicorn/no-for-loop": "error",
2230
+ "unicorn/no-impossible-length-comparison": "error",
2231
+ "unicorn/no-lonely-if": "error",
2232
+ "unicorn/no-misrefactored-assignment": "error",
2233
+ "unicorn/no-unnecessary-boolean-comparison": "error",
2033
2234
  "unicorn/no-unnecessary-nested-ternary": "error",
2235
+ "unicorn/no-useless-boolean-cast": "error",
2236
+ "unicorn/no-useless-coercion": "error",
2034
2237
  "unicorn/no-useless-collection-argument": "error",
2035
- "unicorn/no-useless-iterator-to-array": "error",
2036
- "unicorn/prefer-class-fields": "error",
2037
- "unicorn/prefer-import-meta-properties": "error",
2038
- "unicorn/prefer-includes": "error",
2039
- "unicorn/prefer-keyboard-event-key": "error",
2040
- "unicorn/prefer-math-min-max": "error",
2041
- "unicorn/prefer-math-trunc": "error",
2042
- "unicorn/prefer-modern-math-apis": "error",
2043
- "unicorn/prefer-negative-index": "error",
2044
- "unicorn/prefer-node-protocol": "error",
2045
- "unicorn/prefer-optional-catch-binding": "error",
2046
- "unicorn/prefer-prototype-methods": "error",
2047
- "unicorn/prefer-reflect-apply": "error",
2048
- "unicorn/prefer-response-static-json": "error",
2049
- "unicorn/prefer-structured-clone": "error",
2238
+ "unicorn/no-useless-continue": "error",
2239
+ "unicorn/no-useless-else": "error",
2240
+ "unicorn/prefer-block-statement-over-iife": "error",
2241
+ "unicorn/prefer-combined-guards": "error",
2050
2242
  "unicorn/switch-case-braces": ["error", "avoid"],
2051
2243
  "unicorn/switch-case-break-position": "error",
2052
2244
  /**
2053
2245
  * @pg Error
2054
2246
  */
2055
2247
  "unicorn/catch-error-name": ["error", {
2056
- name: "err",
2248
+ name: "error",
2057
2249
  ignore: ["^_."]
2058
2250
  }],
2059
2251
  "unicorn/custom-error-definition": "error",
2252
+ "unicorn/error-message": "error",
2060
2253
  "unicorn/no-useless-error-capture-stack-trace": "error",
2254
+ "unicorn/prefer-optional-catch-binding": "error",
2061
2255
  "unicorn/prefer-type-error": "error",
2062
2256
  "unicorn/throw-new-error": "error",
2063
2257
  /**
2258
+ * @pg Promise
2259
+ */
2260
+ "unicorn/no-async-promise-finally": "error",
2261
+ "unicorn/no-await-in-promise-methods": "error",
2262
+ "unicorn/no-multiple-promise-resolver-calls": "error",
2263
+ "unicorn/no-unnecessary-await": "error",
2264
+ "unicorn/no-unsafe-promise-all-settled-values": "error",
2265
+ "unicorn/prefer-then-catch": "error",
2266
+ /**
2267
+ * @pg Function
2268
+ */
2269
+ "unicorn/prefer-prototype-methods": "error",
2270
+ "unicorn/prefer-reflect-apply": "error",
2271
+ /**
2272
+ * @pg Web APIs
2273
+ */
2274
+ "unicorn/no-blob-to-file": "error",
2275
+ "unicorn/no-canvas-to-image": "error",
2276
+ "unicorn/no-invalid-fetch-options": "error",
2277
+ "unicorn/no-invalid-response-options": "error",
2278
+ "unicorn/no-invalid-url-protocol-comparison": "error",
2279
+ "unicorn/no-transition-all": "error",
2280
+ "unicorn/no-unnecessary-fetch-options": "error",
2281
+ "unicorn/no-url-in-search-params": "error",
2282
+ "unicorn/prefer-abort-signal-any": "error",
2283
+ "unicorn/prefer-abort-signal-timeout": "error",
2284
+ "unicorn/prefer-keyboard-event-key": "error",
2285
+ "unicorn/prefer-observer-apis": "error",
2286
+ "unicorn/prefer-response-static-json": "error",
2287
+ "unicorn/prefer-url-search-parameters": "error",
2288
+ "unicorn/require-text-decoder-streaming": "error",
2289
+ /**
2064
2290
  * @pg Number
2065
2291
  */
2066
2292
  "unicorn/no-zero-fractions": "error",
2067
2293
  "unicorn/number-literal-case": ["error", { hexadecimalValue: "lowercase" }],
2068
2294
  "unicorn/prefer-math-abs": "error",
2295
+ "unicorn/prefer-math-min-max": "error",
2296
+ "unicorn/prefer-math-trunc": "error",
2297
+ "unicorn/prefer-modern-math-apis": "error",
2298
+ "unicorn/prefer-negative-index": "error",
2299
+ "unicorn/prefer-number-coercion": "error",
2069
2300
  "unicorn/prefer-number-properties": "error",
2070
2301
  /**
2071
2302
  * @pg BigInt
@@ -2079,24 +2310,37 @@ const configUnicorn = (options = {}) => {
2079
2310
  * @pg Date
2080
2311
  */
2081
2312
  "unicorn/consistent-date-clone": "error",
2313
+ "unicorn/no-invalid-temporal-arithmetic": "error",
2082
2314
  "unicorn/prefer-date-now": "error",
2315
+ "unicorn/prefer-temporal-conversion": "error",
2083
2316
  /**
2084
2317
  * @pg String
2085
2318
  */
2086
2319
  "unicorn/consistent-template-literal-escape": "error",
2320
+ "unicorn/escape-case": "error",
2321
+ "unicorn/no-invalid-character-comparison": "error",
2322
+ "unicorn/no-unnecessary-string-trim": "error",
2323
+ "unicorn/no-unsafe-string-replacement": "error",
2087
2324
  "unicorn/prefer-code-point": "error",
2088
2325
  "unicorn/prefer-string-pad-start-end": "error",
2089
2326
  "unicorn/prefer-string-repeat": "error",
2090
2327
  "unicorn/prefer-string-slice": "error",
2091
2328
  "unicorn/prefer-string-starts-ends-with": "error",
2092
2329
  "unicorn/prefer-string-trim-start-end": "error",
2330
+ "unicorn/prefer-unicode-code-point-escapes": "error",
2093
2331
  /**
2094
2332
  * @pg DOM
2095
2333
  */
2096
2334
  "unicorn/better-dom-traversing": "error",
2097
2335
  "unicorn/dom-node-dataset": "error",
2098
2336
  "unicorn/no-incorrect-query-selector": "error",
2337
+ "unicorn/no-invalid-boolean-attribute-value": "error",
2338
+ "unicorn/no-invalid-dom-token": "error",
2339
+ "unicorn/no-invalid-file-input-accept": "error",
2099
2340
  "unicorn/no-invalid-remove-event-listener": "error",
2341
+ "unicorn/no-invalid-style-set-property": "error",
2342
+ "unicorn/no-late-current-target-access": "error",
2343
+ "unicorn/no-prevent-default-in-passive-listener": "error",
2100
2344
  "unicorn/prefer-add-event-listener": "error",
2101
2345
  "unicorn/prefer-classlist-toggle": "error",
2102
2346
  "unicorn/prefer-dom-node-append": "error",
@@ -2104,6 +2348,7 @@ const configUnicorn = (options = {}) => {
2104
2348
  "unicorn/prefer-dom-node-text-content": "error",
2105
2349
  "unicorn/prefer-modern-dom-apis": "error",
2106
2350
  "unicorn/prefer-query-selector": "error",
2351
+ "unicorn/prefer-toggle-attribute": "error",
2107
2352
  /**
2108
2353
  * @pg Array
2109
2354
  */
@@ -2118,37 +2363,73 @@ const configUnicorn = (options = {}) => {
2118
2363
  "unicorn/no-array-fill-with-reference-type": "error",
2119
2364
  "unicorn/no-array-from-fill": "error",
2120
2365
  "unicorn/no-array-method-this-argument": "error",
2366
+ "unicorn/no-boolean-sort-comparator": "error",
2121
2367
  "unicorn/no-confusing-array-splice": "error",
2368
+ "unicorn/no-confusing-array-with": "error",
2369
+ "unicorn/no-duplicate-loops": "error",
2122
2370
  "unicorn/no-new-array": "error",
2123
2371
  "unicorn/no-unnecessary-array-flat-depth": "error",
2124
2372
  "unicorn/no-unnecessary-array-splice-count": "error",
2125
2373
  "unicorn/no-unnecessary-slice-end": "error",
2126
- "unicorn/no-unused-array-method-return": "error",
2127
2374
  "unicorn/prefer-array-find": "error",
2128
2375
  "unicorn/prefer-array-flat-map": "error",
2376
+ "unicorn/prefer-array-from-range": "error",
2129
2377
  "unicorn/prefer-array-index-of": "error",
2130
2378
  "unicorn/prefer-array-some": "error",
2379
+ "unicorn/prefer-includes": "error",
2131
2380
  "unicorn/prefer-includes-over-repeated-comparisons": "error",
2381
+ "unicorn/prefer-single-array-predicate": "error",
2132
2382
  "unicorn/prefer-single-call": "error",
2133
2383
  "unicorn/require-array-join-separator": "error",
2134
2384
  /**
2385
+ * @pg Iterator
2386
+ */
2387
+ "unicorn/no-async-iterator-callback": "error",
2388
+ "unicorn/no-unused-iterator-helper": "error",
2389
+ "unicorn/no-useless-iterator-to-array": "error",
2390
+ /**
2135
2391
  * @pg Set
2136
2392
  */
2137
2393
  "unicorn/no-duplicate-set-values": "error",
2394
+ "unicorn/no-useless-set-construction": "error",
2138
2395
  "unicorn/prefer-set-has": "error",
2139
2396
  "unicorn/prefer-set-size": "error",
2140
2397
  /**
2398
+ * @pg Map
2399
+ */
2400
+ "unicorn/prefer-has-check": "error",
2401
+ /**
2402
+ * @pg Object
2403
+ */
2404
+ "unicorn/consistent-conditional-object-spread": ["error", "ternary"],
2405
+ "unicorn/consistent-existence-index-check": "error",
2406
+ "unicorn/no-collection-bracket-access": "error",
2407
+ "unicorn/no-invalid-property-descriptor": "error",
2408
+ "unicorn/no-object-methods-with-collections": "error",
2409
+ "unicorn/no-unsafe-property-key": "error",
2410
+ "unicorn/prefer-object-from-entries": "error",
2411
+ "unicorn/prefer-single-object-destructuring": "error",
2412
+ /**
2413
+ * @pg Data
2414
+ */
2415
+ "unicorn/consistent-json-file-read": "error",
2416
+ "unicorn/no-unsafe-buffer-conversion": "error",
2417
+ "unicorn/no-unsafe-json-serialization": "error",
2418
+ "unicorn/prefer-structured-clone": "error",
2419
+ /**
2141
2420
  * @pg Module
2142
2421
  */
2143
2422
  "unicorn/no-exports-in-scripts": "error",
2423
+ "unicorn/no-useless-re-export": "error",
2424
+ "unicorn/prefer-import-meta-properties": "error",
2425
+ "unicorn/prefer-node-protocol": "error",
2144
2426
  "unicorn/require-module-attributes": "error",
2145
2427
  "unicorn/require-module-specifiers": "error",
2146
2428
  ...options.overrides
2147
2429
  }
2148
2430
  }];
2149
2431
  };
2150
- //#endregion
2151
- //#region src/configs/deMorgan.ts
2432
+ // src/configs/deMorgan.ts
2152
2433
  /**
2153
2434
  * Config for optimize logic
2154
2435
  *
@@ -2165,8 +2446,7 @@ const configDeMorgan = (options = {}) => [{
2165
2446
  ...options.overrides
2166
2447
  }
2167
2448
  }];
2168
- //#endregion
2169
- //#region src/configs/markdown.ts
2449
+ // src/configs/markdown.ts
2170
2450
  /**
2171
2451
  * Config for markdown files
2172
2452
  *
@@ -2198,7 +2478,7 @@ const configMarkdown = (options = {}) => {
2198
2478
  languageOptions: { parser: parserPlain }
2199
2479
  },
2200
2480
  {
2201
- name: "ntnyq/markdown/disabled",
2481
+ name: "ntnyq/markdown/code-blocks",
2202
2482
  files: [...files, ...extraFileExtensions.map((ext) => `${GLOB_MARKDOWN}/**/*${ext}`)],
2203
2483
  languageOptions: { parserOptions: {
2204
2484
  project: false,
@@ -2231,8 +2511,7 @@ const configMarkdown = (options = {}) => {
2231
2511
  }
2232
2512
  ];
2233
2513
  };
2234
- //#endregion
2235
- //#region src/configs/prettier.ts
2514
+ // src/configs/prettier.ts
2236
2515
  /**
2237
2516
  * Config for using prettier
2238
2517
  *
@@ -2355,6 +2634,10 @@ const PERFECTIONIST = Object.freeze({
2355
2634
  ],
2356
2635
  sortExportAttributesGroups: ["unknown"],
2357
2636
  sortExportsGroups: [
2637
+ "wildcard-export",
2638
+ "named-export",
2639
+ "singleline-export",
2640
+ "multiline-export",
2358
2641
  "value-export",
2359
2642
  "type-export",
2360
2643
  "unknown"
@@ -2427,8 +2710,7 @@ const PERFECTIONIST = Object.freeze({
2427
2710
  "unknown"
2428
2711
  ]
2429
2712
  });
2430
- //#endregion
2431
- //#region src/configs/specials.ts
2713
+ // src/configs/specials.ts
2432
2714
  /**
2433
2715
  * Config for special files
2434
2716
  *
@@ -2436,87 +2718,88 @@ const PERFECTIONIST = Object.freeze({
2436
2718
  * @returns ESLint configs
2437
2719
  */
2438
2720
  const configSpecials = (options = {}) => {
2439
- const { shadcnVue: enableShadcnVue = hasShadcnVue() } = options;
2440
- const configs = [
2441
- {
2442
- name: "ntnyq/specials/scripts",
2443
- files: [`**/scripts/${GLOB_SRC}`],
2444
- rules: {
2445
- "@typescript-eslint/explicit-function-return-type": "off",
2446
- "no-console": "off",
2447
- ...options.overridesScriptsRules
2448
- }
2449
- },
2450
- {
2451
- name: "ntnyq/specials/cli",
2452
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
2453
- rules: {
2454
- "@typescript-eslint/explicit-function-return-type": "off",
2455
- "no-console": "off",
2456
- ...options.overridesCliRules
2457
- }
2458
- },
2459
- {
2460
- name: "ntnyq/specials/bin",
2461
- files: [`**/bin/${GLOB_SRC}`, `**/bin.${GLOB_SRC_EXT}`],
2462
- rules: {
2463
- "@typescript-eslint/explicit-function-return-type": "off",
2464
- "antfu/no-import-dist": "off",
2465
- "no-console": "off",
2466
- ...options.overridesBinRules
2467
- }
2468
- },
2469
- {
2470
- name: "ntnyq/specials/userscript",
2471
- files: [`**/*.user.${GLOB_SRC_EXT}`],
2472
- languageOptions: { globals: { ...globals.greasemonkey } },
2473
- rules: {
2474
- camelcase: ["error", { allow: ["^GM_.+"] }],
2475
- ...options.overridesUserScriptsRules
2476
- }
2721
+ const { additionalConfigs, bin: enableBin = true, cli: enableCli = true, configFiles: enableConfigFiles = true, scripts: enableScripts = true, shadcnVue: enableShadcnVue = hasShadcnVue(), userScripts: enableUserScripts = true } = options;
2722
+ const binOptions = resolveSubOptions(options, "bin");
2723
+ const cliOptions = resolveSubOptions(options, "cli");
2724
+ const configFilesOptions = resolveSubOptions(options, "configFiles");
2725
+ const scriptsOptions = resolveSubOptions(options, "scripts");
2726
+ const shadcnVueOptions = resolveSubOptions(options, "shadcnVue");
2727
+ const userScriptsOptions = resolveSubOptions(options, "userScripts");
2728
+ const configs = [];
2729
+ if (enableScripts) configs.push({
2730
+ name: "ntnyq/specials/scripts",
2731
+ files: scriptsOptions.files ?? [`**/scripts/**/*.?([cm])[jt]s?(x)`],
2732
+ rules: {
2733
+ "@typescript-eslint/explicit-function-return-type": "off",
2734
+ "no-console": "off",
2735
+ ...scriptsOptions.overrides
2736
+ }
2737
+ });
2738
+ if (enableCli) configs.push({
2739
+ name: "ntnyq/specials/cli",
2740
+ files: cliOptions.files ?? [`**/cli/**/*.?([cm])[jt]s?(x)`, `**/cli.?([cm])[jt]s?(x)`],
2741
+ rules: {
2742
+ "@typescript-eslint/explicit-function-return-type": "off",
2743
+ "no-console": "off",
2744
+ ...cliOptions.overrides
2745
+ }
2746
+ });
2747
+ if (enableBin) configs.push({
2748
+ name: "ntnyq/specials/bin",
2749
+ files: binOptions.files ?? [`**/bin/**/*.?([cm])[jt]s?(x)`, `**/bin.?([cm])[jt]s?(x)`],
2750
+ rules: {
2751
+ "@typescript-eslint/explicit-function-return-type": "off",
2752
+ "antfu/no-import-dist": "off",
2753
+ "no-console": "off",
2754
+ ...binOptions.overrides
2755
+ }
2756
+ });
2757
+ if (enableUserScripts) configs.push({
2758
+ name: "ntnyq/specials/userscript",
2759
+ files: userScriptsOptions.files ?? [`**/*.user.?([cm])[jt]s?(x)`],
2760
+ languageOptions: { globals: { ...globals.greasemonkey } },
2761
+ rules: {
2762
+ camelcase: ["error", { allow: ["^GM_.+"] }],
2763
+ ...userScriptsOptions.overrides
2764
+ }
2765
+ });
2766
+ if (enableConfigFiles) configs.push({
2767
+ name: "ntnyq/specials/config-file",
2768
+ files: configFilesOptions.files ?? [`**/*.config*.?([cm])[jt]s?(x)`],
2769
+ plugins: {
2770
+ "import-x": pluginImportX,
2771
+ perfectionist: pluginPerfectionist
2477
2772
  },
2478
- {
2479
- name: "ntnyq/specials/config-file",
2480
- files: [`**/*.config*.${GLOB_SRC_EXT}`],
2481
- plugins: {
2482
- "import-x": pluginImportX,
2483
- perfectionist: pluginPerfectionist
2484
- },
2485
- settings: { perfectionist: PERFECTIONIST.pluginSettings },
2486
- rules: {
2487
- "@typescript-eslint/explicit-function-return-type": "off",
2488
- "import-x/no-default-export": "off",
2489
- "no-console": "off",
2490
- "perfectionist/sort-objects": ["error", {
2491
- ...PERFECTIONIST.partialRuleOptions,
2492
- groups: PERFECTIONIST.sortObjectsGroups
2493
- }],
2494
- ...options.overridesConfigFileRules
2495
- }
2773
+ settings: { perfectionist: PERFECTIONIST.pluginSettings },
2774
+ rules: {
2775
+ "@typescript-eslint/explicit-function-return-type": "off",
2776
+ "import-x/no-default-export": "off",
2777
+ "no-console": "off",
2778
+ "perfectionist/sort-objects": ["error", {
2779
+ ...PERFECTIONIST.partialRuleOptions,
2780
+ groups: PERFECTIONIST.sortObjectsGroups
2781
+ }],
2782
+ ...configFilesOptions.overrides
2496
2783
  }
2497
- ];
2498
- if (enableShadcnVue) {
2499
- const shadcnOptions = resolveSubOptions(options, "shadcnVue");
2500
- configs.push({
2501
- name: "ntnyq/specials/shadcn-vue",
2502
- files: shadcnOptions.files || ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
2503
- rules: {
2504
- "@typescript-eslint/consistent-type-imports": "off",
2505
- "@typescript-eslint/no-unused-vars": "off",
2506
- "import-x/consistent-type-specifier-style": "off",
2507
- "vue/define-emits-declaration": "off",
2508
- "vue/html-button-has-type": "off",
2509
- "vue/no-duplicate-attr-inheritance": "off",
2510
- "vue/prefer-use-template-ref": "off",
2511
- ...shadcnOptions.overridesRules
2512
- }
2513
- });
2514
- }
2515
- if (options.specialCaseConfigs) configs.push(...options.specialCaseConfigs);
2784
+ });
2785
+ if (enableShadcnVue) configs.push({
2786
+ name: "ntnyq/specials/shadcn-vue",
2787
+ files: shadcnVueOptions.files ?? ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
2788
+ rules: {
2789
+ "@typescript-eslint/consistent-type-imports": "off",
2790
+ "@typescript-eslint/no-unused-vars": "off",
2791
+ "import-x/consistent-type-specifier-style": "off",
2792
+ "vue/define-emits-declaration": "off",
2793
+ "vue/html-button-has-type": "off",
2794
+ "vue/no-duplicate-attr-inheritance": "off",
2795
+ "vue/prefer-use-template-ref": "off",
2796
+ ...shadcnVueOptions.overrides
2797
+ }
2798
+ });
2799
+ if (additionalConfigs) configs.push(...additionalConfigs);
2516
2800
  return configs;
2517
2801
  };
2518
- //#endregion
2519
- //#region src/configs/gitignore.ts
2802
+ // src/configs/gitignore.ts
2520
2803
  /**
2521
2804
  * Config for respect `.gitignore`
2522
2805
  *
@@ -2526,14 +2809,15 @@ const configSpecials = (options = {}) => {
2526
2809
  * @returns ESLint configs
2527
2810
  */
2528
2811
  const configGitIgnore = (options = {}) => {
2529
- options.strict ??= false;
2530
2812
  return [{
2531
- ...createGitIgnoreConfig(options),
2813
+ ...createGitIgnoreConfig({
2814
+ ...options,
2815
+ strict: options.strict ?? false
2816
+ }),
2532
2817
  name: "ntnyq/gitignore"
2533
2818
  }];
2534
2819
  };
2535
- //#endregion
2536
- //#region src/configs/javascript.ts
2820
+ // src/configs/javascript.ts
2537
2821
  const strictRules = {
2538
2822
  complexity: ["error", { max: 30 }],
2539
2823
  "max-depth": ["error", { max: 5 }],
@@ -2562,9 +2846,9 @@ const configJavaScript = (options = {}) => {
2562
2846
  const { ecmaVersion = "latest" } = options;
2563
2847
  return [{
2564
2848
  ...jsConfig.configs.recommended,
2565
- name: "ntnyq/js/recommended"
2849
+ name: "ntnyq/javascript/recommended"
2566
2850
  }, {
2567
- name: "ntnyq/js/core",
2851
+ name: "ntnyq/javascript/core",
2568
2852
  languageOptions: {
2569
2853
  ecmaVersion,
2570
2854
  sourceType: "module",
@@ -2741,8 +3025,7 @@ const configJSX = () => [{
2741
3025
  files: [GLOB_JSX_ONLY],
2742
3026
  languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }
2743
3027
  }];
2744
- //#endregion
2745
- //#region src/configs/typescript.ts
3028
+ // src/configs/typescript.ts
2746
3029
  /**
2747
3030
  * @see {@link https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-type-checked.ts}
2748
3031
  */
@@ -2802,7 +3085,7 @@ const configTypeScript = (options = {}) => {
2802
3085
  const { allowDefaultProject = [], ecmaVersion = "latest", extraFileExtensions = [], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [GLOB_ASTRO, `${GLOB_MARKDOWN}/**`], overridesTypeAwareRules = {}, parserOptions = {} } = options;
2803
3086
  const files = options.files ?? [
2804
3087
  "**/*.?([cm])ts",
2805
- GLOB_TSX,
3088
+ "**/*.?([cm])tsx",
2806
3089
  ...extraFileExtensions.map((ext) => `**/*${ext}`)
2807
3090
  ];
2808
3091
  function createParserConfig(enableTypeAware = false, files = [], ignores = []) {
@@ -2820,7 +3103,7 @@ const configTypeScript = (options = {}) => {
2820
3103
  ...parserOptions
2821
3104
  };
2822
3105
  return {
2823
- name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
3106
+ name: `ntnyq/typescript/${enableTypeAware ? "parser-type-aware" : "parser"}`,
2824
3107
  files,
2825
3108
  ignores: [...ignores],
2826
3109
  languageOptions: {
@@ -2831,7 +3114,7 @@ const configTypeScript = (options = {}) => {
2831
3114
  }
2832
3115
  return [
2833
3116
  {
2834
- name: "ntnyq/ts/setup",
3117
+ name: "ntnyq/typescript/setup",
2835
3118
  plugins: {
2836
3119
  "@typescript-eslint": pluginTypeScript,
2837
3120
  antfu: pluginAntfu
@@ -2839,7 +3122,7 @@ const configTypeScript = (options = {}) => {
2839
3122
  },
2840
3123
  ...enableTypeAwareLint ? [createParserConfig(false, files), createParserConfig(true, filesTypeAware, ignoresTypeAware)] : [createParserConfig(false, files)],
2841
3124
  {
2842
- name: "ntnyq/ts/rules",
3125
+ name: "ntnyq/typescript/rules",
2843
3126
  files,
2844
3127
  rules: {
2845
3128
  ...recommendedRules,
@@ -2914,7 +3197,7 @@ const configTypeScript = (options = {}) => {
2914
3197
  }
2915
3198
  },
2916
3199
  ...enableTypeAwareLint ? [{
2917
- name: "ntnyq/ts/rules/type-aware",
3200
+ name: "ntnyq/typescript/rules/type-aware",
2918
3201
  files: [...filesTypeAware],
2919
3202
  ignores: [...ignoresTypeAware],
2920
3203
  rules: {
@@ -2923,7 +3206,7 @@ const configTypeScript = (options = {}) => {
2923
3206
  }
2924
3207
  }] : [],
2925
3208
  {
2926
- name: "ntnyq/ts/types",
3209
+ name: "ntnyq/typescript/types",
2927
3210
  files: [...GLOB_TYPES],
2928
3211
  rules: {
2929
3212
  "@typescript-eslint/no-use-before-define": "off",
@@ -2937,8 +3220,7 @@ const configTypeScript = (options = {}) => {
2937
3220
  }
2938
3221
  ];
2939
3222
  };
2940
- //#endregion
2941
- //#region src/configs/eslintPlugin.ts
3223
+ // src/configs/eslintPlugin.ts
2942
3224
  /**
2943
3225
  * Config for eslint plugin
2944
3226
  *
@@ -2960,8 +3242,7 @@ const configESLintPlugin = async (options = {}) => {
2960
3242
  }
2961
3243
  }];
2962
3244
  };
2963
- //#endregion
2964
- //#region src/configs/githubAction.ts
3245
+ // src/configs/githubAction.ts
2965
3246
  /**
2966
3247
  * Config for github action files
2967
3248
  *
@@ -2987,8 +3268,7 @@ const configGitHubAction = (options = {}) => {
2987
3268
  }
2988
3269
  }];
2989
3270
  };
2990
- //#endregion
2991
- //#region src/configs/perfectionist.ts
3271
+ // src/configs/perfectionist.ts
2992
3272
  /**
2993
3273
  * Config for sorting imports, exports, objects and etc
2994
3274
  *
@@ -2998,7 +3278,14 @@ const configGitHubAction = (options = {}) => {
2998
3278
  * @returns ESLint configs
2999
3279
  */
3000
3280
  const configPerfectionist = (options = {}) => {
3001
- const { filesEnums = [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`], filesTypes = [...GLOB_TYPES], partitionByComment = PERFECTIONIST.partialRuleOptions.partitionByComment, sortConstants: enableSortConstants = true, sortEnums: enableSortEnums = true, sortTypes: enableSortTypes = true, filesConstants = [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`] } = options;
3281
+ const { all: enableAll = false, constants: enableSortConstants = true, enums: enableSortEnums = true, partitionByComment = PERFECTIONIST.partialRuleOptions.partitionByComment, types: enableSortTypes = true } = options;
3282
+ const commonOptions = resolveSubOptions(options, "common");
3283
+ const constantsOptions = resolveSubOptions(options, "constants");
3284
+ const enumsOptions = resolveSubOptions(options, "enums");
3285
+ const typesOptions = resolveSubOptions(options, "types");
3286
+ const filesConstants = constantsOptions.files ?? [`**/constants/**/*.?([cm])[jt]s?(x)`, `**/constants.?([cm])[jt]s?(x)`];
3287
+ const filesEnums = enumsOptions.files ?? [`**/enums/**/*.?([cm])[jt]s?(x)`, `**/enums.?([cm])[jt]s?(x)`];
3288
+ const filesTypes = typesOptions.files ?? [...GLOB_TYPES];
3002
3289
  const sharedOptionsWithNewlinesBetween = {
3003
3290
  newlinesBetween: "ignore",
3004
3291
  partitionByComment
@@ -3092,21 +3379,21 @@ const configPerfectionist = (options = {}) => {
3092
3379
  settings: { perfectionist: PERFECTIONIST.pluginSettings }
3093
3380
  };
3094
3381
  const configs = [{
3095
- name: options.all ? "ntnyq/perfectionist/all" : "ntnyq/perfectionist/common",
3382
+ name: enableAll ? "ntnyq/perfectionist/all" : "ntnyq/perfectionist/common",
3096
3383
  ...sharedConfig,
3097
3384
  rules: {
3098
3385
  ...commonRules,
3099
- ...options.all ? {
3386
+ ...enableAll ? {
3100
3387
  ...sharedRules,
3101
3388
  ...sortEnumsRules,
3102
3389
  ...sortTypesRules,
3103
3390
  ...sortConstantsRules,
3104
3391
  ...extraRules
3105
3392
  } : {},
3106
- ...options.overrides
3393
+ ...commonOptions.overrides
3107
3394
  }
3108
3395
  }];
3109
- if (options.all) return configs;
3396
+ if (enableAll) return configs;
3110
3397
  if (enableSortEnums) configs.push({
3111
3398
  name: "ntnyq/perfectionist/enums",
3112
3399
  files: filesEnums,
@@ -3114,7 +3401,7 @@ const configPerfectionist = (options = {}) => {
3114
3401
  rules: {
3115
3402
  ...sharedRules,
3116
3403
  ...sortEnumsRules,
3117
- ...options.overridesEnumsRules
3404
+ ...enumsOptions.overrides
3118
3405
  }
3119
3406
  });
3120
3407
  if (enableSortTypes) configs.push({
@@ -3124,7 +3411,7 @@ const configPerfectionist = (options = {}) => {
3124
3411
  rules: {
3125
3412
  ...sharedRules,
3126
3413
  ...sortTypesRules,
3127
- ...options.overridesTypesRules
3414
+ ...typesOptions.overrides
3128
3415
  }
3129
3416
  });
3130
3417
  if (enableSortConstants) configs.push({
@@ -3134,13 +3421,12 @@ const configPerfectionist = (options = {}) => {
3134
3421
  rules: {
3135
3422
  ...sharedRules,
3136
3423
  ...sortConstantsRules,
3137
- ...options.overridesConstantsRules
3424
+ ...constantsOptions.overrides
3138
3425
  }
3139
3426
  });
3140
3427
  return configs;
3141
3428
  };
3142
- //#endregion
3143
- //#region src/configs/unusedImports.ts
3429
+ // src/configs/unusedImports.ts
3144
3430
  /**
3145
3431
  * Config for remove unused imports
3146
3432
  *
@@ -3156,6 +3442,7 @@ const configUnusedImports = async (options = {}) => {
3156
3442
  plugins: { "unused-imports": await interopDefault(import("eslint-plugin-unused-imports")) },
3157
3443
  rules: {
3158
3444
  "@typescript-eslint/no-unused-vars": "off",
3445
+ "no-unused-vars": "off",
3159
3446
  "unused-imports/no-unused-imports": "error",
3160
3447
  "unused-imports/no-unused-vars": ["error", {
3161
3448
  args: "after-used",
@@ -3171,8 +3458,7 @@ const configUnusedImports = async (options = {}) => {
3171
3458
  }
3172
3459
  }];
3173
3460
  };
3174
- //#endregion
3175
- //#region src/configs/eslintComments.ts
3461
+ // src/configs/eslintComments.ts
3176
3462
  /**
3177
3463
  * Config for eslint comments
3178
3464
  *
@@ -3190,8 +3476,7 @@ const configESLintComments = (options = {}) => [{
3190
3476
  ...options.overrides
3191
3477
  }
3192
3478
  }];
3193
- //#endregion
3194
- //#region src/core.ts
3479
+ // src/core.ts
3195
3480
  /**
3196
3481
  * @file factory function to create ESLint config
3197
3482
  */
@@ -3199,7 +3484,7 @@ const configESLintComments = (options = {}) => [{
3199
3484
  * Config factory
3200
3485
  */
3201
3486
  function defineESLintConfig(options = {}, ...userConfigs) {
3202
- const { shareable = {}, ignores: userIgnores = [], vue: enableVue = hasVue(), pinia: enablePinia = hasPinia(), test: enableTest = hasVitest(), unocss: enableUnoCSS = hasUnoCSS(), typescript: enableTypeScript = hasTypeScript(), oxfmt: enableOxfmt = hasOxfmt(), prettier: enablePrettier = hasPrettier(), yml: enableYML = true, sort: enableSort = true, toml: enableTOML = true, jsonc: enableJSONC = true, antfu: enableAntfu = true, ntnyq: enableNtnyq = true, depend: enableDepend = true, regexp: enableRegexp = true, unicorn: enableUnicorn = true, deMorgan: enableDeMorgan = true, markdown: enableMarkdown = true, gitignore: enableGitIgnore = true, jsdoc: enableJsdoc = true, importX: enableImportX = true, specials: enableSpecials = true, githubAction: enableGitHubAction = true, perfectionist: enablePerfectionist = true, pnpm: enablePnpm = false, svgo: enableSVGO = false, html: enableHTML = false, astro: enableAstro = false, svelte: enableSvelte = false, eslintPlugin: enableESLintPlugin = false, unusedImports: enableUnusedImports = false } = options;
3487
+ const { shareable = {}, ignores: userIgnores = [], vue: enableVue = hasVue(), pinia: enablePinia = hasPinia(), test: enableTest = hasVitest(), unocss: enableUnoCSS = hasUnoCSS(), typescript: enableTypeScript = shareable.typescript ?? hasTypeScript(), oxfmt: enableOxfmt = hasOxfmt(), prettier: enablePrettier = hasPrettier(), yml: enableYML = true, sort: enableSort = true, toml: enableTOML = true, jsonc: enableJSONC = true, antfu: enableAntfu = true, ntnyq: enableNtnyq = true, depend: enableDepend = true, regexp: enableRegexp = true, unicorn: enableUnicorn = true, deMorgan: enableDeMorgan = true, markdown: enableMarkdown = true, gitignore: enableGitIgnore = true, jsdoc: enableJsdoc = true, importX: enableImportX = true, specials: enableSpecials = true, githubAction: enableGitHubAction = true, perfectionist: enablePerfectionist = true, pnpm: enablePnpm = false, svgo: enableSVGO = false, html: enableHTML = false, shell: enableShell = false, astro: enableAstro = false, svelte: enableSvelte = false, eslintPlugin: enableESLintPlugin = false, unusedImports: enableUnusedImports = false } = options;
3203
3488
  const configs = [];
3204
3489
  const { ecmaVersion = "latest", extraFileExtensions: shareableExtraFileExtensions = [] } = shareable;
3205
3490
  const extraFileExtensions = [...shareableExtraFileExtensions];
@@ -3222,11 +3507,11 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3222
3507
  overrides: getOverrides(options, "jsdoc"),
3223
3508
  ...resolveSubOptions(options, "jsdoc")
3224
3509
  }));
3225
- if (enablePerfectionist) configs.push(configPerfectionist({
3226
- ...resolveSubOptions(options, "perfectionist"),
3227
- overrides: getOverrides(options, "perfectionist")
3510
+ if (enablePerfectionist) configs.push(configPerfectionist(resolveSubOptions(options, "perfectionist")));
3511
+ if (enableUnicorn) configs.push(configUnicorn({
3512
+ ...resolveSubOptions(options, "unicorn"),
3513
+ overrides: getOverrides(options, "unicorn")
3228
3514
  }));
3229
- if (enableUnicorn) configs.push(configUnicorn({ overrides: getOverrides(options, "unicorn") }));
3230
3515
  if (enablePinia) configs.push(configPinia({
3231
3516
  ...resolveSubOptions(options, "pinia"),
3232
3517
  overrides: getOverrides(options, "pinia")
@@ -3245,8 +3530,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3245
3530
  if (enableVue) configs.push(configVue({
3246
3531
  ecmaVersion,
3247
3532
  usingFormatter: !!usingFormatter,
3248
- ...resolveSubOptions(options, "vue"),
3249
3533
  typescript: !!enableTypeScript,
3534
+ ...resolveSubOptions(options, "vue"),
3250
3535
  overrides: getOverrides(options, "vue"),
3251
3536
  extraFileExtensions
3252
3537
  }));
@@ -3265,22 +3550,21 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3265
3550
  overrides: getOverrides(options, "jsonc")
3266
3551
  }));
3267
3552
  if (enableAstro) configs.push(configAstro({
3268
- ...resolveSubOptions(options, "astro"),
3553
+ ecmaVersion,
3269
3554
  typescript: !!enableTypeScript,
3555
+ ...resolveSubOptions(options, "astro"),
3270
3556
  overrides: getOverrides(options, "astro"),
3271
3557
  extraFileExtensions
3272
3558
  }));
3273
3559
  if (enableSvelte) configs.push(configSvelte({
3274
- ...resolveSubOptions(options, "svelte"),
3560
+ ecmaVersion,
3275
3561
  typescript: !!enableTypeScript,
3562
+ ...resolveSubOptions(options, "svelte"),
3276
3563
  overrides: getOverrides(options, "svelte"),
3277
3564
  extraFileExtensions
3278
3565
  }));
3279
3566
  if (enableSort) configs.push(configSort(resolveSubOptions(options, "sort")));
3280
- if (enableTest) configs.push(configTest({
3281
- ...resolveSubOptions(options, "test"),
3282
- overrides: getOverrides(options, "test")
3283
- }));
3567
+ if (enableTest) configs.push(configTest(resolveSubOptions(options, "test")));
3284
3568
  if (enableUnoCSS) configs.push(configUnoCSS({ overrides: getOverrides(options, "unocss") }));
3285
3569
  if (enableMarkdown) configs.push(configMarkdown({
3286
3570
  ...resolveSubOptions(options, "markdown"),
@@ -3303,6 +3587,10 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3303
3587
  overrides: getOverrides(options, "html")
3304
3588
  }));
3305
3589
  if (enableSpecials) configs.push(configSpecials(resolveSubOptions(options, "specials")));
3590
+ if (enableShell) configs.push(configShell({
3591
+ ...resolveSubOptions(options, "shell"),
3592
+ overrides: getOverrides(options, "shell")
3593
+ }));
3306
3594
  const formatterConfigs = [];
3307
3595
  const prettierConfigs = configPrettier({
3308
3596
  ...resolveSubOptions(options, "prettier"),
@@ -3315,7 +3603,11 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3315
3603
  if (options.__DEV__) formatterConfigs.push(...prettierConfigs, ...oxfmtConfigs);
3316
3604
  else if (enablePrettier) formatterConfigs.push(...prettierConfigs);
3317
3605
  else if (enableOxfmt) formatterConfigs.push(...oxfmtConfigs);
3318
- return new FlatConfigComposer(...configs, ...userConfigs, ...formatterConfigs);
3606
+ const composer = new FlatConfigComposer(...configs, ...userConfigs, ...formatterConfigs);
3607
+ if (enableShell) {
3608
+ const { files = [GLOB_SHELL] } = resolveSubOptions(options, "shell");
3609
+ return composer.setDefaultIgnores((ignores) => [...ignores, ...files]);
3610
+ }
3611
+ return composer;
3319
3612
  }
3320
- //#endregion
3321
- export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_SCHEMA, GLOB_JSX, GLOB_JSX_ONLY, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_PNPM_WORKSPACE_YAML, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_SRC_EXTENSIONS, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG_JSON, GLOB_TSX, GLOB_TSX_ONLY, GLOB_TYPES, GLOB_TYPE_TEST, GLOB_VUE, GLOB_YAML, PERFECTIONIST, configAntfu, configAstro, configCommand, configDeMorgan, configDepend, configESLintComments, configESLintPlugin, configGitHubAction, configGitIgnore, configHtml, configIgnores, configImportX, configJSX, configJavaScript, configJsdoc, configJsonc, configMarkdown, configNode, configNtnyq, configOxfmt, configPerfectionist, configPinia, configPnpm, configPrettier, configRegexp, configSVGO, configSort, configSpecials, configSvelte, configTest, configToml, configTypeScript, configUnicorn, configUnoCSS, configUnusedImports, configVue, configYml, configsTypeScript, defineESLintConfig, ensurePackages, getOverrides, hasOxfmt, hasPinia, hasPrettier, hasShadcnVue, hasTypeScript, hasUnoCSS, hasVitest, hasVue, interopDefault, isInGitHooksOrRunBySpecifyPackages, mergeProcessors, parserJsonc, parserPlain, parserToml, parserTypeScript, parserVue, parserYaml, pluginAntfu, pluginDeMorgan, pluginDepend, pluginESLintComments, pluginGitHubAction, pluginImportX, pluginJsdoc, pluginJsonc, pluginMarkdown, pluginNoOnlyTests, pluginNode, pluginNtnyq, pluginOxfmt, pluginPerfectionist, pluginPinia, pluginPrettier, pluginRegexp, pluginSvgo, pluginToml, pluginTypeScript, pluginUnicorn, pluginUnoCSS, pluginVitest, pluginVue, pluginYml, processorPassThrough, processorVueBlocks, resolveSubOptions };
3613
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_SCHEMA, GLOB_JSX, GLOB_JSX_ONLY, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_PNPM_WORKSPACE_YAML, GLOB_POSTCSS, GLOB_SCSS, GLOB_SHELL, GLOB_SRC, GLOB_SRC_EXT, GLOB_SRC_EXTENSIONS, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG_JSON, GLOB_TSX, GLOB_TSX_ONLY, GLOB_TYPES, GLOB_TYPE_TEST, GLOB_VUE, GLOB_VUE_COMPOSABLES, GLOB_YAML, PERFECTIONIST, configAntfu, configAstro, configCommand, configDeMorgan, configDepend, configESLintComments, configESLintPlugin, configGitHubAction, configGitIgnore, configHtml, configIgnores, configImportX, configJSX, configJavaScript, configJsdoc, configJsonc, configMarkdown, configNode, configNtnyq, configOxfmt, configPerfectionist, configPinia, configPnpm, configPrettier, configRegexp, configSVGO, configShell, configSort, configSpecials, configSvelte, configTest, configToml, configTypeScript, configUnicorn, configUnoCSS, configUnusedImports, configVue, configYml, configsTypeScript, defineESLintConfig, ensurePackages, getOverrides, hasAutoImport, hasOxfmt, hasPinia, hasPrettier, hasShadcnVue, hasTypeScript, hasUnoCSS, hasVitest, hasVue, interopDefault, isInGitHooksOrRunBySpecifyPackages, mergeProcessors, parserJsonc, parserPlain, parserToml, parserTypeScript, parserVue, parserYaml, pluginAntfu, pluginDeMorgan, pluginDepend, pluginESLintComments, pluginGitHubAction, pluginImportX, pluginJsdoc, pluginJsonc, pluginMarkdown, pluginNoOnlyTests, pluginNode, pluginNtnyq, pluginOxfmt, pluginPerfectionist, pluginPinia, pluginPrettier, pluginRegexp, pluginShell, pluginSvgo, pluginToml, pluginTypeScript, pluginUnicorn, pluginUnoCSS, pluginVitest, pluginVue, pluginVuePerfectionist, pluginYml, processorPassThrough, processorVueBlocks, resolveSubOptions };