@ntnyq/eslint-config 2.5.3 → 2.6.1
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 +108 -21
- package/dist/index.d.cts +11233 -57
- package/dist/index.d.ts +11233 -57
- package/dist/index.js +127 -47
- package/package.json +15 -9
package/dist/index.cjs
CHANGED
|
@@ -49,6 +49,7 @@ __export(src_exports, {
|
|
|
49
49
|
GLOB_SRC: () => GLOB_SRC,
|
|
50
50
|
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
51
51
|
GLOB_STYLE: () => GLOB_STYLE,
|
|
52
|
+
GLOB_TOML: () => GLOB_TOML,
|
|
52
53
|
GLOB_TS: () => GLOB_TS,
|
|
53
54
|
GLOB_TSX: () => GLOB_TSX,
|
|
54
55
|
GLOB_VUE: () => GLOB_VUE,
|
|
@@ -67,10 +68,12 @@ __export(src_exports, {
|
|
|
67
68
|
jsdoc: () => jsdoc,
|
|
68
69
|
jsonc: () => jsonc,
|
|
69
70
|
jsx: () => jsx,
|
|
71
|
+
loadPlugin: () => loadPlugin,
|
|
70
72
|
markdown: () => markdown,
|
|
71
73
|
node: () => node,
|
|
72
74
|
ntnyq: () => ntnyq,
|
|
73
75
|
parserJsonc: () => parserJsonc,
|
|
76
|
+
parserToml: () => parserToml,
|
|
74
77
|
parserVue: () => parserVue,
|
|
75
78
|
parserYaml: () => parserYaml,
|
|
76
79
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
@@ -81,8 +84,10 @@ __export(src_exports, {
|
|
|
81
84
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
82
85
|
pluginPrettier: () => import_eslint_plugin_prettier.default,
|
|
83
86
|
pluginRegexp: () => pluginRegexp,
|
|
87
|
+
pluginToml: () => import_eslint_plugin_toml.default,
|
|
84
88
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
85
89
|
pluginUnoCSS: () => import_eslint_plugin.default,
|
|
90
|
+
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
86
91
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
87
92
|
pluginYaml: () => import_eslint_plugin_yml.default,
|
|
88
93
|
presetAll: () => presetAll,
|
|
@@ -95,17 +100,19 @@ __export(src_exports, {
|
|
|
95
100
|
regexp: () => regexp,
|
|
96
101
|
sortPackageJson: () => sortPackageJson,
|
|
97
102
|
sortTsConfig: () => sortTsConfig,
|
|
103
|
+
toml: () => toml,
|
|
98
104
|
tseslint: () => import_typescript_eslint.default,
|
|
99
105
|
typescript: () => typescript,
|
|
100
106
|
typescriptCore: () => typescriptCore,
|
|
101
107
|
unicorn: () => unicorn,
|
|
102
108
|
unocss: () => unocss,
|
|
109
|
+
unusedImports: () => unusedImports,
|
|
103
110
|
vue: () => vue,
|
|
104
111
|
yml: () => yml
|
|
105
112
|
});
|
|
106
113
|
module.exports = __toCommonJS(src_exports);
|
|
107
114
|
|
|
108
|
-
// src/env.ts
|
|
115
|
+
// src/utils/env.ts
|
|
109
116
|
var import_node_process = __toESM(require("process"), 1);
|
|
110
117
|
var import_node_path = require("path");
|
|
111
118
|
var import_local_pkg = require("local-pkg");
|
|
@@ -115,7 +122,22 @@ var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pk
|
|
|
115
122
|
});
|
|
116
123
|
var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
|
|
117
124
|
|
|
118
|
-
// src/
|
|
125
|
+
// src/utils/interopDefault.ts
|
|
126
|
+
async function interopDefault(mod) {
|
|
127
|
+
const resolved = await mod;
|
|
128
|
+
return resolved.default || resolved;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/utils/loadPlugin.ts
|
|
132
|
+
async function loadPlugin(name) {
|
|
133
|
+
const mod = await import(name).catch((err) => {
|
|
134
|
+
console.error(err);
|
|
135
|
+
throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
|
|
136
|
+
});
|
|
137
|
+
return interopDefault(mod);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/utils/defineConfig.ts
|
|
119
141
|
function defineConfig(configs = []) {
|
|
120
142
|
return configs;
|
|
121
143
|
}
|
|
@@ -138,6 +160,7 @@ var GLOB_JSONC = "**/*.jsonc";
|
|
|
138
160
|
var GLOB_VUE = "**/*.vue";
|
|
139
161
|
var GLOB_MARKDOWN = "**/*.md";
|
|
140
162
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
163
|
+
var GLOB_TOML = "**/*.toml";
|
|
141
164
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
142
165
|
var GLOB_ALL_SRC = [
|
|
143
166
|
GLOB_SRC,
|
|
@@ -147,6 +170,7 @@ var GLOB_ALL_SRC = [
|
|
|
147
170
|
GLOB_MARKDOWN,
|
|
148
171
|
GLOB_VUE,
|
|
149
172
|
GLOB_YAML,
|
|
173
|
+
GLOB_TOML,
|
|
150
174
|
GLOB_HTML
|
|
151
175
|
];
|
|
152
176
|
var GLOB_NODE_MODULES = "**/node_modules/**";
|
|
@@ -186,6 +210,7 @@ var GLOB_EXCLUDE = [
|
|
|
186
210
|
"**/?(.)cache",
|
|
187
211
|
"**/.eslintcache",
|
|
188
212
|
"**/.stylelintcache",
|
|
213
|
+
"**/.eslint-config-inspector",
|
|
189
214
|
"**/.vite-inspect",
|
|
190
215
|
"**/.nuxt",
|
|
191
216
|
"**/.wxt",
|
|
@@ -208,26 +233,25 @@ var ignores = defineConfig([
|
|
|
208
233
|
]);
|
|
209
234
|
|
|
210
235
|
// src/plugins.ts
|
|
236
|
+
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
237
|
+
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
211
238
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
212
239
|
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
240
|
+
var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
241
|
+
var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
|
|
242
|
+
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
243
|
+
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
213
244
|
var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
|
|
214
245
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
246
|
+
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
215
247
|
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
216
248
|
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
217
|
-
var
|
|
218
|
-
var
|
|
219
|
-
var
|
|
220
|
-
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
221
|
-
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
222
|
-
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
223
|
-
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
249
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
250
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
251
|
+
var parserToml = __toESM(require("toml-eslint-parser"), 1);
|
|
224
252
|
var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
|
|
225
253
|
var parserVue = __toESM(require("vue-eslint-parser"), 1);
|
|
226
254
|
var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
|
|
227
|
-
// @__NO_SIDE_EFFECTS__
|
|
228
|
-
function interopDefault(m) {
|
|
229
|
-
return m.default || m;
|
|
230
|
-
}
|
|
231
255
|
|
|
232
256
|
// src/configs/node.ts
|
|
233
257
|
var node = defineConfig([
|
|
@@ -418,11 +442,11 @@ var comments = defineConfig([
|
|
|
418
442
|
{
|
|
419
443
|
name: "ntnyq/eslint-comments",
|
|
420
444
|
plugins: {
|
|
421
|
-
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
445
|
+
"@eslint-community/eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
422
446
|
},
|
|
423
447
|
rules: {
|
|
424
448
|
...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
|
|
425
|
-
"eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
449
|
+
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
426
450
|
}
|
|
427
451
|
}
|
|
428
452
|
]);
|
|
@@ -742,7 +766,7 @@ var javascript = defineConfig([
|
|
|
742
766
|
"max-lines-per-function": [
|
|
743
767
|
"error",
|
|
744
768
|
{
|
|
745
|
-
max:
|
|
769
|
+
max: 200,
|
|
746
770
|
skipComments: true,
|
|
747
771
|
skipBlankLines: true
|
|
748
772
|
}
|
|
@@ -904,6 +928,29 @@ var typescript = defineConfig([
|
|
|
904
928
|
}
|
|
905
929
|
]);
|
|
906
930
|
|
|
931
|
+
// src/configs/unusedImports.ts
|
|
932
|
+
var unusedImports = defineConfig([
|
|
933
|
+
{
|
|
934
|
+
name: "ntnyq/unused-imports",
|
|
935
|
+
plugins: {
|
|
936
|
+
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
937
|
+
},
|
|
938
|
+
rules: {
|
|
939
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
940
|
+
"unused-imports/no-unused-imports": "error",
|
|
941
|
+
"unused-imports/no-unused-vars": [
|
|
942
|
+
"warn",
|
|
943
|
+
{
|
|
944
|
+
vars: "all",
|
|
945
|
+
varsIgnorePattern: "^_",
|
|
946
|
+
args: "after-used",
|
|
947
|
+
argsIgnorePattern: "^_"
|
|
948
|
+
}
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
]);
|
|
953
|
+
|
|
907
954
|
// src/configs/regexp.ts
|
|
908
955
|
var regexp = defineConfig([
|
|
909
956
|
/**
|
|
@@ -932,7 +979,7 @@ var unocss = defineConfig([
|
|
|
932
979
|
|
|
933
980
|
// src/configs/command.ts
|
|
934
981
|
var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
935
|
-
var command = defineConfig([(0, import_config.default)(
|
|
982
|
+
var command = defineConfig([(0, import_config.default)()]);
|
|
936
983
|
|
|
937
984
|
// src/configs/yml.ts
|
|
938
985
|
var yml = defineConfig([
|
|
@@ -954,6 +1001,41 @@ var yml = defineConfig([
|
|
|
954
1001
|
}
|
|
955
1002
|
]);
|
|
956
1003
|
|
|
1004
|
+
// src/configs/toml.ts
|
|
1005
|
+
var toml = defineConfig([
|
|
1006
|
+
{
|
|
1007
|
+
name: "ntnyq/toml",
|
|
1008
|
+
files: [GLOB_TOML],
|
|
1009
|
+
languageOptions: {
|
|
1010
|
+
parser: parserToml
|
|
1011
|
+
},
|
|
1012
|
+
plugins: {
|
|
1013
|
+
toml: import_eslint_plugin_toml.default
|
|
1014
|
+
},
|
|
1015
|
+
rules: {
|
|
1016
|
+
"toml/comma-style": "error",
|
|
1017
|
+
"toml/keys-order": "error",
|
|
1018
|
+
"toml/no-space-dots": "error",
|
|
1019
|
+
"toml/no-unreadable-number-separator": "error",
|
|
1020
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
1021
|
+
"toml/precision-of-integer": "error",
|
|
1022
|
+
"toml/tables-order": "error",
|
|
1023
|
+
"toml/indent": ["error", 2],
|
|
1024
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1025
|
+
"toml/array-bracket-newline": "error",
|
|
1026
|
+
"toml/array-bracket-spacing": "error",
|
|
1027
|
+
"toml/array-element-newline": "error",
|
|
1028
|
+
"toml/inline-table-curly-spacing": "error",
|
|
1029
|
+
"toml/key-spacing": "error",
|
|
1030
|
+
"toml/padding-line-between-pairs": "error",
|
|
1031
|
+
"toml/padding-line-between-tables": "error",
|
|
1032
|
+
"toml/quoted-keys": "error",
|
|
1033
|
+
"toml/spaced-comment": "error",
|
|
1034
|
+
"toml/table-bracket-spacing": "error"
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
]);
|
|
1038
|
+
|
|
957
1039
|
// src/configs/sort.ts
|
|
958
1040
|
var sortPackageJson = defineConfig([
|
|
959
1041
|
{
|
|
@@ -1216,8 +1298,6 @@ var jsonc = defineConfig([
|
|
|
1216
1298
|
|
|
1217
1299
|
// src/configs/markdown.ts
|
|
1218
1300
|
var markdown = defineConfig([
|
|
1219
|
-
// TODO: Add config name for markdown plugin
|
|
1220
|
-
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1221
1301
|
...import_eslint_plugin_markdown.default.configs.recommended,
|
|
1222
1302
|
{
|
|
1223
1303
|
name: "ntnyq/markdown/extensions",
|
|
@@ -1525,7 +1605,7 @@ var presetJavaScript = [
|
|
|
1525
1605
|
];
|
|
1526
1606
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1527
1607
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
1528
|
-
var presetLanguageExtensions = [...presetJsonc, ...yml, ...markdown];
|
|
1608
|
+
var presetLanguageExtensions = [...presetJsonc, ...yml, ...toml, ...markdown];
|
|
1529
1609
|
var presetCommon = [...presetBasic, ...presetLanguageExtensions, ...prettier];
|
|
1530
1610
|
var presetAll = [...presetCommon, ...vue, ...unocss];
|
|
1531
1611
|
function ntnyq(config = [], {
|
|
@@ -1535,7 +1615,7 @@ function ntnyq(config = [], {
|
|
|
1535
1615
|
markdown: enableMarkdown = true,
|
|
1536
1616
|
command: enableCommand = true
|
|
1537
1617
|
} = {}) {
|
|
1538
|
-
const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
|
|
1618
|
+
const configs = defineConfig([...presetBasic, ...yml, ...toml, ...presetJsonc]);
|
|
1539
1619
|
if (enableVue) {
|
|
1540
1620
|
configs.push(...vue);
|
|
1541
1621
|
}
|
|
@@ -1577,6 +1657,7 @@ function ntnyq(config = [], {
|
|
|
1577
1657
|
GLOB_SRC,
|
|
1578
1658
|
GLOB_SRC_EXT,
|
|
1579
1659
|
GLOB_STYLE,
|
|
1660
|
+
GLOB_TOML,
|
|
1580
1661
|
GLOB_TS,
|
|
1581
1662
|
GLOB_TSX,
|
|
1582
1663
|
GLOB_VUE,
|
|
@@ -1595,10 +1676,12 @@ function ntnyq(config = [], {
|
|
|
1595
1676
|
jsdoc,
|
|
1596
1677
|
jsonc,
|
|
1597
1678
|
jsx,
|
|
1679
|
+
loadPlugin,
|
|
1598
1680
|
markdown,
|
|
1599
1681
|
node,
|
|
1600
1682
|
ntnyq,
|
|
1601
1683
|
parserJsonc,
|
|
1684
|
+
parserToml,
|
|
1602
1685
|
parserVue,
|
|
1603
1686
|
parserYaml,
|
|
1604
1687
|
pluginComments,
|
|
@@ -1609,8 +1692,10 @@ function ntnyq(config = [], {
|
|
|
1609
1692
|
pluginNode,
|
|
1610
1693
|
pluginPrettier,
|
|
1611
1694
|
pluginRegexp,
|
|
1695
|
+
pluginToml,
|
|
1612
1696
|
pluginUnicorn,
|
|
1613
1697
|
pluginUnoCSS,
|
|
1698
|
+
pluginUnusedImports,
|
|
1614
1699
|
pluginVue,
|
|
1615
1700
|
pluginYaml,
|
|
1616
1701
|
presetAll,
|
|
@@ -1623,11 +1708,13 @@ function ntnyq(config = [], {
|
|
|
1623
1708
|
regexp,
|
|
1624
1709
|
sortPackageJson,
|
|
1625
1710
|
sortTsConfig,
|
|
1711
|
+
toml,
|
|
1626
1712
|
tseslint,
|
|
1627
1713
|
typescript,
|
|
1628
1714
|
typescriptCore,
|
|
1629
1715
|
unicorn,
|
|
1630
1716
|
unocss,
|
|
1717
|
+
unusedImports,
|
|
1631
1718
|
vue,
|
|
1632
1719
|
yml
|
|
1633
1720
|
});
|