@ntnyq/eslint-config 2.5.3 → 2.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.
- package/dist/index.cjs +79 -20
- package/dist/index.d.cts +11236 -57
- package/dist/index.d.ts +11236 -57
- package/dist/index.js +100 -46
- package/package.json +10 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/env.ts
|
|
1
|
+
// src/utils/env.ts
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { isPackageExists } from "local-pkg";
|
|
@@ -8,7 +8,22 @@ var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExist
|
|
|
8
8
|
});
|
|
9
9
|
var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
10
10
|
|
|
11
|
-
// src/
|
|
11
|
+
// src/utils/interopDefault.ts
|
|
12
|
+
async function interopDefault(mod) {
|
|
13
|
+
const resolved = await mod;
|
|
14
|
+
return resolved.default || resolved;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/utils/loadPlugin.ts
|
|
18
|
+
async function loadPlugin(name) {
|
|
19
|
+
const mod = await import(name).catch((err) => {
|
|
20
|
+
console.error(err);
|
|
21
|
+
throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
|
|
22
|
+
});
|
|
23
|
+
return interopDefault(mod);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/utils/defineConfig.ts
|
|
12
27
|
function defineConfig(configs = []) {
|
|
13
28
|
return configs;
|
|
14
29
|
}
|
|
@@ -31,6 +46,7 @@ var GLOB_JSONC = "**/*.jsonc";
|
|
|
31
46
|
var GLOB_VUE = "**/*.vue";
|
|
32
47
|
var GLOB_MARKDOWN = "**/*.md";
|
|
33
48
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
49
|
+
var GLOB_TOML = "**/*.toml";
|
|
34
50
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
35
51
|
var GLOB_ALL_SRC = [
|
|
36
52
|
GLOB_SRC,
|
|
@@ -40,6 +56,7 @@ var GLOB_ALL_SRC = [
|
|
|
40
56
|
GLOB_MARKDOWN,
|
|
41
57
|
GLOB_VUE,
|
|
42
58
|
GLOB_YAML,
|
|
59
|
+
GLOB_TOML,
|
|
43
60
|
GLOB_HTML
|
|
44
61
|
];
|
|
45
62
|
var GLOB_NODE_MODULES = "**/node_modules/**";
|
|
@@ -79,6 +96,7 @@ var GLOB_EXCLUDE = [
|
|
|
79
96
|
"**/?(.)cache",
|
|
80
97
|
"**/.eslintcache",
|
|
81
98
|
"**/.stylelintcache",
|
|
99
|
+
"**/.eslint-config-inspector",
|
|
82
100
|
"**/.vite-inspect",
|
|
83
101
|
"**/.nuxt",
|
|
84
102
|
"**/.wxt",
|
|
@@ -101,26 +119,24 @@ var ignores = defineConfig([
|
|
|
101
119
|
]);
|
|
102
120
|
|
|
103
121
|
// src/plugins.ts
|
|
122
|
+
import tseslint from "typescript-eslint";
|
|
123
|
+
import * as pluginRegexp from "eslint-plugin-regexp";
|
|
104
124
|
import { default as default2 } from "eslint-plugin-n";
|
|
105
125
|
import { default as default3 } from "eslint-plugin-vue";
|
|
106
|
-
import { default as default4 } from "
|
|
107
|
-
import { default as default5 } from "eslint-plugin-
|
|
108
|
-
import { default as default6 } from "eslint-plugin-
|
|
109
|
-
import { default as default7 } from "eslint-plugin-
|
|
110
|
-
import { default as default8 } from "eslint-plugin
|
|
111
|
-
import { default as default9 } from "eslint-plugin-
|
|
112
|
-
import { default as default10 } from "eslint-plugin-
|
|
113
|
-
import { default as default11 } from "eslint-plugin-
|
|
114
|
-
import { default as default12 } from "eslint-plugin-
|
|
115
|
-
import
|
|
116
|
-
import
|
|
126
|
+
import { default as default4 } from "eslint-plugin-yml";
|
|
127
|
+
import { default as default5 } from "eslint-plugin-toml";
|
|
128
|
+
import { default as default6 } from "eslint-plugin-jsonc";
|
|
129
|
+
import { default as default7 } from "eslint-plugin-jsdoc";
|
|
130
|
+
import { default as default8 } from "@unocss/eslint-plugin";
|
|
131
|
+
import { default as default9 } from "eslint-plugin-unicorn";
|
|
132
|
+
import { default as default10 } from "eslint-plugin-import-x";
|
|
133
|
+
import { default as default11 } from "eslint-plugin-prettier";
|
|
134
|
+
import { default as default12 } from "eslint-plugin-markdown";
|
|
135
|
+
import { default as default13 } from "@eslint-community/eslint-plugin-eslint-comments";
|
|
136
|
+
import * as parserToml from "toml-eslint-parser";
|
|
117
137
|
import * as parserYaml from "yaml-eslint-parser";
|
|
118
138
|
import * as parserVue from "vue-eslint-parser";
|
|
119
139
|
import * as parserJsonc from "jsonc-eslint-parser";
|
|
120
|
-
// @__NO_SIDE_EFFECTS__
|
|
121
|
-
function interopDefault(m) {
|
|
122
|
-
return m.default || m;
|
|
123
|
-
}
|
|
124
140
|
|
|
125
141
|
// src/configs/node.ts
|
|
126
142
|
var node = defineConfig([
|
|
@@ -147,7 +163,7 @@ var jsdoc = defineConfig([
|
|
|
147
163
|
{
|
|
148
164
|
name: "ntnyq/jsdoc",
|
|
149
165
|
plugins: {
|
|
150
|
-
jsdoc:
|
|
166
|
+
jsdoc: default7
|
|
151
167
|
},
|
|
152
168
|
rules: {
|
|
153
169
|
"jsdoc/check-access": "warn",
|
|
@@ -176,7 +192,7 @@ var imports = defineConfig([
|
|
|
176
192
|
{
|
|
177
193
|
name: "ntnyq/imports",
|
|
178
194
|
plugins: {
|
|
179
|
-
import:
|
|
195
|
+
import: default10
|
|
180
196
|
},
|
|
181
197
|
settings: {
|
|
182
198
|
"import/resolver": {
|
|
@@ -219,7 +235,7 @@ var unicorn = defineConfig([
|
|
|
219
235
|
{
|
|
220
236
|
name: "ntnyq/unicorn",
|
|
221
237
|
plugins: {
|
|
222
|
-
unicorn:
|
|
238
|
+
unicorn: default9
|
|
223
239
|
},
|
|
224
240
|
rules: {
|
|
225
241
|
// Disabled for now
|
|
@@ -296,11 +312,11 @@ var prettier = defineConfig([
|
|
|
296
312
|
{
|
|
297
313
|
name: "ntnyq/prettier",
|
|
298
314
|
plugins: {
|
|
299
|
-
prettier:
|
|
315
|
+
prettier: default11
|
|
300
316
|
},
|
|
301
317
|
rules: {
|
|
302
318
|
...prettierConfig.rules,
|
|
303
|
-
...
|
|
319
|
+
...default11.configs.recommended.rules,
|
|
304
320
|
"prettier/prettier": "warn"
|
|
305
321
|
}
|
|
306
322
|
}
|
|
@@ -311,11 +327,11 @@ var comments = defineConfig([
|
|
|
311
327
|
{
|
|
312
328
|
name: "ntnyq/eslint-comments",
|
|
313
329
|
plugins: {
|
|
314
|
-
"eslint-comments":
|
|
330
|
+
"@eslint-community/eslint-comments": default13
|
|
315
331
|
},
|
|
316
332
|
rules: {
|
|
317
|
-
...
|
|
318
|
-
"eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
333
|
+
...default13.configs.recommended.rules,
|
|
334
|
+
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
319
335
|
}
|
|
320
336
|
}
|
|
321
337
|
]);
|
|
@@ -813,7 +829,7 @@ var unocss = defineConfig([
|
|
|
813
829
|
{
|
|
814
830
|
name: "ntnyq/unocss",
|
|
815
831
|
plugins: {
|
|
816
|
-
unocss:
|
|
832
|
+
unocss: default8
|
|
817
833
|
},
|
|
818
834
|
rules: {
|
|
819
835
|
"unocss/order": "error",
|
|
@@ -825,7 +841,7 @@ var unocss = defineConfig([
|
|
|
825
841
|
|
|
826
842
|
// src/configs/command.ts
|
|
827
843
|
import createCommandPlugin from "eslint-plugin-command/config";
|
|
828
|
-
var command = defineConfig([createCommandPlugin(
|
|
844
|
+
var command = defineConfig([createCommandPlugin()]);
|
|
829
845
|
|
|
830
846
|
// src/configs/yml.ts
|
|
831
847
|
var yml = defineConfig([
|
|
@@ -836,17 +852,52 @@ var yml = defineConfig([
|
|
|
836
852
|
parser: parserYaml
|
|
837
853
|
},
|
|
838
854
|
plugins: {
|
|
839
|
-
yml:
|
|
855
|
+
yml: default4
|
|
840
856
|
},
|
|
841
857
|
rules: {
|
|
842
|
-
...
|
|
843
|
-
...
|
|
858
|
+
...default4.configs.standard.rules,
|
|
859
|
+
...default4.configs.prettier.rules,
|
|
844
860
|
"yml/no-empty-mapping-value": "off",
|
|
845
861
|
"yml/quotes": ["error", { avoidEscape: false, prefer: "single" }]
|
|
846
862
|
}
|
|
847
863
|
}
|
|
848
864
|
]);
|
|
849
865
|
|
|
866
|
+
// src/configs/toml.ts
|
|
867
|
+
var toml = defineConfig([
|
|
868
|
+
{
|
|
869
|
+
name: "ntnyq/toml",
|
|
870
|
+
files: [GLOB_TOML],
|
|
871
|
+
languageOptions: {
|
|
872
|
+
parser: parserToml
|
|
873
|
+
},
|
|
874
|
+
plugins: {
|
|
875
|
+
toml: default5
|
|
876
|
+
},
|
|
877
|
+
rules: {
|
|
878
|
+
"toml/comma-style": "error",
|
|
879
|
+
"toml/keys-order": "error",
|
|
880
|
+
"toml/no-space-dots": "error",
|
|
881
|
+
"toml/no-unreadable-number-separator": "error",
|
|
882
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
883
|
+
"toml/precision-of-integer": "error",
|
|
884
|
+
"toml/tables-order": "error",
|
|
885
|
+
"toml/indent": ["error", 2],
|
|
886
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
887
|
+
"toml/array-bracket-newline": "error",
|
|
888
|
+
"toml/array-bracket-spacing": "error",
|
|
889
|
+
"toml/array-element-newline": "error",
|
|
890
|
+
"toml/inline-table-curly-spacing": "error",
|
|
891
|
+
"toml/key-spacing": "error",
|
|
892
|
+
"toml/padding-line-between-pairs": "error",
|
|
893
|
+
"toml/padding-line-between-tables": "error",
|
|
894
|
+
"toml/quoted-keys": "error",
|
|
895
|
+
"toml/spaced-comment": "error",
|
|
896
|
+
"toml/table-bracket-spacing": "error"
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
]);
|
|
900
|
+
|
|
850
901
|
// src/configs/sort.ts
|
|
851
902
|
var sortPackageJson = defineConfig([
|
|
852
903
|
{
|
|
@@ -1070,13 +1121,13 @@ var jsonc = defineConfig([
|
|
|
1070
1121
|
name: "ntnyq/jsonc",
|
|
1071
1122
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1072
1123
|
plugins: {
|
|
1073
|
-
jsonc:
|
|
1124
|
+
jsonc: default6
|
|
1074
1125
|
},
|
|
1075
1126
|
languageOptions: {
|
|
1076
1127
|
parser: parserJsonc
|
|
1077
1128
|
},
|
|
1078
1129
|
rules: {
|
|
1079
|
-
...
|
|
1130
|
+
...default6.configs["recommended-with-jsonc"].rules,
|
|
1080
1131
|
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1081
1132
|
"jsonc/comma-dangle": ["error", "never"],
|
|
1082
1133
|
"jsonc/comma-style": ["error", "last"],
|
|
@@ -1109,9 +1160,7 @@ var jsonc = defineConfig([
|
|
|
1109
1160
|
|
|
1110
1161
|
// src/configs/markdown.ts
|
|
1111
1162
|
var markdown = defineConfig([
|
|
1112
|
-
|
|
1113
|
-
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1114
|
-
...default7.configs.recommended,
|
|
1163
|
+
...default12.configs.recommended,
|
|
1115
1164
|
{
|
|
1116
1165
|
name: "ntnyq/markdown/extensions",
|
|
1117
1166
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
@@ -1418,7 +1467,7 @@ var presetJavaScript = [
|
|
|
1418
1467
|
];
|
|
1419
1468
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1420
1469
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
1421
|
-
var presetLanguageExtensions = [...presetJsonc, ...yml, ...markdown];
|
|
1470
|
+
var presetLanguageExtensions = [...presetJsonc, ...yml, ...toml, ...markdown];
|
|
1422
1471
|
var presetCommon = [...presetBasic, ...presetLanguageExtensions, ...prettier];
|
|
1423
1472
|
var presetAll = [...presetCommon, ...vue, ...unocss];
|
|
1424
1473
|
function ntnyq(config = [], {
|
|
@@ -1428,7 +1477,7 @@ function ntnyq(config = [], {
|
|
|
1428
1477
|
markdown: enableMarkdown = true,
|
|
1429
1478
|
command: enableCommand = true
|
|
1430
1479
|
} = {}) {
|
|
1431
|
-
const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
|
|
1480
|
+
const configs = defineConfig([...presetBasic, ...yml, ...toml, ...presetJsonc]);
|
|
1432
1481
|
if (enableVue) {
|
|
1433
1482
|
configs.push(...vue);
|
|
1434
1483
|
}
|
|
@@ -1469,6 +1518,7 @@ export {
|
|
|
1469
1518
|
GLOB_SRC,
|
|
1470
1519
|
GLOB_SRC_EXT,
|
|
1471
1520
|
GLOB_STYLE,
|
|
1521
|
+
GLOB_TOML,
|
|
1472
1522
|
GLOB_TS,
|
|
1473
1523
|
GLOB_TSX,
|
|
1474
1524
|
GLOB_VUE,
|
|
@@ -1487,24 +1537,27 @@ export {
|
|
|
1487
1537
|
jsdoc,
|
|
1488
1538
|
jsonc,
|
|
1489
1539
|
jsx,
|
|
1540
|
+
loadPlugin,
|
|
1490
1541
|
markdown,
|
|
1491
1542
|
node,
|
|
1492
1543
|
ntnyq,
|
|
1493
1544
|
parserJsonc,
|
|
1545
|
+
parserToml,
|
|
1494
1546
|
parserVue,
|
|
1495
1547
|
parserYaml,
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1548
|
+
default13 as pluginComments,
|
|
1549
|
+
default10 as pluginImport,
|
|
1550
|
+
default7 as pluginJsdoc,
|
|
1551
|
+
default6 as pluginJsonc,
|
|
1552
|
+
default12 as pluginMarkdown,
|
|
1501
1553
|
default2 as pluginNode,
|
|
1502
|
-
|
|
1554
|
+
default11 as pluginPrettier,
|
|
1503
1555
|
pluginRegexp,
|
|
1504
|
-
default5 as
|
|
1505
|
-
|
|
1556
|
+
default5 as pluginToml,
|
|
1557
|
+
default9 as pluginUnicorn,
|
|
1558
|
+
default8 as pluginUnoCSS,
|
|
1506
1559
|
default3 as pluginVue,
|
|
1507
|
-
|
|
1560
|
+
default4 as pluginYaml,
|
|
1508
1561
|
presetAll,
|
|
1509
1562
|
presetBasic,
|
|
1510
1563
|
presetCommon,
|
|
@@ -1515,6 +1568,7 @@ export {
|
|
|
1515
1568
|
regexp,
|
|
1516
1569
|
sortPackageJson,
|
|
1517
1570
|
sortTsConfig,
|
|
1571
|
+
toml,
|
|
1518
1572
|
tseslint,
|
|
1519
1573
|
typescript,
|
|
1520
1574
|
typescriptCore,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.6.0",
|
|
5
5
|
"packageManager": "pnpm@9.5.0",
|
|
6
6
|
"description": "ESLint flat config of ntnyq",
|
|
7
7
|
"keywords": [
|
|
@@ -36,10 +36,11 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"scripts": {
|
|
39
|
-
"build": "tsup",
|
|
39
|
+
"build": "pnpm run generate:type && tsup",
|
|
40
40
|
"clean": "rimraf dist",
|
|
41
41
|
"dev": "tsup --watch",
|
|
42
|
-
"generate:site": "
|
|
42
|
+
"generate:site": "tsx scripts/generateSite.ts",
|
|
43
|
+
"generate:type": "tsx scripts/generateType.ts",
|
|
43
44
|
"lint": "eslint .",
|
|
44
45
|
"prepare": "husky",
|
|
45
46
|
"release": "run-s release:check release:version",
|
|
@@ -54,12 +55,13 @@
|
|
|
54
55
|
"eslint": "^9.0.0"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
58
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
|
|
57
59
|
"@eslint/js": "^9.7.0",
|
|
58
60
|
"@types/eslint": "^8.56.10",
|
|
59
61
|
"@unocss/eslint-plugin": "^0.61.3",
|
|
60
62
|
"eslint-config-prettier": "^9.1.0",
|
|
63
|
+
"eslint-flat-config-utils": "^0.2.5",
|
|
61
64
|
"eslint-plugin-command": "^0.2.3",
|
|
62
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
63
65
|
"eslint-plugin-import-x": "^3.0.1",
|
|
64
66
|
"eslint-plugin-jsdoc": "^48.7.0",
|
|
65
67
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
@@ -67,6 +69,7 @@
|
|
|
67
69
|
"eslint-plugin-n": "^17.9.0",
|
|
68
70
|
"eslint-plugin-prettier": "^5.1.3",
|
|
69
71
|
"eslint-plugin-regexp": "^2.6.0",
|
|
72
|
+
"eslint-plugin-toml": "^0.11.1",
|
|
70
73
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
71
74
|
"eslint-plugin-unused-imports": "^4.0.0",
|
|
72
75
|
"eslint-plugin-vue": "^9.27.0",
|
|
@@ -75,6 +78,7 @@
|
|
|
75
78
|
"jsonc-eslint-parser": "^2.4.0",
|
|
76
79
|
"local-pkg": "^0.5.0",
|
|
77
80
|
"prettier": "^3.3.2",
|
|
81
|
+
"toml-eslint-parser": "^0.10.0",
|
|
78
82
|
"typescript-eslint": "^8.0.0-alpha.41",
|
|
79
83
|
"vue-eslint-parser": "^9.4.3",
|
|
80
84
|
"yaml-eslint-parser": "^1.2.3"
|
|
@@ -84,11 +88,13 @@
|
|
|
84
88
|
"@types/node": "^20.14.10",
|
|
85
89
|
"bumpp": "^9.4.1",
|
|
86
90
|
"eslint": "^9.6.0",
|
|
91
|
+
"eslint-typegen": "^0.2.4",
|
|
87
92
|
"husky": "^9.0.11",
|
|
88
93
|
"nano-staged": "^0.8.0",
|
|
89
94
|
"npm-run-all2": "^6.2.2",
|
|
90
95
|
"rimraf": "^6.0.1",
|
|
91
96
|
"tsup": "^8.1.0",
|
|
97
|
+
"tsx": "^4.16.2",
|
|
92
98
|
"typescript": "^5.5.3",
|
|
93
99
|
"zx": "^8.1.4"
|
|
94
100
|
},
|