@ntnyq/eslint-config 2.2.1 → 2.4.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/README.md +1 -1
- package/dist/index.cjs +49 -51
- package/dist/index.d.cts +56 -29
- package/dist/index.d.ts +56 -29
- package/dist/index.js +47 -51
- package/package.json +8 -7
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -52,7 +52,9 @@ __export(src_exports, {
|
|
|
52
52
|
GLOB_TSX: () => GLOB_TSX,
|
|
53
53
|
GLOB_VUE: () => GLOB_VUE,
|
|
54
54
|
GLOB_YAML: () => GLOB_YAML,
|
|
55
|
+
command: () => command,
|
|
55
56
|
comments: () => comments,
|
|
57
|
+
defineConfig: () => defineConfig,
|
|
56
58
|
getVueVersion: () => getVueVersion,
|
|
57
59
|
hasTypeScript: () => hasTypeScript,
|
|
58
60
|
hasUnoCSS: () => hasUnoCSS,
|
|
@@ -106,6 +108,11 @@ var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
|
|
|
106
108
|
var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli");
|
|
107
109
|
var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
|
|
108
110
|
|
|
111
|
+
// src/types.ts
|
|
112
|
+
function defineConfig(configs = []) {
|
|
113
|
+
return configs;
|
|
114
|
+
}
|
|
115
|
+
|
|
109
116
|
// src/globs.ts
|
|
110
117
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
111
118
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -146,6 +153,11 @@ var GLOB_EXCLUDE = [
|
|
|
146
153
|
GLOB_NODE_MODULES,
|
|
147
154
|
GLOB_DIST,
|
|
148
155
|
...GLOB_LOCKFILE,
|
|
156
|
+
// Force lint
|
|
157
|
+
"!.github",
|
|
158
|
+
"!.vitepress",
|
|
159
|
+
"!.vuepress",
|
|
160
|
+
"!.vscode",
|
|
149
161
|
"**/CHANGELOG*.md",
|
|
150
162
|
"**/*.min.*",
|
|
151
163
|
"**/LICENSE*",
|
|
@@ -161,9 +173,9 @@ var GLOB_EXCLUDE = [
|
|
|
161
173
|
"**/output",
|
|
162
174
|
"**/public",
|
|
163
175
|
"**/static",
|
|
164
|
-
|
|
165
|
-
"
|
|
166
|
-
"
|
|
176
|
+
// VitePress VuePress
|
|
177
|
+
"**/?(.)temp",
|
|
178
|
+
"**/?(.)cache",
|
|
167
179
|
"**/.eslintcache",
|
|
168
180
|
"**/.stylelintcache",
|
|
169
181
|
"**/.vite-inspect",
|
|
@@ -175,28 +187,16 @@ var GLOB_EXCLUDE = [
|
|
|
175
187
|
"**/.vercel",
|
|
176
188
|
"**/.changeset",
|
|
177
189
|
"**/.npmrc",
|
|
178
|
-
"**/.yarnrc"
|
|
179
|
-
// Force lint
|
|
180
|
-
"!.github",
|
|
181
|
-
"!.vitepress",
|
|
182
|
-
"!.vuepress",
|
|
183
|
-
"!.vscode"
|
|
190
|
+
"**/.yarnrc"
|
|
184
191
|
];
|
|
185
192
|
|
|
186
|
-
// src/presets.ts
|
|
187
|
-
var import_eslint_define_config16 = require("eslint-define-config");
|
|
188
|
-
|
|
189
193
|
// src/configs/ignores.ts
|
|
190
|
-
var
|
|
191
|
-
var ignores = (0, import_eslint_define_config.defineFlatConfig)([
|
|
194
|
+
var ignores = defineConfig([
|
|
192
195
|
{
|
|
193
196
|
ignores: GLOB_EXCLUDE
|
|
194
197
|
}
|
|
195
198
|
]);
|
|
196
199
|
|
|
197
|
-
// src/configs/node.ts
|
|
198
|
-
var import_eslint_define_config2 = require("eslint-define-config");
|
|
199
|
-
|
|
200
200
|
// src/plugins.ts
|
|
201
201
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
202
202
|
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
@@ -219,7 +219,7 @@ function interopDefault(m) {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
// src/configs/node.ts
|
|
222
|
-
var node = (
|
|
222
|
+
var node = defineConfig([
|
|
223
223
|
{
|
|
224
224
|
plugins: {
|
|
225
225
|
node: import_eslint_plugin_n.default
|
|
@@ -238,8 +238,7 @@ var node = (0, import_eslint_define_config2.defineFlatConfig)([
|
|
|
238
238
|
]);
|
|
239
239
|
|
|
240
240
|
// src/configs/jsdoc.ts
|
|
241
|
-
var
|
|
242
|
-
var jsdoc = (0, import_eslint_define_config3.defineFlatConfig)([
|
|
241
|
+
var jsdoc = defineConfig([
|
|
243
242
|
{
|
|
244
243
|
plugins: {
|
|
245
244
|
jsdoc: import_eslint_plugin_jsdoc.default
|
|
@@ -267,8 +266,7 @@ var jsdoc = (0, import_eslint_define_config3.defineFlatConfig)([
|
|
|
267
266
|
]);
|
|
268
267
|
|
|
269
268
|
// src/configs/imports.ts
|
|
270
|
-
var
|
|
271
|
-
var imports = (0, import_eslint_define_config4.defineFlatConfig)([
|
|
269
|
+
var imports = defineConfig([
|
|
272
270
|
{
|
|
273
271
|
plugins: {
|
|
274
272
|
import: import_eslint_plugin_import_x.default
|
|
@@ -310,14 +308,17 @@ var imports = (0, import_eslint_define_config4.defineFlatConfig)([
|
|
|
310
308
|
]);
|
|
311
309
|
|
|
312
310
|
// src/configs/unicorn.ts
|
|
313
|
-
var
|
|
314
|
-
var unicorn = (0, import_eslint_define_config5.defineFlatConfig)([
|
|
311
|
+
var unicorn = defineConfig([
|
|
315
312
|
{
|
|
316
313
|
plugins: {
|
|
317
314
|
unicorn: import_eslint_plugin_unicorn.default
|
|
318
315
|
},
|
|
319
316
|
rules: {
|
|
317
|
+
// Disabled
|
|
320
318
|
"unicorn/no-unsafe-regex": "off",
|
|
319
|
+
"unicorn/prefer-top-level-await": "off",
|
|
320
|
+
"unicorn/explicit-length-check": "off",
|
|
321
|
+
"unicorn/no-array-callback-reference": "off",
|
|
321
322
|
"unicorn/error-message": "error",
|
|
322
323
|
"unicorn/escape-case": "error",
|
|
323
324
|
"unicorn/no-new-buffer": "error",
|
|
@@ -331,12 +332,10 @@ var unicorn = (0, import_eslint_define_config5.defineFlatConfig)([
|
|
|
331
332
|
"unicorn/prefer-set-size": "error",
|
|
332
333
|
"unicorn/better-regex": "error",
|
|
333
334
|
"unicorn/prefer-regexp-test": "error",
|
|
334
|
-
"unicorn/prefer-top-level-await": "error",
|
|
335
335
|
"unicorn/no-static-only-class": "error",
|
|
336
336
|
"unicorn/no-zero-fractions": "error",
|
|
337
337
|
"unicorn/custom-error-definition": "error",
|
|
338
338
|
"unicorn/prefer-modern-math-apis": "error",
|
|
339
|
-
"unicorn/explicit-length-check": "error",
|
|
340
339
|
"unicorn/new-for-builtins": "error",
|
|
341
340
|
"unicorn/no-console-spaces": "error",
|
|
342
341
|
"unicorn/no-for-loop": "error",
|
|
@@ -375,7 +374,6 @@ var unicorn = (0, import_eslint_define_config5.defineFlatConfig)([
|
|
|
375
374
|
"unicorn/no-new-array": "error",
|
|
376
375
|
"unicorn/no-instanceof-array": "error",
|
|
377
376
|
"unicorn/no-array-push-push": "error",
|
|
378
|
-
"unicorn/no-array-callback-reference": "error",
|
|
379
377
|
"unicorn/no-array-method-this-argument": "error",
|
|
380
378
|
"unicorn/prefer-array-find": "error",
|
|
381
379
|
"unicorn/prefer-array-some": "error",
|
|
@@ -387,8 +385,7 @@ var unicorn = (0, import_eslint_define_config5.defineFlatConfig)([
|
|
|
387
385
|
|
|
388
386
|
// src/configs/prettier.ts
|
|
389
387
|
var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
|
|
390
|
-
var
|
|
391
|
-
var prettier = (0, import_eslint_define_config6.defineFlatConfig)([
|
|
388
|
+
var prettier = defineConfig([
|
|
392
389
|
{
|
|
393
390
|
plugins: {
|
|
394
391
|
prettier: import_eslint_plugin_prettier.default
|
|
@@ -402,8 +399,7 @@ var prettier = (0, import_eslint_define_config6.defineFlatConfig)([
|
|
|
402
399
|
]);
|
|
403
400
|
|
|
404
401
|
// src/configs/comments.ts
|
|
405
|
-
var
|
|
406
|
-
var comments = (0, import_eslint_define_config7.defineFlatConfig)([
|
|
402
|
+
var comments = defineConfig([
|
|
407
403
|
{
|
|
408
404
|
plugins: {
|
|
409
405
|
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
@@ -418,8 +414,7 @@ var comments = (0, import_eslint_define_config7.defineFlatConfig)([
|
|
|
418
414
|
// src/configs/javascript.ts
|
|
419
415
|
var import_globals = __toESM(require("globals"), 1);
|
|
420
416
|
var import_js = __toESM(require("@eslint/js"), 1);
|
|
421
|
-
var
|
|
422
|
-
var javascript = (0, import_eslint_define_config8.defineFlatConfig)([
|
|
417
|
+
var javascript = defineConfig([
|
|
423
418
|
import_js.default.configs.recommended,
|
|
424
419
|
{
|
|
425
420
|
languageOptions: {
|
|
@@ -781,7 +776,7 @@ var javascript = (0, import_eslint_define_config8.defineFlatConfig)([
|
|
|
781
776
|
}
|
|
782
777
|
}
|
|
783
778
|
]);
|
|
784
|
-
var jsx = (
|
|
779
|
+
var jsx = defineConfig([
|
|
785
780
|
{
|
|
786
781
|
files: ["**/*.jsx"],
|
|
787
782
|
languageOptions: {
|
|
@@ -795,7 +790,6 @@ var jsx = (0, import_eslint_define_config8.defineFlatConfig)([
|
|
|
795
790
|
]);
|
|
796
791
|
|
|
797
792
|
// src/configs/typescript.ts
|
|
798
|
-
var import_eslint_define_config9 = require("eslint-define-config");
|
|
799
793
|
var typescriptCore = import_typescript_eslint.default.config({
|
|
800
794
|
extends: [...import_typescript_eslint.default.configs.recommended],
|
|
801
795
|
files: [GLOB_TS, GLOB_TSX],
|
|
@@ -854,7 +848,7 @@ var typescriptCore = import_typescript_eslint.default.config({
|
|
|
854
848
|
"@typescript-eslint/consistent-indexed-object-style": "off"
|
|
855
849
|
}
|
|
856
850
|
});
|
|
857
|
-
var typescript = (
|
|
851
|
+
var typescript = defineConfig([
|
|
858
852
|
...typescriptCore,
|
|
859
853
|
{
|
|
860
854
|
files: ["**/*.d.ts"],
|
|
@@ -879,8 +873,7 @@ var typescript = (0, import_eslint_define_config9.defineFlatConfig)([
|
|
|
879
873
|
]);
|
|
880
874
|
|
|
881
875
|
// src/configs/unocss.ts
|
|
882
|
-
var
|
|
883
|
-
var unocss = (0, import_eslint_define_config10.defineFlatConfig)([
|
|
876
|
+
var unocss = defineConfig([
|
|
884
877
|
{
|
|
885
878
|
plugins: {
|
|
886
879
|
unocss: import_eslint_plugin.default
|
|
@@ -893,9 +886,12 @@ var unocss = (0, import_eslint_define_config10.defineFlatConfig)([
|
|
|
893
886
|
}
|
|
894
887
|
]);
|
|
895
888
|
|
|
889
|
+
// src/configs/command.ts
|
|
890
|
+
var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
891
|
+
var command = defineConfig([(0, import_config.default)()]);
|
|
892
|
+
|
|
896
893
|
// src/configs/yml.ts
|
|
897
|
-
var
|
|
898
|
-
var yml = (0, import_eslint_define_config11.defineFlatConfig)([
|
|
894
|
+
var yml = defineConfig([
|
|
899
895
|
{
|
|
900
896
|
files: [GLOB_YAML],
|
|
901
897
|
languageOptions: {
|
|
@@ -914,8 +910,7 @@ var yml = (0, import_eslint_define_config11.defineFlatConfig)([
|
|
|
914
910
|
]);
|
|
915
911
|
|
|
916
912
|
// src/configs/sort.ts
|
|
917
|
-
var
|
|
918
|
-
var sortPackageJson = (0, import_eslint_define_config12.defineFlatConfig)([
|
|
913
|
+
var sortPackageJson = defineConfig([
|
|
919
914
|
{
|
|
920
915
|
files: ["**/package.json"],
|
|
921
916
|
rules: {
|
|
@@ -1013,7 +1008,7 @@ var sortPackageJson = (0, import_eslint_define_config12.defineFlatConfig)([
|
|
|
1013
1008
|
}
|
|
1014
1009
|
}
|
|
1015
1010
|
]);
|
|
1016
|
-
var sortTsConfig = (
|
|
1011
|
+
var sortTsConfig = defineConfig([
|
|
1017
1012
|
{
|
|
1018
1013
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
1019
1014
|
rules: {
|
|
@@ -1130,8 +1125,7 @@ var sortTsConfig = (0, import_eslint_define_config12.defineFlatConfig)([
|
|
|
1130
1125
|
]);
|
|
1131
1126
|
|
|
1132
1127
|
// src/configs/jsonc.ts
|
|
1133
|
-
var
|
|
1134
|
-
var jsonc = (0, import_eslint_define_config13.defineFlatConfig)([
|
|
1128
|
+
var jsonc = defineConfig([
|
|
1135
1129
|
{
|
|
1136
1130
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1137
1131
|
plugins: {
|
|
@@ -1173,8 +1167,7 @@ var jsonc = (0, import_eslint_define_config13.defineFlatConfig)([
|
|
|
1173
1167
|
]);
|
|
1174
1168
|
|
|
1175
1169
|
// src/configs/markdown.ts
|
|
1176
|
-
var
|
|
1177
|
-
var markdown = (0, import_eslint_define_config14.defineFlatConfig)([
|
|
1170
|
+
var markdown = defineConfig([
|
|
1178
1171
|
...import_eslint_plugin_markdown.default.configs.recommended,
|
|
1179
1172
|
{
|
|
1180
1173
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
@@ -1204,7 +1197,6 @@ var markdown = (0, import_eslint_define_config14.defineFlatConfig)([
|
|
|
1204
1197
|
// src/configs/vue.ts
|
|
1205
1198
|
var import_node_process = __toESM(require("process"), 1);
|
|
1206
1199
|
var import_local_pkg2 = require("local-pkg");
|
|
1207
|
-
var import_eslint_define_config15 = require("eslint-define-config");
|
|
1208
1200
|
function getVueVersion() {
|
|
1209
1201
|
const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process.default.cwd()] });
|
|
1210
1202
|
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
@@ -1225,7 +1217,7 @@ var vue3Rules = {
|
|
|
1225
1217
|
...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
|
|
1226
1218
|
...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
|
|
1227
1219
|
};
|
|
1228
|
-
var vue = (
|
|
1220
|
+
var vue = defineConfig([
|
|
1229
1221
|
...import_typescript_eslint.default.config({
|
|
1230
1222
|
files: [GLOB_VUE],
|
|
1231
1223
|
extends: typescriptCore
|
|
@@ -1486,9 +1478,10 @@ function ntnyq(config = [], {
|
|
|
1486
1478
|
vue: enableVue = hasVue,
|
|
1487
1479
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
1488
1480
|
prettier: enablePrettier = true,
|
|
1489
|
-
markdown: enableMarkdown = true
|
|
1481
|
+
markdown: enableMarkdown = true,
|
|
1482
|
+
command: enableCommand = true
|
|
1490
1483
|
} = {}) {
|
|
1491
|
-
const configs = (
|
|
1484
|
+
const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
|
|
1492
1485
|
if (enableVue) {
|
|
1493
1486
|
configs.push(...vue);
|
|
1494
1487
|
}
|
|
@@ -1501,6 +1494,9 @@ function ntnyq(config = [], {
|
|
|
1501
1494
|
if (enableMarkdown) {
|
|
1502
1495
|
configs.push(...markdown);
|
|
1503
1496
|
}
|
|
1497
|
+
if (enableCommand) {
|
|
1498
|
+
configs.push(...command);
|
|
1499
|
+
}
|
|
1504
1500
|
if (Object.keys(config).length > 0) {
|
|
1505
1501
|
configs.push(...Array.isArray(config) ? config : [config]);
|
|
1506
1502
|
}
|
|
@@ -1530,7 +1526,9 @@ function ntnyq(config = [], {
|
|
|
1530
1526
|
GLOB_TSX,
|
|
1531
1527
|
GLOB_VUE,
|
|
1532
1528
|
GLOB_YAML,
|
|
1529
|
+
command,
|
|
1533
1530
|
comments,
|
|
1531
|
+
defineConfig,
|
|
1534
1532
|
getVueVersion,
|
|
1535
1533
|
hasTypeScript,
|
|
1536
1534
|
hasUnoCSS,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FlatESLintConfig } from 'eslint-define-config';
|
|
1
|
+
import { Linter, ESLint } from 'eslint';
|
|
3
2
|
export { default as pluginNode } from 'eslint-plugin-n';
|
|
4
3
|
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
5
4
|
export { default as pluginUnoCSS } from '@unocss/eslint-plugin';
|
|
@@ -23,6 +22,31 @@ declare const hasTypeScript: boolean;
|
|
|
23
22
|
declare const hasVue: boolean;
|
|
24
23
|
declare const hasUnoCSS: boolean;
|
|
25
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @file Types
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ESLint config
|
|
31
|
+
*/
|
|
32
|
+
type FlatConfig = Linter.FlatConfig;
|
|
33
|
+
/**
|
|
34
|
+
* ESLint Plugin
|
|
35
|
+
*/
|
|
36
|
+
type ESLintPlugin = ESLint.Plugin;
|
|
37
|
+
/**
|
|
38
|
+
* ESLint rules
|
|
39
|
+
*/
|
|
40
|
+
type RuleRecord = Linter.RulesRecord;
|
|
41
|
+
/**
|
|
42
|
+
* ESLint rules entry
|
|
43
|
+
*/
|
|
44
|
+
type RuleRecordEntry = Record<string, RuleRecord>;
|
|
45
|
+
/**
|
|
46
|
+
* Define ESLint config
|
|
47
|
+
*/
|
|
48
|
+
declare function defineConfig(configs?: FlatConfig[]): FlatConfig[];
|
|
49
|
+
|
|
26
50
|
/**
|
|
27
51
|
* @file globs constants
|
|
28
52
|
*/
|
|
@@ -56,70 +80,73 @@ declare const GLOB_EXCLUDE: string[];
|
|
|
56
80
|
/**
|
|
57
81
|
* JavaScript preset
|
|
58
82
|
*/
|
|
59
|
-
declare const presetJavaScript:
|
|
83
|
+
declare const presetJavaScript: FlatConfig[];
|
|
60
84
|
/**
|
|
61
85
|
* JavaScript & TypeScript
|
|
62
86
|
*/
|
|
63
|
-
declare const presetBasic:
|
|
87
|
+
declare const presetBasic: FlatConfig[];
|
|
64
88
|
/**
|
|
65
89
|
* JSON and sort json keys
|
|
66
90
|
*/
|
|
67
|
-
declare const presetJsonc:
|
|
91
|
+
declare const presetJsonc: FlatConfig[];
|
|
68
92
|
/**
|
|
69
93
|
* JSON YAML Markdown
|
|
70
94
|
*/
|
|
71
|
-
declare const presetLanguageExtensions:
|
|
72
|
-
declare const presetCommon:
|
|
95
|
+
declare const presetLanguageExtensions: FlatConfig[];
|
|
96
|
+
declare const presetCommon: FlatConfig[];
|
|
73
97
|
/**
|
|
74
98
|
* All supported framework
|
|
75
99
|
*/
|
|
76
|
-
declare const presetAll:
|
|
100
|
+
declare const presetAll: FlatConfig[];
|
|
77
101
|
/**
|
|
78
102
|
* Custom framework support
|
|
79
103
|
*/
|
|
80
|
-
declare function ntnyq(config?:
|
|
104
|
+
declare function ntnyq(config?: FlatConfig | FlatConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, command: enableCommand, }?: {
|
|
81
105
|
vue?: boolean | undefined;
|
|
82
106
|
unocss?: boolean | undefined;
|
|
83
107
|
prettier?: boolean | undefined;
|
|
84
108
|
markdown?: boolean | undefined;
|
|
85
|
-
|
|
109
|
+
command?: boolean | undefined;
|
|
110
|
+
}): FlatConfig[];
|
|
86
111
|
|
|
87
112
|
/**
|
|
88
113
|
* @see https://eslint.org/docs/latest/use/configure/configuration-files-new#globally-ignoring-files-with-ignores
|
|
89
114
|
*/
|
|
90
|
-
declare const ignores:
|
|
115
|
+
declare const ignores: FlatConfig[];
|
|
116
|
+
|
|
117
|
+
declare const node: FlatConfig[];
|
|
91
118
|
|
|
92
|
-
declare const
|
|
119
|
+
declare const jsdoc: FlatConfig[];
|
|
93
120
|
|
|
94
|
-
declare const
|
|
121
|
+
declare const imports: FlatConfig[];
|
|
95
122
|
|
|
96
|
-
declare const
|
|
123
|
+
declare const unicorn: FlatConfig[];
|
|
97
124
|
|
|
98
|
-
declare const
|
|
125
|
+
declare const prettier: FlatConfig[];
|
|
99
126
|
|
|
100
|
-
declare const
|
|
127
|
+
declare const comments: FlatConfig[];
|
|
101
128
|
|
|
102
|
-
declare const
|
|
129
|
+
declare const javascript: FlatConfig[];
|
|
130
|
+
declare const jsx: FlatConfig[];
|
|
103
131
|
|
|
104
|
-
declare const
|
|
105
|
-
declare const
|
|
132
|
+
declare const typescriptCore: FlatConfig[];
|
|
133
|
+
declare const typescript: FlatConfig[];
|
|
106
134
|
|
|
107
|
-
declare const
|
|
108
|
-
declare const typescript: FlatESLintConfig[];
|
|
135
|
+
declare const unocss: FlatConfig[];
|
|
109
136
|
|
|
110
|
-
declare const
|
|
137
|
+
declare const command: FlatConfig[];
|
|
111
138
|
|
|
112
|
-
declare const yml:
|
|
139
|
+
declare const yml: FlatConfig[];
|
|
113
140
|
|
|
114
|
-
declare const sortPackageJson:
|
|
115
|
-
declare const sortTsConfig:
|
|
141
|
+
declare const sortPackageJson: FlatConfig[];
|
|
142
|
+
declare const sortTsConfig: FlatConfig[];
|
|
116
143
|
|
|
117
|
-
declare const jsonc:
|
|
144
|
+
declare const jsonc: FlatConfig[];
|
|
118
145
|
|
|
119
|
-
declare const markdown:
|
|
146
|
+
declare const markdown: FlatConfig[];
|
|
120
147
|
|
|
121
148
|
declare function getVueVersion(): number;
|
|
122
|
-
declare const vue:
|
|
149
|
+
declare const vue: FlatConfig[];
|
|
123
150
|
|
|
124
151
|
/**
|
|
125
152
|
* @file plugins & parsers
|
|
@@ -129,4 +156,4 @@ type InteropDefault<T> = T extends {
|
|
|
129
156
|
} ? U : T;
|
|
130
157
|
declare function interopDefault<T>(m: T): InteropDefault<T>;
|
|
131
158
|
|
|
132
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, comments, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
|
159
|
+
export { type ESLintPlugin, type FlatConfig, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, type RuleRecord, type RuleRecordEntry, command, comments, defineConfig, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FlatESLintConfig } from 'eslint-define-config';
|
|
1
|
+
import { Linter, ESLint } from 'eslint';
|
|
3
2
|
export { default as pluginNode } from 'eslint-plugin-n';
|
|
4
3
|
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
5
4
|
export { default as pluginUnoCSS } from '@unocss/eslint-plugin';
|
|
@@ -23,6 +22,31 @@ declare const hasTypeScript: boolean;
|
|
|
23
22
|
declare const hasVue: boolean;
|
|
24
23
|
declare const hasUnoCSS: boolean;
|
|
25
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @file Types
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ESLint config
|
|
31
|
+
*/
|
|
32
|
+
type FlatConfig = Linter.FlatConfig;
|
|
33
|
+
/**
|
|
34
|
+
* ESLint Plugin
|
|
35
|
+
*/
|
|
36
|
+
type ESLintPlugin = ESLint.Plugin;
|
|
37
|
+
/**
|
|
38
|
+
* ESLint rules
|
|
39
|
+
*/
|
|
40
|
+
type RuleRecord = Linter.RulesRecord;
|
|
41
|
+
/**
|
|
42
|
+
* ESLint rules entry
|
|
43
|
+
*/
|
|
44
|
+
type RuleRecordEntry = Record<string, RuleRecord>;
|
|
45
|
+
/**
|
|
46
|
+
* Define ESLint config
|
|
47
|
+
*/
|
|
48
|
+
declare function defineConfig(configs?: FlatConfig[]): FlatConfig[];
|
|
49
|
+
|
|
26
50
|
/**
|
|
27
51
|
* @file globs constants
|
|
28
52
|
*/
|
|
@@ -56,70 +80,73 @@ declare const GLOB_EXCLUDE: string[];
|
|
|
56
80
|
/**
|
|
57
81
|
* JavaScript preset
|
|
58
82
|
*/
|
|
59
|
-
declare const presetJavaScript:
|
|
83
|
+
declare const presetJavaScript: FlatConfig[];
|
|
60
84
|
/**
|
|
61
85
|
* JavaScript & TypeScript
|
|
62
86
|
*/
|
|
63
|
-
declare const presetBasic:
|
|
87
|
+
declare const presetBasic: FlatConfig[];
|
|
64
88
|
/**
|
|
65
89
|
* JSON and sort json keys
|
|
66
90
|
*/
|
|
67
|
-
declare const presetJsonc:
|
|
91
|
+
declare const presetJsonc: FlatConfig[];
|
|
68
92
|
/**
|
|
69
93
|
* JSON YAML Markdown
|
|
70
94
|
*/
|
|
71
|
-
declare const presetLanguageExtensions:
|
|
72
|
-
declare const presetCommon:
|
|
95
|
+
declare const presetLanguageExtensions: FlatConfig[];
|
|
96
|
+
declare const presetCommon: FlatConfig[];
|
|
73
97
|
/**
|
|
74
98
|
* All supported framework
|
|
75
99
|
*/
|
|
76
|
-
declare const presetAll:
|
|
100
|
+
declare const presetAll: FlatConfig[];
|
|
77
101
|
/**
|
|
78
102
|
* Custom framework support
|
|
79
103
|
*/
|
|
80
|
-
declare function ntnyq(config?:
|
|
104
|
+
declare function ntnyq(config?: FlatConfig | FlatConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, command: enableCommand, }?: {
|
|
81
105
|
vue?: boolean | undefined;
|
|
82
106
|
unocss?: boolean | undefined;
|
|
83
107
|
prettier?: boolean | undefined;
|
|
84
108
|
markdown?: boolean | undefined;
|
|
85
|
-
|
|
109
|
+
command?: boolean | undefined;
|
|
110
|
+
}): FlatConfig[];
|
|
86
111
|
|
|
87
112
|
/**
|
|
88
113
|
* @see https://eslint.org/docs/latest/use/configure/configuration-files-new#globally-ignoring-files-with-ignores
|
|
89
114
|
*/
|
|
90
|
-
declare const ignores:
|
|
115
|
+
declare const ignores: FlatConfig[];
|
|
116
|
+
|
|
117
|
+
declare const node: FlatConfig[];
|
|
91
118
|
|
|
92
|
-
declare const
|
|
119
|
+
declare const jsdoc: FlatConfig[];
|
|
93
120
|
|
|
94
|
-
declare const
|
|
121
|
+
declare const imports: FlatConfig[];
|
|
95
122
|
|
|
96
|
-
declare const
|
|
123
|
+
declare const unicorn: FlatConfig[];
|
|
97
124
|
|
|
98
|
-
declare const
|
|
125
|
+
declare const prettier: FlatConfig[];
|
|
99
126
|
|
|
100
|
-
declare const
|
|
127
|
+
declare const comments: FlatConfig[];
|
|
101
128
|
|
|
102
|
-
declare const
|
|
129
|
+
declare const javascript: FlatConfig[];
|
|
130
|
+
declare const jsx: FlatConfig[];
|
|
103
131
|
|
|
104
|
-
declare const
|
|
105
|
-
declare const
|
|
132
|
+
declare const typescriptCore: FlatConfig[];
|
|
133
|
+
declare const typescript: FlatConfig[];
|
|
106
134
|
|
|
107
|
-
declare const
|
|
108
|
-
declare const typescript: FlatESLintConfig[];
|
|
135
|
+
declare const unocss: FlatConfig[];
|
|
109
136
|
|
|
110
|
-
declare const
|
|
137
|
+
declare const command: FlatConfig[];
|
|
111
138
|
|
|
112
|
-
declare const yml:
|
|
139
|
+
declare const yml: FlatConfig[];
|
|
113
140
|
|
|
114
|
-
declare const sortPackageJson:
|
|
115
|
-
declare const sortTsConfig:
|
|
141
|
+
declare const sortPackageJson: FlatConfig[];
|
|
142
|
+
declare const sortTsConfig: FlatConfig[];
|
|
116
143
|
|
|
117
|
-
declare const jsonc:
|
|
144
|
+
declare const jsonc: FlatConfig[];
|
|
118
145
|
|
|
119
|
-
declare const markdown:
|
|
146
|
+
declare const markdown: FlatConfig[];
|
|
120
147
|
|
|
121
148
|
declare function getVueVersion(): number;
|
|
122
|
-
declare const vue:
|
|
149
|
+
declare const vue: FlatConfig[];
|
|
123
150
|
|
|
124
151
|
/**
|
|
125
152
|
* @file plugins & parsers
|
|
@@ -129,4 +156,4 @@ type InteropDefault<T> = T extends {
|
|
|
129
156
|
} ? U : T;
|
|
130
157
|
declare function interopDefault<T>(m: T): InteropDefault<T>;
|
|
131
158
|
|
|
132
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, comments, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
|
159
|
+
export { type ESLintPlugin, type FlatConfig, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, type RuleRecord, type RuleRecordEntry, command, comments, defineConfig, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,11 @@ var hasTypeScript = isPackageExists("typescript");
|
|
|
4
4
|
var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
|
|
5
5
|
var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
6
6
|
|
|
7
|
+
// src/types.ts
|
|
8
|
+
function defineConfig(configs = []) {
|
|
9
|
+
return configs;
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
// src/globs.ts
|
|
8
13
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
9
14
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -44,6 +49,11 @@ var GLOB_EXCLUDE = [
|
|
|
44
49
|
GLOB_NODE_MODULES,
|
|
45
50
|
GLOB_DIST,
|
|
46
51
|
...GLOB_LOCKFILE,
|
|
52
|
+
// Force lint
|
|
53
|
+
"!.github",
|
|
54
|
+
"!.vitepress",
|
|
55
|
+
"!.vuepress",
|
|
56
|
+
"!.vscode",
|
|
47
57
|
"**/CHANGELOG*.md",
|
|
48
58
|
"**/*.min.*",
|
|
49
59
|
"**/LICENSE*",
|
|
@@ -59,9 +69,9 @@ var GLOB_EXCLUDE = [
|
|
|
59
69
|
"**/output",
|
|
60
70
|
"**/public",
|
|
61
71
|
"**/static",
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
72
|
+
// VitePress VuePress
|
|
73
|
+
"**/?(.)temp",
|
|
74
|
+
"**/?(.)cache",
|
|
65
75
|
"**/.eslintcache",
|
|
66
76
|
"**/.stylelintcache",
|
|
67
77
|
"**/.vite-inspect",
|
|
@@ -73,28 +83,16 @@ var GLOB_EXCLUDE = [
|
|
|
73
83
|
"**/.vercel",
|
|
74
84
|
"**/.changeset",
|
|
75
85
|
"**/.npmrc",
|
|
76
|
-
"**/.yarnrc"
|
|
77
|
-
// Force lint
|
|
78
|
-
"!.github",
|
|
79
|
-
"!.vitepress",
|
|
80
|
-
"!.vuepress",
|
|
81
|
-
"!.vscode"
|
|
86
|
+
"**/.yarnrc"
|
|
82
87
|
];
|
|
83
88
|
|
|
84
|
-
// src/presets.ts
|
|
85
|
-
import { defineFlatConfig as defineFlatConfig16 } from "eslint-define-config";
|
|
86
|
-
|
|
87
89
|
// src/configs/ignores.ts
|
|
88
|
-
|
|
89
|
-
var ignores = defineFlatConfig([
|
|
90
|
+
var ignores = defineConfig([
|
|
90
91
|
{
|
|
91
92
|
ignores: GLOB_EXCLUDE
|
|
92
93
|
}
|
|
93
94
|
]);
|
|
94
95
|
|
|
95
|
-
// src/configs/node.ts
|
|
96
|
-
import { defineFlatConfig as defineFlatConfig2 } from "eslint-define-config";
|
|
97
|
-
|
|
98
96
|
// src/plugins.ts
|
|
99
97
|
import { default as default2 } from "eslint-plugin-n";
|
|
100
98
|
import { default as default3 } from "eslint-plugin-vue";
|
|
@@ -117,7 +115,7 @@ function interopDefault(m) {
|
|
|
117
115
|
}
|
|
118
116
|
|
|
119
117
|
// src/configs/node.ts
|
|
120
|
-
var node =
|
|
118
|
+
var node = defineConfig([
|
|
121
119
|
{
|
|
122
120
|
plugins: {
|
|
123
121
|
node: default2
|
|
@@ -136,8 +134,7 @@ var node = defineFlatConfig2([
|
|
|
136
134
|
]);
|
|
137
135
|
|
|
138
136
|
// src/configs/jsdoc.ts
|
|
139
|
-
|
|
140
|
-
var jsdoc = defineFlatConfig3([
|
|
137
|
+
var jsdoc = defineConfig([
|
|
141
138
|
{
|
|
142
139
|
plugins: {
|
|
143
140
|
jsdoc: default12
|
|
@@ -165,8 +162,7 @@ var jsdoc = defineFlatConfig3([
|
|
|
165
162
|
]);
|
|
166
163
|
|
|
167
164
|
// src/configs/imports.ts
|
|
168
|
-
|
|
169
|
-
var imports = defineFlatConfig4([
|
|
165
|
+
var imports = defineConfig([
|
|
170
166
|
{
|
|
171
167
|
plugins: {
|
|
172
168
|
import: default11
|
|
@@ -208,14 +204,17 @@ var imports = defineFlatConfig4([
|
|
|
208
204
|
]);
|
|
209
205
|
|
|
210
206
|
// src/configs/unicorn.ts
|
|
211
|
-
|
|
212
|
-
var unicorn = defineFlatConfig5([
|
|
207
|
+
var unicorn = defineConfig([
|
|
213
208
|
{
|
|
214
209
|
plugins: {
|
|
215
210
|
unicorn: default5
|
|
216
211
|
},
|
|
217
212
|
rules: {
|
|
213
|
+
// Disabled
|
|
218
214
|
"unicorn/no-unsafe-regex": "off",
|
|
215
|
+
"unicorn/prefer-top-level-await": "off",
|
|
216
|
+
"unicorn/explicit-length-check": "off",
|
|
217
|
+
"unicorn/no-array-callback-reference": "off",
|
|
219
218
|
"unicorn/error-message": "error",
|
|
220
219
|
"unicorn/escape-case": "error",
|
|
221
220
|
"unicorn/no-new-buffer": "error",
|
|
@@ -229,12 +228,10 @@ var unicorn = defineFlatConfig5([
|
|
|
229
228
|
"unicorn/prefer-set-size": "error",
|
|
230
229
|
"unicorn/better-regex": "error",
|
|
231
230
|
"unicorn/prefer-regexp-test": "error",
|
|
232
|
-
"unicorn/prefer-top-level-await": "error",
|
|
233
231
|
"unicorn/no-static-only-class": "error",
|
|
234
232
|
"unicorn/no-zero-fractions": "error",
|
|
235
233
|
"unicorn/custom-error-definition": "error",
|
|
236
234
|
"unicorn/prefer-modern-math-apis": "error",
|
|
237
|
-
"unicorn/explicit-length-check": "error",
|
|
238
235
|
"unicorn/new-for-builtins": "error",
|
|
239
236
|
"unicorn/no-console-spaces": "error",
|
|
240
237
|
"unicorn/no-for-loop": "error",
|
|
@@ -273,7 +270,6 @@ var unicorn = defineFlatConfig5([
|
|
|
273
270
|
"unicorn/no-new-array": "error",
|
|
274
271
|
"unicorn/no-instanceof-array": "error",
|
|
275
272
|
"unicorn/no-array-push-push": "error",
|
|
276
|
-
"unicorn/no-array-callback-reference": "error",
|
|
277
273
|
"unicorn/no-array-method-this-argument": "error",
|
|
278
274
|
"unicorn/prefer-array-find": "error",
|
|
279
275
|
"unicorn/prefer-array-some": "error",
|
|
@@ -285,8 +281,7 @@ var unicorn = defineFlatConfig5([
|
|
|
285
281
|
|
|
286
282
|
// src/configs/prettier.ts
|
|
287
283
|
import prettierConfig from "eslint-config-prettier";
|
|
288
|
-
|
|
289
|
-
var prettier = defineFlatConfig6([
|
|
284
|
+
var prettier = defineConfig([
|
|
290
285
|
{
|
|
291
286
|
plugins: {
|
|
292
287
|
prettier: default6
|
|
@@ -300,8 +295,7 @@ var prettier = defineFlatConfig6([
|
|
|
300
295
|
]);
|
|
301
296
|
|
|
302
297
|
// src/configs/comments.ts
|
|
303
|
-
|
|
304
|
-
var comments = defineFlatConfig7([
|
|
298
|
+
var comments = defineConfig([
|
|
305
299
|
{
|
|
306
300
|
plugins: {
|
|
307
301
|
"eslint-comments": default8
|
|
@@ -316,8 +310,7 @@ var comments = defineFlatConfig7([
|
|
|
316
310
|
// src/configs/javascript.ts
|
|
317
311
|
import globals from "globals";
|
|
318
312
|
import jsConfig from "@eslint/js";
|
|
319
|
-
|
|
320
|
-
var javascript = defineFlatConfig8([
|
|
313
|
+
var javascript = defineConfig([
|
|
321
314
|
jsConfig.configs.recommended,
|
|
322
315
|
{
|
|
323
316
|
languageOptions: {
|
|
@@ -679,7 +672,7 @@ var javascript = defineFlatConfig8([
|
|
|
679
672
|
}
|
|
680
673
|
}
|
|
681
674
|
]);
|
|
682
|
-
var jsx =
|
|
675
|
+
var jsx = defineConfig([
|
|
683
676
|
{
|
|
684
677
|
files: ["**/*.jsx"],
|
|
685
678
|
languageOptions: {
|
|
@@ -693,7 +686,6 @@ var jsx = defineFlatConfig8([
|
|
|
693
686
|
]);
|
|
694
687
|
|
|
695
688
|
// src/configs/typescript.ts
|
|
696
|
-
import { defineFlatConfig as defineFlatConfig9 } from "eslint-define-config";
|
|
697
689
|
var typescriptCore = tseslint.config({
|
|
698
690
|
extends: [...tseslint.configs.recommended],
|
|
699
691
|
files: [GLOB_TS, GLOB_TSX],
|
|
@@ -752,7 +744,7 @@ var typescriptCore = tseslint.config({
|
|
|
752
744
|
"@typescript-eslint/consistent-indexed-object-style": "off"
|
|
753
745
|
}
|
|
754
746
|
});
|
|
755
|
-
var typescript =
|
|
747
|
+
var typescript = defineConfig([
|
|
756
748
|
...typescriptCore,
|
|
757
749
|
{
|
|
758
750
|
files: ["**/*.d.ts"],
|
|
@@ -777,8 +769,7 @@ var typescript = defineFlatConfig9([
|
|
|
777
769
|
]);
|
|
778
770
|
|
|
779
771
|
// src/configs/unocss.ts
|
|
780
|
-
|
|
781
|
-
var unocss = defineFlatConfig10([
|
|
772
|
+
var unocss = defineConfig([
|
|
782
773
|
{
|
|
783
774
|
plugins: {
|
|
784
775
|
unocss: default4
|
|
@@ -791,9 +782,12 @@ var unocss = defineFlatConfig10([
|
|
|
791
782
|
}
|
|
792
783
|
]);
|
|
793
784
|
|
|
785
|
+
// src/configs/command.ts
|
|
786
|
+
import createCommandPlugin from "eslint-plugin-command/config";
|
|
787
|
+
var command = defineConfig([createCommandPlugin()]);
|
|
788
|
+
|
|
794
789
|
// src/configs/yml.ts
|
|
795
|
-
|
|
796
|
-
var yml = defineFlatConfig11([
|
|
790
|
+
var yml = defineConfig([
|
|
797
791
|
{
|
|
798
792
|
files: [GLOB_YAML],
|
|
799
793
|
languageOptions: {
|
|
@@ -812,8 +806,7 @@ var yml = defineFlatConfig11([
|
|
|
812
806
|
]);
|
|
813
807
|
|
|
814
808
|
// src/configs/sort.ts
|
|
815
|
-
|
|
816
|
-
var sortPackageJson = defineFlatConfig12([
|
|
809
|
+
var sortPackageJson = defineConfig([
|
|
817
810
|
{
|
|
818
811
|
files: ["**/package.json"],
|
|
819
812
|
rules: {
|
|
@@ -911,7 +904,7 @@ var sortPackageJson = defineFlatConfig12([
|
|
|
911
904
|
}
|
|
912
905
|
}
|
|
913
906
|
]);
|
|
914
|
-
var sortTsConfig =
|
|
907
|
+
var sortTsConfig = defineConfig([
|
|
915
908
|
{
|
|
916
909
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
917
910
|
rules: {
|
|
@@ -1028,8 +1021,7 @@ var sortTsConfig = defineFlatConfig12([
|
|
|
1028
1021
|
]);
|
|
1029
1022
|
|
|
1030
1023
|
// src/configs/jsonc.ts
|
|
1031
|
-
|
|
1032
|
-
var jsonc = defineFlatConfig13([
|
|
1024
|
+
var jsonc = defineConfig([
|
|
1033
1025
|
{
|
|
1034
1026
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1035
1027
|
plugins: {
|
|
@@ -1071,8 +1063,7 @@ var jsonc = defineFlatConfig13([
|
|
|
1071
1063
|
]);
|
|
1072
1064
|
|
|
1073
1065
|
// src/configs/markdown.ts
|
|
1074
|
-
|
|
1075
|
-
var markdown = defineFlatConfig14([
|
|
1066
|
+
var markdown = defineConfig([
|
|
1076
1067
|
...default7.configs.recommended,
|
|
1077
1068
|
{
|
|
1078
1069
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
@@ -1102,7 +1093,6 @@ var markdown = defineFlatConfig14([
|
|
|
1102
1093
|
// src/configs/vue.ts
|
|
1103
1094
|
import process from "node:process";
|
|
1104
1095
|
import { getPackageInfoSync } from "local-pkg";
|
|
1105
|
-
import { defineFlatConfig as defineFlatConfig15 } from "eslint-define-config";
|
|
1106
1096
|
function getVueVersion() {
|
|
1107
1097
|
const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
|
|
1108
1098
|
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
@@ -1123,7 +1113,7 @@ var vue3Rules = {
|
|
|
1123
1113
|
...default3.configs["vue3-strongly-recommended"].rules,
|
|
1124
1114
|
...default3.configs["vue3-recommended"].rules
|
|
1125
1115
|
};
|
|
1126
|
-
var vue =
|
|
1116
|
+
var vue = defineConfig([
|
|
1127
1117
|
...tseslint.config({
|
|
1128
1118
|
files: [GLOB_VUE],
|
|
1129
1119
|
extends: typescriptCore
|
|
@@ -1384,9 +1374,10 @@ function ntnyq(config = [], {
|
|
|
1384
1374
|
vue: enableVue = hasVue,
|
|
1385
1375
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
1386
1376
|
prettier: enablePrettier = true,
|
|
1387
|
-
markdown: enableMarkdown = true
|
|
1377
|
+
markdown: enableMarkdown = true,
|
|
1378
|
+
command: enableCommand = true
|
|
1388
1379
|
} = {}) {
|
|
1389
|
-
const configs =
|
|
1380
|
+
const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
|
|
1390
1381
|
if (enableVue) {
|
|
1391
1382
|
configs.push(...vue);
|
|
1392
1383
|
}
|
|
@@ -1399,6 +1390,9 @@ function ntnyq(config = [], {
|
|
|
1399
1390
|
if (enableMarkdown) {
|
|
1400
1391
|
configs.push(...markdown);
|
|
1401
1392
|
}
|
|
1393
|
+
if (enableCommand) {
|
|
1394
|
+
configs.push(...command);
|
|
1395
|
+
}
|
|
1402
1396
|
if (Object.keys(config).length > 0) {
|
|
1403
1397
|
configs.push(...Array.isArray(config) ? config : [config]);
|
|
1404
1398
|
}
|
|
@@ -1427,7 +1421,9 @@ export {
|
|
|
1427
1421
|
GLOB_TSX,
|
|
1428
1422
|
GLOB_VUE,
|
|
1429
1423
|
GLOB_YAML,
|
|
1424
|
+
command,
|
|
1430
1425
|
comments,
|
|
1426
|
+
defineConfig,
|
|
1431
1427
|
getVueVersion,
|
|
1432
1428
|
hasTypeScript,
|
|
1433
1429
|
hasUnoCSS,
|
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.4.0",
|
|
5
5
|
"packageManager": "pnpm@9.4.0",
|
|
6
6
|
"description": "ESLint flat config of ntnyq",
|
|
7
7
|
"keywords": [
|
|
@@ -52,13 +52,14 @@
|
|
|
52
52
|
"eslint": "^9.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@eslint/js": "^9.
|
|
55
|
+
"@eslint/js": "^9.6.0",
|
|
56
|
+
"@types/eslint": "^8.56.10",
|
|
56
57
|
"@unocss/eslint-plugin": "^0.61.0",
|
|
57
58
|
"eslint-config-prettier": "^9.1.0",
|
|
58
|
-
"eslint-
|
|
59
|
+
"eslint-plugin-command": "^0.2.3",
|
|
59
60
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
60
|
-
"eslint-plugin-import-x": "^0.5.
|
|
61
|
-
"eslint-plugin-jsdoc": "^48.
|
|
61
|
+
"eslint-plugin-import-x": "^0.5.2",
|
|
62
|
+
"eslint-plugin-jsdoc": "^48.5.0",
|
|
62
63
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
63
64
|
"eslint-plugin-markdown": "^5.0.0",
|
|
64
65
|
"eslint-plugin-n": "^17.9.0",
|
|
@@ -71,13 +72,13 @@
|
|
|
71
72
|
"jsonc-eslint-parser": "^2.4.0",
|
|
72
73
|
"local-pkg": "^0.5.0",
|
|
73
74
|
"prettier": "^3.3.2",
|
|
74
|
-
"typescript-eslint": "^8.0.0-alpha.
|
|
75
|
+
"typescript-eslint": "^8.0.0-alpha.34",
|
|
75
76
|
"vue-eslint-parser": "^9.4.3",
|
|
76
77
|
"yaml-eslint-parser": "^1.2.3"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
79
80
|
"@ntnyq/prettier-config": "^1.21.2",
|
|
80
|
-
"@types/node": "^20.14.
|
|
81
|
+
"@types/node": "^20.14.9",
|
|
81
82
|
"bumpp": "^9.4.1",
|
|
82
83
|
"eslint": "^9.5.0",
|
|
83
84
|
"husky": "^9.0.11",
|