@cuiqg/eslint-config 2.8.14 → 2.8.16
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.mjs +106 -392
- package/package.json +17 -15
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
2
|
import globals from "globals";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { isPackageExists } from "local-pkg";
|
|
5
3
|
import path from "node:path";
|
|
6
4
|
import fs from "node:fs";
|
|
7
5
|
import process$1 from "node:process";
|
|
6
|
+
import { isPackageExists } from "local-pkg";
|
|
7
|
+
|
|
8
|
+
//#region src/utils.js
|
|
9
|
+
async function interopDefault(module) {
|
|
10
|
+
const resolved = await module;
|
|
11
|
+
return resolved.default || resolved;
|
|
12
|
+
}
|
|
8
13
|
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/configs/baseline.js
|
|
16
|
+
async function baseline() {
|
|
17
|
+
const [pluginBaseline] = await Promise.all([interopDefault(import("eslint-plugin-baseline-js"))]);
|
|
18
|
+
return [{
|
|
19
|
+
name: "cuiqg/baseline",
|
|
20
|
+
plugins: { "baseline-js": pluginBaseline },
|
|
21
|
+
rules: { ...pluginBaseline.configs.recommended({
|
|
22
|
+
available: "widely",
|
|
23
|
+
level: "warn"
|
|
24
|
+
}).rules }
|
|
25
|
+
}];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
9
29
|
//#region src/globs.js
|
|
10
30
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
11
31
|
const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
@@ -13,12 +33,9 @@ const GLOB_TS = `**/*.?([cm])ts`;
|
|
|
13
33
|
const GLOB_TSX = `**/*.?([cm])tsx`;
|
|
14
34
|
const GLOB_JS = `**/*.?([cm])js`;
|
|
15
35
|
const GLOB_JSX = `**/*.?([cm])jsx`;
|
|
16
|
-
const GLOB_STYLE = "**/*.{c,
|
|
36
|
+
const GLOB_STYLE = "**/*.{c,sc}ss";
|
|
17
37
|
const GLOB_CSS = "**/*.css";
|
|
18
38
|
const GLOB_SCSS = "**/*.scss";
|
|
19
|
-
const GLOB_LESS = "**/*.less";
|
|
20
|
-
const GLOB_STYLUS = "**/*.styl";
|
|
21
|
-
const GLOB_POSTCSS = "**/*.{p,post}css";
|
|
22
39
|
const GLOB_VUE = "**/*.vue";
|
|
23
40
|
const GLOB_EXCLUDE = [
|
|
24
41
|
"**/node_modules",
|
|
@@ -64,233 +81,42 @@ const GLOB_EXCLUDE = [
|
|
|
64
81
|
//#endregion
|
|
65
82
|
//#region src/configs/ignores.js
|
|
66
83
|
async function ignores() {
|
|
84
|
+
const [pluginGitignore] = await Promise.all([interopDefault(import("eslint-config-flat-gitignore"))]);
|
|
67
85
|
return [{
|
|
68
86
|
ignores: [...GLOB_EXCLUDE],
|
|
69
87
|
name: "cuiqg/ignores"
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
//#region src/utils.js
|
|
75
|
-
const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
76
|
-
async function interopDefault(module) {
|
|
77
|
-
try {
|
|
78
|
-
let resolved = await module;
|
|
79
|
-
return resolved?.default || resolved;
|
|
80
|
-
} catch (error) {
|
|
81
|
-
throw new Error(`Cannot import module: ${String(error)}`);
|
|
82
|
-
}
|
|
88
|
+
}, { ...pluginGitignore({
|
|
89
|
+
name: "cuiqg/ignores/gitignore",
|
|
90
|
+
strict: false
|
|
91
|
+
}) }];
|
|
83
92
|
}
|
|
84
93
|
|
|
85
94
|
//#endregion
|
|
86
95
|
//#region src/configs/javascript.js
|
|
87
|
-
async function javascript(
|
|
88
|
-
const
|
|
89
|
-
const
|
|
96
|
+
async function javascript() {
|
|
97
|
+
const files = [GLOB_JS];
|
|
98
|
+
const [pluginJS] = await Promise.all([interopDefault(import("@eslint/js"))]);
|
|
90
99
|
return [{
|
|
91
100
|
name: "cuiqg/javascript",
|
|
92
|
-
|
|
101
|
+
files,
|
|
102
|
+
plugins: { js: pluginJS },
|
|
93
103
|
languageOptions: {
|
|
94
104
|
globals: {
|
|
95
105
|
...globals.browser,
|
|
96
|
-
...globals.
|
|
106
|
+
...globals.es2026,
|
|
97
107
|
...globals.node
|
|
98
108
|
},
|
|
99
109
|
parserOptions: {
|
|
110
|
+
ecmaFeatures: { jsx: true },
|
|
100
111
|
ecmaVersion: "latest",
|
|
101
112
|
sourceType: "module"
|
|
102
|
-
}
|
|
113
|
+
},
|
|
114
|
+
sourceType: "module"
|
|
103
115
|
},
|
|
104
116
|
linterOptions: { reportUnusedDisableDirectives: true },
|
|
105
117
|
rules: {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
setWithoutGet: true
|
|
109
|
-
}],
|
|
110
|
-
"array-callback-return": "error",
|
|
111
|
-
"block-scoped-var": "error",
|
|
112
|
-
"constructor-super": "error",
|
|
113
|
-
"default-case-last": "error",
|
|
114
|
-
"dot-notation": ["error", { allowKeywords: true }],
|
|
115
|
-
"eqeqeq": ["error", "smart"],
|
|
116
|
-
"new-cap": ["error", {
|
|
117
|
-
capIsNew: false,
|
|
118
|
-
newIsCap: true,
|
|
119
|
-
properties: true
|
|
120
|
-
}],
|
|
121
|
-
"no-alert": "error",
|
|
122
|
-
"no-array-constructor": "error",
|
|
123
|
-
"no-async-promise-executor": "error",
|
|
124
|
-
"no-caller": "error",
|
|
125
|
-
"no-case-declarations": "error",
|
|
126
|
-
"no-class-assign": "error",
|
|
127
|
-
"no-compare-neg-zero": "error",
|
|
128
|
-
"no-cond-assign": ["error", "always"],
|
|
129
|
-
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
130
|
-
"no-const-assign": "error",
|
|
131
|
-
"no-control-regex": "error",
|
|
132
|
-
"no-debugger": "error",
|
|
133
|
-
"no-delete-var": "error",
|
|
134
|
-
"no-dupe-args": "error",
|
|
135
|
-
"no-dupe-class-members": "error",
|
|
136
|
-
"no-dupe-keys": "error",
|
|
137
|
-
"no-duplicate-case": "error",
|
|
138
|
-
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
139
|
-
"no-empty-character-class": "error",
|
|
140
|
-
"no-empty-pattern": "error",
|
|
141
|
-
"no-eval": "error",
|
|
142
|
-
"no-ex-assign": "error",
|
|
143
|
-
"no-extend-native": "error",
|
|
144
|
-
"no-extra-bind": "error",
|
|
145
|
-
"no-extra-boolean-cast": "error",
|
|
146
|
-
"no-fallthrough": "error",
|
|
147
|
-
"no-func-assign": "error",
|
|
148
|
-
"no-global-assign": "error",
|
|
149
|
-
"no-implied-eval": "error",
|
|
150
|
-
"no-import-assign": "error",
|
|
151
|
-
"no-invalid-regexp": "error",
|
|
152
|
-
"no-irregular-whitespace": "error",
|
|
153
|
-
"no-iterator": "error",
|
|
154
|
-
"no-labels": ["error", {
|
|
155
|
-
allowLoop: false,
|
|
156
|
-
allowSwitch: false
|
|
157
|
-
}],
|
|
158
|
-
"no-lone-blocks": "error",
|
|
159
|
-
"no-loss-of-precision": "error",
|
|
160
|
-
"no-misleading-character-class": "error",
|
|
161
|
-
"no-multi-str": "error",
|
|
162
|
-
"no-new": "error",
|
|
163
|
-
"no-new-func": "error",
|
|
164
|
-
"no-new-native-nonconstructor": "error",
|
|
165
|
-
"no-new-wrappers": "error",
|
|
166
|
-
"no-obj-calls": "error",
|
|
167
|
-
"no-octal": "error",
|
|
168
|
-
"no-octal-escape": "error",
|
|
169
|
-
"no-proto": "error",
|
|
170
|
-
"no-prototype-builtins": "error",
|
|
171
|
-
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
172
|
-
"no-regex-spaces": "error",
|
|
173
|
-
"no-restricted-globals": [
|
|
174
|
-
"error",
|
|
175
|
-
{
|
|
176
|
-
message: "Use `globalThis` instead.",
|
|
177
|
-
name: "global"
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
message: "Use `globalThis` instead.",
|
|
181
|
-
name: "self"
|
|
182
|
-
}
|
|
183
|
-
],
|
|
184
|
-
"no-restricted-properties": [
|
|
185
|
-
"error",
|
|
186
|
-
{
|
|
187
|
-
message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
|
|
188
|
-
property: "__proto__"
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
message: "Use `Object.defineProperty` instead.",
|
|
192
|
-
property: "__defineGetter__"
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
message: "Use `Object.defineProperty` instead.",
|
|
196
|
-
property: "__defineSetter__"
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
200
|
-
property: "__lookupGetter__"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
204
|
-
property: "__lookupSetter__"
|
|
205
|
-
}
|
|
206
|
-
],
|
|
207
|
-
"no-restricted-syntax": [
|
|
208
|
-
"error",
|
|
209
|
-
"TSEnumDeclaration[const=true]",
|
|
210
|
-
"TSExportAssignment"
|
|
211
|
-
],
|
|
212
|
-
"no-self-assign": ["error", { props: true }],
|
|
213
|
-
"no-self-compare": "error",
|
|
214
|
-
"no-sequences": "error",
|
|
215
|
-
"no-shadow-restricted-names": "error",
|
|
216
|
-
"no-sparse-arrays": "error",
|
|
217
|
-
"no-template-curly-in-string": "error",
|
|
218
|
-
"no-this-before-super": "error",
|
|
219
|
-
"no-throw-literal": "error",
|
|
220
|
-
"no-undef": "error",
|
|
221
|
-
"no-undef-init": "error",
|
|
222
|
-
"no-unexpected-multiline": "error",
|
|
223
|
-
"no-unmodified-loop-condition": "error",
|
|
224
|
-
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
225
|
-
"no-unreachable": "error",
|
|
226
|
-
"no-unreachable-loop": "error",
|
|
227
|
-
"no-unsafe-finally": "error",
|
|
228
|
-
"no-unsafe-negation": "error",
|
|
229
|
-
"no-unused-expressions": ["error", {
|
|
230
|
-
allowShortCircuit: true,
|
|
231
|
-
allowTaggedTemplates: true,
|
|
232
|
-
allowTernary: true
|
|
233
|
-
}],
|
|
234
|
-
"no-unused-vars": ["error", {
|
|
235
|
-
args: "none",
|
|
236
|
-
caughtErrors: "none",
|
|
237
|
-
ignoreRestSiblings: true,
|
|
238
|
-
vars: "all"
|
|
239
|
-
}],
|
|
240
|
-
"no-use-before-define": ["error", {
|
|
241
|
-
classes: false,
|
|
242
|
-
functions: false,
|
|
243
|
-
variables: true
|
|
244
|
-
}],
|
|
245
|
-
"no-useless-backreference": "error",
|
|
246
|
-
"no-useless-call": "error",
|
|
247
|
-
"no-useless-catch": "error",
|
|
248
|
-
"no-useless-computed-key": "error",
|
|
249
|
-
"no-useless-constructor": "error",
|
|
250
|
-
"no-useless-rename": "error",
|
|
251
|
-
"no-useless-return": "error",
|
|
252
|
-
"no-var": "error",
|
|
253
|
-
"no-with": "error",
|
|
254
|
-
"object-shorthand": [
|
|
255
|
-
"error",
|
|
256
|
-
"always",
|
|
257
|
-
{
|
|
258
|
-
avoidQuotes: true,
|
|
259
|
-
ignoreConstructors: false
|
|
260
|
-
}
|
|
261
|
-
],
|
|
262
|
-
"one-var": ["error", { initialized: "never" }],
|
|
263
|
-
"prefer-arrow-callback": ["error", {
|
|
264
|
-
allowNamedFunctions: false,
|
|
265
|
-
allowUnboundThis: true
|
|
266
|
-
}],
|
|
267
|
-
"prefer-const": [isInEditor$1 ? "warn" : "error", {
|
|
268
|
-
destructuring: "all",
|
|
269
|
-
ignoreReadBeforeAssign: true
|
|
270
|
-
}],
|
|
271
|
-
"prefer-exponentiation-operator": "error",
|
|
272
|
-
"prefer-promise-reject-errors": "error",
|
|
273
|
-
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
274
|
-
"prefer-rest-params": "error",
|
|
275
|
-
"prefer-spread": "error",
|
|
276
|
-
"prefer-template": "error",
|
|
277
|
-
"symbol-description": "error",
|
|
278
|
-
"unicode-bom": ["error", "never"],
|
|
279
|
-
"unused-imports/no-unused-imports": isInEditor$1 ? "warn" : "error",
|
|
280
|
-
"unused-imports/no-unused-vars": ["error", {
|
|
281
|
-
args: "after-used",
|
|
282
|
-
argsIgnorePattern: "^_",
|
|
283
|
-
ignoreRestSiblings: true,
|
|
284
|
-
vars: "all",
|
|
285
|
-
varsIgnorePattern: "^_"
|
|
286
|
-
}],
|
|
287
|
-
"use-isnan": ["error", {
|
|
288
|
-
enforceForIndexOf: true,
|
|
289
|
-
enforceForSwitchCase: true
|
|
290
|
-
}],
|
|
291
|
-
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
292
|
-
"vars-on-top": "error",
|
|
293
|
-
"yoda": ["error", "never"]
|
|
118
|
+
...pluginJS.configs.recommended.rules,
|
|
119
|
+
"no-unused-vars": "off"
|
|
294
120
|
}
|
|
295
121
|
}];
|
|
296
122
|
}
|
|
@@ -298,9 +124,10 @@ async function javascript(options = {}) {
|
|
|
298
124
|
//#endregion
|
|
299
125
|
//#region src/configs/jsdoc.js
|
|
300
126
|
async function jsdoc() {
|
|
127
|
+
const [pluginJsdoc] = await Promise.all([interopDefault(import("eslint-plugin-jsdoc"))]);
|
|
301
128
|
return [{
|
|
302
129
|
name: "cuiqg/jsdoc",
|
|
303
|
-
plugins: { jsdoc:
|
|
130
|
+
plugins: { jsdoc: pluginJsdoc },
|
|
304
131
|
rules: {
|
|
305
132
|
"jsdoc/check-access": "warn",
|
|
306
133
|
"jsdoc/check-param-names": "warn",
|
|
@@ -327,8 +154,9 @@ async function jsdoc() {
|
|
|
327
154
|
//#endregion
|
|
328
155
|
//#region src/configs/macros.js
|
|
329
156
|
async function macros() {
|
|
157
|
+
const [configMacros] = await Promise.all([interopDefault(import("@vue-macros/eslint-config"))]);
|
|
330
158
|
return [{
|
|
331
|
-
...
|
|
159
|
+
...configMacros,
|
|
332
160
|
name: "cuiqg/macros"
|
|
333
161
|
}];
|
|
334
162
|
}
|
|
@@ -429,7 +257,7 @@ async function stylistic(options = {}) {
|
|
|
429
257
|
//#endregion
|
|
430
258
|
//#region src/configs/unocss.js
|
|
431
259
|
async function unocss() {
|
|
432
|
-
const pluginUnoCSS = await interopDefault(import("@unocss/eslint-plugin"));
|
|
260
|
+
const [pluginUnoCSS] = await Promise.all([interopDefault(import("@unocss/eslint-plugin"))]);
|
|
433
261
|
return [{
|
|
434
262
|
name: "cuiqg/unocss",
|
|
435
263
|
plugins: { "@unocss": pluginUnoCSS },
|
|
@@ -464,154 +292,49 @@ async function vue(options = {}) {
|
|
|
464
292
|
},
|
|
465
293
|
processor: pluginVue.processors[".vue"],
|
|
466
294
|
rules: {
|
|
467
|
-
"
|
|
295
|
+
...pluginVue.configs["flat/recommended"].map((c) => c.rules).reduce((acc, c) => ({
|
|
296
|
+
...acc,
|
|
297
|
+
...c
|
|
298
|
+
}), {}),
|
|
468
299
|
"vue/block-order": ["error", { order: [
|
|
469
300
|
"script",
|
|
470
301
|
"template",
|
|
471
302
|
"style"
|
|
472
303
|
] }],
|
|
473
|
-
"vue/
|
|
474
|
-
"vue/
|
|
475
|
-
"vue/
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
"vue/max-attributes-per-line": ["error", {
|
|
484
|
-
"singleline": { "max": 1 },
|
|
485
|
-
"multiline": { "max": 1 }
|
|
304
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
305
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
306
|
+
"vue/html-self-closing": ["error", {
|
|
307
|
+
html: {
|
|
308
|
+
component: "always",
|
|
309
|
+
normal: "always",
|
|
310
|
+
void: "any"
|
|
311
|
+
},
|
|
312
|
+
math: "always",
|
|
313
|
+
svg: "always"
|
|
486
314
|
}],
|
|
487
|
-
"vue/
|
|
488
|
-
"vue/
|
|
489
|
-
"vue/
|
|
490
|
-
"vue/no-
|
|
491
|
-
"vue/no-
|
|
492
|
-
"vue/no-
|
|
493
|
-
"vue/no-
|
|
494
|
-
"vue/no-deprecated-delete-set": "error",
|
|
495
|
-
"vue/no-deprecated-destroyed-lifecycle": "error",
|
|
496
|
-
"vue/no-deprecated-dollar-listeners-api": "error",
|
|
497
|
-
"vue/no-deprecated-dollar-scopedslots-api": "error",
|
|
498
|
-
"vue/no-deprecated-events-api": "error",
|
|
499
|
-
"vue/no-deprecated-filter": "error",
|
|
500
|
-
"vue/no-deprecated-functional-template": "error",
|
|
501
|
-
"vue/no-deprecated-html-element-is": "error",
|
|
502
|
-
"vue/no-deprecated-inline-template": "error",
|
|
503
|
-
"vue/no-deprecated-model-definition": "error",
|
|
504
|
-
"vue/no-deprecated-props-default-this": "error",
|
|
505
|
-
"vue/no-deprecated-router-link-tag-prop": "error",
|
|
506
|
-
"vue/no-deprecated-scope-attribute": "error",
|
|
507
|
-
"vue/no-deprecated-slot-attribute": "error",
|
|
508
|
-
"vue/no-deprecated-slot-scope-attribute": "error",
|
|
509
|
-
"vue/no-deprecated-v-bind-sync": "error",
|
|
510
|
-
"vue/no-deprecated-v-is": "error",
|
|
511
|
-
"vue/no-deprecated-v-on-native-modifier": "error",
|
|
512
|
-
"vue/no-deprecated-v-on-number-modifiers": "error",
|
|
513
|
-
"vue/no-deprecated-vue-config-keycodes": "error",
|
|
514
|
-
"vue/no-dupe-keys": "error",
|
|
515
|
-
"vue/no-dupe-v-else-if": "error",
|
|
516
|
-
"vue/no-duplicate-attr-inheritance": "error",
|
|
517
|
-
"vue/no-duplicate-attributes": "error",
|
|
518
|
-
"vue/no-duplicate-class-names": "error",
|
|
519
|
-
"vue/no-empty-component-block": "error",
|
|
520
|
-
"vue/no-export-in-script-setup": "error",
|
|
521
|
-
"vue/no-expose-after-await": "error",
|
|
522
|
-
"vue/no-lifecycle-after-await": "error",
|
|
523
|
-
"vue/no-lone-template": "error",
|
|
524
|
-
"vue/no-multiple-objects-in-class": "error",
|
|
525
|
-
"vue/no-multiple-slot-args": "error",
|
|
526
|
-
"vue/no-mutating-props": "error",
|
|
527
|
-
"vue/no-negated-condition": "error",
|
|
528
|
-
"vue/no-negated-v-if-condition": "error",
|
|
529
|
-
"vue/no-parsing-error": "error",
|
|
530
|
-
"vue/no-potential-component-option-typo": "error",
|
|
531
|
-
"vue/no-ref-as-operand": "error",
|
|
532
|
-
"vue/no-ref-object-reactivity-loss": "error",
|
|
533
|
-
"vue/no-required-prop-with-default": "error",
|
|
534
|
-
"vue/no-reserved-component-names": "error",
|
|
535
|
-
"vue/no-reserved-keys": "error",
|
|
536
|
-
"vue/no-reserved-props": "error",
|
|
537
|
-
"vue/no-setup-props-reactivity-loss": "error",
|
|
538
|
-
"vue/no-shared-component-data": "error",
|
|
539
|
-
"vue/no-side-effects-in-computed-properties": "error",
|
|
540
|
-
"vue/no-template-key": "error",
|
|
541
|
-
"vue/no-template-shadow": "error",
|
|
542
|
-
"vue/no-template-target-blank": "error",
|
|
543
|
-
"vue/no-textarea-mustache": "error",
|
|
544
|
-
"vue/no-this-in-before-route-enter": "error",
|
|
545
|
-
"vue/no-undef-components": "error",
|
|
546
|
-
"vue/no-undef-properties": "error",
|
|
547
|
-
"vue/no-unused-components": "error",
|
|
548
|
-
"vue/no-unused-emit-declarations": "error",
|
|
549
|
-
"vue/no-unused-vars": ["error", { ignorePattern: "^_" }],
|
|
550
|
-
"vue/no-use-computed-property-like-method": "error",
|
|
551
|
-
"vue/no-use-v-else-with-v-for": "error",
|
|
552
|
-
"vue/no-use-v-if-with-v-for": "error",
|
|
553
|
-
"vue/no-useless-mustaches": "error",
|
|
554
|
-
"vue/no-useless-template-attributes": "error",
|
|
315
|
+
"vue/max-attributes-per-line": "off",
|
|
316
|
+
"vue/multi-word-component-names": "off",
|
|
317
|
+
"vue/no-constant-condition": "warn",
|
|
318
|
+
"vue/no-empty-pattern": "error",
|
|
319
|
+
"vue/no-loss-of-precision": "error",
|
|
320
|
+
"vue/no-ref-as-operand": "off",
|
|
321
|
+
"vue/no-unused-refs": "error",
|
|
555
322
|
"vue/no-useless-v-bind": "error",
|
|
556
|
-
"vue/no-v-
|
|
557
|
-
"vue/
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
"vue/
|
|
566
|
-
"vue/
|
|
567
|
-
"vue/
|
|
568
|
-
"vue/require-
|
|
569
|
-
"vue/require-
|
|
570
|
-
"vue/
|
|
571
|
-
defineEmits: "emit",
|
|
572
|
-
defineProps: "props",
|
|
573
|
-
defineSlots: "slots",
|
|
574
|
-
useAttrs: "attrs",
|
|
575
|
-
useSlots: "slots"
|
|
576
|
-
}],
|
|
577
|
-
"vue/require-name-property": "error",
|
|
578
|
-
"vue/require-prop-type-constructor": "error",
|
|
579
|
-
"vue/require-render-return": "error",
|
|
580
|
-
"vue/require-slots-as-functions": "error",
|
|
581
|
-
"vue/require-toggle-inside-transition": "error",
|
|
582
|
-
"vue/require-typed-ref": "error",
|
|
583
|
-
"vue/require-v-for-key": "error",
|
|
584
|
-
"vue/require-valid-default-prop": "error",
|
|
585
|
-
"vue/return-in-computed-property": "error",
|
|
586
|
-
"vue/return-in-emits-validator": "error",
|
|
587
|
-
"vue/this-in-template": "error",
|
|
588
|
-
"vue/use-v-on-exact": "error",
|
|
589
|
-
"vue/v-bind-style": "error",
|
|
590
|
-
"vue/v-on-event-hyphenation": "error",
|
|
591
|
-
"vue/v-on-style": "error",
|
|
592
|
-
"vue/v-slot-style": "error",
|
|
593
|
-
"vue/valid-attribute-name": "error",
|
|
594
|
-
"vue/valid-define-emits": "error",
|
|
595
|
-
"vue/valid-define-options": "error",
|
|
596
|
-
"vue/valid-define-props": "error",
|
|
597
|
-
"vue/valid-next-tick": "error",
|
|
598
|
-
"vue/valid-template-root": "error",
|
|
599
|
-
"vue/valid-v-bind": "error",
|
|
600
|
-
"vue/valid-v-cloak": "error",
|
|
601
|
-
"vue/valid-v-else": "error",
|
|
602
|
-
"vue/valid-v-else-if": "error",
|
|
603
|
-
"vue/valid-v-for": "error",
|
|
604
|
-
"vue/valid-v-html": "error",
|
|
605
|
-
"vue/valid-v-if": "error",
|
|
606
|
-
"vue/valid-v-is": "error",
|
|
607
|
-
"vue/valid-v-memo": "error",
|
|
608
|
-
"vue/valid-v-model": "error",
|
|
609
|
-
"vue/valid-v-on": "error",
|
|
610
|
-
"vue/valid-v-once": "error",
|
|
611
|
-
"vue/valid-v-pre": "error",
|
|
612
|
-
"vue/valid-v-show": "error",
|
|
613
|
-
"vue/valid-v-slot": "error",
|
|
614
|
-
"vue/valid-v-text": "error"
|
|
323
|
+
"vue/no-v-html": "off",
|
|
324
|
+
"vue/object-shorthand": [
|
|
325
|
+
"error",
|
|
326
|
+
"always",
|
|
327
|
+
{
|
|
328
|
+
avoidQuotes: true,
|
|
329
|
+
ignoreConstructors: false
|
|
330
|
+
}
|
|
331
|
+
],
|
|
332
|
+
"vue/one-component-per-file": "off",
|
|
333
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
334
|
+
"vue/prefer-template": "error",
|
|
335
|
+
"vue/require-default-prop": "off",
|
|
336
|
+
"vue/require-prop-types": "off",
|
|
337
|
+
"vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
|
|
615
338
|
}
|
|
616
339
|
}];
|
|
617
340
|
}
|
|
@@ -619,7 +342,7 @@ async function vue(options = {}) {
|
|
|
619
342
|
//#endregion
|
|
620
343
|
//#region src/configs/tailwindcss.js
|
|
621
344
|
async function tailwindcss() {
|
|
622
|
-
const pluginTailwindcss = await interopDefault(import("eslint-plugin-tailwindcss"));
|
|
345
|
+
const [pluginTailwindcss] = await Promise.all([interopDefault(import("eslint-plugin-tailwindcss"))]);
|
|
623
346
|
return [{
|
|
624
347
|
name: "cuiqg/tailwindcss",
|
|
625
348
|
plugins: { tailwindcss: pluginTailwindcss },
|
|
@@ -629,22 +352,6 @@ async function tailwindcss() {
|
|
|
629
352
|
}];
|
|
630
353
|
}
|
|
631
354
|
|
|
632
|
-
//#endregion
|
|
633
|
-
//#region src/configs/comments.js
|
|
634
|
-
async function comments() {
|
|
635
|
-
const pluginComments = await interopDefault(import("@eslint-community/eslint-plugin-eslint-comments"));
|
|
636
|
-
return [{
|
|
637
|
-
name: "cuiqg/eslint-comments",
|
|
638
|
-
plugins: { "@eslint-community/eslint-comments": pluginComments },
|
|
639
|
-
rules: {
|
|
640
|
-
"@eslint-community/eslint-comments/no-aggregating-enable": "error",
|
|
641
|
-
"@eslint-community/eslint-comments/no-duplicate-disable": "error",
|
|
642
|
-
"@eslint-community/eslint-comments/no-unlimited-disable": "error",
|
|
643
|
-
"@eslint-community/eslint-comments/no-unused-enable": "error"
|
|
644
|
-
}
|
|
645
|
-
}];
|
|
646
|
-
}
|
|
647
|
-
|
|
648
355
|
//#endregion
|
|
649
356
|
//#region src/configs/typescript.js
|
|
650
357
|
async function typescript() {
|
|
@@ -852,6 +559,17 @@ async function autoImports(options = {}) {
|
|
|
852
559
|
return config;
|
|
853
560
|
}
|
|
854
561
|
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/configs/next.js
|
|
564
|
+
async function nextjs() {
|
|
565
|
+
const [pluginNextjs] = await Promise.all([interopDefault(import("@next/eslint-plugin-next"))]);
|
|
566
|
+
return [{
|
|
567
|
+
name: "cuiqg/nextjs",
|
|
568
|
+
plugins: { "@next/next": pluginNextjs },
|
|
569
|
+
rules: { ...pluginNextjs.configs.recommended.rules }
|
|
570
|
+
}];
|
|
571
|
+
}
|
|
572
|
+
|
|
855
573
|
//#endregion
|
|
856
574
|
//#region src/env.js
|
|
857
575
|
const isInGitHookOrLintStaged = () => {
|
|
@@ -863,37 +581,33 @@ const isInEditor = () => {
|
|
|
863
581
|
return !!(process$1.env.VSCODE_PID || process$1.env.VSCODE_CWD || process$1.env.JETBRAINS_IDE || process$1.env.VIM || process$1.env.NVIM);
|
|
864
582
|
};
|
|
865
583
|
const hasVue = () => isPackageExists("vue");
|
|
866
|
-
const hasTypeScript = () => isPackageExists("typescript");
|
|
867
584
|
const hasUnocss = () => isPackageExists("unocss");
|
|
868
|
-
const hasTailwindcss = () => isPackageExists("tailwindcss");
|
|
869
585
|
|
|
870
586
|
//#endregion
|
|
871
587
|
//#region src/presets.js
|
|
872
588
|
/**
|
|
873
589
|
*
|
|
874
|
-
* @param {object} options
|
|
875
|
-
* @param {boolean} [options.
|
|
876
|
-
* @param {boolean} [options.unocss]
|
|
877
|
-
* @param {boolean} [options.tailwindcss]
|
|
878
|
-
* @param {boolean} [options.
|
|
879
|
-
* @param {boolean} [options.
|
|
880
|
-
* @param {
|
|
881
|
-
*
|
|
882
|
-
* @returns {
|
|
590
|
+
* @param {object} [options]
|
|
591
|
+
* @param {boolean} [options.jsdoc]
|
|
592
|
+
* @param {boolean} [options.unocss]
|
|
593
|
+
* @param {boolean} [options.tailwindcss]
|
|
594
|
+
* @param {boolean} [options.typescript]
|
|
595
|
+
* @param {boolean} [options.vue]
|
|
596
|
+
* @param {boolean} [options.nextjs]
|
|
597
|
+
* @param {...object} userConfigs
|
|
598
|
+
* @returns {FlatConfigComposer} FlatConfigComposer
|
|
883
599
|
*/
|
|
884
600
|
function cuiqg(options = {}, ...userConfigs) {
|
|
885
|
-
const { jsdoc: enableJsdoc = true, unocss: enableUnocss = hasUnocss(), tailwindcss: enableTailwindcss =
|
|
601
|
+
const { jsdoc: enableJsdoc = true, unocss: enableUnocss = hasUnocss(), tailwindcss: enableTailwindcss = false, typescript: enableTypescript = false, vue: enableVue = hasVue(), nextjs: enableNextjs = false } = options;
|
|
886
602
|
const configs = [];
|
|
887
|
-
configs.push(autoImports(),
|
|
603
|
+
configs.push(autoImports(), baseline(), ignores(), javascript({ isInEditor }), stylistic(), packageJson());
|
|
888
604
|
if (enableTypescript) configs.push(typescript());
|
|
889
605
|
if (enableJsdoc) configs.push(jsdoc());
|
|
890
606
|
if (enableVue) configs.push(vue({ typescript: enableTypescript }), macros());
|
|
607
|
+
if (enableNextjs) configs.push(nextjs());
|
|
891
608
|
if (enableUnocss) configs.push(unocss());
|
|
892
609
|
if (enableTailwindcss) configs.push(tailwindcss());
|
|
893
|
-
|
|
894
|
-
composer = composer.append(...configs, ...userConfigs);
|
|
895
|
-
if (isInEditor) composer = composer.disableRulesFix(["unused-imports/no-unused-imports"], { builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then((r) => r.builtinRules) });
|
|
896
|
-
return composer;
|
|
610
|
+
return new FlatConfigComposer(...configs, ...userConfigs);
|
|
897
611
|
}
|
|
898
612
|
|
|
899
613
|
//#endregion
|
|
@@ -901,4 +615,4 @@ function cuiqg(options = {}, ...userConfigs) {
|
|
|
901
615
|
var src_default = cuiqg;
|
|
902
616
|
|
|
903
617
|
//#endregion
|
|
904
|
-
export { GLOB_CSS, GLOB_EXCLUDE, GLOB_JS, GLOB_JSX,
|
|
618
|
+
export { GLOB_CSS, GLOB_EXCLUDE, GLOB_JS, GLOB_JSX, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, autoImports, baseline, cuiqg, src_default as default, hasUnocss, hasVue, ignores, isInEditor, isInGitHookOrLintStaged, javascript, jsdoc, macros, nextjs, packageJson, stylistic, stylisticConfigDefaults, tailwindcss, typescript, unocss, vue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuiqg/eslint-config",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.16",
|
|
4
4
|
"description": "Eslint config for @cuiqg",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config"
|
|
@@ -26,43 +26,45 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"scripts": {
|
|
30
|
-
"build": "tsdown",
|
|
31
|
-
"dev": "tsdown --watch",
|
|
32
|
-
"build:inspect": "npx @eslint/config-inspector build --config eslint-inspector.config.js",
|
|
33
|
-
"lint": "eslint .",
|
|
34
|
-
"lint:inspect": "npx @eslint/config-inspector --open false --config eslint-inspector.config.js",
|
|
35
|
-
"prepublishOnly": "npm run build",
|
|
36
|
-
"release": "bumpp"
|
|
37
|
-
},
|
|
38
29
|
"devDependencies": {
|
|
39
30
|
"@eslint/config-inspector": "^1.4.2",
|
|
31
|
+
"@types/node": "^25.0.3",
|
|
40
32
|
"bumpp": "^10.3.2",
|
|
41
33
|
"eslint": "^9.39.2",
|
|
42
34
|
"tsdown": "^0.18.2",
|
|
43
|
-
"typescript": "^5.9.3"
|
|
35
|
+
"typescript": "^5.9.3",
|
|
36
|
+
"unrun": "^0.2.22"
|
|
44
37
|
},
|
|
45
38
|
"peerDependencies": {
|
|
46
39
|
"eslint": ">=9.28.0"
|
|
47
40
|
},
|
|
48
41
|
"dependencies": {
|
|
49
|
-
"@eslint
|
|
42
|
+
"@eslint/js": "^9.39.2",
|
|
43
|
+
"@next/eslint-plugin-next": "^16.1.1",
|
|
50
44
|
"@stylistic/eslint-plugin": "^5.6.1",
|
|
51
45
|
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
52
46
|
"@typescript-eslint/parser": "^8.50.1",
|
|
53
47
|
"@unocss/eslint-plugin": "^66.5.10",
|
|
54
48
|
"@vue-macros/eslint-config": "3.0.0-beta.21",
|
|
49
|
+
"eslint-config-flat-gitignore": "^2.1.0",
|
|
55
50
|
"eslint-flat-config-utils": "^2.1.4",
|
|
51
|
+
"eslint-plugin-baseline-js": "^0.4.2",
|
|
56
52
|
"eslint-plugin-depend": "^1.4.0",
|
|
57
|
-
"eslint-plugin-import-x": "^4.16.1",
|
|
58
53
|
"eslint-plugin-jsdoc": "^61.5.0",
|
|
59
54
|
"eslint-plugin-package-json": "^0.85.0",
|
|
60
55
|
"eslint-plugin-tailwindcss": "4.0.0-beta.0",
|
|
61
|
-
"eslint-plugin-unused-imports": "^4.3.0",
|
|
62
56
|
"eslint-plugin-vue": "^10.6.2",
|
|
63
57
|
"globals": "^16.5.0",
|
|
64
58
|
"jsonc-eslint-parser": "^2.4.2",
|
|
65
59
|
"local-pkg": "^1.1.2",
|
|
66
60
|
"vue-eslint-parser": "^10.2.0"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsdown",
|
|
64
|
+
"dev": "tsdown --watch",
|
|
65
|
+
"build:inspect": "npx @eslint/config-inspector build --config eslint-inspector.config.js",
|
|
66
|
+
"lint": "eslint .",
|
|
67
|
+
"lint:inspect": "npx @eslint/config-inspector --open false --config eslint-inspector.config.js",
|
|
68
|
+
"release": "bumpp"
|
|
67
69
|
}
|
|
68
|
-
}
|
|
70
|
+
}
|