@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.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,6 +84,7 @@ __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,
|
|
86
90
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
@@ -95,6 +99,7 @@ __export(src_exports, {
|
|
|
95
99
|
regexp: () => regexp,
|
|
96
100
|
sortPackageJson: () => sortPackageJson,
|
|
97
101
|
sortTsConfig: () => sortTsConfig,
|
|
102
|
+
toml: () => toml,
|
|
98
103
|
tseslint: () => import_typescript_eslint.default,
|
|
99
104
|
typescript: () => typescript,
|
|
100
105
|
typescriptCore: () => typescriptCore,
|
|
@@ -105,7 +110,7 @@ __export(src_exports, {
|
|
|
105
110
|
});
|
|
106
111
|
module.exports = __toCommonJS(src_exports);
|
|
107
112
|
|
|
108
|
-
// src/env.ts
|
|
113
|
+
// src/utils/env.ts
|
|
109
114
|
var import_node_process = __toESM(require("process"), 1);
|
|
110
115
|
var import_node_path = require("path");
|
|
111
116
|
var import_local_pkg = require("local-pkg");
|
|
@@ -115,7 +120,22 @@ var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pk
|
|
|
115
120
|
});
|
|
116
121
|
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
122
|
|
|
118
|
-
// src/
|
|
123
|
+
// src/utils/interopDefault.ts
|
|
124
|
+
async function interopDefault(mod) {
|
|
125
|
+
const resolved = await mod;
|
|
126
|
+
return resolved.default || resolved;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// src/utils/loadPlugin.ts
|
|
130
|
+
async function loadPlugin(name) {
|
|
131
|
+
const mod = await import(name).catch((err) => {
|
|
132
|
+
console.error(err);
|
|
133
|
+
throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
|
|
134
|
+
});
|
|
135
|
+
return interopDefault(mod);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/utils/defineConfig.ts
|
|
119
139
|
function defineConfig(configs = []) {
|
|
120
140
|
return configs;
|
|
121
141
|
}
|
|
@@ -138,6 +158,7 @@ var GLOB_JSONC = "**/*.jsonc";
|
|
|
138
158
|
var GLOB_VUE = "**/*.vue";
|
|
139
159
|
var GLOB_MARKDOWN = "**/*.md";
|
|
140
160
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
161
|
+
var GLOB_TOML = "**/*.toml";
|
|
141
162
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
142
163
|
var GLOB_ALL_SRC = [
|
|
143
164
|
GLOB_SRC,
|
|
@@ -147,6 +168,7 @@ var GLOB_ALL_SRC = [
|
|
|
147
168
|
GLOB_MARKDOWN,
|
|
148
169
|
GLOB_VUE,
|
|
149
170
|
GLOB_YAML,
|
|
171
|
+
GLOB_TOML,
|
|
150
172
|
GLOB_HTML
|
|
151
173
|
];
|
|
152
174
|
var GLOB_NODE_MODULES = "**/node_modules/**";
|
|
@@ -186,6 +208,7 @@ var GLOB_EXCLUDE = [
|
|
|
186
208
|
"**/?(.)cache",
|
|
187
209
|
"**/.eslintcache",
|
|
188
210
|
"**/.stylelintcache",
|
|
211
|
+
"**/.eslint-config-inspector",
|
|
189
212
|
"**/.vite-inspect",
|
|
190
213
|
"**/.nuxt",
|
|
191
214
|
"**/.wxt",
|
|
@@ -208,26 +231,24 @@ var ignores = defineConfig([
|
|
|
208
231
|
]);
|
|
209
232
|
|
|
210
233
|
// src/plugins.ts
|
|
234
|
+
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
235
|
+
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
211
236
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
212
237
|
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
238
|
+
var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
239
|
+
var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
|
|
240
|
+
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
241
|
+
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
213
242
|
var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
|
|
214
243
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
244
|
+
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
215
245
|
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
216
246
|
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
217
|
-
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
218
|
-
var
|
|
219
|
-
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
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);
|
|
247
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
248
|
+
var parserToml = __toESM(require("toml-eslint-parser"), 1);
|
|
224
249
|
var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
|
|
225
250
|
var parserVue = __toESM(require("vue-eslint-parser"), 1);
|
|
226
251
|
var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
|
|
227
|
-
// @__NO_SIDE_EFFECTS__
|
|
228
|
-
function interopDefault(m) {
|
|
229
|
-
return m.default || m;
|
|
230
|
-
}
|
|
231
252
|
|
|
232
253
|
// src/configs/node.ts
|
|
233
254
|
var node = defineConfig([
|
|
@@ -418,11 +439,11 @@ var comments = defineConfig([
|
|
|
418
439
|
{
|
|
419
440
|
name: "ntnyq/eslint-comments",
|
|
420
441
|
plugins: {
|
|
421
|
-
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
442
|
+
"@eslint-community/eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
422
443
|
},
|
|
423
444
|
rules: {
|
|
424
445
|
...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
|
|
425
|
-
"eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
446
|
+
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
426
447
|
}
|
|
427
448
|
}
|
|
428
449
|
]);
|
|
@@ -932,7 +953,7 @@ var unocss = defineConfig([
|
|
|
932
953
|
|
|
933
954
|
// src/configs/command.ts
|
|
934
955
|
var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
935
|
-
var command = defineConfig([(0, import_config.default)(
|
|
956
|
+
var command = defineConfig([(0, import_config.default)()]);
|
|
936
957
|
|
|
937
958
|
// src/configs/yml.ts
|
|
938
959
|
var yml = defineConfig([
|
|
@@ -954,6 +975,41 @@ var yml = defineConfig([
|
|
|
954
975
|
}
|
|
955
976
|
]);
|
|
956
977
|
|
|
978
|
+
// src/configs/toml.ts
|
|
979
|
+
var toml = defineConfig([
|
|
980
|
+
{
|
|
981
|
+
name: "ntnyq/toml",
|
|
982
|
+
files: [GLOB_TOML],
|
|
983
|
+
languageOptions: {
|
|
984
|
+
parser: parserToml
|
|
985
|
+
},
|
|
986
|
+
plugins: {
|
|
987
|
+
toml: import_eslint_plugin_toml.default
|
|
988
|
+
},
|
|
989
|
+
rules: {
|
|
990
|
+
"toml/comma-style": "error",
|
|
991
|
+
"toml/keys-order": "error",
|
|
992
|
+
"toml/no-space-dots": "error",
|
|
993
|
+
"toml/no-unreadable-number-separator": "error",
|
|
994
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
995
|
+
"toml/precision-of-integer": "error",
|
|
996
|
+
"toml/tables-order": "error",
|
|
997
|
+
"toml/indent": ["error", 2],
|
|
998
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
999
|
+
"toml/array-bracket-newline": "error",
|
|
1000
|
+
"toml/array-bracket-spacing": "error",
|
|
1001
|
+
"toml/array-element-newline": "error",
|
|
1002
|
+
"toml/inline-table-curly-spacing": "error",
|
|
1003
|
+
"toml/key-spacing": "error",
|
|
1004
|
+
"toml/padding-line-between-pairs": "error",
|
|
1005
|
+
"toml/padding-line-between-tables": "error",
|
|
1006
|
+
"toml/quoted-keys": "error",
|
|
1007
|
+
"toml/spaced-comment": "error",
|
|
1008
|
+
"toml/table-bracket-spacing": "error"
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
]);
|
|
1012
|
+
|
|
957
1013
|
// src/configs/sort.ts
|
|
958
1014
|
var sortPackageJson = defineConfig([
|
|
959
1015
|
{
|
|
@@ -1216,8 +1272,6 @@ var jsonc = defineConfig([
|
|
|
1216
1272
|
|
|
1217
1273
|
// src/configs/markdown.ts
|
|
1218
1274
|
var markdown = defineConfig([
|
|
1219
|
-
// TODO: Add config name for markdown plugin
|
|
1220
|
-
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1221
1275
|
...import_eslint_plugin_markdown.default.configs.recommended,
|
|
1222
1276
|
{
|
|
1223
1277
|
name: "ntnyq/markdown/extensions",
|
|
@@ -1525,7 +1579,7 @@ var presetJavaScript = [
|
|
|
1525
1579
|
];
|
|
1526
1580
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1527
1581
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
1528
|
-
var presetLanguageExtensions = [...presetJsonc, ...yml, ...markdown];
|
|
1582
|
+
var presetLanguageExtensions = [...presetJsonc, ...yml, ...toml, ...markdown];
|
|
1529
1583
|
var presetCommon = [...presetBasic, ...presetLanguageExtensions, ...prettier];
|
|
1530
1584
|
var presetAll = [...presetCommon, ...vue, ...unocss];
|
|
1531
1585
|
function ntnyq(config = [], {
|
|
@@ -1535,7 +1589,7 @@ function ntnyq(config = [], {
|
|
|
1535
1589
|
markdown: enableMarkdown = true,
|
|
1536
1590
|
command: enableCommand = true
|
|
1537
1591
|
} = {}) {
|
|
1538
|
-
const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
|
|
1592
|
+
const configs = defineConfig([...presetBasic, ...yml, ...toml, ...presetJsonc]);
|
|
1539
1593
|
if (enableVue) {
|
|
1540
1594
|
configs.push(...vue);
|
|
1541
1595
|
}
|
|
@@ -1577,6 +1631,7 @@ function ntnyq(config = [], {
|
|
|
1577
1631
|
GLOB_SRC,
|
|
1578
1632
|
GLOB_SRC_EXT,
|
|
1579
1633
|
GLOB_STYLE,
|
|
1634
|
+
GLOB_TOML,
|
|
1580
1635
|
GLOB_TS,
|
|
1581
1636
|
GLOB_TSX,
|
|
1582
1637
|
GLOB_VUE,
|
|
@@ -1595,10 +1650,12 @@ function ntnyq(config = [], {
|
|
|
1595
1650
|
jsdoc,
|
|
1596
1651
|
jsonc,
|
|
1597
1652
|
jsx,
|
|
1653
|
+
loadPlugin,
|
|
1598
1654
|
markdown,
|
|
1599
1655
|
node,
|
|
1600
1656
|
ntnyq,
|
|
1601
1657
|
parserJsonc,
|
|
1658
|
+
parserToml,
|
|
1602
1659
|
parserVue,
|
|
1603
1660
|
parserYaml,
|
|
1604
1661
|
pluginComments,
|
|
@@ -1609,6 +1666,7 @@ function ntnyq(config = [], {
|
|
|
1609
1666
|
pluginNode,
|
|
1610
1667
|
pluginPrettier,
|
|
1611
1668
|
pluginRegexp,
|
|
1669
|
+
pluginToml,
|
|
1612
1670
|
pluginUnicorn,
|
|
1613
1671
|
pluginUnoCSS,
|
|
1614
1672
|
pluginVue,
|
|
@@ -1623,6 +1681,7 @@ function ntnyq(config = [], {
|
|
|
1623
1681
|
regexp,
|
|
1624
1682
|
sortPackageJson,
|
|
1625
1683
|
sortTsConfig,
|
|
1684
|
+
toml,
|
|
1626
1685
|
tseslint,
|
|
1627
1686
|
typescript,
|
|
1628
1687
|
typescriptCore,
|