@ntnyq/eslint-config 5.5.0 → 5.6.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +299 -180
  2. package/dist/index.js +42 -22
  3. package/package.json +27 -26
package/dist/index.js CHANGED
@@ -550,8 +550,7 @@ function getOverrides(options, key) {
550
550
  //#endregion
551
551
  //#region src/utils/combineConfigs.ts
552
552
  async function combineConfigs(...configs) {
553
- const resolved = await Promise.all(configs);
554
- return resolved.flat();
553
+ return (await Promise.all(configs)).flat();
555
554
  }
556
555
 
557
556
  //#endregion
@@ -577,8 +576,7 @@ async function ensurePackages(packages) {
577
576
  const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
578
577
  if (nonExistingPackages.length === 0) return;
579
578
  const { confirm } = await import("@clack/prompts");
580
- const confirmInstall = await confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` });
581
- if (confirmInstall) try {
579
+ if (await confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` })) try {
582
580
  const { installPackage } = await import("@antfu/install-pkg");
583
581
  await installPackage(nonExistingPackages, { dev: true });
584
582
  } catch (err) {
@@ -601,12 +599,11 @@ async function interopDefault(mod) {
601
599
  //#endregion
602
600
  //#region src/utils/mergePrettierOptions.ts
603
601
  function mergePrettierOptions(options = {}, overrides = {}) {
604
- const result = {
602
+ return {
605
603
  ...options,
606
604
  ...overrides,
607
605
  plugins: [...options.plugins || [], ...overrides.plugins || []]
608
606
  };
609
- return result;
610
607
  }
611
608
 
612
609
  //#endregion
@@ -1324,6 +1321,7 @@ const configJsdoc = (options = {}) => [{
1324
1321
  name: "ntnyq/jsdoc",
1325
1322
  plugins: { jsdoc: pluginJsdoc },
1326
1323
  rules: {
1324
+ "jsdoc/require-tags": "off",
1327
1325
  "jsdoc/tag-lines": "off",
1328
1326
  "jsdoc/text-escaping": "off",
1329
1327
  "jsdoc/check-access": "warn",
@@ -1335,6 +1333,12 @@ const configJsdoc = (options = {}) => [{
1335
1333
  "jsdoc/require-returns-check": "warn",
1336
1334
  "jsdoc/require-returns-description": "warn",
1337
1335
  "jsdoc/require-yields-check": "warn",
1336
+ "jsdoc/require-next-description": "warn",
1337
+ "jsdoc/require-next-type": "warn",
1338
+ "jsdoc/require-throws-description": "warn",
1339
+ "jsdoc/require-throws-type": "warn",
1340
+ "jsdoc/require-yields-description": "warn",
1341
+ "jsdoc/require-yields-type": "warn",
1338
1342
  "jsdoc/check-alignment": "error",
1339
1343
  "jsdoc/check-line-alignment": "error",
1340
1344
  "jsdoc/check-param-names": "error",
@@ -1364,8 +1368,21 @@ const configJsdoc = (options = {}) => [{
1364
1368
  "jsdoc/no-blank-blocks": "error",
1365
1369
  "jsdoc/no-defaults": "error",
1366
1370
  "jsdoc/no-multi-asterisks": "error",
1371
+ "jsdoc/reject-any-type": "error",
1372
+ "jsdoc/reject-function-type": "error",
1367
1373
  "jsdoc/require-asterisk-prefix": "error",
1368
1374
  "jsdoc/require-hyphen-before-param-description": "error",
1375
+ "jsdoc/type-formatting": ["error", {
1376
+ arrayBrackets: "square",
1377
+ enableFixer: true,
1378
+ genericDot: false,
1379
+ objectFieldIndent: "",
1380
+ objectFieldQuote: null,
1381
+ objectFieldSeparator: "comma",
1382
+ stringQuotes: "single",
1383
+ typeBracketSpacing: "",
1384
+ unionSpacing: ""
1385
+ }],
1369
1386
  ...options.typescript ? typescriptRules : javscriptRules,
1370
1387
  ...options.overrides
1371
1388
  }
@@ -1529,25 +1546,31 @@ const configPinia = (options = {}) => {
1529
1546
  * @returns ESLint configs
1530
1547
  */
1531
1548
  const configDepend = (options = {}) => {
1532
- const { files = [GLOB_SRC], allowed = [], packageJson: enableCheckPackageJson = true } = options;
1549
+ const { files = [GLOB_SRC], allowed = [], modules = [], packageJson: enableCheckPackageJson = true, presets = [
1550
+ "native",
1551
+ "microutilities",
1552
+ "preferred"
1553
+ ] } = options;
1554
+ const rules = {
1555
+ "depend/ban-dependencies": ["error", {
1556
+ allowed,
1557
+ modules,
1558
+ presets
1559
+ }],
1560
+ ...options.overrides
1561
+ };
1533
1562
  const configs = [{
1534
1563
  name: "ntnyq/depend",
1535
1564
  files,
1536
1565
  plugins: { depend: pluginDepend },
1537
- rules: {
1538
- "depend/ban-dependencies": ["error", { allowed }],
1539
- ...options.overrides
1540
- }
1566
+ rules
1541
1567
  }];
1542
1568
  if (enableCheckPackageJson) configs.push({
1543
1569
  name: "ntnyq/depend/package-json",
1544
1570
  files: [GLOB_PACKAGE_JSON],
1545
1571
  plugins: { depend: pluginDepend },
1546
1572
  languageOptions: { parser: parserJsonc },
1547
- rules: {
1548
- "depend/ban-dependencies": ["error", { allowed }],
1549
- ...options.overrides
1550
- }
1573
+ rules
1551
1574
  });
1552
1575
  return configs;
1553
1576
  };
@@ -1885,7 +1908,6 @@ const configSvelte = async (options = {}) => {
1885
1908
  "svelte/no-dupe-else-if-blocks": "error",
1886
1909
  "svelte/no-dupe-style-properties": "error",
1887
1910
  "svelte/no-dupe-use-directives": "error",
1888
- "svelte/no-dynamic-slot-name": "error",
1889
1911
  "svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
1890
1912
  "svelte/no-inner-declarations": "error",
1891
1913
  "svelte/no-not-function-handler": "error",
@@ -2190,7 +2212,7 @@ const configDeMorgan = (options = {}) => [{
2190
2212
  */
2191
2213
  const configMarkdown = (options = {}) => {
2192
2214
  const { files = [GLOB_MARKDOWN_CODE], extraFileExtensions = [] } = options;
2193
- const configs = [
2215
+ return [
2194
2216
  ...pluginMarkdown.configs.processor.map((config) => ({
2195
2217
  ...config,
2196
2218
  name: `ntnyq/${config.name}`
@@ -2243,7 +2265,6 @@ const configMarkdown = (options = {}) => {
2243
2265
  }
2244
2266
  }
2245
2267
  ];
2246
- return configs;
2247
2268
  };
2248
2269
 
2249
2270
  //#endregion
@@ -2614,6 +2635,7 @@ const configJavaScript = (options = {}) => [{
2614
2635
  "prefer-rest-params": "error",
2615
2636
  "prefer-spread": "error",
2616
2637
  "prefer-template": "error",
2638
+ "preserve-caught-error": ["error", { requireCatchParameter: true }],
2617
2639
  "symbol-description": "error",
2618
2640
  "unicode-bom": ["error", "never"],
2619
2641
  "use-isnan": ["error", {
@@ -2710,7 +2732,7 @@ const configTypeScript = (options = {}) => {
2710
2732
  } : {},
2711
2733
  ...parserOptions
2712
2734
  };
2713
- const parserConfig = {
2735
+ return {
2714
2736
  name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
2715
2737
  files: files$1,
2716
2738
  ignores: [...ignores],
@@ -2719,7 +2741,6 @@ const configTypeScript = (options = {}) => {
2719
2741
  parserOptions: typescriptParserOptions
2720
2742
  }
2721
2743
  };
2722
- return parserConfig;
2723
2744
  }
2724
2745
  return [
2725
2746
  {
@@ -3186,8 +3207,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3186
3207
  ...resolveSubOptions(options, "prettier"),
3187
3208
  overrides: getOverrides(options, "prettier")
3188
3209
  }) : [];
3189
- const composer = new FlatConfigComposer(...configs, ...userConfigs, ...prettierConfigs);
3190
- return composer;
3210
+ return new FlatConfigComposer(...configs, ...userConfigs, ...prettierConfigs);
3191
3211
  }
3192
3212
 
3193
3213
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "5.5.0",
4
+ "version": "5.6.0",
5
5
  "description": "An opinionated ESLint config preset of ntnyq",
6
6
  "keywords": [
7
7
  "eslint",
@@ -36,18 +36,18 @@
36
36
  "tag": "latest"
37
37
  },
38
38
  "peerDependencies": {
39
- "@html-eslint/eslint-plugin": "^0.46.0",
40
- "@html-eslint/parser": "^0.46.0",
39
+ "@html-eslint/eslint-plugin": "^0.46.2",
40
+ "@html-eslint/parser": "^0.46.2",
41
41
  "astro-eslint-parser": "^1.2.2",
42
42
  "eslint": "^9.20.0",
43
43
  "eslint-plugin-astro": "^1.3.1",
44
44
  "eslint-plugin-eslint-plugin": "^7.0.0",
45
- "eslint-plugin-format": "^1.0.1",
45
+ "eslint-plugin-format": "^1.0.2",
46
46
  "eslint-plugin-pnpm": "^1.1.1",
47
- "eslint-plugin-svelte": "^3.11.0",
47
+ "eslint-plugin-svelte": "^3.12.4",
48
48
  "eslint-plugin-unused-imports": "^4.2.0",
49
- "svelte": "^5.38.2",
50
- "svelte-eslint-parser": "^1.3.1"
49
+ "svelte": "^5.39.3",
50
+ "svelte-eslint-parser": "^1.3.3"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "@html-eslint/eslint-plugin": {
@@ -88,59 +88,60 @@
88
88
  "@antfu/install-pkg": "^1.1.0",
89
89
  "@clack/prompts": "^0.11.0",
90
90
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
91
- "@eslint/js": "^9.35.0",
92
- "@eslint/markdown": "^7.2.0",
93
- "@unocss/eslint-plugin": "^66.5.1",
94
- "@vitest/eslint-plugin": "^1.3.9",
91
+ "@eslint/js": "^9.36.0",
92
+ "@eslint/markdown": "^7.3.0",
93
+ "@unocss/eslint-plugin": "^66.5.2",
94
+ "@vitest/eslint-plugin": "^1.3.12",
95
95
  "eslint-config-flat-gitignore": "^2.1.0",
96
- "eslint-flat-config-utils": "^2.1.1",
96
+ "eslint-flat-config-utils": "^2.1.4",
97
97
  "eslint-import-resolver-typescript": "^4.4.4",
98
98
  "eslint-merge-processors": "^2.0.0",
99
99
  "eslint-parser-plain": "^0.1.1",
100
100
  "eslint-plugin-antfu": "^3.1.1",
101
101
  "eslint-plugin-command": "^3.3.1",
102
102
  "eslint-plugin-de-morgan": "^1.3.1",
103
- "eslint-plugin-depend": "^1.2.0",
103
+ "eslint-plugin-depend": "^1.3.1",
104
104
  "eslint-plugin-github-action": "^0.0.16",
105
105
  "eslint-plugin-import-x": "^4.16.1",
106
- "eslint-plugin-jsdoc": "^54.5.0",
106
+ "eslint-plugin-jsdoc": "^60.1.1",
107
107
  "eslint-plugin-jsonc": "^2.20.1",
108
- "eslint-plugin-n": "^17.21.3",
108
+ "eslint-plugin-n": "^17.23.1",
109
109
  "eslint-plugin-no-only-tests": "^3.3.0",
110
110
  "eslint-plugin-ntnyq": "^0.12.0",
111
111
  "eslint-plugin-perfectionist": "^4.15.0",
112
112
  "eslint-plugin-pinia": "^0.4.1",
113
113
  "eslint-plugin-prettier": "^5.5.4",
114
114
  "eslint-plugin-regexp": "^2.10.0",
115
- "eslint-plugin-svgo": "^0.11.1",
115
+ "eslint-plugin-svgo": "^0.11.3",
116
116
  "eslint-plugin-toml": "^0.12.0",
117
- "eslint-plugin-unicorn": "^61.0.1",
118
- "eslint-plugin-vue": "^10.4.0",
117
+ "eslint-plugin-unicorn": "^61.0.2",
118
+ "eslint-plugin-vue": "^10.5.0",
119
119
  "eslint-plugin-yml": "^1.18.0",
120
120
  "eslint-processor-vue-blocks": "^2.0.0",
121
- "globals": "^16.3.0",
122
- "jsonc-eslint-parser": "^2.4.0",
121
+ "globals": "^16.4.0",
122
+ "jsonc-eslint-parser": "^2.4.1",
123
123
  "local-pkg": "^1.1.2",
124
124
  "toml-eslint-parser": "^0.10.0",
125
- "typescript-eslint": "^8.42.0",
125
+ "typescript-eslint": "^8.44.1",
126
126
  "vue-eslint-parser": "^10.2.0",
127
127
  "yaml-eslint-parser": "^1.3.0"
128
128
  },
129
129
  "devDependencies": {
130
130
  "@ntnyq/prettier-config": "^3.0.1",
131
- "@types/node": "^24.3.1",
132
- "@typescript-eslint/utils": "^8.42.0",
131
+ "@types/node": "^24.5.2",
132
+ "@typescript-eslint/types": "^8.44.1",
133
+ "@typescript-eslint/utils": "^8.44.1",
133
134
  "bumpp": "^10.2.3",
134
135
  "consola": "^3.4.2",
135
- "eslint": "^9.35.0",
136
+ "eslint": "^9.36.0",
136
137
  "eslint-typegen": "^2.3.0",
137
138
  "husky": "^9.1.7",
138
- "jiti": "^2.5.1",
139
+ "jiti": "^2.6.0",
139
140
  "nano-staged": "^0.8.0",
140
141
  "npm-run-all2": "^8.0.4",
141
142
  "prettier": "^3.6.2",
142
143
  "tinyglobby": "^0.2.15",
143
- "tsdown": "^0.14.2",
144
+ "tsdown": "^0.15.4",
144
145
  "tsx": "^4.20.5",
145
146
  "typescript": "^5.9.2",
146
147
  "uncase": "^0.2.0",