@ntnyq/eslint-config 3.11.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -37,40 +37,37 @@ import * as pluginRegexp from "eslint-plugin-regexp";
37
37
  import * as pluginDepend from "eslint-plugin-depend";
38
38
  import { default as default2 } from "eslint-plugin-n";
39
39
  import { default as default3 } from "eslint-plugin-vue";
40
- import { default as default4 } from "eslint-plugin-es-x";
41
- import { default as default5 } from "eslint-plugin-yml";
42
- import { default as default6 } from "eslint-plugin-svgo";
43
- import { default as default7 } from "eslint-plugin-toml";
44
- import { default as default8 } from "eslint-plugin-pinia";
45
- import { default as default9 } from "eslint-plugin-ntnyq";
46
- import { default as default10 } from "@eslint/markdown";
47
- import { default as default11 } from "eslint-plugin-antfu";
48
- import { default as default12 } from "eslint-plugin-jsdoc";
49
- import { default as default13 } from "eslint-plugin-jsonc";
40
+ import { default as default4 } from "eslint-plugin-yml";
41
+ import { default as default5 } from "eslint-plugin-svgo";
42
+ import { default as default6 } from "eslint-plugin-toml";
43
+ import { default as default7 } from "eslint-plugin-pinia";
44
+ import { default as default8 } from "@eslint/markdown";
45
+ import { default as default9 } from "eslint-plugin-antfu";
46
+ import { default as default10 } from "eslint-plugin-jsdoc";
47
+ import { default as default11 } from "eslint-plugin-jsonc";
50
48
  import { plugin } from "typescript-eslint";
51
- import { default as default14 } from "eslint-plugin-format";
52
- import { default as default15 } from "@unocss/eslint-plugin";
53
- import { default as default16 } from "@vitest/eslint-plugin";
54
- import { default as default17 } from "eslint-plugin-unicorn";
55
- import { default as default18 } from "eslint-plugin-import-x";
56
- import { default as default19 } from "eslint-plugin-prettier";
57
- import { default as default20 } from "@stylistic/eslint-plugin";
58
- import { default as default21 } from "eslint-plugin-github-action";
59
- import { default as default22 } from "eslint-plugin-perfectionist";
60
- import { default as default23 } from "eslint-plugin-unused-imports";
61
- import { default as default24 } from "@eslint-community/eslint-plugin-eslint-comments";
49
+ import { default as default12 } from "eslint-plugin-format";
50
+ import { default as default13 } from "@unocss/eslint-plugin";
51
+ import { default as default14 } from "@vitest/eslint-plugin";
52
+ import { default as default15 } from "eslint-plugin-unicorn";
53
+ import { default as default16 } from "eslint-plugin-import-x";
54
+ import { default as default17 } from "eslint-plugin-prettier";
55
+ import { default as default18 } from "eslint-plugin-github-action";
56
+ import { default as default19 } from "eslint-plugin-perfectionist";
57
+ import { default as default20 } from "eslint-plugin-unused-imports";
58
+ import { default as default21 } from "@eslint-community/eslint-plugin-eslint-comments";
62
59
 
63
60
  // src/eslint/configs.ts
64
61
  import { configs } from "typescript-eslint";
65
62
 
66
63
  // src/eslint/resolvers.ts
67
64
  import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
68
- var createNodeResolver = default18.createNodeResolver;
65
+ var createNodeResolver = default16.createNodeResolver;
69
66
 
70
67
  // src/eslint/processors.ts
71
68
  import { mergeProcessors } from "eslint-merge-processors";
72
69
  import { processorPassThrough } from "eslint-merge-processors";
73
- import { default as default25 } from "eslint-processor-vue-blocks";
70
+ import { default as default22 } from "eslint-processor-vue-blocks";
74
71
 
75
72
  // src/globs.ts
76
73
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -171,7 +168,11 @@ var GLOB_EXCLUDE = [
171
168
  "**/.wrangler",
172
169
  "**/.changeset",
173
170
  "**/.npmrc",
174
- "**/.yarnrc"
171
+ "**/.yarnrc",
172
+ "**/.husky",
173
+ // tauri
174
+ "**/src-tauri/gen",
175
+ "**/src-tauri/target"
175
176
  ];
176
177
 
177
178
  // src/configs/vue.ts
@@ -382,7 +383,7 @@ var vue = (options = {}) => {
382
383
  if (!sfcBlocks) return processorVueSFC;
383
384
  return mergeProcessors2([
384
385
  processorVueSFC,
385
- default25({
386
+ default22({
386
387
  ...sfcBlocks,
387
388
  blocks: {
388
389
  styles: true,
@@ -537,11 +538,11 @@ var yml = (options = {}) => [
537
538
  parser: parserYaml
538
539
  },
539
540
  plugins: {
540
- yml: default5
541
+ yml: default4
541
542
  },
542
543
  rules: {
543
- ...default5.configs.standard.rules,
544
- ...default5.configs.prettier.rules,
544
+ ...default4.configs.standard.rules,
545
+ ...default4.configs.prettier.rules,
545
546
  "yml/no-empty-mapping-value": "off",
546
547
  "yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
547
548
  // Overrides rules
@@ -550,19 +551,123 @@ var yml = (options = {}) => [
550
551
  }
551
552
  ];
552
553
 
553
- // src/configs/esX.ts
554
- var esX = (options = {}) => [
555
- {
556
- name: "ntnyq/es-x",
557
- plugins: {
558
- "es-x": default4
559
- },
560
- rules: {
561
- // Overrides rules
562
- ...options.overrides
554
+ // src/utils/env.ts
555
+ import { resolve } from "node:path";
556
+ import process from "node:process";
557
+ import { isPackageExists } from "local-pkg";
558
+ var hasPinia = isPackageExists("pinia");
559
+ var hasVitest = isPackageExists("vitest");
560
+ var hasTypeScript = isPackageExists("typescript");
561
+ var hasShadcnVue = isPackageExists("radix-vue") && isPackageExists("clsx");
562
+ var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
563
+ var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
564
+ paths: [resolve(process.cwd(), "playground"), resolve(process.cwd(), "docs")]
565
+ });
566
+
567
+ // src/utils/toArray.ts
568
+ function toArray(val) {
569
+ val = val ?? [];
570
+ return Array.isArray(val) ? val : [val];
571
+ }
572
+
573
+ // src/utils/resolveSubOptions.ts
574
+ function resolveSubOptions(options, key) {
575
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
576
+ }
577
+
578
+ // src/utils/getOverrides.ts
579
+ function getOverrides(options, key) {
580
+ const subOptions = resolveSubOptions(options, key);
581
+ return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
582
+ }
583
+
584
+ // src/utils/combineConfigs.ts
585
+ async function combineConfigs(...configs2) {
586
+ const resolved = await Promise.all(configs2);
587
+ return resolved.flat();
588
+ }
589
+
590
+ // src/utils/ensurePackages.ts
591
+ import process3 from "node:process";
592
+ import { fileURLToPath } from "node:url";
593
+ import { isPackageExists as isPackageExists2 } from "local-pkg";
594
+
595
+ // src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
596
+ import process2 from "node:process";
597
+ function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
598
+ return !!(process2.env.GIT_PARAMS || process2.env.VSCODE_GIT_COMMAND || // lint staged files
599
+ process2.env.npm_lifecycle_script?.startsWith("nano-staged") || // run `scripts/generateType.ts`
600
+ process2.env.npm_lifecycle_script?.startsWith("tsx"));
601
+ }
602
+
603
+ // src/utils/ensurePackages.ts
604
+ var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
605
+ var isCwdInScope = isPackageExists2("@ntnyq/eslint-config");
606
+ function isPackageInScope(name) {
607
+ return isPackageExists2(name, {
608
+ paths: [scopeUrl]
609
+ });
610
+ }
611
+ async function ensurePackages(packages) {
612
+ if (process3.env.CI || !process3.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
613
+ return;
614
+ }
615
+ const nonExistingPackages = packages.filter((pkg) => !!pkg && isPackageInScope(pkg));
616
+ if (nonExistingPackages.length === 0) {
617
+ return;
618
+ }
619
+ const { confirm } = await import("@clack/prompts");
620
+ const confirmInstall = await confirm({
621
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
622
+ });
623
+ if (confirmInstall) {
624
+ try {
625
+ const { installPackage } = await import("@antfu/install-pkg");
626
+ await installPackage(nonExistingPackages, { dev: true });
627
+ } catch (err) {
628
+ console.log(err);
563
629
  }
564
630
  }
565
- ];
631
+ }
632
+
633
+ // src/utils/interopDefault.ts
634
+ async function interopDefault(mod) {
635
+ const resolved = await mod;
636
+ return resolved.default || resolved;
637
+ }
638
+
639
+ // src/utils/mergePrettierOptions.ts
640
+ function mergePrettierOptions(options = {}, overrides = {}) {
641
+ const result = {
642
+ ...options,
643
+ ...overrides,
644
+ plugins: [
645
+ // built-in plugins
646
+ ...options.plugins || [],
647
+ // custom plugins
648
+ ...overrides.plugins || []
649
+ ]
650
+ };
651
+ return result;
652
+ }
653
+
654
+ // src/configs/esX.ts
655
+ var esX = async (options = {}) => {
656
+ await ensurePackages(["eslint-plugin-es-x"]);
657
+ const pluginEsX = await interopDefault(import("eslint-plugin-es-x"));
658
+ return [
659
+ {
660
+ name: "ntnyq/es-x",
661
+ plugins: {
662
+ "es-x": pluginEsX
663
+ },
664
+ rules: {
665
+ // Overrides rules
666
+ ...options.overrides
667
+ }
668
+ }
669
+ ];
670
+ };
566
671
 
567
672
  // src/configs/node.ts
568
673
  var node = (options = {}) => [
@@ -936,7 +1041,7 @@ var toml = (options = {}) => [
936
1041
  parser: parserToml
937
1042
  },
938
1043
  plugins: {
939
- toml: default7
1044
+ toml: default6
940
1045
  },
941
1046
  rules: {
942
1047
  "toml/keys-order": "error",
@@ -978,13 +1083,13 @@ var test = (options = {}) => [
978
1083
  }
979
1084
  ];
980
1085
  var vitest = (options = {}) => {
981
- if (!default16.configs?.recommended) return [];
982
- const vitestConfigs = default16.configs;
1086
+ if (!default14.configs?.recommended) return [];
1087
+ const vitestConfigs = default14.configs;
983
1088
  return [
984
1089
  {
985
1090
  name: "ntnyq/vitest",
986
1091
  plugins: {
987
- vitest: default16
1092
+ vitest: default14
988
1093
  },
989
1094
  files: [...GLOB_TEST],
990
1095
  rules: {
@@ -1010,7 +1115,7 @@ var antfu = (options = {}) => [
1010
1115
  {
1011
1116
  name: "ntnyq/antfu",
1012
1117
  plugins: {
1013
- antfu: default11
1118
+ antfu: default9
1014
1119
  },
1015
1120
  rules: {
1016
1121
  // required `object-curly-newline` to be disabled
@@ -1037,7 +1142,7 @@ var jsdoc = (options = {}) => [
1037
1142
  {
1038
1143
  name: "ntnyq/jsdoc",
1039
1144
  plugins: {
1040
- jsdoc: default12
1145
+ jsdoc: default10
1041
1146
  },
1042
1147
  rules: {
1043
1148
  // Disabled rules
@@ -1046,20 +1151,33 @@ var jsdoc = (options = {}) => [
1046
1151
  "jsdoc/text-escaping": "off",
1047
1152
  // No need
1048
1153
  // Fixable rules
1049
- "jsdoc/check-alignment": "error",
1050
- "jsdoc/check-line-alignment": "error",
1051
- "jsdoc/check-param-names": "error",
1052
- "jsdoc/check-property-names": "error",
1053
- "jsdoc/check-types": "error",
1054
1154
  "jsdoc/empty-tags": "error",
1055
- "jsdoc/multiline-blocks": "error",
1056
- "jsdoc/no-bad-blocks": "error",
1057
- "jsdoc/no-blank-block-descriptions": "error",
1058
- "jsdoc/no-blank-blocks": "error",
1059
1155
  "jsdoc/no-defaults": "error",
1156
+ "jsdoc/check-types": "error",
1157
+ "jsdoc/no-blank-blocks": "error",
1158
+ "jsdoc/check-alignment": "error",
1159
+ "jsdoc/multiline-blocks": "error",
1160
+ "jsdoc/check-param-names": "error",
1060
1161
  "jsdoc/no-multi-asterisks": "error",
1162
+ "jsdoc/check-line-alignment": "error",
1163
+ "jsdoc/check-property-names": "error",
1061
1164
  "jsdoc/require-asterisk-prefix": "error",
1165
+ "jsdoc/no-blank-block-descriptions": "error",
1062
1166
  "jsdoc/require-hyphen-before-param-description": "error",
1167
+ "jsdoc/no-bad-blocks": [
1168
+ "error",
1169
+ {
1170
+ ignore: [
1171
+ // built-in default
1172
+ "ts-check",
1173
+ "ts-expect-error",
1174
+ "ts-ignore",
1175
+ "ts-nocheck",
1176
+ // useful
1177
+ "vite-ignore"
1178
+ ]
1179
+ }
1180
+ ],
1063
1181
  "jsdoc/check-tag-names": [
1064
1182
  "error",
1065
1183
  {
@@ -1266,13 +1384,13 @@ var jsonc = (options = {}) => [
1266
1384
  name: "ntnyq/jsonc",
1267
1385
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1268
1386
  plugins: {
1269
- jsonc: default13
1387
+ jsonc: default11
1270
1388
  },
1271
1389
  languageOptions: {
1272
1390
  parser: parserJsonc
1273
1391
  },
1274
1392
  rules: {
1275
- ...default13.configs["recommended-with-jsonc"].rules,
1393
+ ...default11.configs["recommended-with-jsonc"].rules,
1276
1394
  "jsonc/no-octal-escape": "error",
1277
1395
  "jsonc/indent": ["error", 2],
1278
1396
  "jsonc/comma-style": ["error", "last"],
@@ -1313,7 +1431,7 @@ var pinia = (options = {}) => {
1313
1431
  name: "ntnyq/pinia",
1314
1432
  files,
1315
1433
  plugins: {
1316
- pinia: default8
1434
+ pinia: default7
1317
1435
  },
1318
1436
  rules: {
1319
1437
  "pinia/prefer-single-store-per-file": "error",
@@ -1337,17 +1455,17 @@ var pinia = (options = {}) => {
1337
1455
  };
1338
1456
 
1339
1457
  // src/configs/ntnyq.ts
1458
+ import { createConfig as createNtnyqConfig } from "eslint-plugin-ntnyq";
1340
1459
  var ntnyq = (options = {}) => [
1341
1460
  {
1342
- name: "ntnyq/ntnyq",
1343
- plugins: {
1344
- ntnyq: default9
1345
- },
1346
- rules: {
1347
- "ntnyq/no-member-accessibility": "error",
1348
- // Overrides rules
1349
- ...options.overrides
1350
- }
1461
+ ...createNtnyqConfig({
1462
+ rules: {
1463
+ "ntnyq/prefer-newline-after-file-header": "error",
1464
+ // Overrides rules
1465
+ ...options.overrides
1466
+ }
1467
+ }),
1468
+ name: "ntnyq/ntnyq"
1351
1469
  }
1352
1470
  ];
1353
1471
 
@@ -1423,7 +1541,7 @@ var unocss = (options = {}) => [
1423
1541
  {
1424
1542
  name: "ntnyq/unocss",
1425
1543
  plugins: {
1426
- unocss: default15
1544
+ unocss: default13
1427
1545
  },
1428
1546
  rules: {
1429
1547
  "unocss/order": "error",
@@ -1483,66 +1601,6 @@ var DEFAULT_PRETTIER_OPTIONS = {
1483
1601
  vueIndentScriptAndStyle: false
1484
1602
  };
1485
1603
 
1486
- // src/utils/env.ts
1487
- import { resolve } from "node:path";
1488
- import process from "node:process";
1489
- import { isPackageExists } from "local-pkg";
1490
- var hasTypeScript = isPackageExists("typescript");
1491
- var hasVitest = isPackageExists("vitest");
1492
- var hasShadcnVue = isPackageExists("radix-vue") && isPackageExists("clsx");
1493
- var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
1494
- paths: [resolve(process.cwd(), "playground")]
1495
- });
1496
- var hasPinia = isPackageExists("pinia");
1497
- var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
1498
-
1499
- // src/utils/toArray.ts
1500
- function toArray(val) {
1501
- val = val ?? [];
1502
- return Array.isArray(val) ? val : [val];
1503
- }
1504
-
1505
- // src/utils/interopDefault.ts
1506
- async function interopDefault(mod) {
1507
- const resolved = await mod;
1508
- return resolved.default || resolved;
1509
- }
1510
-
1511
- // src/utils/loadPlugin.ts
1512
- async function loadPlugin(name) {
1513
- const mod = await import(name).catch((err) => {
1514
- console.error(err);
1515
- throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
1516
- });
1517
- return interopDefault(mod);
1518
- }
1519
-
1520
- // src/utils/resolveSubOptions.ts
1521
- function resolveSubOptions(options, key) {
1522
- return typeof options[key] === "boolean" ? {} : options[key] || {};
1523
- }
1524
-
1525
- // src/utils/getOverrides.ts
1526
- function getOverrides(options, key) {
1527
- const subOptions = resolveSubOptions(options, key);
1528
- return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
1529
- }
1530
-
1531
- // src/utils/mergePrettierOptions.ts
1532
- function mergePrettierOptions(options = {}, overrides = {}) {
1533
- const result = {
1534
- ...options,
1535
- ...overrides,
1536
- plugins: [
1537
- // built-in plugins
1538
- ...options.plugins || [],
1539
- // custom plugins
1540
- ...overrides.plugins || []
1541
- ]
1542
- };
1543
- return result;
1544
- }
1545
-
1546
1604
  // src/configs/format.ts
1547
1605
  var format = (options = {}) => {
1548
1606
  const {
@@ -1559,7 +1617,7 @@ var format = (options = {}) => {
1559
1617
  {
1560
1618
  name: "ntnyq/format/setup",
1561
1619
  plugins: {
1562
- format: default14
1620
+ format: default12
1563
1621
  }
1564
1622
  }
1565
1623
  ];
@@ -1722,7 +1780,7 @@ var importX = (options = {}) => {
1722
1780
  {
1723
1781
  name: "ntnyq/import-x",
1724
1782
  plugins: {
1725
- "import-x": default18
1783
+ "import-x": default16
1726
1784
  },
1727
1785
  settings: {
1728
1786
  "import-x/resolver-next": [
@@ -1768,7 +1826,7 @@ var unicorn = (options = {}) => [
1768
1826
  {
1769
1827
  name: "ntnyq/unicorn",
1770
1828
  plugins: {
1771
- unicorn: default17
1829
+ unicorn: default15
1772
1830
  },
1773
1831
  rules: {
1774
1832
  "unicorn/escape-case": "error",
@@ -1895,8 +1953,8 @@ var specials = (options = {}) => {
1895
1953
  name: "ntnyq/specials/config-file",
1896
1954
  files: [`**/*.config*.${GLOB_SRC_EXT}`],
1897
1955
  plugins: {
1898
- "import-x": default18,
1899
- perfectionist: default22
1956
+ "import-x": default16,
1957
+ perfectionist: default19
1900
1958
  },
1901
1959
  rules: {
1902
1960
  "no-console": "off",
@@ -1939,10 +1997,10 @@ var comments = (options = {}) => [
1939
1997
  {
1940
1998
  name: "ntnyq/eslint-comments",
1941
1999
  plugins: {
1942
- "@eslint-community/eslint-comments": default24
2000
+ "@eslint-community/eslint-comments": default21
1943
2001
  },
1944
2002
  rules: {
1945
- ...default24.configs.recommended.rules,
2003
+ ...default21.configs.recommended.rules,
1946
2004
  "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
1947
2005
  // Overrides rules
1948
2006
  ...options.overrides
@@ -1952,7 +2010,7 @@ var comments = (options = {}) => [
1952
2010
 
1953
2011
  // src/configs/markdown.ts
1954
2012
  var markdown = (options = {}) => {
1955
- if (!Array.isArray(default10.configs?.processor)) return [];
2013
+ if (!Array.isArray(default8.configs?.processor)) return [];
1956
2014
  const {
1957
2015
  /**
1958
2016
  * code block files
@@ -1967,7 +2025,7 @@ var markdown = (options = {}) => {
1967
2025
  /**
1968
2026
  * extracting code blocks to be linted individually
1969
2027
  */
1970
- ...default10.configs.processor.map((config) => ({
2028
+ ...default8.configs.processor.map((config) => ({
1971
2029
  ...config,
1972
2030
  name: `ntnyq/${config.name}`
1973
2031
  })),
@@ -1979,7 +2037,7 @@ var markdown = (options = {}) => {
1979
2037
  files,
1980
2038
  ignores: [GLOB_MARKDOWN_NESTED],
1981
2039
  processor: mergeProcessors([
1982
- default10.processors.markdown,
2040
+ default8.processors.markdown,
1983
2041
  // Just pass through processor
1984
2042
  processorPassThrough
1985
2043
  ])
@@ -2044,7 +2102,7 @@ var prettier = (options = {}) => {
2044
2102
  {
2045
2103
  name: "ntnyq/prettier",
2046
2104
  plugins: {
2047
- prettier: default19
2105
+ prettier: default17
2048
2106
  },
2049
2107
  rules: {
2050
2108
  "vue/array-bracket-newline": "off",
@@ -2084,7 +2142,7 @@ var prettier = (options = {}) => {
2084
2142
  "vue/space-infix-ops": "off",
2085
2143
  "vue/space-unary-ops": "off",
2086
2144
  "vue/template-curly-spacing": "off",
2087
- ...default19.configs.recommended.rules,
2145
+ ...default17.configs.recommended.rules,
2088
2146
  "prettier/prettier": options.severity || options.level || "warn",
2089
2147
  // Overrides rules
2090
2148
  ...options.overrides
@@ -2097,7 +2155,7 @@ var prettier = (options = {}) => {
2097
2155
  name: "ntnyq/prettier/disabled",
2098
2156
  files: [...disabledFiles, ...userDisabledFiles],
2099
2157
  plugins: {
2100
- prettier: default19
2158
+ prettier: default17
2101
2159
  },
2102
2160
  rules: {
2103
2161
  "prettier/prettier": "off"
@@ -2107,20 +2165,24 @@ var prettier = (options = {}) => {
2107
2165
  };
2108
2166
 
2109
2167
  // src/configs/stylistic.ts
2110
- var stylistic = (options = {}) => [
2111
- {
2112
- name: "ntnyq/stylistic",
2113
- plugins: {
2114
- "@stylistic": default20
2115
- },
2116
- rules: {
2117
- // Only rules are not conflicted with Prettier
2118
- // Use stylistic config to provide type support
2119
- // Overrides rules
2120
- ...options.overrides
2168
+ var stylistic = async (options = {}) => {
2169
+ await ensurePackages(["@stylistic/eslint-plugin"]);
2170
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
2171
+ return [
2172
+ {
2173
+ name: "ntnyq/stylistic",
2174
+ plugins: {
2175
+ "@stylistic": pluginStylistic
2176
+ },
2177
+ rules: {
2178
+ // Only rules are not conflicted with Prettier
2179
+ // Use stylistic config to provide type support
2180
+ // Overrides rules
2181
+ ...options.overrides
2182
+ }
2121
2183
  }
2122
- }
2123
- ];
2184
+ ];
2185
+ };
2124
2186
 
2125
2187
  // src/configs/gitignore.ts
2126
2188
  import createGitIgnoreConfig from "eslint-config-flat-gitignore";
@@ -2366,7 +2428,7 @@ var jsx = () => [
2366
2428
  ];
2367
2429
 
2368
2430
  // src/configs/typescript.ts
2369
- import process2 from "node:process";
2431
+ import process4 from "node:process";
2370
2432
  var typeAwareRules = {
2371
2433
  "dot-notation": "off",
2372
2434
  "require-await": "off",
@@ -2425,7 +2487,7 @@ var typescript = (options = {}) => {
2425
2487
  allowDefaultProject: ["./*.js"],
2426
2488
  defaultProject: options.tsconfigPath
2427
2489
  },
2428
- tsconfigRootDir: process2.cwd()
2490
+ tsconfigRootDir: process4.cwd()
2429
2491
  } : {},
2430
2492
  ...parserOptions
2431
2493
  };
@@ -2445,7 +2507,7 @@ var typescript = (options = {}) => {
2445
2507
  name: "ntnyq/ts/setup",
2446
2508
  plugins: {
2447
2509
  "@typescript-eslint": plugin,
2448
- antfu: default11
2510
+ antfu: default9
2449
2511
  }
2450
2512
  },
2451
2513
  ...enableTypeAwareLint ? [
@@ -2581,6 +2643,25 @@ var typescript = (options = {}) => {
2581
2643
  ];
2582
2644
  };
2583
2645
 
2646
+ // src/configs/eslintPlugin.ts
2647
+ var eslintPlugin = async (options = {}) => {
2648
+ await ensurePackages(["eslint-plugin-eslint-plugin"]);
2649
+ const pluginESLintPlugin = await interopDefault(import("eslint-plugin-eslint-plugin"));
2650
+ return [
2651
+ {
2652
+ ...pluginESLintPlugin.configs["flat/all"],
2653
+ name: "ntnyq/eslint-plugin",
2654
+ rules: {
2655
+ ...pluginESLintPlugin.configs["flat/all"].rules,
2656
+ // injected by `createRule`
2657
+ "eslint-plugin/require-meta-docs-url": "off",
2658
+ // Overrides rules
2659
+ ...options.overrides
2660
+ }
2661
+ }
2662
+ ];
2663
+ };
2664
+
2584
2665
  // src/configs/githubAction.ts
2585
2666
  import { createRecommendedConfig } from "eslint-plugin-github-action";
2586
2667
  var githubAction = (options = {}) => {
@@ -2685,7 +2766,7 @@ var perfectionist = (options = {}) => {
2685
2766
  {
2686
2767
  name: "ntnyq/perfectionist/common",
2687
2768
  plugins: {
2688
- perfectionist: default22
2769
+ perfectionist: default19
2689
2770
  },
2690
2771
  rules: {
2691
2772
  "perfectionist/sort-imports": [
@@ -2775,7 +2856,7 @@ var perfectionist = (options = {}) => {
2775
2856
  name: "ntnyq/perfectionist/enums",
2776
2857
  files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
2777
2858
  plugins: {
2778
- perfectionist: default22
2859
+ perfectionist: default19
2779
2860
  },
2780
2861
  rules: {
2781
2862
  "perfectionist/sort-enums": [
@@ -2804,7 +2885,7 @@ var perfectionist = (options = {}) => {
2804
2885
  name: "ntnyq/perfectionist/types",
2805
2886
  files: [...GLOB_TYPES],
2806
2887
  plugins: {
2807
- perfectionist: default22
2888
+ perfectionist: default19
2808
2889
  },
2809
2890
  rules: {
2810
2891
  "perfectionist/sort-heritage-clauses": [
@@ -2868,7 +2949,7 @@ var perfectionist = (options = {}) => {
2868
2949
  name: "ntnyq/perfectionist/constants",
2869
2950
  files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
2870
2951
  plugins: {
2871
- perfectionist: default22
2952
+ perfectionist: default19
2872
2953
  },
2873
2954
  rules: {
2874
2955
  "perfectionist/sort-maps": [
@@ -2917,7 +2998,7 @@ var unusedImports = (options = {}) => [
2917
2998
  {
2918
2999
  name: "ntnyq/unused-imports",
2919
3000
  plugins: {
2920
- "unused-imports": default23
3001
+ "unused-imports": default20
2921
3002
  },
2922
3003
  rules: {
2923
3004
  "@typescript-eslint/no-unused-vars": "off",
@@ -2964,17 +3045,19 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2964
3045
  toml: enableTOML = true,
2965
3046
  jsonc: enableJSONC = true,
2966
3047
  antfu: enableAntfu = true,
3048
+ ntnyq: enableNtnyq = true,
2967
3049
  depend: enableDepend = true,
2968
3050
  regexp: enableRegexp = true,
2969
3051
  unicorn: enableUnicorn = true,
2970
3052
  prettier: enablePrettier = true,
2971
3053
  markdown: enableMarkdown = true,
2972
- stylistic: enableStylistic = true,
2973
3054
  gitignore: enableGitIgnore = true,
2974
3055
  githubAction: enableGitHubAction = true,
2975
3056
  perfectionist: enablePerfectionist = true,
2976
3057
  // disabled by default
2977
- svgo: enableSVGO = false
3058
+ svgo: enableSVGO = false,
3059
+ stylistic: enableStylistic = false,
3060
+ eslintPlugin: enableESLintPlugin = false
2978
3061
  } = options;
2979
3062
  const configs2 = [];
2980
3063
  if (enableVue) {
@@ -3122,13 +3205,6 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3122
3205
  })
3123
3206
  );
3124
3207
  }
3125
- if (enableStylistic) {
3126
- configs2.push(
3127
- ...stylistic({
3128
- overrides: getOverrides(options, "stylistic")
3129
- })
3130
- );
3131
- }
3132
3208
  if (enableDepend) {
3133
3209
  configs2.push(
3134
3210
  ...depend({
@@ -3137,13 +3213,34 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3137
3213
  })
3138
3214
  );
3139
3215
  }
3216
+ if (enableNtnyq) {
3217
+ configs2.push(
3218
+ ntnyq({
3219
+ overrides: getOverrides(options, "ntnyq")
3220
+ })
3221
+ );
3222
+ }
3140
3223
  if (enableGitHubAction) {
3141
3224
  configs2.push(
3142
- ...githubAction({
3225
+ githubAction({
3143
3226
  overrides: getOverrides(options, "githubAction")
3144
3227
  })
3145
3228
  );
3146
3229
  }
3230
+ if (enableESLintPlugin) {
3231
+ configs2.push(
3232
+ eslintPlugin({
3233
+ overrides: getOverrides(options, "eslintPlugin")
3234
+ })
3235
+ );
3236
+ }
3237
+ if (enableStylistic) {
3238
+ configs2.push(
3239
+ stylistic({
3240
+ overrides: getOverrides(options, "stylistic")
3241
+ })
3242
+ );
3243
+ }
3147
3244
  if (enableSVGO) {
3148
3245
  configs2.push(
3149
3246
  ...svgo({
@@ -3205,13 +3302,16 @@ export {
3205
3302
  GLOB_VUE,
3206
3303
  GLOB_YAML,
3207
3304
  antfu,
3305
+ combineConfigs,
3208
3306
  command,
3209
3307
  comments,
3210
3308
  createNodeResolver,
3211
3309
  createTypeScriptImportResolver,
3212
3310
  defineESLintConfig,
3213
3311
  depend,
3312
+ ensurePackages,
3214
3313
  esX,
3314
+ eslintPlugin,
3215
3315
  format,
3216
3316
  getOverrides,
3217
3317
  githubAction,
@@ -3225,11 +3325,11 @@ export {
3225
3325
  ignores,
3226
3326
  importX,
3227
3327
  interopDefault,
3328
+ isInGitHooksOrRunByNanoStagedOrRunByTSX,
3228
3329
  javascript,
3229
3330
  jsdoc,
3230
3331
  jsonc,
3231
3332
  jsx,
3232
- loadPlugin,
3233
3333
  markdown,
3234
3334
  mergePrettierOptions,
3235
3335
  mergeProcessors,
@@ -3243,35 +3343,32 @@ export {
3243
3343
  parserYaml,
3244
3344
  perfectionist,
3245
3345
  pinia,
3246
- default11 as pluginAntfu,
3247
- default24 as pluginComments,
3346
+ default9 as pluginAntfu,
3347
+ default21 as pluginComments,
3248
3348
  pluginDepend,
3249
- default4 as pluginEsX,
3250
- default14 as pluginFormat,
3251
- default21 as pluginGitHubAction,
3252
- default18 as pluginImportX,
3253
- default12 as pluginJsdoc,
3254
- default13 as pluginJsonc,
3255
- default10 as pluginMarkdown,
3349
+ default12 as pluginFormat,
3350
+ default18 as pluginGitHubAction,
3351
+ default16 as pluginImportX,
3352
+ default10 as pluginJsdoc,
3353
+ default11 as pluginJsonc,
3354
+ default8 as pluginMarkdown,
3256
3355
  default2 as pluginNode,
3257
- default9 as pluginNtnyq,
3258
- default22 as pluginPerfectionist,
3259
- default8 as pluginPinia,
3260
- default19 as pluginPrettier,
3356
+ default19 as pluginPerfectionist,
3357
+ default7 as pluginPinia,
3358
+ default17 as pluginPrettier,
3261
3359
  pluginRegexp,
3262
- default20 as pluginStylistic,
3263
- default6 as pluginSvgo,
3264
- default7 as pluginToml,
3360
+ default5 as pluginSvgo,
3361
+ default6 as pluginToml,
3265
3362
  plugin as pluginTypeScript,
3266
- default17 as pluginUnicorn,
3267
- default15 as pluginUnoCSS,
3268
- default23 as pluginUnusedImports,
3269
- default16 as pluginVitest,
3363
+ default15 as pluginUnicorn,
3364
+ default13 as pluginUnoCSS,
3365
+ default20 as pluginUnusedImports,
3366
+ default14 as pluginVitest,
3270
3367
  default3 as pluginVue,
3271
- default5 as pluginYaml,
3368
+ default4 as pluginYaml,
3272
3369
  prettier,
3273
3370
  processorPassThrough,
3274
- default25 as processorVueBlocks,
3371
+ default22 as processorVueBlocks,
3275
3372
  regexp,
3276
3373
  resolveSubOptions,
3277
3374
  sort,