@ntnyq/eslint-config 3.11.0 → 3.12.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
@@ -68,13 +68,16 @@ __export(index_exports, {
68
68
  GLOB_VUE: () => GLOB_VUE,
69
69
  GLOB_YAML: () => GLOB_YAML,
70
70
  antfu: () => antfu,
71
+ combineConfigs: () => combineConfigs,
71
72
  command: () => command,
72
73
  comments: () => comments,
73
74
  createNodeResolver: () => createNodeResolver,
74
75
  createTypeScriptImportResolver: () => import_eslint_import_resolver_typescript.createTypeScriptImportResolver,
75
76
  defineESLintConfig: () => defineESLintConfig,
76
77
  depend: () => depend,
78
+ ensurePackages: () => ensurePackages,
77
79
  esX: () => esX,
80
+ eslintPlugin: () => eslintPlugin,
78
81
  format: () => format,
79
82
  getOverrides: () => getOverrides,
80
83
  githubAction: () => githubAction,
@@ -88,11 +91,11 @@ __export(index_exports, {
88
91
  ignores: () => ignores,
89
92
  importX: () => importX,
90
93
  interopDefault: () => interopDefault,
94
+ isInGitHooksOrRunByNanoStagedOrRunByTSX: () => isInGitHooksOrRunByNanoStagedOrRunByTSX,
91
95
  javascript: () => javascript,
92
96
  jsdoc: () => jsdoc,
93
97
  jsonc: () => jsonc,
94
98
  jsx: () => jsx,
95
- loadPlugin: () => loadPlugin,
96
99
  markdown: () => markdown,
97
100
  mergePrettierOptions: () => mergePrettierOptions,
98
101
  mergeProcessors: () => import_eslint_merge_processors.mergeProcessors,
@@ -109,7 +112,6 @@ __export(index_exports, {
109
112
  pluginAntfu: () => import_eslint_plugin_antfu.default,
110
113
  pluginComments: () => import_eslint_plugin_eslint_comments.default,
111
114
  pluginDepend: () => pluginDepend,
112
- pluginEsX: () => import_eslint_plugin_es_x.default,
113
115
  pluginFormat: () => import_eslint_plugin_format.default,
114
116
  pluginGitHubAction: () => import_eslint_plugin_github_action.default,
115
117
  pluginImportX: () => import_eslint_plugin_import_x.default,
@@ -117,12 +119,10 @@ __export(index_exports, {
117
119
  pluginJsonc: () => import_eslint_plugin_jsonc.default,
118
120
  pluginMarkdown: () => import_markdown.default,
119
121
  pluginNode: () => import_eslint_plugin_n.default,
120
- pluginNtnyq: () => import_eslint_plugin_ntnyq.default,
121
122
  pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
122
123
  pluginPinia: () => import_eslint_plugin_pinia.default,
123
124
  pluginPrettier: () => import_eslint_plugin_prettier.default,
124
125
  pluginRegexp: () => pluginRegexp,
125
- pluginStylistic: () => import_eslint_plugin3.default,
126
126
  pluginSvgo: () => import_eslint_plugin_svgo.default,
127
127
  pluginToml: () => import_eslint_plugin_toml.default,
128
128
  pluginTypeScript: () => import_typescript_eslint2.plugin,
@@ -155,6 +155,10 @@ __export(index_exports, {
155
155
  });
156
156
  module.exports = __toCommonJS(index_exports);
157
157
 
158
+ // node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
159
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
160
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
161
+
158
162
  // src/core.ts
159
163
  var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
160
164
 
@@ -194,12 +198,10 @@ var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
194
198
  var pluginDepend = __toESM(require("eslint-plugin-depend"), 1);
195
199
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
196
200
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
197
- var import_eslint_plugin_es_x = __toESM(require("eslint-plugin-es-x"), 1);
198
201
  var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
199
202
  var import_eslint_plugin_svgo = __toESM(require("eslint-plugin-svgo"), 1);
200
203
  var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
201
204
  var import_eslint_plugin_pinia = __toESM(require("eslint-plugin-pinia"), 1);
202
- var import_eslint_plugin_ntnyq = __toESM(require("eslint-plugin-ntnyq"), 1);
203
205
  var import_markdown = __toESM(require("@eslint/markdown"), 1);
204
206
  var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
205
207
  var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
@@ -211,7 +213,6 @@ var import_eslint_plugin2 = __toESM(require("@vitest/eslint-plugin"), 1);
211
213
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
212
214
  var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
213
215
  var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
214
- var import_eslint_plugin3 = __toESM(require("@stylistic/eslint-plugin"), 1);
215
216
  var import_eslint_plugin_github_action = __toESM(require("eslint-plugin-github-action"), 1);
216
217
  var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
217
218
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
@@ -328,7 +329,11 @@ var GLOB_EXCLUDE = [
328
329
  "**/.wrangler",
329
330
  "**/.changeset",
330
331
  "**/.npmrc",
331
- "**/.yarnrc"
332
+ "**/.yarnrc",
333
+ "**/.husky",
334
+ // tauri
335
+ "**/src-tauri/gen",
336
+ "**/src-tauri/target"
332
337
  ];
333
338
 
334
339
  // src/configs/vue.ts
@@ -707,19 +712,123 @@ var yml = (options = {}) => [
707
712
  }
708
713
  ];
709
714
 
710
- // src/configs/esX.ts
711
- var esX = (options = {}) => [
712
- {
713
- name: "ntnyq/es-x",
714
- plugins: {
715
- "es-x": import_eslint_plugin_es_x.default
716
- },
717
- rules: {
718
- // Overrides rules
719
- ...options.overrides
715
+ // src/utils/env.ts
716
+ var import_node_path = require("path");
717
+ var import_node_process = __toESM(require("process"), 1);
718
+ var import_local_pkg = require("local-pkg");
719
+ var hasPinia = (0, import_local_pkg.isPackageExists)("pinia");
720
+ var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
721
+ var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
722
+ var hasShadcnVue = (0, import_local_pkg.isPackageExists)("radix-vue") && (0, import_local_pkg.isPackageExists)("clsx");
723
+ var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
724
+ var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("vuepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli") || (0, import_local_pkg.isPackageExists)("vue", {
725
+ paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground"), (0, import_node_path.resolve)(import_node_process.default.cwd(), "docs")]
726
+ });
727
+
728
+ // src/utils/toArray.ts
729
+ function toArray(val) {
730
+ val = val ?? [];
731
+ return Array.isArray(val) ? val : [val];
732
+ }
733
+
734
+ // src/utils/resolveSubOptions.ts
735
+ function resolveSubOptions(options, key) {
736
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
737
+ }
738
+
739
+ // src/utils/getOverrides.ts
740
+ function getOverrides(options, key) {
741
+ const subOptions = resolveSubOptions(options, key);
742
+ return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
743
+ }
744
+
745
+ // src/utils/combineConfigs.ts
746
+ async function combineConfigs(...configs2) {
747
+ const resolved = await Promise.all(configs2);
748
+ return resolved.flat();
749
+ }
750
+
751
+ // src/utils/ensurePackages.ts
752
+ var import_node_process3 = __toESM(require("process"), 1);
753
+ var import_node_url = require("url");
754
+ var import_local_pkg2 = require("local-pkg");
755
+
756
+ // src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
757
+ var import_node_process2 = __toESM(require("process"), 1);
758
+ function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
759
+ return !!(import_node_process2.default.env.GIT_PARAMS || import_node_process2.default.env.VSCODE_GIT_COMMAND || // lint staged files
760
+ import_node_process2.default.env.npm_lifecycle_script?.startsWith("nano-staged") || // run `scripts/generateType.ts`
761
+ import_node_process2.default.env.npm_lifecycle_script?.startsWith("tsx"));
762
+ }
763
+
764
+ // src/utils/ensurePackages.ts
765
+ var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
766
+ var isCwdInScope = (0, import_local_pkg2.isPackageExists)("@ntnyq/eslint-config");
767
+ function isPackageInScope(name) {
768
+ return (0, import_local_pkg2.isPackageExists)(name, {
769
+ paths: [scopeUrl]
770
+ });
771
+ }
772
+ async function ensurePackages(packages) {
773
+ if (import_node_process3.default.env.CI || !import_node_process3.default.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
774
+ return;
775
+ }
776
+ const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
777
+ if (nonExistingPackages.length === 0) {
778
+ return;
779
+ }
780
+ const { confirm } = await import("@clack/prompts");
781
+ const confirmInstall = await confirm({
782
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
783
+ });
784
+ if (confirmInstall) {
785
+ try {
786
+ const { installPackage } = await import("@antfu/install-pkg");
787
+ await installPackage(nonExistingPackages, { dev: true });
788
+ } catch (err) {
789
+ console.log(err);
720
790
  }
721
791
  }
722
- ];
792
+ }
793
+
794
+ // src/utils/interopDefault.ts
795
+ async function interopDefault(mod) {
796
+ const resolved = await mod;
797
+ return resolved.default || resolved;
798
+ }
799
+
800
+ // src/utils/mergePrettierOptions.ts
801
+ function mergePrettierOptions(options = {}, overrides = {}) {
802
+ const result = {
803
+ ...options,
804
+ ...overrides,
805
+ plugins: [
806
+ // built-in plugins
807
+ ...options.plugins || [],
808
+ // custom plugins
809
+ ...overrides.plugins || []
810
+ ]
811
+ };
812
+ return result;
813
+ }
814
+
815
+ // src/configs/esX.ts
816
+ var esX = async (options = {}) => {
817
+ await ensurePackages(["eslint-plugin-es-x"]);
818
+ const pluginEsX = await interopDefault(import("eslint-plugin-es-x"));
819
+ return [
820
+ {
821
+ name: "ntnyq/es-x",
822
+ plugins: {
823
+ "es-x": pluginEsX
824
+ },
825
+ rules: {
826
+ // Overrides rules
827
+ ...options.overrides
828
+ }
829
+ }
830
+ ];
831
+ };
723
832
 
724
833
  // src/configs/node.ts
725
834
  var node = (options = {}) => [
@@ -1155,12 +1264,19 @@ var vitest = (options = {}) => {
1155
1264
 
1156
1265
  // src/configs/svgo.ts
1157
1266
  var import_eslint_plugin_svgo2 = require("eslint-plugin-svgo");
1158
- var svgo = (options = {}) => [
1159
- {
1160
- ...(0, import_eslint_plugin_svgo2.config)(options),
1161
- name: "ntnyq/svgo"
1162
- }
1163
- ];
1267
+ var svgo = (options = {}) => {
1268
+ const { files = [GLOB_SVG], rules: overridesRules = {} } = options;
1269
+ return [
1270
+ (0, import_eslint_plugin_svgo2.createConfig)({
1271
+ name: "ntnyq/svgo",
1272
+ files,
1273
+ rules: {
1274
+ "svgo/svgo": "error",
1275
+ ...overridesRules
1276
+ }
1277
+ })
1278
+ ];
1279
+ };
1164
1280
 
1165
1281
  // src/configs/antfu.ts
1166
1282
  var antfu = (options = {}) => [
@@ -1183,6 +1299,13 @@ var antfu = (options = {}) => [
1183
1299
  ];
1184
1300
 
1185
1301
  // src/configs/jsdoc.ts
1302
+ var javscriptRules = {
1303
+ "jsdoc/no-types": "off",
1304
+ "jsdoc/no-undefined-types": "error",
1305
+ "jsdoc/require-param-type": "error",
1306
+ "jsdoc/require-property-type": "error",
1307
+ "jsdoc/require-returns-type": "error"
1308
+ };
1186
1309
  var typescriptRules = {
1187
1310
  "jsdoc/no-undefined-types": "off",
1188
1311
  "jsdoc/require-param-type": "off",
@@ -1203,20 +1326,33 @@ var jsdoc = (options = {}) => [
1203
1326
  "jsdoc/text-escaping": "off",
1204
1327
  // No need
1205
1328
  // Fixable rules
1206
- "jsdoc/check-alignment": "error",
1207
- "jsdoc/check-line-alignment": "error",
1208
- "jsdoc/check-param-names": "error",
1209
- "jsdoc/check-property-names": "error",
1210
- "jsdoc/check-types": "error",
1211
1329
  "jsdoc/empty-tags": "error",
1212
- "jsdoc/multiline-blocks": "error",
1213
- "jsdoc/no-bad-blocks": "error",
1214
- "jsdoc/no-blank-block-descriptions": "error",
1215
- "jsdoc/no-blank-blocks": "error",
1216
1330
  "jsdoc/no-defaults": "error",
1331
+ "jsdoc/check-types": "error",
1332
+ "jsdoc/no-blank-blocks": "error",
1333
+ "jsdoc/check-alignment": "error",
1334
+ "jsdoc/multiline-blocks": "error",
1335
+ "jsdoc/check-param-names": "error",
1217
1336
  "jsdoc/no-multi-asterisks": "error",
1337
+ "jsdoc/check-line-alignment": "error",
1338
+ "jsdoc/check-property-names": "error",
1218
1339
  "jsdoc/require-asterisk-prefix": "error",
1340
+ "jsdoc/no-blank-block-descriptions": "error",
1219
1341
  "jsdoc/require-hyphen-before-param-description": "error",
1342
+ "jsdoc/no-bad-blocks": [
1343
+ "error",
1344
+ {
1345
+ ignore: [
1346
+ // built-in default
1347
+ "ts-check",
1348
+ "ts-expect-error",
1349
+ "ts-ignore",
1350
+ "ts-nocheck",
1351
+ // useful
1352
+ "vite-ignore"
1353
+ ]
1354
+ }
1355
+ ],
1220
1356
  "jsdoc/check-tag-names": [
1221
1357
  "error",
1222
1358
  {
@@ -1410,7 +1546,7 @@ var jsdoc = (options = {}) => [
1410
1546
  "jsdoc/require-returns-description": "warn",
1411
1547
  "jsdoc/require-yields-check": "warn",
1412
1548
  // TypeScript rules overrides
1413
- ...options.typescript ? typescriptRules : {},
1549
+ ...options.typescript ? typescriptRules : javscriptRules,
1414
1550
  // Overrides rules
1415
1551
  ...options.overrides
1416
1552
  }
@@ -1494,17 +1630,17 @@ var pinia = (options = {}) => {
1494
1630
  };
1495
1631
 
1496
1632
  // src/configs/ntnyq.ts
1633
+ var import_eslint_plugin_ntnyq = require("eslint-plugin-ntnyq");
1497
1634
  var ntnyq = (options = {}) => [
1498
1635
  {
1499
- name: "ntnyq/ntnyq",
1500
- plugins: {
1501
- ntnyq: import_eslint_plugin_ntnyq.default
1502
- },
1503
- rules: {
1504
- "ntnyq/no-member-accessibility": "error",
1505
- // Overrides rules
1506
- ...options.overrides
1507
- }
1636
+ ...(0, import_eslint_plugin_ntnyq.createConfig)({
1637
+ rules: {
1638
+ "ntnyq/prefer-newline-after-file-header": "error",
1639
+ // Overrides rules
1640
+ ...options.overrides
1641
+ }
1642
+ }),
1643
+ name: "ntnyq/ntnyq"
1508
1644
  }
1509
1645
  ];
1510
1646
 
@@ -1640,66 +1776,6 @@ var DEFAULT_PRETTIER_OPTIONS = {
1640
1776
  vueIndentScriptAndStyle: false
1641
1777
  };
1642
1778
 
1643
- // src/utils/env.ts
1644
- var import_node_path = require("path");
1645
- var import_node_process = __toESM(require("process"), 1);
1646
- var import_local_pkg = require("local-pkg");
1647
- var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
1648
- var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
1649
- var hasShadcnVue = (0, import_local_pkg.isPackageExists)("radix-vue") && (0, import_local_pkg.isPackageExists)("clsx");
1650
- var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli") || (0, import_local_pkg.isPackageExists)("vue", {
1651
- paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground")]
1652
- });
1653
- var hasPinia = (0, import_local_pkg.isPackageExists)("pinia");
1654
- var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
1655
-
1656
- // src/utils/toArray.ts
1657
- function toArray(val) {
1658
- val = val ?? [];
1659
- return Array.isArray(val) ? val : [val];
1660
- }
1661
-
1662
- // src/utils/interopDefault.ts
1663
- async function interopDefault(mod) {
1664
- const resolved = await mod;
1665
- return resolved.default || resolved;
1666
- }
1667
-
1668
- // src/utils/loadPlugin.ts
1669
- async function loadPlugin(name) {
1670
- const mod = await import(name).catch((err) => {
1671
- console.error(err);
1672
- throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
1673
- });
1674
- return interopDefault(mod);
1675
- }
1676
-
1677
- // src/utils/resolveSubOptions.ts
1678
- function resolveSubOptions(options, key) {
1679
- return typeof options[key] === "boolean" ? {} : options[key] || {};
1680
- }
1681
-
1682
- // src/utils/getOverrides.ts
1683
- function getOverrides(options, key) {
1684
- const subOptions = resolveSubOptions(options, key);
1685
- return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
1686
- }
1687
-
1688
- // src/utils/mergePrettierOptions.ts
1689
- function mergePrettierOptions(options = {}, overrides = {}) {
1690
- const result = {
1691
- ...options,
1692
- ...overrides,
1693
- plugins: [
1694
- // built-in plugins
1695
- ...options.plugins || [],
1696
- // custom plugins
1697
- ...overrides.plugins || []
1698
- ]
1699
- };
1700
- return result;
1701
- }
1702
-
1703
1779
  // src/configs/format.ts
1704
1780
  var format = (options = {}) => {
1705
1781
  const {
@@ -2264,20 +2340,24 @@ var prettier = (options = {}) => {
2264
2340
  };
2265
2341
 
2266
2342
  // src/configs/stylistic.ts
2267
- var stylistic = (options = {}) => [
2268
- {
2269
- name: "ntnyq/stylistic",
2270
- plugins: {
2271
- "@stylistic": import_eslint_plugin3.default
2272
- },
2273
- rules: {
2274
- // Only rules are not conflicted with Prettier
2275
- // Use stylistic config to provide type support
2276
- // Overrides rules
2277
- ...options.overrides
2343
+ var stylistic = async (options = {}) => {
2344
+ await ensurePackages(["@stylistic/eslint-plugin"]);
2345
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
2346
+ return [
2347
+ {
2348
+ name: "ntnyq/stylistic",
2349
+ plugins: {
2350
+ "@stylistic": pluginStylistic
2351
+ },
2352
+ rules: {
2353
+ // Only rules are not conflicted with Prettier
2354
+ // Use stylistic config to provide type support
2355
+ // Overrides rules
2356
+ ...options.overrides
2357
+ }
2278
2358
  }
2279
- }
2280
- ];
2359
+ ];
2360
+ };
2281
2361
 
2282
2362
  // src/configs/gitignore.ts
2283
2363
  var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
@@ -2523,7 +2603,7 @@ var jsx = () => [
2523
2603
  ];
2524
2604
 
2525
2605
  // src/configs/typescript.ts
2526
- var import_node_process2 = __toESM(require("process"), 1);
2606
+ var import_node_process4 = __toESM(require("process"), 1);
2527
2607
  var typeAwareRules = {
2528
2608
  "dot-notation": "off",
2529
2609
  "require-await": "off",
@@ -2582,7 +2662,7 @@ var typescript = (options = {}) => {
2582
2662
  allowDefaultProject: ["./*.js"],
2583
2663
  defaultProject: options.tsconfigPath
2584
2664
  },
2585
- tsconfigRootDir: import_node_process2.default.cwd()
2665
+ tsconfigRootDir: import_node_process4.default.cwd()
2586
2666
  } : {},
2587
2667
  ...parserOptions
2588
2668
  };
@@ -2738,6 +2818,25 @@ var typescript = (options = {}) => {
2738
2818
  ];
2739
2819
  };
2740
2820
 
2821
+ // src/configs/eslintPlugin.ts
2822
+ var eslintPlugin = async (options = {}) => {
2823
+ await ensurePackages(["eslint-plugin-eslint-plugin"]);
2824
+ const pluginESLintPlugin = await interopDefault(import("eslint-plugin-eslint-plugin"));
2825
+ return [
2826
+ {
2827
+ ...pluginESLintPlugin.configs["flat/all"],
2828
+ name: "ntnyq/eslint-plugin",
2829
+ rules: {
2830
+ ...pluginESLintPlugin.configs["flat/all"].rules,
2831
+ // injected by `createRule`
2832
+ "eslint-plugin/require-meta-docs-url": "off",
2833
+ // Overrides rules
2834
+ ...options.overrides
2835
+ }
2836
+ }
2837
+ ];
2838
+ };
2839
+
2741
2840
  // src/configs/githubAction.ts
2742
2841
  var import_eslint_plugin_github_action2 = require("eslint-plugin-github-action");
2743
2842
  var githubAction = (options = {}) => {
@@ -3121,58 +3220,55 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3121
3220
  toml: enableTOML = true,
3122
3221
  jsonc: enableJSONC = true,
3123
3222
  antfu: enableAntfu = true,
3223
+ ntnyq: enableNtnyq = true,
3124
3224
  depend: enableDepend = true,
3125
3225
  regexp: enableRegexp = true,
3126
3226
  unicorn: enableUnicorn = true,
3127
3227
  prettier: enablePrettier = true,
3128
3228
  markdown: enableMarkdown = true,
3129
- stylistic: enableStylistic = true,
3130
3229
  gitignore: enableGitIgnore = true,
3131
3230
  githubAction: enableGitHubAction = true,
3132
3231
  perfectionist: enablePerfectionist = true,
3133
3232
  // disabled by default
3134
- svgo: enableSVGO = false
3233
+ svgo: enableSVGO = false,
3234
+ stylistic: enableStylistic = false,
3235
+ eslintPlugin: enableESLintPlugin = false
3135
3236
  } = options;
3136
3237
  const configs2 = [];
3137
3238
  if (enableVue) {
3138
3239
  supportedExtensions.push("vue");
3139
3240
  }
3140
3241
  if (enableGitIgnore) {
3141
- configs2.push(
3142
- ...gitignore({
3143
- ...resolveSubOptions(options, "gitignore")
3144
- })
3145
- );
3242
+ configs2.push(gitignore(resolveSubOptions(options, "gitignore")));
3146
3243
  }
3147
3244
  configs2.push(
3148
- ...ignores(options.ignores),
3149
- ...jsx(),
3150
- ...node({
3245
+ ignores(options.ignores),
3246
+ jsx(),
3247
+ node({
3151
3248
  overrides: getOverrides(options, "node")
3152
3249
  }),
3153
- ...command({
3154
- ...resolveSubOptions(options, "command")
3155
- }),
3156
- ...importX({
3250
+ command(resolveSubOptions(options, "command")),
3251
+ importX({
3157
3252
  ...resolveSubOptions(options, "importX"),
3158
3253
  typescript: !!enableTypeScript,
3159
3254
  overrides: getOverrides(options, "importX")
3160
3255
  }),
3161
- ...jsdoc({
3256
+ jsdoc({
3162
3257
  typescript: !!enableTypeScript,
3163
- overrides: getOverrides(options, "jsdoc")
3258
+ overrides: getOverrides(options, "jsdoc"),
3259
+ ...resolveSubOptions(options, "jsdoc")
3164
3260
  }),
3165
- ...comments({
3261
+ comments({
3166
3262
  overrides: getOverrides(options, "comments")
3167
3263
  }),
3168
- ...javascript({
3264
+ javascript({
3169
3265
  ...resolveSubOptions(options, "javascript"),
3170
3266
  overrides: getOverrides(options, "javascript")
3171
3267
  })
3172
3268
  );
3173
3269
  if (enablePerfectionist) {
3174
3270
  configs2.push(
3175
- ...perfectionist({
3271
+ perfectionist({
3176
3272
  ...resolveSubOptions(options, "perfectionist"),
3177
3273
  overrides: getOverrides(options, "perfectionist")
3178
3274
  })
@@ -3180,14 +3276,14 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3180
3276
  }
3181
3277
  if (enableUnicorn) {
3182
3278
  configs2.push(
3183
- ...unicorn({
3279
+ unicorn({
3184
3280
  overrides: getOverrides(options, "unicorn")
3185
3281
  })
3186
3282
  );
3187
3283
  }
3188
3284
  if (enablePinia) {
3189
3285
  configs2.push(
3190
- ...pinia({
3286
+ pinia({
3191
3287
  ...resolveSubOptions(options, "pinia"),
3192
3288
  overrides: getOverrides(options, "pinia")
3193
3289
  })
@@ -3195,7 +3291,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3195
3291
  }
3196
3292
  if (enableRegexp) {
3197
3293
  configs2.push(
3198
- ...regexp({
3294
+ regexp({
3199
3295
  ...resolveSubOptions(options, "regexp"),
3200
3296
  overrides: getOverrides(options, "regexp")
3201
3297
  })
@@ -3203,7 +3299,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3203
3299
  }
3204
3300
  if (enableTypeScript) {
3205
3301
  configs2.push(
3206
- ...typescript({
3302
+ typescript({
3207
3303
  ...resolveSubOptions(options, "typescript"),
3208
3304
  extensions: supportedExtensions,
3209
3305
  overrides: getOverrides(options, "typescript")
@@ -3212,7 +3308,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3212
3308
  }
3213
3309
  if (enableVue) {
3214
3310
  configs2.push(
3215
- ...vue({
3311
+ vue({
3216
3312
  ...resolveSubOptions(options, "vue"),
3217
3313
  typescript: !!enableTypeScript,
3218
3314
  overrides: getOverrides(options, "vue")
@@ -3221,52 +3317,48 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3221
3317
  }
3222
3318
  if (enableYML) {
3223
3319
  configs2.push(
3224
- ...yml({
3320
+ yml({
3225
3321
  overrides: getOverrides(options, "yml")
3226
3322
  })
3227
3323
  );
3228
3324
  }
3229
3325
  if (enableTOML) {
3230
3326
  configs2.push(
3231
- ...toml({
3327
+ toml({
3232
3328
  overrides: getOverrides(options, "toml")
3233
3329
  })
3234
3330
  );
3235
3331
  }
3236
3332
  if (enableJSONC) {
3237
3333
  configs2.push(
3238
- ...jsonc({
3334
+ jsonc({
3239
3335
  overrides: getOverrides(options, "jsonc")
3240
3336
  })
3241
3337
  );
3242
3338
  }
3243
3339
  if (enableSort) {
3244
- configs2.push(
3245
- ...sort({
3246
- ...resolveSubOptions(options, "sort")
3247
- })
3248
- );
3340
+ configs2.push(sort(resolveSubOptions(options, "sort")));
3249
3341
  }
3250
3342
  if (enableTest) {
3251
3343
  configs2.push(
3252
- ...test({
3344
+ test({
3253
3345
  overrides: getOverrides(options, "test")
3254
3346
  }),
3255
- ...vitest({
3347
+ vitest({
3256
3348
  overrides: getOverrides(options, "test")
3257
3349
  })
3258
3350
  );
3259
3351
  }
3260
3352
  if (enableUnoCSS) {
3261
3353
  configs2.push(
3262
- ...unocss({
3354
+ unocss({
3263
3355
  overrides: getOverrides(options, "unocss")
3264
3356
  })
3265
3357
  );
3266
3358
  }
3267
3359
  if (enableMarkdown) {
3268
3360
  configs2.push(
3269
- ...markdown({
3361
+ markdown({
3270
3362
  extensions: supportedExtensions,
3271
3363
  overrides: getOverrides(options, "markdown")
3272
3364
  })
@@ -3274,43 +3366,51 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3274
3366
  }
3275
3367
  if (enableAntfu) {
3276
3368
  configs2.push(
3277
- ...antfu({
3369
+ antfu({
3278
3370
  overrides: getOverrides(options, "antfu")
3279
3371
  })
3280
3372
  );
3281
3373
  }
3282
- if (enableStylistic) {
3374
+ if (enableDepend) {
3283
3375
  configs2.push(
3284
- ...stylistic({
3285
- overrides: getOverrides(options, "stylistic")
3376
+ depend({
3377
+ ...resolveSubOptions(options, "depend"),
3378
+ overrides: getOverrides(options, "depend")
3286
3379
  })
3287
3380
  );
3288
3381
  }
3289
- if (enableDepend) {
3382
+ if (enableNtnyq) {
3290
3383
  configs2.push(
3291
- ...depend({
3292
- ...resolveSubOptions(options, "depend"),
3293
- overrides: getOverrides(options, "depend")
3384
+ ntnyq({
3385
+ overrides: getOverrides(options, "ntnyq")
3294
3386
  })
3295
3387
  );
3296
3388
  }
3297
3389
  if (enableGitHubAction) {
3298
3390
  configs2.push(
3299
- ...githubAction({
3391
+ githubAction({
3300
3392
  overrides: getOverrides(options, "githubAction")
3301
3393
  })
3302
3394
  );
3303
3395
  }
3304
- if (enableSVGO) {
3396
+ if (enableESLintPlugin) {
3305
3397
  configs2.push(
3306
- ...svgo({
3307
- ...resolveSubOptions(options, "svgo")
3398
+ eslintPlugin({
3399
+ overrides: getOverrides(options, "eslintPlugin")
3308
3400
  })
3309
3401
  );
3310
3402
  }
3311
- const configSpecials = specials({
3312
- ...resolveSubOptions(options, "specials")
3313
- });
3403
+ if (enableStylistic) {
3404
+ configs2.push(
3405
+ stylistic({
3406
+ overrides: getOverrides(options, "stylistic")
3407
+ })
3408
+ );
3409
+ }
3410
+ if (enableSVGO) {
3411
+ configs2.push(svgo(resolveSubOptions(options, "svgo")));
3412
+ }
3413
+ const configSpecials = specials(resolveSubOptions(options, "specials"));
3314
3414
  const configPrettier = enablePrettier ? prettier({
3315
3415
  ...resolveSubOptions(options, "prettier"),
3316
3416
  overrides: getOverrides(options, "prettier")
@@ -3363,13 +3463,16 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3363
3463
  GLOB_VUE,
3364
3464
  GLOB_YAML,
3365
3465
  antfu,
3466
+ combineConfigs,
3366
3467
  command,
3367
3468
  comments,
3368
3469
  createNodeResolver,
3369
3470
  createTypeScriptImportResolver,
3370
3471
  defineESLintConfig,
3371
3472
  depend,
3473
+ ensurePackages,
3372
3474
  esX,
3475
+ eslintPlugin,
3373
3476
  format,
3374
3477
  getOverrides,
3375
3478
  githubAction,
@@ -3383,11 +3486,11 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3383
3486
  ignores,
3384
3487
  importX,
3385
3488
  interopDefault,
3489
+ isInGitHooksOrRunByNanoStagedOrRunByTSX,
3386
3490
  javascript,
3387
3491
  jsdoc,
3388
3492
  jsonc,
3389
3493
  jsx,
3390
- loadPlugin,
3391
3494
  markdown,
3392
3495
  mergePrettierOptions,
3393
3496
  mergeProcessors,
@@ -3404,7 +3507,6 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3404
3507
  pluginAntfu,
3405
3508
  pluginComments,
3406
3509
  pluginDepend,
3407
- pluginEsX,
3408
3510
  pluginFormat,
3409
3511
  pluginGitHubAction,
3410
3512
  pluginImportX,
@@ -3412,12 +3514,10 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3412
3514
  pluginJsonc,
3413
3515
  pluginMarkdown,
3414
3516
  pluginNode,
3415
- pluginNtnyq,
3416
3517
  pluginPerfectionist,
3417
3518
  pluginPinia,
3418
3519
  pluginPrettier,
3419
3520
  pluginRegexp,
3420
- pluginStylistic,
3421
3521
  pluginSvgo,
3422
3522
  pluginToml,
3423
3523
  pluginTypeScript,