@ntnyq/eslint-config 3.10.4 → 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,65 +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 hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
1493
- paths: [resolve(process.cwd(), "playground")]
1494
- });
1495
- var hasPinia = isPackageExists("pinia");
1496
- var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
1497
-
1498
- // src/utils/toArray.ts
1499
- function toArray(val) {
1500
- val = val ?? [];
1501
- return Array.isArray(val) ? val : [val];
1502
- }
1503
-
1504
- // src/utils/interopDefault.ts
1505
- async function interopDefault(mod) {
1506
- const resolved = await mod;
1507
- return resolved.default || resolved;
1508
- }
1509
-
1510
- // src/utils/loadPlugin.ts
1511
- async function loadPlugin(name) {
1512
- const mod = await import(name).catch((err) => {
1513
- console.error(err);
1514
- throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
1515
- });
1516
- return interopDefault(mod);
1517
- }
1518
-
1519
- // src/utils/resolveSubOptions.ts
1520
- function resolveSubOptions(options, key) {
1521
- return typeof options[key] === "boolean" ? {} : options[key] || {};
1522
- }
1523
-
1524
- // src/utils/getOverrides.ts
1525
- function getOverrides(options, key) {
1526
- const sub = resolveSubOptions(options, key);
1527
- return "overrides" in sub && sub.overrides ? sub.overrides : {};
1528
- }
1529
-
1530
- // src/utils/mergePrettierOptions.ts
1531
- function mergePrettierOptions(options = {}, overrides = {}) {
1532
- const result = {
1533
- ...options,
1534
- ...overrides,
1535
- plugins: [
1536
- // built-in plugins
1537
- ...options.plugins || [],
1538
- // custom plugins
1539
- ...overrides.plugins || []
1540
- ]
1541
- };
1542
- return result;
1543
- }
1544
-
1545
1604
  // src/configs/format.ts
1546
1605
  var format = (options = {}) => {
1547
1606
  const {
@@ -1558,7 +1617,7 @@ var format = (options = {}) => {
1558
1617
  {
1559
1618
  name: "ntnyq/format/setup",
1560
1619
  plugins: {
1561
- format: default14
1620
+ format: default12
1562
1621
  }
1563
1622
  }
1564
1623
  ];
@@ -1721,7 +1780,7 @@ var importX = (options = {}) => {
1721
1780
  {
1722
1781
  name: "ntnyq/import-x",
1723
1782
  plugins: {
1724
- "import-x": default18
1783
+ "import-x": default16
1725
1784
  },
1726
1785
  settings: {
1727
1786
  "import-x/resolver-next": [
@@ -1767,7 +1826,7 @@ var unicorn = (options = {}) => [
1767
1826
  {
1768
1827
  name: "ntnyq/unicorn",
1769
1828
  plugins: {
1770
- unicorn: default17
1829
+ unicorn: default15
1771
1830
  },
1772
1831
  rules: {
1773
1832
  "unicorn/escape-case": "error",
@@ -1845,83 +1904,103 @@ var unicorn = (options = {}) => [
1845
1904
 
1846
1905
  // src/configs/specials.ts
1847
1906
  import globals from "globals";
1848
- var specials = (options = {}) => [
1849
- {
1850
- name: "ntnyq/specials/scripts",
1851
- files: [`**/scripts/${GLOB_SRC}`],
1852
- rules: {
1853
- "no-console": "off",
1854
- "@typescript-eslint/explicit-function-return-type": "off",
1855
- // Overrides rules
1856
- ...options.overridesScriptsRules
1857
- }
1858
- },
1859
- {
1860
- name: "ntnyq/specials/cli",
1861
- files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1862
- rules: {
1863
- "no-console": "off",
1864
- "@typescript-eslint/explicit-function-return-type": "off",
1865
- // Overrides rules
1866
- ...options.overridesCliRules
1867
- }
1868
- },
1869
- {
1870
- name: "ntnyq/specials/userscript",
1871
- files: [`**/*.user.${GLOB_SRC_EXT}`],
1872
- languageOptions: {
1873
- globals: {
1874
- ...globals.greasemonkey
1907
+ var specials = (options = {}) => {
1908
+ const {
1909
+ // Enable shadcn-vue support
1910
+ shadcnVue: enableShadcnVue = hasShadcnVue
1911
+ } = options;
1912
+ const configs2 = [
1913
+ {
1914
+ name: "ntnyq/specials/scripts",
1915
+ files: [`**/scripts/${GLOB_SRC}`],
1916
+ rules: {
1917
+ "no-console": "off",
1918
+ "@typescript-eslint/explicit-function-return-type": "off",
1919
+ // Overrides rules
1920
+ ...options.overridesScriptsRules
1875
1921
  }
1876
1922
  },
1877
- rules: {
1878
- camelcase: [
1879
- "error",
1880
- {
1881
- allow: ["^GM_.+"]
1882
- }
1883
- ],
1884
- // Overrides rules
1885
- ...options.overridesUserScriptsRules
1886
- }
1887
- },
1888
- {
1889
- name: "ntnyq/specials/config-file",
1890
- files: [`**/*.config*.${GLOB_SRC_EXT}`],
1891
- plugins: {
1892
- "import-x": default18,
1893
- perfectionist: default22
1923
+ {
1924
+ name: "ntnyq/specials/cli",
1925
+ files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
1926
+ rules: {
1927
+ "no-console": "off",
1928
+ "@typescript-eslint/explicit-function-return-type": "off",
1929
+ // Overrides rules
1930
+ ...options.overridesCliRules
1931
+ }
1894
1932
  },
1895
- rules: {
1896
- "no-console": "off",
1897
- "import-x/no-default-export": "off",
1898
- "@typescript-eslint/explicit-function-return-type": "off",
1899
- "perfectionist/sort-objects": [
1900
- "error",
1901
- {
1902
- type: "alphabetical",
1903
- order: "asc",
1904
- partitionByComment: true,
1905
- groups: ["unknown", "method", "multiline"]
1933
+ {
1934
+ name: "ntnyq/specials/userscript",
1935
+ files: [`**/*.user.${GLOB_SRC_EXT}`],
1936
+ languageOptions: {
1937
+ globals: {
1938
+ ...globals.greasemonkey
1906
1939
  }
1907
- ],
1908
- ...options.overridesConfigFileRules
1940
+ },
1941
+ rules: {
1942
+ camelcase: [
1943
+ "error",
1944
+ {
1945
+ allow: ["^GM_.+"]
1946
+ }
1947
+ ],
1948
+ // Overrides rules
1949
+ ...options.overridesUserScriptsRules
1950
+ }
1951
+ },
1952
+ {
1953
+ name: "ntnyq/specials/config-file",
1954
+ files: [`**/*.config*.${GLOB_SRC_EXT}`],
1955
+ plugins: {
1956
+ "import-x": default16,
1957
+ perfectionist: default19
1958
+ },
1959
+ rules: {
1960
+ "no-console": "off",
1961
+ "import-x/no-default-export": "off",
1962
+ "@typescript-eslint/explicit-function-return-type": "off",
1963
+ "perfectionist/sort-objects": [
1964
+ "error",
1965
+ {
1966
+ type: "alphabetical",
1967
+ order: "asc",
1968
+ partitionByComment: true,
1969
+ groups: ["unknown", "method", "multiline"]
1970
+ }
1971
+ ],
1972
+ ...options.overridesConfigFileRules
1973
+ }
1909
1974
  }
1910
- },
1911
- // More special case configs
1912
- // So don't need to append configs to composer
1913
- ...options.specialCaseConfigs ? options.specialCaseConfigs : []
1914
- ];
1975
+ ];
1976
+ if (enableShadcnVue) {
1977
+ const shadcnOptions = resolveSubOptions(options, "shadcnVue");
1978
+ configs2.push({
1979
+ name: "ntnyq/specials/shadcn-vue",
1980
+ files: shadcnOptions.files || ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
1981
+ rules: {
1982
+ "@typescript-eslint/no-unused-vars": "off",
1983
+ "@typescript-eslint/consistent-type-imports": "off",
1984
+ // Overrides rules
1985
+ ...shadcnOptions.overridesRules
1986
+ }
1987
+ });
1988
+ }
1989
+ if (options.specialCaseConfigs) {
1990
+ configs2.push(...options.specialCaseConfigs);
1991
+ }
1992
+ return configs2;
1993
+ };
1915
1994
 
1916
1995
  // src/configs/comments.ts
1917
1996
  var comments = (options = {}) => [
1918
1997
  {
1919
1998
  name: "ntnyq/eslint-comments",
1920
1999
  plugins: {
1921
- "@eslint-community/eslint-comments": default24
2000
+ "@eslint-community/eslint-comments": default21
1922
2001
  },
1923
2002
  rules: {
1924
- ...default24.configs.recommended.rules,
2003
+ ...default21.configs.recommended.rules,
1925
2004
  "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
1926
2005
  // Overrides rules
1927
2006
  ...options.overrides
@@ -1931,7 +2010,7 @@ var comments = (options = {}) => [
1931
2010
 
1932
2011
  // src/configs/markdown.ts
1933
2012
  var markdown = (options = {}) => {
1934
- if (!Array.isArray(default10.configs?.processor)) return [];
2013
+ if (!Array.isArray(default8.configs?.processor)) return [];
1935
2014
  const {
1936
2015
  /**
1937
2016
  * code block files
@@ -1946,7 +2025,7 @@ var markdown = (options = {}) => {
1946
2025
  /**
1947
2026
  * extracting code blocks to be linted individually
1948
2027
  */
1949
- ...default10.configs.processor.map((config) => ({
2028
+ ...default8.configs.processor.map((config) => ({
1950
2029
  ...config,
1951
2030
  name: `ntnyq/${config.name}`
1952
2031
  })),
@@ -1958,7 +2037,7 @@ var markdown = (options = {}) => {
1958
2037
  files,
1959
2038
  ignores: [GLOB_MARKDOWN_NESTED],
1960
2039
  processor: mergeProcessors([
1961
- default10.processors.markdown,
2040
+ default8.processors.markdown,
1962
2041
  // Just pass through processor
1963
2042
  processorPassThrough
1964
2043
  ])
@@ -2023,7 +2102,7 @@ var prettier = (options = {}) => {
2023
2102
  {
2024
2103
  name: "ntnyq/prettier",
2025
2104
  plugins: {
2026
- prettier: default19
2105
+ prettier: default17
2027
2106
  },
2028
2107
  rules: {
2029
2108
  "vue/array-bracket-newline": "off",
@@ -2063,7 +2142,7 @@ var prettier = (options = {}) => {
2063
2142
  "vue/space-infix-ops": "off",
2064
2143
  "vue/space-unary-ops": "off",
2065
2144
  "vue/template-curly-spacing": "off",
2066
- ...default19.configs.recommended.rules,
2145
+ ...default17.configs.recommended.rules,
2067
2146
  "prettier/prettier": options.severity || options.level || "warn",
2068
2147
  // Overrides rules
2069
2148
  ...options.overrides
@@ -2076,7 +2155,7 @@ var prettier = (options = {}) => {
2076
2155
  name: "ntnyq/prettier/disabled",
2077
2156
  files: [...disabledFiles, ...userDisabledFiles],
2078
2157
  plugins: {
2079
- prettier: default19
2158
+ prettier: default17
2080
2159
  },
2081
2160
  rules: {
2082
2161
  "prettier/prettier": "off"
@@ -2086,20 +2165,24 @@ var prettier = (options = {}) => {
2086
2165
  };
2087
2166
 
2088
2167
  // src/configs/stylistic.ts
2089
- var stylistic = (options = {}) => [
2090
- {
2091
- name: "ntnyq/stylistic",
2092
- plugins: {
2093
- "@stylistic": default20
2094
- },
2095
- rules: {
2096
- // Only rules are not conflicted with Prettier
2097
- // Use stylistic config to provide type support
2098
- // Overrides rules
2099
- ...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
+ }
2100
2183
  }
2101
- }
2102
- ];
2184
+ ];
2185
+ };
2103
2186
 
2104
2187
  // src/configs/gitignore.ts
2105
2188
  import createGitIgnoreConfig from "eslint-config-flat-gitignore";
@@ -2345,7 +2428,7 @@ var jsx = () => [
2345
2428
  ];
2346
2429
 
2347
2430
  // src/configs/typescript.ts
2348
- import process2 from "node:process";
2431
+ import process4 from "node:process";
2349
2432
  var typeAwareRules = {
2350
2433
  "dot-notation": "off",
2351
2434
  "require-await": "off",
@@ -2404,7 +2487,7 @@ var typescript = (options = {}) => {
2404
2487
  allowDefaultProject: ["./*.js"],
2405
2488
  defaultProject: options.tsconfigPath
2406
2489
  },
2407
- tsconfigRootDir: process2.cwd()
2490
+ tsconfigRootDir: process4.cwd()
2408
2491
  } : {},
2409
2492
  ...parserOptions
2410
2493
  };
@@ -2424,7 +2507,7 @@ var typescript = (options = {}) => {
2424
2507
  name: "ntnyq/ts/setup",
2425
2508
  plugins: {
2426
2509
  "@typescript-eslint": plugin,
2427
- antfu: default11
2510
+ antfu: default9
2428
2511
  }
2429
2512
  },
2430
2513
  ...enableTypeAwareLint ? [
@@ -2436,11 +2519,24 @@ var typescript = (options = {}) => {
2436
2519
  files,
2437
2520
  rules: {
2438
2521
  ...recommendedRules,
2439
- // Disabled in favor of ts rules
2522
+ "@typescript-eslint/no-namespace": "off",
2523
+ "@typescript-eslint/no-explicit-any": "off",
2524
+ "@typescript-eslint/naming-convention": "off",
2525
+ "@typescript-eslint/no-empty-function": "off",
2526
+ "@typescript-eslint/no-non-null-assertion": "off",
2527
+ "@typescript-eslint/triple-slash-reference": "off",
2528
+ "@typescript-eslint/explicit-member-accessibility": "off",
2529
+ "@typescript-eslint/explicit-function-return-type": "off",
2530
+ "@typescript-eslint/explicit-module-boundary-types": "off",
2531
+ "@typescript-eslint/consistent-indexed-object-style": "off",
2532
+ "@typescript-eslint/prefer-as-const": "warn",
2533
+ // Disabled in favor of enhanced ts rules
2440
2534
  "no-redeclare": "off",
2441
2535
  "no-unused-vars": "off",
2536
+ "default-param-last": "off",
2442
2537
  "no-use-before-define": "off",
2443
2538
  "no-useless-constructor": "off",
2539
+ "@typescript-eslint/default-param-last": "error",
2444
2540
  "@typescript-eslint/no-useless-constructor": "error",
2445
2541
  "@typescript-eslint/no-redeclare": [
2446
2542
  "error",
@@ -2474,6 +2570,19 @@ var typescript = (options = {}) => {
2474
2570
  ignoreRestSiblings: true
2475
2571
  }
2476
2572
  ],
2573
+ // Extra rules
2574
+ "@typescript-eslint/ban-tslint-comment": "error",
2575
+ "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
2576
+ "@typescript-eslint/ban-ts-comment": [
2577
+ "error",
2578
+ {
2579
+ minimumDescriptionLength: 1,
2580
+ "ts-check": false,
2581
+ "ts-expect-error": "allow-with-description",
2582
+ "ts-ignore": "allow-with-description",
2583
+ "ts-nocheck": "allow-with-description"
2584
+ }
2585
+ ],
2477
2586
  "@typescript-eslint/no-unused-expressions": [
2478
2587
  "error",
2479
2588
  {
@@ -2504,18 +2613,6 @@ var typescript = (options = {}) => {
2504
2613
  objectLiteralTypeAssertions: "allow-as-parameter"
2505
2614
  }
2506
2615
  ],
2507
- "@typescript-eslint/prefer-as-const": "warn",
2508
- "@typescript-eslint/no-namespace": "off",
2509
- "@typescript-eslint/ban-ts-comment": "off",
2510
- "@typescript-eslint/no-explicit-any": "off",
2511
- "@typescript-eslint/no-empty-function": "off",
2512
- "@typescript-eslint/naming-convention": "off",
2513
- "@typescript-eslint/no-non-null-assertion": "off",
2514
- "@typescript-eslint/triple-slash-reference": "off",
2515
- "@typescript-eslint/explicit-member-accessibility": "off",
2516
- "@typescript-eslint/explicit-function-return-type": "off",
2517
- "@typescript-eslint/explicit-module-boundary-types": "off",
2518
- "@typescript-eslint/consistent-indexed-object-style": "off",
2519
2616
  // Overrides rules
2520
2617
  ...options.overrides
2521
2618
  }
@@ -2546,6 +2643,25 @@ var typescript = (options = {}) => {
2546
2643
  ];
2547
2644
  };
2548
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
+
2549
2665
  // src/configs/githubAction.ts
2550
2666
  import { createRecommendedConfig } from "eslint-plugin-github-action";
2551
2667
  var githubAction = (options = {}) => {
@@ -2650,7 +2766,7 @@ var perfectionist = (options = {}) => {
2650
2766
  {
2651
2767
  name: "ntnyq/perfectionist/common",
2652
2768
  plugins: {
2653
- perfectionist: default22
2769
+ perfectionist: default19
2654
2770
  },
2655
2771
  rules: {
2656
2772
  "perfectionist/sort-imports": [
@@ -2740,7 +2856,7 @@ var perfectionist = (options = {}) => {
2740
2856
  name: "ntnyq/perfectionist/enums",
2741
2857
  files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
2742
2858
  plugins: {
2743
- perfectionist: default22
2859
+ perfectionist: default19
2744
2860
  },
2745
2861
  rules: {
2746
2862
  "perfectionist/sort-enums": [
@@ -2769,7 +2885,7 @@ var perfectionist = (options = {}) => {
2769
2885
  name: "ntnyq/perfectionist/types",
2770
2886
  files: [...GLOB_TYPES],
2771
2887
  plugins: {
2772
- perfectionist: default22
2888
+ perfectionist: default19
2773
2889
  },
2774
2890
  rules: {
2775
2891
  "perfectionist/sort-heritage-clauses": [
@@ -2833,7 +2949,7 @@ var perfectionist = (options = {}) => {
2833
2949
  name: "ntnyq/perfectionist/constants",
2834
2950
  files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
2835
2951
  plugins: {
2836
- perfectionist: default22
2952
+ perfectionist: default19
2837
2953
  },
2838
2954
  rules: {
2839
2955
  "perfectionist/sort-maps": [
@@ -2882,7 +2998,7 @@ var unusedImports = (options = {}) => [
2882
2998
  {
2883
2999
  name: "ntnyq/unused-imports",
2884
3000
  plugins: {
2885
- "unused-imports": default23
3001
+ "unused-imports": default20
2886
3002
  },
2887
3003
  rules: {
2888
3004
  "@typescript-eslint/no-unused-vars": "off",
@@ -2929,17 +3045,19 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2929
3045
  toml: enableTOML = true,
2930
3046
  jsonc: enableJSONC = true,
2931
3047
  antfu: enableAntfu = true,
3048
+ ntnyq: enableNtnyq = true,
2932
3049
  depend: enableDepend = true,
2933
3050
  regexp: enableRegexp = true,
2934
3051
  unicorn: enableUnicorn = true,
2935
3052
  prettier: enablePrettier = true,
2936
3053
  markdown: enableMarkdown = true,
2937
- stylistic: enableStylistic = true,
2938
3054
  gitignore: enableGitIgnore = true,
2939
3055
  githubAction: enableGitHubAction = true,
2940
3056
  perfectionist: enablePerfectionist = true,
2941
3057
  // disabled by default
2942
- svgo: enableSVGO = false
3058
+ svgo: enableSVGO = false,
3059
+ stylistic: enableStylistic = false,
3060
+ eslintPlugin: enableESLintPlugin = false
2943
3061
  } = options;
2944
3062
  const configs2 = [];
2945
3063
  if (enableVue) {
@@ -3087,13 +3205,6 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3087
3205
  })
3088
3206
  );
3089
3207
  }
3090
- if (enableStylistic) {
3091
- configs2.push(
3092
- ...stylistic({
3093
- overrides: getOverrides(options, "stylistic")
3094
- })
3095
- );
3096
- }
3097
3208
  if (enableDepend) {
3098
3209
  configs2.push(
3099
3210
  ...depend({
@@ -3102,13 +3213,34 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3102
3213
  })
3103
3214
  );
3104
3215
  }
3216
+ if (enableNtnyq) {
3217
+ configs2.push(
3218
+ ntnyq({
3219
+ overrides: getOverrides(options, "ntnyq")
3220
+ })
3221
+ );
3222
+ }
3105
3223
  if (enableGitHubAction) {
3106
3224
  configs2.push(
3107
- ...githubAction({
3225
+ githubAction({
3108
3226
  overrides: getOverrides(options, "githubAction")
3109
3227
  })
3110
3228
  );
3111
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
+ }
3112
3244
  if (enableSVGO) {
3113
3245
  configs2.push(
3114
3246
  ...svgo({
@@ -3170,18 +3302,22 @@ export {
3170
3302
  GLOB_VUE,
3171
3303
  GLOB_YAML,
3172
3304
  antfu,
3305
+ combineConfigs,
3173
3306
  command,
3174
3307
  comments,
3175
3308
  createNodeResolver,
3176
3309
  createTypeScriptImportResolver,
3177
3310
  defineESLintConfig,
3178
3311
  depend,
3312
+ ensurePackages,
3179
3313
  esX,
3314
+ eslintPlugin,
3180
3315
  format,
3181
3316
  getOverrides,
3182
3317
  githubAction,
3183
3318
  gitignore,
3184
3319
  hasPinia,
3320
+ hasShadcnVue,
3185
3321
  hasTypeScript,
3186
3322
  hasUnoCSS,
3187
3323
  hasVitest,
@@ -3189,11 +3325,11 @@ export {
3189
3325
  ignores,
3190
3326
  importX,
3191
3327
  interopDefault,
3328
+ isInGitHooksOrRunByNanoStagedOrRunByTSX,
3192
3329
  javascript,
3193
3330
  jsdoc,
3194
3331
  jsonc,
3195
3332
  jsx,
3196
- loadPlugin,
3197
3333
  markdown,
3198
3334
  mergePrettierOptions,
3199
3335
  mergeProcessors,
@@ -3207,35 +3343,32 @@ export {
3207
3343
  parserYaml,
3208
3344
  perfectionist,
3209
3345
  pinia,
3210
- default11 as pluginAntfu,
3211
- default24 as pluginComments,
3346
+ default9 as pluginAntfu,
3347
+ default21 as pluginComments,
3212
3348
  pluginDepend,
3213
- default4 as pluginEsX,
3214
- default14 as pluginFormat,
3215
- default21 as pluginGitHubAction,
3216
- default18 as pluginImportX,
3217
- default12 as pluginJsdoc,
3218
- default13 as pluginJsonc,
3219
- 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,
3220
3355
  default2 as pluginNode,
3221
- default9 as pluginNtnyq,
3222
- default22 as pluginPerfectionist,
3223
- default8 as pluginPinia,
3224
- default19 as pluginPrettier,
3356
+ default19 as pluginPerfectionist,
3357
+ default7 as pluginPinia,
3358
+ default17 as pluginPrettier,
3225
3359
  pluginRegexp,
3226
- default20 as pluginStylistic,
3227
- default6 as pluginSvgo,
3228
- default7 as pluginToml,
3360
+ default5 as pluginSvgo,
3361
+ default6 as pluginToml,
3229
3362
  plugin as pluginTypeScript,
3230
- default17 as pluginUnicorn,
3231
- default15 as pluginUnoCSS,
3232
- default23 as pluginUnusedImports,
3233
- default16 as pluginVitest,
3363
+ default15 as pluginUnicorn,
3364
+ default13 as pluginUnoCSS,
3365
+ default20 as pluginUnusedImports,
3366
+ default14 as pluginVitest,
3234
3367
  default3 as pluginVue,
3235
- default5 as pluginYaml,
3368
+ default4 as pluginYaml,
3236
3369
  prettier,
3237
3370
  processorPassThrough,
3238
- default25 as processorVueBlocks,
3371
+ default22 as processorVueBlocks,
3239
3372
  regexp,
3240
3373
  resolveSubOptions,
3241
3374
  sort,