@ntnyq/eslint-config 2.5.2 → 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 +82 -21
- package/dist/index.d.cts +11236 -57
- package/dist/index.d.ts +11236 -57
- package/dist/index.js +103 -47
- package/package.json +14 -8
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",
|
|
@@ -86,6 +104,7 @@ var GLOB_EXCLUDE = [
|
|
|
86
104
|
"**/.tsup",
|
|
87
105
|
"**/.nitro",
|
|
88
106
|
"**/.vercel",
|
|
107
|
+
"**/.wrangler",
|
|
89
108
|
"**/.changeset",
|
|
90
109
|
"**/.npmrc",
|
|
91
110
|
"**/.yarnrc"
|
|
@@ -100,26 +119,24 @@ var ignores = defineConfig([
|
|
|
100
119
|
]);
|
|
101
120
|
|
|
102
121
|
// src/plugins.ts
|
|
122
|
+
import tseslint from "typescript-eslint";
|
|
123
|
+
import * as pluginRegexp from "eslint-plugin-regexp";
|
|
103
124
|
import { default as default2 } from "eslint-plugin-n";
|
|
104
125
|
import { default as default3 } from "eslint-plugin-vue";
|
|
105
|
-
import { default as default4 } from "
|
|
106
|
-
import { default as default5 } from "eslint-plugin-
|
|
107
|
-
import { default as default6 } from "eslint-plugin-
|
|
108
|
-
import { default as default7 } from "eslint-plugin-
|
|
109
|
-
import { default as default8 } from "eslint-plugin
|
|
110
|
-
import { default as default9 } from "eslint-plugin-
|
|
111
|
-
import { default as default10 } from "eslint-plugin-
|
|
112
|
-
import { default as default11 } from "eslint-plugin-
|
|
113
|
-
import { default as default12 } from "eslint-plugin-
|
|
114
|
-
import
|
|
115
|
-
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";
|
|
116
137
|
import * as parserYaml from "yaml-eslint-parser";
|
|
117
138
|
import * as parserVue from "vue-eslint-parser";
|
|
118
139
|
import * as parserJsonc from "jsonc-eslint-parser";
|
|
119
|
-
// @__NO_SIDE_EFFECTS__
|
|
120
|
-
function interopDefault(m) {
|
|
121
|
-
return m.default || m;
|
|
122
|
-
}
|
|
123
140
|
|
|
124
141
|
// src/configs/node.ts
|
|
125
142
|
var node = defineConfig([
|
|
@@ -146,7 +163,7 @@ var jsdoc = defineConfig([
|
|
|
146
163
|
{
|
|
147
164
|
name: "ntnyq/jsdoc",
|
|
148
165
|
plugins: {
|
|
149
|
-
jsdoc:
|
|
166
|
+
jsdoc: default7
|
|
150
167
|
},
|
|
151
168
|
rules: {
|
|
152
169
|
"jsdoc/check-access": "warn",
|
|
@@ -175,7 +192,7 @@ var imports = defineConfig([
|
|
|
175
192
|
{
|
|
176
193
|
name: "ntnyq/imports",
|
|
177
194
|
plugins: {
|
|
178
|
-
import:
|
|
195
|
+
import: default10
|
|
179
196
|
},
|
|
180
197
|
settings: {
|
|
181
198
|
"import/resolver": {
|
|
@@ -218,7 +235,7 @@ var unicorn = defineConfig([
|
|
|
218
235
|
{
|
|
219
236
|
name: "ntnyq/unicorn",
|
|
220
237
|
plugins: {
|
|
221
|
-
unicorn:
|
|
238
|
+
unicorn: default9
|
|
222
239
|
},
|
|
223
240
|
rules: {
|
|
224
241
|
// Disabled for now
|
|
@@ -295,11 +312,11 @@ var prettier = defineConfig([
|
|
|
295
312
|
{
|
|
296
313
|
name: "ntnyq/prettier",
|
|
297
314
|
plugins: {
|
|
298
|
-
prettier:
|
|
315
|
+
prettier: default11
|
|
299
316
|
},
|
|
300
317
|
rules: {
|
|
301
318
|
...prettierConfig.rules,
|
|
302
|
-
...
|
|
319
|
+
...default11.configs.recommended.rules,
|
|
303
320
|
"prettier/prettier": "warn"
|
|
304
321
|
}
|
|
305
322
|
}
|
|
@@ -310,11 +327,11 @@ var comments = defineConfig([
|
|
|
310
327
|
{
|
|
311
328
|
name: "ntnyq/eslint-comments",
|
|
312
329
|
plugins: {
|
|
313
|
-
"eslint-comments":
|
|
330
|
+
"@eslint-community/eslint-comments": default13
|
|
314
331
|
},
|
|
315
332
|
rules: {
|
|
316
|
-
...
|
|
317
|
-
"eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
333
|
+
...default13.configs.recommended.rules,
|
|
334
|
+
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
318
335
|
}
|
|
319
336
|
}
|
|
320
337
|
]);
|
|
@@ -738,7 +755,8 @@ var typescriptCore = tseslint.config({
|
|
|
738
755
|
"@typescript-eslint/no-empty-object-type": [
|
|
739
756
|
"error",
|
|
740
757
|
{
|
|
741
|
-
allowInterfaces: "always"
|
|
758
|
+
allowInterfaces: "always",
|
|
759
|
+
allowObjectTypes: "always"
|
|
742
760
|
}
|
|
743
761
|
],
|
|
744
762
|
"@typescript-eslint/consistent-type-assertions": [
|
|
@@ -811,7 +829,7 @@ var unocss = defineConfig([
|
|
|
811
829
|
{
|
|
812
830
|
name: "ntnyq/unocss",
|
|
813
831
|
plugins: {
|
|
814
|
-
unocss:
|
|
832
|
+
unocss: default8
|
|
815
833
|
},
|
|
816
834
|
rules: {
|
|
817
835
|
"unocss/order": "error",
|
|
@@ -823,7 +841,7 @@ var unocss = defineConfig([
|
|
|
823
841
|
|
|
824
842
|
// src/configs/command.ts
|
|
825
843
|
import createCommandPlugin from "eslint-plugin-command/config";
|
|
826
|
-
var command = defineConfig([createCommandPlugin(
|
|
844
|
+
var command = defineConfig([createCommandPlugin()]);
|
|
827
845
|
|
|
828
846
|
// src/configs/yml.ts
|
|
829
847
|
var yml = defineConfig([
|
|
@@ -834,17 +852,52 @@ var yml = defineConfig([
|
|
|
834
852
|
parser: parserYaml
|
|
835
853
|
},
|
|
836
854
|
plugins: {
|
|
837
|
-
yml:
|
|
855
|
+
yml: default4
|
|
838
856
|
},
|
|
839
857
|
rules: {
|
|
840
|
-
...
|
|
841
|
-
...
|
|
858
|
+
...default4.configs.standard.rules,
|
|
859
|
+
...default4.configs.prettier.rules,
|
|
842
860
|
"yml/no-empty-mapping-value": "off",
|
|
843
861
|
"yml/quotes": ["error", { avoidEscape: false, prefer: "single" }]
|
|
844
862
|
}
|
|
845
863
|
}
|
|
846
864
|
]);
|
|
847
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
|
+
|
|
848
901
|
// src/configs/sort.ts
|
|
849
902
|
var sortPackageJson = defineConfig([
|
|
850
903
|
{
|
|
@@ -1068,13 +1121,13 @@ var jsonc = defineConfig([
|
|
|
1068
1121
|
name: "ntnyq/jsonc",
|
|
1069
1122
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1070
1123
|
plugins: {
|
|
1071
|
-
jsonc:
|
|
1124
|
+
jsonc: default6
|
|
1072
1125
|
},
|
|
1073
1126
|
languageOptions: {
|
|
1074
1127
|
parser: parserJsonc
|
|
1075
1128
|
},
|
|
1076
1129
|
rules: {
|
|
1077
|
-
...
|
|
1130
|
+
...default6.configs["recommended-with-jsonc"].rules,
|
|
1078
1131
|
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1079
1132
|
"jsonc/comma-dangle": ["error", "never"],
|
|
1080
1133
|
"jsonc/comma-style": ["error", "last"],
|
|
@@ -1107,9 +1160,7 @@ var jsonc = defineConfig([
|
|
|
1107
1160
|
|
|
1108
1161
|
// src/configs/markdown.ts
|
|
1109
1162
|
var markdown = defineConfig([
|
|
1110
|
-
|
|
1111
|
-
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1112
|
-
...default7.configs.recommended,
|
|
1163
|
+
...default12.configs.recommended,
|
|
1113
1164
|
{
|
|
1114
1165
|
name: "ntnyq/markdown/extensions",
|
|
1115
1166
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
@@ -1416,7 +1467,7 @@ var presetJavaScript = [
|
|
|
1416
1467
|
];
|
|
1417
1468
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1418
1469
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
1419
|
-
var presetLanguageExtensions = [...presetJsonc, ...yml, ...markdown];
|
|
1470
|
+
var presetLanguageExtensions = [...presetJsonc, ...yml, ...toml, ...markdown];
|
|
1420
1471
|
var presetCommon = [...presetBasic, ...presetLanguageExtensions, ...prettier];
|
|
1421
1472
|
var presetAll = [...presetCommon, ...vue, ...unocss];
|
|
1422
1473
|
function ntnyq(config = [], {
|
|
@@ -1426,7 +1477,7 @@ function ntnyq(config = [], {
|
|
|
1426
1477
|
markdown: enableMarkdown = true,
|
|
1427
1478
|
command: enableCommand = true
|
|
1428
1479
|
} = {}) {
|
|
1429
|
-
const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
|
|
1480
|
+
const configs = defineConfig([...presetBasic, ...yml, ...toml, ...presetJsonc]);
|
|
1430
1481
|
if (enableVue) {
|
|
1431
1482
|
configs.push(...vue);
|
|
1432
1483
|
}
|
|
@@ -1467,6 +1518,7 @@ export {
|
|
|
1467
1518
|
GLOB_SRC,
|
|
1468
1519
|
GLOB_SRC_EXT,
|
|
1469
1520
|
GLOB_STYLE,
|
|
1521
|
+
GLOB_TOML,
|
|
1470
1522
|
GLOB_TS,
|
|
1471
1523
|
GLOB_TSX,
|
|
1472
1524
|
GLOB_VUE,
|
|
@@ -1485,24 +1537,27 @@ export {
|
|
|
1485
1537
|
jsdoc,
|
|
1486
1538
|
jsonc,
|
|
1487
1539
|
jsx,
|
|
1540
|
+
loadPlugin,
|
|
1488
1541
|
markdown,
|
|
1489
1542
|
node,
|
|
1490
1543
|
ntnyq,
|
|
1491
1544
|
parserJsonc,
|
|
1545
|
+
parserToml,
|
|
1492
1546
|
parserVue,
|
|
1493
1547
|
parserYaml,
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1548
|
+
default13 as pluginComments,
|
|
1549
|
+
default10 as pluginImport,
|
|
1550
|
+
default7 as pluginJsdoc,
|
|
1551
|
+
default6 as pluginJsonc,
|
|
1552
|
+
default12 as pluginMarkdown,
|
|
1499
1553
|
default2 as pluginNode,
|
|
1500
|
-
|
|
1554
|
+
default11 as pluginPrettier,
|
|
1501
1555
|
pluginRegexp,
|
|
1502
|
-
default5 as
|
|
1503
|
-
|
|
1556
|
+
default5 as pluginToml,
|
|
1557
|
+
default9 as pluginUnicorn,
|
|
1558
|
+
default8 as pluginUnoCSS,
|
|
1504
1559
|
default3 as pluginVue,
|
|
1505
|
-
|
|
1560
|
+
default4 as pluginYaml,
|
|
1506
1561
|
presetAll,
|
|
1507
1562
|
presetBasic,
|
|
1508
1563
|
presetCommon,
|
|
@@ -1513,6 +1568,7 @@ export {
|
|
|
1513
1568
|
regexp,
|
|
1514
1569
|
sortPackageJson,
|
|
1515
1570
|
sortTsConfig,
|
|
1571
|
+
toml,
|
|
1516
1572
|
tseslint,
|
|
1517
1573
|
typescript,
|
|
1518
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,19 +55,21 @@
|
|
|
54
55
|
"eslint": "^9.0.0"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
|
-
"@eslint/
|
|
58
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
|
|
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-
|
|
63
|
-
"eslint-plugin-import-x": "^3.0.0",
|
|
65
|
+
"eslint-plugin-import-x": "^3.0.1",
|
|
64
66
|
"eslint-plugin-jsdoc": "^48.7.0",
|
|
65
67
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
66
|
-
"eslint-plugin-markdown": "^5.
|
|
68
|
+
"eslint-plugin-markdown": "^5.1.0",
|
|
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,7 +78,8 @@
|
|
|
75
78
|
"jsonc-eslint-parser": "^2.4.0",
|
|
76
79
|
"local-pkg": "^0.5.0",
|
|
77
80
|
"prettier": "^3.3.2",
|
|
78
|
-
"
|
|
81
|
+
"toml-eslint-parser": "^0.10.0",
|
|
82
|
+
"typescript-eslint": "^8.0.0-alpha.41",
|
|
79
83
|
"vue-eslint-parser": "^9.4.3",
|
|
80
84
|
"yaml-eslint-parser": "^1.2.3"
|
|
81
85
|
},
|
|
@@ -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
|
},
|