@ntnyq/eslint-config 3.2.1 → 3.3.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 +22 -16
- package/dist/index.cjs +462 -132
- package/dist/index.d.cts +969 -387
- package/dist/index.d.ts +969 -387
- package/dist/index.js +466 -151
- package/package.json +26 -18
package/dist/index.cjs
CHANGED
|
@@ -30,12 +30,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
DEFAULT_PRETTIER_OPTIONS: () => DEFAULT_PRETTIER_OPTIONS,
|
|
33
34
|
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
35
|
GLOB_ASTRO: () => GLOB_ASTRO,
|
|
35
36
|
GLOB_CSS: () => GLOB_CSS,
|
|
36
37
|
GLOB_DIST: () => GLOB_DIST,
|
|
37
38
|
GLOB_DTS: () => GLOB_DTS,
|
|
38
39
|
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
40
|
+
GLOB_GITHUB_ACTION: () => GLOB_GITHUB_ACTION,
|
|
39
41
|
GLOB_HTML: () => GLOB_HTML,
|
|
40
42
|
GLOB_JS: () => GLOB_JS,
|
|
41
43
|
GLOB_JSON: () => GLOB_JSON,
|
|
@@ -48,6 +50,7 @@ __export(src_exports, {
|
|
|
48
50
|
GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
|
|
49
51
|
GLOB_MARKDOWN_NESTED: () => GLOB_MARKDOWN_NESTED,
|
|
50
52
|
GLOB_NODE_MODULES: () => GLOB_NODE_MODULES,
|
|
53
|
+
GLOB_POSTCSS: () => GLOB_POSTCSS,
|
|
51
54
|
GLOB_SCSS: () => GLOB_SCSS,
|
|
52
55
|
GLOB_SRC: () => GLOB_SRC,
|
|
53
56
|
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
@@ -62,8 +65,11 @@ __export(src_exports, {
|
|
|
62
65
|
antfu: () => antfu,
|
|
63
66
|
command: () => command,
|
|
64
67
|
comments: () => comments,
|
|
68
|
+
createTypeScriptConfig: () => import_typescript_eslint.config,
|
|
65
69
|
defineESLintConfig: () => defineESLintConfig,
|
|
70
|
+
format: () => format,
|
|
66
71
|
getOverrides: () => getOverrides,
|
|
72
|
+
githubAction: () => githubAction,
|
|
67
73
|
gitignore: () => gitignore,
|
|
68
74
|
hasTypeScript: () => hasTypeScript,
|
|
69
75
|
hasUnoCSS: () => hasUnoCSS,
|
|
@@ -78,15 +84,21 @@ __export(src_exports, {
|
|
|
78
84
|
jsx: () => jsx,
|
|
79
85
|
loadPlugin: () => loadPlugin,
|
|
80
86
|
markdown: () => markdown,
|
|
87
|
+
mergePrettierOptions: () => mergePrettierOptions,
|
|
88
|
+
mergeProcessors: () => import_eslint_merge_processors.mergeProcessors,
|
|
81
89
|
node: () => node,
|
|
82
90
|
ntnyq: () => ntnyq,
|
|
83
91
|
parserJsonc: () => parserJsonc,
|
|
92
|
+
parserPlain: () => parserPlain,
|
|
84
93
|
parserToml: () => parserToml,
|
|
94
|
+
parserTypeScript: () => parserTypeScript,
|
|
85
95
|
parserVue: () => parserVue,
|
|
86
96
|
parserYaml: () => parserYaml,
|
|
87
97
|
perfectionist: () => perfectionist,
|
|
88
98
|
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
89
99
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
100
|
+
pluginFormat: () => import_eslint_plugin_format.default,
|
|
101
|
+
pluginGitHubAction: () => import_eslint_plugin_github_action.default,
|
|
90
102
|
pluginImport: () => import_eslint_plugin_import_x.default,
|
|
91
103
|
pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
|
|
92
104
|
pluginJsonc: () => import_eslint_plugin_jsonc.default,
|
|
@@ -97,6 +109,7 @@ __export(src_exports, {
|
|
|
97
109
|
pluginPrettier: () => import_eslint_plugin_prettier.default,
|
|
98
110
|
pluginRegexp: () => pluginRegexp,
|
|
99
111
|
pluginToml: () => import_eslint_plugin_toml.default,
|
|
112
|
+
pluginTypeScript: () => import_typescript_eslint3.plugin,
|
|
100
113
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
101
114
|
pluginUnoCSS: () => import_eslint_plugin.default,
|
|
102
115
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
@@ -104,6 +117,8 @@ __export(src_exports, {
|
|
|
104
117
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
105
118
|
pluginYaml: () => import_eslint_plugin_yml.default,
|
|
106
119
|
prettier: () => prettier,
|
|
120
|
+
processorPassThrough: () => import_eslint_merge_processors2.processorPassThrough,
|
|
121
|
+
processorVueBlocks: () => import_eslint_processor_vue_blocks.default,
|
|
107
122
|
regexp: () => regexp,
|
|
108
123
|
resolveSubOptions: () => resolveSubOptions,
|
|
109
124
|
sort: () => sort,
|
|
@@ -111,8 +126,8 @@ __export(src_exports, {
|
|
|
111
126
|
test: () => test,
|
|
112
127
|
toArray: () => toArray,
|
|
113
128
|
toml: () => toml,
|
|
114
|
-
tseslint: () => import_typescript_eslint.default,
|
|
115
129
|
typescript: () => typescript,
|
|
130
|
+
typescriptConfigs: () => import_typescript_eslint4.configs,
|
|
116
131
|
typescriptCore: () => typescriptCore,
|
|
117
132
|
unicorn: () => unicorn,
|
|
118
133
|
unocss: () => unocss,
|
|
@@ -126,6 +141,71 @@ module.exports = __toCommonJS(src_exports);
|
|
|
126
141
|
// src/core.ts
|
|
127
142
|
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
128
143
|
|
|
144
|
+
// src/configs/vue.ts
|
|
145
|
+
var import_eslint_merge_processors3 = require("eslint-merge-processors");
|
|
146
|
+
|
|
147
|
+
// src/eslint/utils.ts
|
|
148
|
+
var import_typescript_eslint = require("typescript-eslint");
|
|
149
|
+
|
|
150
|
+
// src/eslint/parsers.ts
|
|
151
|
+
var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
|
|
152
|
+
var parserVue = __toESM(require("vue-eslint-parser"), 1);
|
|
153
|
+
var parserToml = __toESM(require("toml-eslint-parser"), 1);
|
|
154
|
+
var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
|
|
155
|
+
var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
|
|
156
|
+
var parserTypeScript = import_typescript_eslint2.default.parser;
|
|
157
|
+
var parserPlain = {
|
|
158
|
+
meta: {
|
|
159
|
+
name: "plain-eslint-parser"
|
|
160
|
+
},
|
|
161
|
+
parseForESLint: (code) => ({
|
|
162
|
+
ast: {
|
|
163
|
+
body: [],
|
|
164
|
+
comments: [],
|
|
165
|
+
loc: { start: 0, end: code.length },
|
|
166
|
+
range: [0, code.length],
|
|
167
|
+
tokens: [],
|
|
168
|
+
type: "Program"
|
|
169
|
+
},
|
|
170
|
+
scopeManager: null,
|
|
171
|
+
services: { isPlain: true },
|
|
172
|
+
visitorKeys: {
|
|
173
|
+
Program: []
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// src/eslint/plugins.ts
|
|
179
|
+
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
180
|
+
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
181
|
+
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
182
|
+
var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
183
|
+
var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
|
|
184
|
+
var import_eslint_plugin_ntnyq = __toESM(require("eslint-plugin-ntnyq"), 1);
|
|
185
|
+
var import_markdown = __toESM(require("@eslint/markdown"), 1);
|
|
186
|
+
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
187
|
+
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
188
|
+
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
189
|
+
var import_typescript_eslint3 = require("typescript-eslint");
|
|
190
|
+
var import_eslint_plugin_format = __toESM(require("eslint-plugin-format"), 1);
|
|
191
|
+
var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
|
|
192
|
+
var import_eslint_plugin2 = __toESM(require("@vitest/eslint-plugin"), 1);
|
|
193
|
+
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
194
|
+
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
195
|
+
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
196
|
+
var import_eslint_plugin_github_action = __toESM(require("eslint-plugin-github-action"), 1);
|
|
197
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
198
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
199
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
200
|
+
|
|
201
|
+
// src/eslint/configs.ts
|
|
202
|
+
var import_typescript_eslint4 = require("typescript-eslint");
|
|
203
|
+
|
|
204
|
+
// src/eslint/processors.ts
|
|
205
|
+
var import_eslint_merge_processors = require("eslint-merge-processors");
|
|
206
|
+
var import_eslint_merge_processors2 = require("eslint-merge-processors");
|
|
207
|
+
var import_eslint_processor_vue_blocks = __toESM(require("eslint-processor-vue-blocks"), 1);
|
|
208
|
+
|
|
129
209
|
// src/globs.ts
|
|
130
210
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
131
211
|
var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
@@ -144,6 +224,7 @@ var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
|
144
224
|
var GLOB_CSS = "**/*.css";
|
|
145
225
|
var GLOB_LESS = "**/*.less";
|
|
146
226
|
var GLOB_SCSS = "**/*.scss";
|
|
227
|
+
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
147
228
|
var GLOB_JSON = "**/*.json";
|
|
148
229
|
var GLOB_JSON5 = "**/*.json5";
|
|
149
230
|
var GLOB_JSONC = "**/*.jsonc";
|
|
@@ -167,6 +248,7 @@ var GLOB_ALL_SRC = [
|
|
|
167
248
|
GLOB_HTML,
|
|
168
249
|
GLOB_MARKDOWN
|
|
169
250
|
];
|
|
251
|
+
var GLOB_GITHUB_ACTION = "**/.github/workflows/*.y?(a)ml";
|
|
170
252
|
var GLOB_NODE_MODULES = "**/node_modules/**";
|
|
171
253
|
var GLOB_DIST = "**/dist/**";
|
|
172
254
|
var GLOB_LOCKFILE = [
|
|
@@ -221,41 +303,16 @@ var GLOB_EXCLUDE = [
|
|
|
221
303
|
"**/.yarnrc"
|
|
222
304
|
];
|
|
223
305
|
|
|
224
|
-
// src/plugins.ts
|
|
225
|
-
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
226
|
-
var parserVue = __toESM(require("vue-eslint-parser"), 1);
|
|
227
|
-
var parserToml = __toESM(require("toml-eslint-parser"), 1);
|
|
228
|
-
var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
|
|
229
|
-
var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
|
|
230
|
-
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
231
|
-
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
232
|
-
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
233
|
-
var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
234
|
-
var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
|
|
235
|
-
var import_eslint_plugin_ntnyq = __toESM(require("eslint-plugin-ntnyq"), 1);
|
|
236
|
-
var import_markdown = __toESM(require("@eslint/markdown"), 1);
|
|
237
|
-
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
238
|
-
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
239
|
-
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
240
|
-
var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
|
|
241
|
-
var import_eslint_plugin2 = __toESM(require("@vitest/eslint-plugin"), 1);
|
|
242
|
-
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
243
|
-
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
244
|
-
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
245
|
-
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
246
|
-
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
247
|
-
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
248
|
-
|
|
249
306
|
// src/configs/typescript.ts
|
|
250
307
|
var import_node_process = __toESM(require("process"), 1);
|
|
251
308
|
var typescriptCore = (options = {}) => {
|
|
252
309
|
const isTypeAware = !!options.tsconfigPath;
|
|
253
|
-
const
|
|
310
|
+
const configs2 = (0, import_typescript_eslint.config)({
|
|
254
311
|
name: "ntnyq/ts/core",
|
|
255
|
-
extends: [...
|
|
312
|
+
extends: [...import_typescript_eslint4.configs.recommended],
|
|
256
313
|
files: [GLOB_TS, GLOB_TSX],
|
|
257
314
|
languageOptions: {
|
|
258
|
-
parser:
|
|
315
|
+
parser: parserTypeScript,
|
|
259
316
|
parserOptions: {
|
|
260
317
|
sourceType: "module",
|
|
261
318
|
...isTypeAware ? {
|
|
@@ -349,7 +406,7 @@ var typescriptCore = (options = {}) => {
|
|
|
349
406
|
...options.overrides
|
|
350
407
|
}
|
|
351
408
|
});
|
|
352
|
-
return
|
|
409
|
+
return configs2;
|
|
353
410
|
};
|
|
354
411
|
var typescript = (options = {}) => [
|
|
355
412
|
...typescriptCore(options),
|
|
@@ -443,29 +500,76 @@ var extensionRules = {
|
|
|
443
500
|
]
|
|
444
501
|
};
|
|
445
502
|
var unCategorizedRules = {
|
|
503
|
+
"vue/no-v-text": "error",
|
|
446
504
|
"vue/no-useless-v-bind": "error",
|
|
447
505
|
"vue/valid-define-options": "error",
|
|
448
506
|
"vue/prefer-define-options": "error",
|
|
507
|
+
"vue/prefer-use-template-ref": "error",
|
|
449
508
|
"vue/no-irregular-whitespace": "error",
|
|
450
509
|
"vue/no-use-v-else-with-v-for": "error",
|
|
451
510
|
"vue/no-deprecated-delete-set": "error",
|
|
511
|
+
"vue/no-empty-component-block": "error",
|
|
452
512
|
"vue/require-typed-object-prop": "error",
|
|
453
513
|
"vue/no-unused-emit-declarations": "error",
|
|
454
514
|
"vue/padding-line-between-blocks": "error",
|
|
455
|
-
"vue/no-
|
|
515
|
+
"vue/no-multiple-objects-in-class": "error",
|
|
456
516
|
"vue/prefer-separate-static-class": "error",
|
|
517
|
+
"vue/no-ref-object-reactivity-loss": "error",
|
|
518
|
+
"vue/no-duplicate-attr-inheritance": "error",
|
|
519
|
+
"vue/prefer-prop-type-boolean-first": "error",
|
|
520
|
+
"vue/html-comment-indent": ["error", 2],
|
|
457
521
|
"vue/next-tick-style": ["error", "promise"],
|
|
522
|
+
"vue/v-for-delimiter-style": ["error", "in"],
|
|
458
523
|
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
459
524
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
525
|
+
"vue/define-props-declaration": ["error", "type-based"],
|
|
460
526
|
"vue/define-emits-declaration": ["error", "type-literal"],
|
|
461
527
|
"vue/prefer-true-attribute-shorthand": ["error", "always"],
|
|
462
528
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
529
|
+
"vue/component-api-style": ["error", ["script-setup", "composition"]],
|
|
530
|
+
"vue/html-button-has-type": [
|
|
531
|
+
"error",
|
|
532
|
+
{
|
|
533
|
+
button: true,
|
|
534
|
+
submit: true,
|
|
535
|
+
reset: true
|
|
536
|
+
}
|
|
537
|
+
],
|
|
463
538
|
"vue/block-order": [
|
|
464
539
|
"error",
|
|
465
540
|
{
|
|
466
541
|
order: ["script", "template", "style"]
|
|
467
542
|
}
|
|
468
543
|
],
|
|
544
|
+
"vue/enforce-style-attribute": [
|
|
545
|
+
"error",
|
|
546
|
+
{
|
|
547
|
+
allow: ["scoped", "plain"]
|
|
548
|
+
}
|
|
549
|
+
],
|
|
550
|
+
"vue/block-tag-newline": [
|
|
551
|
+
"error",
|
|
552
|
+
{
|
|
553
|
+
singleline: "always",
|
|
554
|
+
multiline: "always"
|
|
555
|
+
}
|
|
556
|
+
],
|
|
557
|
+
"vue/no-required-prop-with-default": [
|
|
558
|
+
"error",
|
|
559
|
+
{
|
|
560
|
+
autofix: true
|
|
561
|
+
}
|
|
562
|
+
],
|
|
563
|
+
"vue/html-comment-content-newline": [
|
|
564
|
+
"error",
|
|
565
|
+
{
|
|
566
|
+
singleline: "ignore",
|
|
567
|
+
multiline: "always"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
exceptions: ["*"]
|
|
571
|
+
}
|
|
572
|
+
],
|
|
469
573
|
"vue/no-static-inline-styles": [
|
|
470
574
|
"error",
|
|
471
575
|
{
|
|
@@ -500,35 +604,61 @@ var unCategorizedRules = {
|
|
|
500
604
|
{
|
|
501
605
|
exceptions: ["-"]
|
|
502
606
|
}
|
|
607
|
+
],
|
|
608
|
+
"vue/require-macro-variable-name": [
|
|
609
|
+
"error",
|
|
610
|
+
{
|
|
611
|
+
defineProps: "props",
|
|
612
|
+
defineEmits: "emits",
|
|
613
|
+
defineSlots: "slots",
|
|
614
|
+
useSlots: "slots",
|
|
615
|
+
useAttrs: "attrs"
|
|
616
|
+
}
|
|
503
617
|
]
|
|
504
618
|
};
|
|
505
619
|
var vue = (options = {}) => {
|
|
506
620
|
const isVue3 = options.vueVersion !== 2;
|
|
621
|
+
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
507
622
|
return [
|
|
508
|
-
...import_typescript_eslint.
|
|
623
|
+
...(0, import_typescript_eslint.config)({
|
|
509
624
|
name: "ntnyq/vue/ts",
|
|
510
625
|
files: [GLOB_VUE],
|
|
511
626
|
extends: typescriptCore()
|
|
512
627
|
}),
|
|
513
628
|
{
|
|
514
|
-
name: "ntnyq/vue/
|
|
515
|
-
files: [GLOB_VUE],
|
|
629
|
+
name: "ntnyq/vue/setup",
|
|
516
630
|
plugins: {
|
|
517
631
|
vue: import_eslint_plugin_vue.default,
|
|
518
|
-
"@typescript-eslint":
|
|
632
|
+
"@typescript-eslint": import_typescript_eslint3.plugin
|
|
519
633
|
},
|
|
520
634
|
languageOptions: {
|
|
521
|
-
parser: parserVue,
|
|
522
635
|
parserOptions: {
|
|
523
|
-
parser: "@typescript-eslint/parser",
|
|
524
636
|
sourceType: "module",
|
|
637
|
+
ecmaVersion: "latest",
|
|
525
638
|
extraFileExtensions: [".vue"],
|
|
639
|
+
parser: "@typescript-eslint/parser",
|
|
526
640
|
ecmaFeatures: {
|
|
527
641
|
jsx: true
|
|
528
642
|
}
|
|
529
643
|
}
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: "ntnyq/vue/rules",
|
|
648
|
+
files: [GLOB_VUE],
|
|
649
|
+
languageOptions: {
|
|
650
|
+
parser: parserVue
|
|
530
651
|
},
|
|
531
|
-
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
652
|
+
processor: sfcBlocks === false ? import_eslint_plugin_vue.default.processors[".vue"] : (0, import_eslint_merge_processors3.mergeProcessors)([
|
|
653
|
+
import_eslint_plugin_vue.default.processors[".vue"],
|
|
654
|
+
(0, import_eslint_processor_vue_blocks.default)({
|
|
655
|
+
...sfcBlocks,
|
|
656
|
+
blocks: {
|
|
657
|
+
styles: true,
|
|
658
|
+
...sfcBlocks.blocks
|
|
659
|
+
}
|
|
660
|
+
})
|
|
661
|
+
]),
|
|
532
662
|
rules: {
|
|
533
663
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
534
664
|
"vue/html-self-closing": [
|
|
@@ -543,13 +673,6 @@ var vue = (options = {}) => {
|
|
|
543
673
|
math: "always"
|
|
544
674
|
}
|
|
545
675
|
],
|
|
546
|
-
"vue/block-tag-newline": [
|
|
547
|
-
"error",
|
|
548
|
-
{
|
|
549
|
-
singleline: "always",
|
|
550
|
-
multiline: "always"
|
|
551
|
-
}
|
|
552
|
-
],
|
|
553
676
|
"vue/this-in-template": ["error", "never"],
|
|
554
677
|
"vue/prop-name-casing": ["error", "camelCase"],
|
|
555
678
|
"vue/attributes-order": [
|
|
@@ -692,9 +815,9 @@ var node = (options = {}) => [
|
|
|
692
815
|
|
|
693
816
|
// src/configs/sort.ts
|
|
694
817
|
var sort = (options = {}) => {
|
|
695
|
-
const
|
|
818
|
+
const configs2 = [];
|
|
696
819
|
if (options.tsconfig ?? true) {
|
|
697
|
-
|
|
820
|
+
configs2.push({
|
|
698
821
|
name: "ntnyq/sort/tsconfig",
|
|
699
822
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
700
823
|
rules: {
|
|
@@ -810,7 +933,7 @@ var sort = (options = {}) => {
|
|
|
810
933
|
});
|
|
811
934
|
}
|
|
812
935
|
if (options.packageJson ?? true) {
|
|
813
|
-
|
|
936
|
+
configs2.push({
|
|
814
937
|
name: "ntnyq/sort/package-json",
|
|
815
938
|
files: ["**/package.json"],
|
|
816
939
|
rules: {
|
|
@@ -942,7 +1065,7 @@ var sort = (options = {}) => {
|
|
|
942
1065
|
});
|
|
943
1066
|
}
|
|
944
1067
|
if (options.i18nLocale ?? true) {
|
|
945
|
-
|
|
1068
|
+
configs2.push(
|
|
946
1069
|
{
|
|
947
1070
|
name: "ntnyq/sort/i18n-locale/json",
|
|
948
1071
|
files: ["**/{locales,i18n}/*.json"],
|
|
@@ -972,7 +1095,7 @@ var sort = (options = {}) => {
|
|
|
972
1095
|
);
|
|
973
1096
|
}
|
|
974
1097
|
if (options.pnpmWorkspace ?? true) {
|
|
975
|
-
|
|
1098
|
+
configs2.push({
|
|
976
1099
|
name: "ntnyq/sort/pnpm-workspace",
|
|
977
1100
|
files: ["**/pnpm-workspace.yaml"],
|
|
978
1101
|
rules: {
|
|
@@ -986,7 +1109,7 @@ var sort = (options = {}) => {
|
|
|
986
1109
|
}
|
|
987
1110
|
});
|
|
988
1111
|
}
|
|
989
|
-
return
|
|
1112
|
+
return configs2;
|
|
990
1113
|
};
|
|
991
1114
|
|
|
992
1115
|
// src/configs/toml.ts
|
|
@@ -1065,7 +1188,9 @@ var antfu = (options = {}) => [
|
|
|
1065
1188
|
// required `object-curly-newline` to be disabled
|
|
1066
1189
|
// 'antfu/consistent-list-newline': 'error',
|
|
1067
1190
|
"antfu/import-dedupe": "error",
|
|
1068
|
-
"antfu/
|
|
1191
|
+
"antfu/no-import-dist": "error",
|
|
1192
|
+
"antfu/indent-unindent": "error",
|
|
1193
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
1069
1194
|
// Overrides rules
|
|
1070
1195
|
...options.overrides
|
|
1071
1196
|
}
|
|
@@ -1165,9 +1290,9 @@ var ntnyq = (options = {}) => [
|
|
|
1165
1290
|
|
|
1166
1291
|
// src/configs/regexp.ts
|
|
1167
1292
|
var regexp = (options = {}) => {
|
|
1168
|
-
const
|
|
1293
|
+
const config2 = pluginRegexp.configs["flat/recommended"];
|
|
1169
1294
|
const rules = {
|
|
1170
|
-
...
|
|
1295
|
+
...config2.rules
|
|
1171
1296
|
};
|
|
1172
1297
|
if (options.level === "warn") {
|
|
1173
1298
|
for (const key in rules) {
|
|
@@ -1178,7 +1303,7 @@ var regexp = (options = {}) => {
|
|
|
1178
1303
|
}
|
|
1179
1304
|
return [
|
|
1180
1305
|
{
|
|
1181
|
-
...
|
|
1306
|
+
...config2,
|
|
1182
1307
|
name: "ntnyq/regexp",
|
|
1183
1308
|
rules: {
|
|
1184
1309
|
...rules,
|
|
@@ -1206,6 +1331,202 @@ var unocss = (options = {}) => [
|
|
|
1206
1331
|
}
|
|
1207
1332
|
];
|
|
1208
1333
|
|
|
1334
|
+
// src/constants.ts
|
|
1335
|
+
var DEFAULT_PRETTIER_OPTIONS = {
|
|
1336
|
+
// Maximum line length
|
|
1337
|
+
printWidth: 100,
|
|
1338
|
+
// Specify the number of spaces per indentation-level
|
|
1339
|
+
tabWidth: 2,
|
|
1340
|
+
// Indent lines with tabs instead of spaces
|
|
1341
|
+
useTabs: false,
|
|
1342
|
+
// Use semicolons or not
|
|
1343
|
+
semi: false,
|
|
1344
|
+
// Use single quotes instead of double quotes
|
|
1345
|
+
singleQuote: true,
|
|
1346
|
+
// Change when properties in objects are quoted
|
|
1347
|
+
quoteProps: "as-needed",
|
|
1348
|
+
// Use single quotes instead of double quotes in JSX
|
|
1349
|
+
jsxSingleQuote: true,
|
|
1350
|
+
// Print trailing commas wherever possible when multi-line
|
|
1351
|
+
trailingComma: "all",
|
|
1352
|
+
// Print spaces between brackets in object literals.
|
|
1353
|
+
bracketSpacing: true,
|
|
1354
|
+
// Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
|
|
1355
|
+
bracketSameLine: false,
|
|
1356
|
+
// Include parentheses around a sole arrow function parameter
|
|
1357
|
+
arrowParens: "avoid",
|
|
1358
|
+
// Format only a segment of a file.
|
|
1359
|
+
rangeStart: 0,
|
|
1360
|
+
rangeEnd: Number.POSITIVE_INFINITY,
|
|
1361
|
+
// Specify which parser to use.
|
|
1362
|
+
// parser: undefined,
|
|
1363
|
+
// Specify the file name to use to infer which parser to use.
|
|
1364
|
+
// filepath: undefined,
|
|
1365
|
+
// Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
|
|
1366
|
+
requirePragma: false,
|
|
1367
|
+
// Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
|
|
1368
|
+
insertPragma: false,
|
|
1369
|
+
// By default, Prettier will wrap markdown text as-is since some services use a line-break-sensitive renderer, e.g. GitHub comment and Bitbucket.
|
|
1370
|
+
proseWrap: "preserve",
|
|
1371
|
+
// Specify the global whitespace sensitivity for HTML files
|
|
1372
|
+
htmlWhitespaceSensitivity: "css",
|
|
1373
|
+
// Whether or not to indent the code inside <script> and <style> tags in Vue files
|
|
1374
|
+
vueIndentScriptAndStyle: false,
|
|
1375
|
+
// End of line
|
|
1376
|
+
endOfLine: "lf",
|
|
1377
|
+
// Control whether Prettier formats quoted code embedded in the file
|
|
1378
|
+
embeddedLanguageFormatting: "auto",
|
|
1379
|
+
// Enforce single attribute per line in HTML, Vue and JSX
|
|
1380
|
+
singleAttributePerLine: true
|
|
1381
|
+
};
|
|
1382
|
+
|
|
1383
|
+
// src/utils/env.ts
|
|
1384
|
+
var import_node_path = require("path");
|
|
1385
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
1386
|
+
var import_local_pkg = require("local-pkg");
|
|
1387
|
+
var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
|
|
1388
|
+
var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
|
|
1389
|
+
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") || (0, import_local_pkg.isPackageExists)("vue", {
|
|
1390
|
+
paths: [(0, import_node_path.resolve)(import_node_process2.default.cwd(), "playground")]
|
|
1391
|
+
});
|
|
1392
|
+
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");
|
|
1393
|
+
|
|
1394
|
+
// src/utils/toArray.ts
|
|
1395
|
+
function toArray(val) {
|
|
1396
|
+
val = val ?? [];
|
|
1397
|
+
return Array.isArray(val) ? val : [val];
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
// src/utils/interopDefault.ts
|
|
1401
|
+
async function interopDefault(mod) {
|
|
1402
|
+
const resolved = await mod;
|
|
1403
|
+
return resolved.default || resolved;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
// src/utils/loadPlugin.ts
|
|
1407
|
+
async function loadPlugin(name) {
|
|
1408
|
+
const mod = await import(name).catch((err) => {
|
|
1409
|
+
console.error(err);
|
|
1410
|
+
throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
|
|
1411
|
+
});
|
|
1412
|
+
return interopDefault(mod);
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
// src/utils/resolveSubOptions.ts
|
|
1416
|
+
function resolveSubOptions(options, key) {
|
|
1417
|
+
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
// src/utils/getOverrides.ts
|
|
1421
|
+
function getOverrides(options, key) {
|
|
1422
|
+
const sub = resolveSubOptions(options, key);
|
|
1423
|
+
return "overrides" in sub && sub.overrides ? sub.overrides : {};
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
// src/utils/mergePrettierOptions.ts
|
|
1427
|
+
function mergePrettierOptions(options = {}, overrides = {}) {
|
|
1428
|
+
const result = {
|
|
1429
|
+
...options,
|
|
1430
|
+
...overrides,
|
|
1431
|
+
plugins: [
|
|
1432
|
+
// built-in plugins
|
|
1433
|
+
...options.plugins || [],
|
|
1434
|
+
// custom plugins
|
|
1435
|
+
...overrides.plugins || []
|
|
1436
|
+
]
|
|
1437
|
+
};
|
|
1438
|
+
return result;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
// src/configs/format.ts
|
|
1442
|
+
var format = (options = {}) => {
|
|
1443
|
+
const {
|
|
1444
|
+
css: enableCSS = true,
|
|
1445
|
+
html: enableHTML = true,
|
|
1446
|
+
// user custom options
|
|
1447
|
+
prettierOptions = {}
|
|
1448
|
+
} = options;
|
|
1449
|
+
const sharedPrettierOptions = {
|
|
1450
|
+
...DEFAULT_PRETTIER_OPTIONS,
|
|
1451
|
+
...prettierOptions
|
|
1452
|
+
};
|
|
1453
|
+
const configs2 = [
|
|
1454
|
+
{
|
|
1455
|
+
name: "ntnyq/format/setup",
|
|
1456
|
+
plugins: {
|
|
1457
|
+
format: import_eslint_plugin_format.default
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
];
|
|
1461
|
+
if (enableCSS) {
|
|
1462
|
+
configs2.push(
|
|
1463
|
+
{
|
|
1464
|
+
name: "ntnyq/format/css",
|
|
1465
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
1466
|
+
languageOptions: {
|
|
1467
|
+
parser: parserPlain
|
|
1468
|
+
},
|
|
1469
|
+
rules: {
|
|
1470
|
+
"format/prettier": [
|
|
1471
|
+
"error",
|
|
1472
|
+
mergePrettierOptions(sharedPrettierOptions, {
|
|
1473
|
+
parser: "css"
|
|
1474
|
+
})
|
|
1475
|
+
]
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
name: "ntnyq/format/scss",
|
|
1480
|
+
files: [GLOB_SCSS],
|
|
1481
|
+
languageOptions: {
|
|
1482
|
+
parser: parserPlain
|
|
1483
|
+
},
|
|
1484
|
+
rules: {
|
|
1485
|
+
"format/prettier": [
|
|
1486
|
+
"error",
|
|
1487
|
+
mergePrettierOptions(sharedPrettierOptions, {
|
|
1488
|
+
parser: "scss"
|
|
1489
|
+
})
|
|
1490
|
+
]
|
|
1491
|
+
}
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
name: "ntnyq/format/less",
|
|
1495
|
+
files: [GLOB_LESS],
|
|
1496
|
+
languageOptions: {
|
|
1497
|
+
parser: parserPlain
|
|
1498
|
+
},
|
|
1499
|
+
rules: {
|
|
1500
|
+
"format/prettier": [
|
|
1501
|
+
"error",
|
|
1502
|
+
mergePrettierOptions(sharedPrettierOptions, {
|
|
1503
|
+
parser: "less"
|
|
1504
|
+
})
|
|
1505
|
+
]
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1510
|
+
if (enableHTML) {
|
|
1511
|
+
configs2.push({
|
|
1512
|
+
name: "ntnyq/format/html",
|
|
1513
|
+
files: [GLOB_HTML],
|
|
1514
|
+
languageOptions: {
|
|
1515
|
+
parser: parserPlain
|
|
1516
|
+
},
|
|
1517
|
+
rules: {
|
|
1518
|
+
"format/prettier": [
|
|
1519
|
+
"error",
|
|
1520
|
+
mergePrettierOptions(sharedPrettierOptions, {
|
|
1521
|
+
parser: "html"
|
|
1522
|
+
})
|
|
1523
|
+
]
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
return configs2;
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1209
1530
|
// src/configs/command.ts
|
|
1210
1531
|
var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
1211
1532
|
var command = (options = {}) => [
|
|
@@ -1259,6 +1580,16 @@ var imports = (options = {}) => [
|
|
|
1259
1580
|
];
|
|
1260
1581
|
|
|
1261
1582
|
// src/configs/unicorn.ts
|
|
1583
|
+
var disabledRules2 = {
|
|
1584
|
+
"unicorn/better-regex": "off",
|
|
1585
|
+
"unicorn/prefer-top-level-await": "off",
|
|
1586
|
+
"unicorn/explicit-length-check": "off",
|
|
1587
|
+
"unicorn/no-array-callback-reference": "off",
|
|
1588
|
+
/**
|
|
1589
|
+
* @see https://caniuse.com/?search=globalThis
|
|
1590
|
+
*/
|
|
1591
|
+
"unicorn/prefer-global-this": "off"
|
|
1592
|
+
};
|
|
1262
1593
|
var unicorn = (options = {}) => [
|
|
1263
1594
|
{
|
|
1264
1595
|
name: "ntnyq/unicorn",
|
|
@@ -1266,15 +1597,6 @@ var unicorn = (options = {}) => [
|
|
|
1266
1597
|
unicorn: import_eslint_plugin_unicorn.default
|
|
1267
1598
|
},
|
|
1268
1599
|
rules: {
|
|
1269
|
-
// Disabled for now
|
|
1270
|
-
"unicorn/better-regex": "off",
|
|
1271
|
-
"unicorn/prefer-top-level-await": "off",
|
|
1272
|
-
"unicorn/explicit-length-check": "off",
|
|
1273
|
-
"unicorn/no-array-callback-reference": "off",
|
|
1274
|
-
/**
|
|
1275
|
-
* @see https://caniuse.com/?search=globalThis
|
|
1276
|
-
*/
|
|
1277
|
-
"unicorn/prefer-global-this": "off",
|
|
1278
1600
|
"unicorn/error-message": "error",
|
|
1279
1601
|
"unicorn/escape-case": "error",
|
|
1280
1602
|
"unicorn/no-new-buffer": "error",
|
|
@@ -1285,7 +1607,6 @@ var unicorn = (options = {}) => [
|
|
|
1285
1607
|
"unicorn/no-unnecessary-await": "error",
|
|
1286
1608
|
"unicorn/switch-case-braces": ["error", "avoid"],
|
|
1287
1609
|
"unicorn/no-typeof-undefined": "error",
|
|
1288
|
-
"unicorn/prefer-set-size": "error",
|
|
1289
1610
|
"unicorn/prefer-regexp-test": "error",
|
|
1290
1611
|
"unicorn/no-static-only-class": "error",
|
|
1291
1612
|
"unicorn/no-zero-fractions": "error",
|
|
@@ -1305,6 +1626,7 @@ var unicorn = (options = {}) => [
|
|
|
1305
1626
|
"unicorn/prefer-prototype-methods": "error",
|
|
1306
1627
|
"unicorn/prefer-reflect-apply": "error",
|
|
1307
1628
|
"unicorn/prefer-math-min-max": "error",
|
|
1629
|
+
"unicorn/prefer-structured-clone": "error",
|
|
1308
1630
|
"unicorn/consistent-existence-index-check": "error",
|
|
1309
1631
|
"unicorn/catch-error-name": [
|
|
1310
1632
|
"error",
|
|
@@ -1315,6 +1637,7 @@ var unicorn = (options = {}) => [
|
|
|
1315
1637
|
],
|
|
1316
1638
|
"unicorn/prefer-date-now": "error",
|
|
1317
1639
|
// String
|
|
1640
|
+
"unicorn/prefer-code-point": "error",
|
|
1318
1641
|
"unicorn/prefer-string-slice": "error",
|
|
1319
1642
|
"unicorn/prefer-string-trim-start-end": "error",
|
|
1320
1643
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
@@ -1336,6 +1659,11 @@ var unicorn = (options = {}) => [
|
|
|
1336
1659
|
"unicorn/prefer-array-some": "error",
|
|
1337
1660
|
"unicorn/prefer-array-flat-map": "error",
|
|
1338
1661
|
"unicorn/prefer-array-index-of": "error",
|
|
1662
|
+
"unicorn/require-array-join-separator": "error",
|
|
1663
|
+
// Set
|
|
1664
|
+
"unicorn/prefer-set-has": "error",
|
|
1665
|
+
"unicorn/prefer-set-size": "error",
|
|
1666
|
+
...disabledRules2,
|
|
1339
1667
|
// Overrides rules
|
|
1340
1668
|
...options.overrides
|
|
1341
1669
|
}
|
|
@@ -1400,9 +1728,9 @@ var comments = (options = {}) => [
|
|
|
1400
1728
|
var markdown = (options = {}) => {
|
|
1401
1729
|
if (!Array.isArray(import_markdown.default.configs?.processor)) return [];
|
|
1402
1730
|
return [
|
|
1403
|
-
...import_markdown.default.configs.processor.map((
|
|
1404
|
-
...
|
|
1405
|
-
name: `ntnyq/${
|
|
1731
|
+
...import_markdown.default.configs.processor.map((config2) => ({
|
|
1732
|
+
...config2,
|
|
1733
|
+
name: `ntnyq/${config2.name}`
|
|
1406
1734
|
})),
|
|
1407
1735
|
{
|
|
1408
1736
|
name: "ntnyq/markdown/disabled/code-blocks",
|
|
@@ -1752,6 +2080,22 @@ var jsx = () => [
|
|
|
1752
2080
|
}
|
|
1753
2081
|
];
|
|
1754
2082
|
|
|
2083
|
+
// src/configs/githubAction.ts
|
|
2084
|
+
var githubAction = (options = {}) => [
|
|
2085
|
+
{
|
|
2086
|
+
name: "ntnyq/github-action",
|
|
2087
|
+
files: [GLOB_GITHUB_ACTION],
|
|
2088
|
+
plugins: {
|
|
2089
|
+
"github-action": import_eslint_plugin_github_action.default
|
|
2090
|
+
},
|
|
2091
|
+
rules: {
|
|
2092
|
+
"github-action/require-action-name": "error",
|
|
2093
|
+
// Overrides rules
|
|
2094
|
+
...options.overrides
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
];
|
|
2098
|
+
|
|
1755
2099
|
// src/configs/perfectionist.ts
|
|
1756
2100
|
var perfectionist = (options = {}) => [
|
|
1757
2101
|
{
|
|
@@ -1802,7 +2146,7 @@ var perfectionist = (options = {}) => [
|
|
|
1802
2146
|
order: options.imports?.order || "asc",
|
|
1803
2147
|
type: options.imports?.type || "natural",
|
|
1804
2148
|
ignoreCase: true,
|
|
1805
|
-
internalPattern: ["
|
|
2149
|
+
internalPattern: ["^~/.+", "^@/.+", "^#.+"],
|
|
1806
2150
|
newlinesBetween: "ignore"
|
|
1807
2151
|
}
|
|
1808
2152
|
],
|
|
@@ -1867,60 +2211,17 @@ var unusedImports = (options = {}) => [
|
|
|
1867
2211
|
}
|
|
1868
2212
|
];
|
|
1869
2213
|
|
|
1870
|
-
// src/utils/env.ts
|
|
1871
|
-
var import_node_path = require("path");
|
|
1872
|
-
var import_node_process2 = __toESM(require("process"), 1);
|
|
1873
|
-
var import_local_pkg = require("local-pkg");
|
|
1874
|
-
var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
|
|
1875
|
-
var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
|
|
1876
|
-
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") || (0, import_local_pkg.isPackageExists)("vue", {
|
|
1877
|
-
paths: [(0, import_node_path.resolve)(import_node_process2.default.cwd(), "playground")]
|
|
1878
|
-
});
|
|
1879
|
-
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");
|
|
1880
|
-
|
|
1881
|
-
// src/utils/toArray.ts
|
|
1882
|
-
function toArray(val) {
|
|
1883
|
-
val = val ?? [];
|
|
1884
|
-
return Array.isArray(val) ? val : [val];
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
// src/utils/interopDefault.ts
|
|
1888
|
-
async function interopDefault(mod) {
|
|
1889
|
-
const resolved = await mod;
|
|
1890
|
-
return resolved.default || resolved;
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
// src/utils/loadPlugin.ts
|
|
1894
|
-
async function loadPlugin(name) {
|
|
1895
|
-
const mod = await import(name).catch((err) => {
|
|
1896
|
-
console.error(err);
|
|
1897
|
-
throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
|
|
1898
|
-
});
|
|
1899
|
-
return interopDefault(mod);
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
// src/utils/resolveSubOptions.ts
|
|
1903
|
-
function resolveSubOptions(options, key) {
|
|
1904
|
-
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
// src/utils/getOverrides.ts
|
|
1908
|
-
function getOverrides(options, key) {
|
|
1909
|
-
const sub = resolveSubOptions(options, key);
|
|
1910
|
-
return "overrides" in sub && sub.overrides ? sub.overrides : {};
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
2214
|
// src/core.ts
|
|
1914
2215
|
function defineESLintConfig(options = {}, userConfigs = []) {
|
|
1915
|
-
const
|
|
2216
|
+
const configs2 = [];
|
|
1916
2217
|
if (options.gitignore ?? true) {
|
|
1917
|
-
|
|
2218
|
+
configs2.push(
|
|
1918
2219
|
...gitignore({
|
|
1919
2220
|
...resolveSubOptions(options, "gitignore")
|
|
1920
2221
|
})
|
|
1921
2222
|
);
|
|
1922
2223
|
}
|
|
1923
|
-
|
|
2224
|
+
configs2.push(
|
|
1924
2225
|
...ignores(options.ignores),
|
|
1925
2226
|
...jsx(),
|
|
1926
2227
|
...node({
|
|
@@ -1935,7 +2236,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
1935
2236
|
})
|
|
1936
2237
|
);
|
|
1937
2238
|
if (options.perfectionist ?? true) {
|
|
1938
|
-
|
|
2239
|
+
configs2.push(
|
|
1939
2240
|
...perfectionist({
|
|
1940
2241
|
...resolveSubOptions(options, "perfectionist"),
|
|
1941
2242
|
overrides: getOverrides(options, "perfectionist")
|
|
@@ -1943,14 +2244,14 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
1943
2244
|
);
|
|
1944
2245
|
}
|
|
1945
2246
|
if (options.unicorn ?? true) {
|
|
1946
|
-
|
|
2247
|
+
configs2.push(
|
|
1947
2248
|
...unicorn({
|
|
1948
2249
|
overrides: getOverrides(options, "unicorn")
|
|
1949
2250
|
})
|
|
1950
2251
|
);
|
|
1951
2252
|
}
|
|
1952
2253
|
if (options.regexp ?? true) {
|
|
1953
|
-
|
|
2254
|
+
configs2.push(
|
|
1954
2255
|
...regexp({
|
|
1955
2256
|
...resolveSubOptions(options, "regexp"),
|
|
1956
2257
|
overrides: getOverrides(options, "regexp")
|
|
@@ -1958,21 +2259,21 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
1958
2259
|
);
|
|
1959
2260
|
}
|
|
1960
2261
|
if (options.jsdoc ?? true) {
|
|
1961
|
-
|
|
2262
|
+
configs2.push(
|
|
1962
2263
|
...jsdoc({
|
|
1963
2264
|
overrides: getOverrides(options, "jsdoc")
|
|
1964
2265
|
})
|
|
1965
2266
|
);
|
|
1966
2267
|
}
|
|
1967
2268
|
if (options.comments ?? true) {
|
|
1968
|
-
|
|
2269
|
+
configs2.push(
|
|
1969
2270
|
...comments({
|
|
1970
2271
|
overrides: getOverrides(options, "comments")
|
|
1971
2272
|
})
|
|
1972
2273
|
);
|
|
1973
2274
|
}
|
|
1974
2275
|
if (options.typescript ?? hasTypeScript) {
|
|
1975
|
-
|
|
2276
|
+
configs2.push(
|
|
1976
2277
|
...typescript({
|
|
1977
2278
|
...resolveSubOptions(options, "typescript"),
|
|
1978
2279
|
overrides: getOverrides(options, "typescript")
|
|
@@ -1980,35 +2281,35 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
1980
2281
|
);
|
|
1981
2282
|
}
|
|
1982
2283
|
if (options.yml ?? true) {
|
|
1983
|
-
|
|
2284
|
+
configs2.push(
|
|
1984
2285
|
...yml({
|
|
1985
2286
|
overrides: getOverrides(options, "yml")
|
|
1986
2287
|
})
|
|
1987
2288
|
);
|
|
1988
2289
|
}
|
|
1989
2290
|
if (options.toml ?? true) {
|
|
1990
|
-
|
|
2291
|
+
configs2.push(
|
|
1991
2292
|
...toml({
|
|
1992
2293
|
overrides: getOverrides(options, "toml")
|
|
1993
2294
|
})
|
|
1994
2295
|
);
|
|
1995
2296
|
}
|
|
1996
2297
|
if (options.jsonc ?? true) {
|
|
1997
|
-
|
|
2298
|
+
configs2.push(
|
|
1998
2299
|
...jsonc({
|
|
1999
2300
|
overrides: getOverrides(options, "jsonc")
|
|
2000
2301
|
})
|
|
2001
2302
|
);
|
|
2002
2303
|
}
|
|
2003
2304
|
if (options.sort ?? true) {
|
|
2004
|
-
|
|
2305
|
+
configs2.push(
|
|
2005
2306
|
...sort({
|
|
2006
2307
|
...resolveSubOptions(options, "sort")
|
|
2007
2308
|
})
|
|
2008
2309
|
);
|
|
2009
2310
|
}
|
|
2010
2311
|
if (options.vue ?? hasVue) {
|
|
2011
|
-
|
|
2312
|
+
configs2.push(
|
|
2012
2313
|
...vue({
|
|
2013
2314
|
...resolveSubOptions(options, "vue"),
|
|
2014
2315
|
overrides: getOverrides(options, "vue")
|
|
@@ -2016,7 +2317,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2016
2317
|
);
|
|
2017
2318
|
}
|
|
2018
2319
|
if (options.test ?? hasVitest) {
|
|
2019
|
-
|
|
2320
|
+
configs2.push(
|
|
2020
2321
|
...test({
|
|
2021
2322
|
overrides: getOverrides(options, "test")
|
|
2022
2323
|
}),
|
|
@@ -2026,26 +2327,40 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2026
2327
|
);
|
|
2027
2328
|
}
|
|
2028
2329
|
if (options.unocss ?? hasUnoCSS) {
|
|
2029
|
-
|
|
2330
|
+
configs2.push(
|
|
2030
2331
|
...unocss({
|
|
2031
2332
|
overrides: getOverrides(options, "unocss")
|
|
2032
2333
|
})
|
|
2033
2334
|
);
|
|
2034
2335
|
}
|
|
2035
2336
|
if (options.markdown ?? true) {
|
|
2036
|
-
|
|
2337
|
+
configs2.push(
|
|
2037
2338
|
...markdown({
|
|
2038
2339
|
overrides: getOverrides(options, "markdown")
|
|
2039
2340
|
})
|
|
2040
2341
|
);
|
|
2041
2342
|
}
|
|
2042
2343
|
if (options.command ?? true) {
|
|
2043
|
-
|
|
2344
|
+
configs2.push(
|
|
2044
2345
|
...command({
|
|
2045
2346
|
...resolveSubOptions(options, "command")
|
|
2046
2347
|
})
|
|
2047
2348
|
);
|
|
2048
2349
|
}
|
|
2350
|
+
if (options.antfu ?? true) {
|
|
2351
|
+
configs2.push(
|
|
2352
|
+
...antfu({
|
|
2353
|
+
overrides: getOverrides(options, "antfu")
|
|
2354
|
+
})
|
|
2355
|
+
);
|
|
2356
|
+
}
|
|
2357
|
+
if (options.githubAction ?? true) {
|
|
2358
|
+
configs2.push(
|
|
2359
|
+
...githubAction({
|
|
2360
|
+
overrides: getOverrides(options, "githubAction")
|
|
2361
|
+
})
|
|
2362
|
+
);
|
|
2363
|
+
}
|
|
2049
2364
|
const configSpecials = specials();
|
|
2050
2365
|
const configPrettier = options.prettier ?? true ? prettier({
|
|
2051
2366
|
...resolveSubOptions(options, "prettier"),
|
|
@@ -2053,7 +2368,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2053
2368
|
}) : [];
|
|
2054
2369
|
const composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
2055
2370
|
composer.append(
|
|
2056
|
-
...
|
|
2371
|
+
...configs2,
|
|
2057
2372
|
...toArray(userConfigs),
|
|
2058
2373
|
...configSpecials,
|
|
2059
2374
|
...configPrettier
|
|
@@ -2062,12 +2377,14 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2062
2377
|
}
|
|
2063
2378
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2064
2379
|
0 && (module.exports = {
|
|
2380
|
+
DEFAULT_PRETTIER_OPTIONS,
|
|
2065
2381
|
GLOB_ALL_SRC,
|
|
2066
2382
|
GLOB_ASTRO,
|
|
2067
2383
|
GLOB_CSS,
|
|
2068
2384
|
GLOB_DIST,
|
|
2069
2385
|
GLOB_DTS,
|
|
2070
2386
|
GLOB_EXCLUDE,
|
|
2387
|
+
GLOB_GITHUB_ACTION,
|
|
2071
2388
|
GLOB_HTML,
|
|
2072
2389
|
GLOB_JS,
|
|
2073
2390
|
GLOB_JSON,
|
|
@@ -2080,6 +2397,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2080
2397
|
GLOB_MARKDOWN_CODE,
|
|
2081
2398
|
GLOB_MARKDOWN_NESTED,
|
|
2082
2399
|
GLOB_NODE_MODULES,
|
|
2400
|
+
GLOB_POSTCSS,
|
|
2083
2401
|
GLOB_SCSS,
|
|
2084
2402
|
GLOB_SRC,
|
|
2085
2403
|
GLOB_SRC_EXT,
|
|
@@ -2094,8 +2412,11 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2094
2412
|
antfu,
|
|
2095
2413
|
command,
|
|
2096
2414
|
comments,
|
|
2415
|
+
createTypeScriptConfig,
|
|
2097
2416
|
defineESLintConfig,
|
|
2417
|
+
format,
|
|
2098
2418
|
getOverrides,
|
|
2419
|
+
githubAction,
|
|
2099
2420
|
gitignore,
|
|
2100
2421
|
hasTypeScript,
|
|
2101
2422
|
hasUnoCSS,
|
|
@@ -2110,15 +2431,21 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2110
2431
|
jsx,
|
|
2111
2432
|
loadPlugin,
|
|
2112
2433
|
markdown,
|
|
2434
|
+
mergePrettierOptions,
|
|
2435
|
+
mergeProcessors,
|
|
2113
2436
|
node,
|
|
2114
2437
|
ntnyq,
|
|
2115
2438
|
parserJsonc,
|
|
2439
|
+
parserPlain,
|
|
2116
2440
|
parserToml,
|
|
2441
|
+
parserTypeScript,
|
|
2117
2442
|
parserVue,
|
|
2118
2443
|
parserYaml,
|
|
2119
2444
|
perfectionist,
|
|
2120
2445
|
pluginAntfu,
|
|
2121
2446
|
pluginComments,
|
|
2447
|
+
pluginFormat,
|
|
2448
|
+
pluginGitHubAction,
|
|
2122
2449
|
pluginImport,
|
|
2123
2450
|
pluginJsdoc,
|
|
2124
2451
|
pluginJsonc,
|
|
@@ -2129,6 +2456,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2129
2456
|
pluginPrettier,
|
|
2130
2457
|
pluginRegexp,
|
|
2131
2458
|
pluginToml,
|
|
2459
|
+
pluginTypeScript,
|
|
2132
2460
|
pluginUnicorn,
|
|
2133
2461
|
pluginUnoCSS,
|
|
2134
2462
|
pluginUnusedImports,
|
|
@@ -2136,6 +2464,8 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2136
2464
|
pluginVue,
|
|
2137
2465
|
pluginYaml,
|
|
2138
2466
|
prettier,
|
|
2467
|
+
processorPassThrough,
|
|
2468
|
+
processorVueBlocks,
|
|
2139
2469
|
regexp,
|
|
2140
2470
|
resolveSubOptions,
|
|
2141
2471
|
sort,
|
|
@@ -2143,8 +2473,8 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
2143
2473
|
test,
|
|
2144
2474
|
toArray,
|
|
2145
2475
|
toml,
|
|
2146
|
-
tseslint,
|
|
2147
2476
|
typescript,
|
|
2477
|
+
typescriptConfigs,
|
|
2148
2478
|
typescriptCore,
|
|
2149
2479
|
unicorn,
|
|
2150
2480
|
unocss,
|