@jiakun-zhao/eslint-config 4.1.7 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +11 -10
- package/dist/index.mjs +1086 -994
- package/package.json +28 -30
- package/dist/index.d.ts +0 -14
package/dist/index.mjs
CHANGED
|
@@ -1,1084 +1,1176 @@
|
|
|
1
|
-
import { composer } from
|
|
2
|
-
import pluginStylistic from
|
|
3
|
-
import pluginTypescript from
|
|
4
|
-
import pluginUnocss from
|
|
5
|
-
import pluginAntfu from
|
|
6
|
-
import pluginCommand from
|
|
7
|
-
import pluginImportX from
|
|
8
|
-
import pluginJsonc from
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import globals from 'globals';
|
|
1
|
+
import { composer } from "eslint-flat-config-utils";
|
|
2
|
+
import pluginStylistic from "@stylistic/eslint-plugin";
|
|
3
|
+
import pluginTypescript from "@typescript-eslint/eslint-plugin";
|
|
4
|
+
import pluginUnocss from "@unocss/eslint-plugin";
|
|
5
|
+
import pluginAntfu from "eslint-plugin-antfu";
|
|
6
|
+
import pluginCommand from "eslint-plugin-command";
|
|
7
|
+
import pluginImportX from "eslint-plugin-import-x";
|
|
8
|
+
import pluginJsonc from "eslint-plugin-jsonc";
|
|
9
|
+
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
10
|
+
import * as pluginRegExp from "eslint-plugin-regexp";
|
|
11
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
12
|
+
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
13
|
+
import gitignore from "eslint-config-flat-gitignore";
|
|
14
|
+
import globals from "globals";
|
|
16
15
|
|
|
16
|
+
//#region src/definition.ts
|
|
17
17
|
const indent = 2;
|
|
18
18
|
const ignores$1 = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
19
|
+
"**/node_modules",
|
|
20
|
+
"**/dist",
|
|
21
|
+
"**/package-lock.json",
|
|
22
|
+
"**/yarn.lock",
|
|
23
|
+
"**/pnpm-lock.yaml",
|
|
24
|
+
"**/bun.lockb",
|
|
25
|
+
"**/output",
|
|
26
|
+
"**/coverage",
|
|
27
|
+
"**/temp",
|
|
28
|
+
"**/.temp",
|
|
29
|
+
"**/tmp",
|
|
30
|
+
"**/.tmp",
|
|
31
|
+
"**/.history",
|
|
32
|
+
"**/.vitepress/cache",
|
|
33
|
+
"**/.nuxt",
|
|
34
|
+
"**/.next",
|
|
35
|
+
"**/.svelte-kit",
|
|
36
|
+
"**/.vercel",
|
|
37
|
+
"**/.changeset",
|
|
38
|
+
"**/.idea",
|
|
39
|
+
"**/.cache",
|
|
40
|
+
"**/.output",
|
|
41
|
+
"**/.vite-inspect",
|
|
42
|
+
"**/.yarn",
|
|
43
|
+
"**/vite.config.*.timestamp-*",
|
|
44
|
+
"**/CHANGELOG*.md",
|
|
45
|
+
"**/*.min.*",
|
|
46
|
+
"**/LICENSE*",
|
|
47
|
+
"**/__snapshots__",
|
|
48
|
+
"**/auto-import?(s).d.ts",
|
|
49
|
+
"**/components.d.ts"
|
|
50
50
|
];
|
|
51
51
|
const packageJsonTopLevelOrder = [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
52
|
+
"publisher",
|
|
53
|
+
"name",
|
|
54
|
+
"displayName",
|
|
55
|
+
"type",
|
|
56
|
+
"version",
|
|
57
|
+
"private",
|
|
58
|
+
"packageManager",
|
|
59
|
+
"description",
|
|
60
|
+
"author",
|
|
61
|
+
"contributors",
|
|
62
|
+
"license",
|
|
63
|
+
"funding",
|
|
64
|
+
"homepage",
|
|
65
|
+
"repository",
|
|
66
|
+
"bugs",
|
|
67
|
+
"keywords",
|
|
68
|
+
"categories",
|
|
69
|
+
"sideEffects",
|
|
70
|
+
"exports",
|
|
71
|
+
"main",
|
|
72
|
+
"module",
|
|
73
|
+
"unpkg",
|
|
74
|
+
"jsdelivr",
|
|
75
|
+
"types",
|
|
76
|
+
"typesVersions",
|
|
77
|
+
"bin",
|
|
78
|
+
"icon",
|
|
79
|
+
"files",
|
|
80
|
+
"engines",
|
|
81
|
+
"activationEvents",
|
|
82
|
+
"contributes",
|
|
83
|
+
"scripts",
|
|
84
|
+
"peerDependencies",
|
|
85
|
+
"peerDependenciesMeta",
|
|
86
|
+
"dependencies",
|
|
87
|
+
"optionalDependencies",
|
|
88
|
+
"devDependencies",
|
|
89
|
+
"pnpm",
|
|
90
|
+
"overrides",
|
|
91
|
+
"resolutions",
|
|
92
|
+
"husky",
|
|
93
|
+
"simple-git-hooks",
|
|
94
|
+
"lint-staged",
|
|
95
|
+
"eslintConfig"
|
|
96
96
|
];
|
|
97
97
|
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/configs/antfu.ts
|
|
98
100
|
function antfu() {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
};
|
|
101
|
+
return {
|
|
102
|
+
name: "antfu",
|
|
103
|
+
plugins: { antfu: pluginAntfu },
|
|
104
|
+
rules: {
|
|
105
|
+
"antfu/consistent-list-newline": ["warn", { JSXOpeningElement: false }],
|
|
106
|
+
"antfu/if-newline": "warn"
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/utils.ts
|
|
111
113
|
const tsParser = findParser(pluginTypescript);
|
|
112
114
|
const jsoncParser = findParser(pluginJsonc);
|
|
113
115
|
function findParser(plugin) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
throw new Error(`Can not find parser in ${plugin.meta?.name}`);
|
|
116
|
+
const configs = Object.values(plugin.configs ?? {}).flat();
|
|
117
|
+
for (const config of configs) {
|
|
118
|
+
const parser = config.languageOptions?.parser;
|
|
119
|
+
if (parser) return parser;
|
|
120
|
+
}
|
|
121
|
+
throw new Error(`Can not find parser in ${plugin.meta?.name}`);
|
|
121
122
|
}
|
|
122
|
-
async function findDynamicPlugin(name, key = "default") {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
async function findDynamicPlugin(name$4, key = "default") {
|
|
124
|
+
try {
|
|
125
|
+
return (await import(name$4))[key];
|
|
126
|
+
} catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
128
129
|
}
|
|
129
130
|
function createRule(rule) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
const { name: name$4, ...rest } = rule;
|
|
132
|
+
rest.meta.docs ??= {};
|
|
133
|
+
rest.meta.docs.url = `https://example.com/${name$4}`;
|
|
134
|
+
return rest;
|
|
134
135
|
}
|
|
135
136
|
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/configs/astro.ts
|
|
136
139
|
async function astro() {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
const pluginAstro = await findDynamicPlugin("eslint-plugin-astro");
|
|
141
|
+
return pluginAstro && createSharedAstroConfig(pluginAstro, {
|
|
142
|
+
"mine/astro-multi-top-level-element-indent": "warn",
|
|
143
|
+
"mine/astro-no-blank-before-root-element": "warn",
|
|
144
|
+
"mine/no-newline-in-closing-tag": "warn",
|
|
145
|
+
"mine/no-space-before-opening-tag": "warn",
|
|
146
|
+
"style/jsx-tag-spacing": ["warn", {
|
|
147
|
+
afterOpening: "never",
|
|
148
|
+
beforeClosing: "never",
|
|
149
|
+
beforeSelfClosing: "always",
|
|
150
|
+
closingSlash: "never"
|
|
151
|
+
}]
|
|
152
|
+
});
|
|
143
153
|
}
|
|
144
|
-
function createSharedAstroConfig(plugin, rules = {}) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
plugins: {
|
|
160
|
-
astro: plugin
|
|
161
|
-
},
|
|
162
|
-
rules
|
|
163
|
-
};
|
|
154
|
+
function createSharedAstroConfig(plugin, rules$1 = {}) {
|
|
155
|
+
return {
|
|
156
|
+
files: ["**/*.astro"],
|
|
157
|
+
languageOptions: {
|
|
158
|
+
parser: findParser(plugin),
|
|
159
|
+
parserOptions: {
|
|
160
|
+
extraFileExtensions: [".astro"],
|
|
161
|
+
parser: tsParser
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
name: "astro",
|
|
165
|
+
plugins: { astro: plugin },
|
|
166
|
+
processor: plugin.processors?.["client-side-ts"],
|
|
167
|
+
rules: rules$1
|
|
168
|
+
};
|
|
164
169
|
}
|
|
165
170
|
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/configs/command.ts
|
|
166
173
|
function command() {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
rules: {
|
|
173
|
-
"command/command": "warn"
|
|
174
|
-
}
|
|
175
|
-
};
|
|
174
|
+
return {
|
|
175
|
+
name: "command",
|
|
176
|
+
plugins: { command: pluginCommand },
|
|
177
|
+
rules: { "command/command": "warn" }
|
|
178
|
+
};
|
|
176
179
|
}
|
|
177
180
|
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/configs/ignores.ts
|
|
178
183
|
function ignores(options) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
return [
|
|
185
|
+
gitignore({
|
|
186
|
+
...options.gitignore,
|
|
187
|
+
name: "ignores/gitignore"
|
|
188
|
+
}),
|
|
189
|
+
{
|
|
190
|
+
ignores: ignores$1,
|
|
191
|
+
name: "ignores/antfu"
|
|
192
|
+
},
|
|
193
|
+
options.ignores && {
|
|
194
|
+
ignores: options.ignores,
|
|
195
|
+
name: "ignores"
|
|
196
|
+
}
|
|
197
|
+
];
|
|
184
198
|
}
|
|
185
199
|
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/configs/import-x.ts
|
|
186
202
|
function importX() {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
+
return {
|
|
204
|
+
name: "import-x",
|
|
205
|
+
plugins: { "import-x": pluginImportX },
|
|
206
|
+
rules: {
|
|
207
|
+
"import-x/consistent-type-specifier-style": ["warn", "prefer-top-level"],
|
|
208
|
+
"import-x/first": "warn",
|
|
209
|
+
"import-x/newline-after-import": ["warn", { count: 1 }],
|
|
210
|
+
"import-x/no-duplicates": "warn",
|
|
211
|
+
"import-x/no-mutable-exports": "warn",
|
|
212
|
+
"import-x/no-named-default": "warn",
|
|
213
|
+
"import-x/no-self-import": "warn",
|
|
214
|
+
"import-x/no-webpack-loader-syntax": "warn"
|
|
215
|
+
}
|
|
216
|
+
};
|
|
203
217
|
}
|
|
204
218
|
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/configs/javascript.ts
|
|
205
221
|
function javascript() {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
222
|
+
return {
|
|
223
|
+
languageOptions: {
|
|
224
|
+
ecmaVersion: 2022,
|
|
225
|
+
globals: {
|
|
226
|
+
...globals.browser,
|
|
227
|
+
...globals.es2021,
|
|
228
|
+
...globals.node,
|
|
229
|
+
document: "readonly",
|
|
230
|
+
navigator: "readonly",
|
|
231
|
+
window: "readonly"
|
|
232
|
+
},
|
|
233
|
+
parserOptions: {
|
|
234
|
+
ecmaFeatures: { jsx: true },
|
|
235
|
+
ecmaVersion: 2022,
|
|
236
|
+
sourceType: "module"
|
|
237
|
+
},
|
|
238
|
+
sourceType: "module"
|
|
239
|
+
},
|
|
240
|
+
name: "javascript",
|
|
241
|
+
rules: {
|
|
242
|
+
"array-callback-return": "error",
|
|
243
|
+
"block-scoped-var": "error",
|
|
244
|
+
"constructor-super": "error",
|
|
245
|
+
"default-case-last": "error",
|
|
246
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
247
|
+
"eqeqeq": ["error", "smart"],
|
|
248
|
+
"new-cap": ["error", {
|
|
249
|
+
capIsNew: false,
|
|
250
|
+
newIsCap: true,
|
|
251
|
+
properties: true
|
|
252
|
+
}],
|
|
253
|
+
"no-alert": "error",
|
|
254
|
+
"no-array-constructor": "error",
|
|
255
|
+
"no-async-promise-executor": "error",
|
|
256
|
+
"no-caller": "error",
|
|
257
|
+
"no-case-declarations": "error",
|
|
258
|
+
"no-class-assign": "error",
|
|
259
|
+
"no-compare-neg-zero": "error",
|
|
260
|
+
"no-cond-assign": ["error", "always"],
|
|
261
|
+
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
262
|
+
"no-const-assign": "error",
|
|
263
|
+
"no-control-regex": "error",
|
|
264
|
+
"no-debugger": "error",
|
|
265
|
+
"no-delete-var": "error",
|
|
266
|
+
"no-dupe-args": "error",
|
|
267
|
+
"no-dupe-class-members": "error",
|
|
268
|
+
"no-dupe-keys": "error",
|
|
269
|
+
"no-duplicate-case": "error",
|
|
270
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
271
|
+
"no-empty-character-class": "error",
|
|
272
|
+
"no-empty-pattern": "error",
|
|
273
|
+
"no-eval": "error",
|
|
274
|
+
"no-ex-assign": "error",
|
|
275
|
+
"no-extend-native": "error",
|
|
276
|
+
"no-extra-bind": "error",
|
|
277
|
+
"no-extra-boolean-cast": "error",
|
|
278
|
+
"no-fallthrough": "error",
|
|
279
|
+
"no-func-assign": "error",
|
|
280
|
+
"no-global-assign": "error",
|
|
281
|
+
"no-implied-eval": "error",
|
|
282
|
+
"no-import-assign": "error",
|
|
283
|
+
"no-invalid-regexp": "error",
|
|
284
|
+
"no-irregular-whitespace": "error",
|
|
285
|
+
"no-iterator": "error",
|
|
286
|
+
"no-labels": ["error", {
|
|
287
|
+
allowLoop: false,
|
|
288
|
+
allowSwitch: false
|
|
289
|
+
}],
|
|
290
|
+
"no-lone-blocks": "error",
|
|
291
|
+
"no-loss-of-precision": "error",
|
|
292
|
+
"no-misleading-character-class": "error",
|
|
293
|
+
"no-multi-str": "error",
|
|
294
|
+
"no-new": "error",
|
|
295
|
+
"no-new-func": "error",
|
|
296
|
+
"no-new-native-nonconstructor": "error",
|
|
297
|
+
"no-new-wrappers": "error",
|
|
298
|
+
"no-obj-calls": "error",
|
|
299
|
+
"no-octal": "error",
|
|
300
|
+
"no-octal-escape": "error",
|
|
301
|
+
"no-proto": "error",
|
|
302
|
+
"no-prototype-builtins": "error",
|
|
303
|
+
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
304
|
+
"no-regex-spaces": "error",
|
|
305
|
+
"no-restricted-globals": [
|
|
306
|
+
"error",
|
|
307
|
+
{
|
|
308
|
+
message: "Use `globalThis` instead.",
|
|
309
|
+
name: "global"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
message: "Use `globalThis` instead.",
|
|
313
|
+
name: "self"
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
"no-restricted-properties": [
|
|
317
|
+
"error",
|
|
318
|
+
{
|
|
319
|
+
message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
|
|
320
|
+
property: "__proto__"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
message: "Use `Object.defineProperty` instead.",
|
|
324
|
+
property: "__defineGetter__"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
message: "Use `Object.defineProperty` instead.",
|
|
328
|
+
property: "__defineSetter__"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
332
|
+
property: "__lookupGetter__"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
336
|
+
property: "__lookupSetter__"
|
|
337
|
+
}
|
|
338
|
+
],
|
|
339
|
+
"no-restricted-syntax": [
|
|
340
|
+
"error",
|
|
341
|
+
"TSEnumDeclaration[const=true]",
|
|
342
|
+
"TSExportAssignment"
|
|
343
|
+
],
|
|
344
|
+
"no-self-assign": ["error", { props: true }],
|
|
345
|
+
"no-self-compare": "error",
|
|
346
|
+
"no-sequences": "error",
|
|
347
|
+
"no-shadow-restricted-names": "error",
|
|
348
|
+
"no-sparse-arrays": "error",
|
|
349
|
+
"no-template-curly-in-string": "error",
|
|
350
|
+
"no-this-before-super": "error",
|
|
351
|
+
"no-throw-literal": "error",
|
|
352
|
+
"no-undef": "error",
|
|
353
|
+
"no-undef-init": "error",
|
|
354
|
+
"no-unexpected-multiline": "error",
|
|
355
|
+
"no-unmodified-loop-condition": "error",
|
|
356
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
357
|
+
"no-unreachable": "error",
|
|
358
|
+
"no-unreachable-loop": "error",
|
|
359
|
+
"no-unsafe-finally": "error",
|
|
360
|
+
"no-unsafe-negation": "error",
|
|
361
|
+
"no-unused-expressions": ["error", {
|
|
362
|
+
allowShortCircuit: true,
|
|
363
|
+
allowTaggedTemplates: true,
|
|
364
|
+
allowTernary: true
|
|
365
|
+
}],
|
|
366
|
+
"no-unused-vars": ["error", {
|
|
367
|
+
args: "none",
|
|
368
|
+
caughtErrors: "none",
|
|
369
|
+
ignoreRestSiblings: true,
|
|
370
|
+
vars: "all"
|
|
371
|
+
}],
|
|
372
|
+
"no-use-before-define": ["error", {
|
|
373
|
+
classes: false,
|
|
374
|
+
functions: false,
|
|
375
|
+
variables: true
|
|
376
|
+
}],
|
|
377
|
+
"no-useless-backreference": "error",
|
|
378
|
+
"no-useless-call": "error",
|
|
379
|
+
"no-useless-catch": "error",
|
|
380
|
+
"no-useless-computed-key": "error",
|
|
381
|
+
"no-useless-constructor": "error",
|
|
382
|
+
"no-useless-rename": "error",
|
|
383
|
+
"no-useless-return": "error",
|
|
384
|
+
"no-var": "error",
|
|
385
|
+
"no-with": "error",
|
|
386
|
+
"object-shorthand": [
|
|
387
|
+
"error",
|
|
388
|
+
"always",
|
|
389
|
+
{
|
|
390
|
+
avoidQuotes: true,
|
|
391
|
+
ignoreConstructors: false
|
|
392
|
+
}
|
|
393
|
+
],
|
|
394
|
+
"one-var": ["error", { initialized: "never" }],
|
|
395
|
+
"prefer-arrow-callback": ["error", {
|
|
396
|
+
allowNamedFunctions: false,
|
|
397
|
+
allowUnboundThis: true
|
|
398
|
+
}],
|
|
399
|
+
"prefer-const": "warn",
|
|
400
|
+
"prefer-exponentiation-operator": "error",
|
|
401
|
+
"prefer-promise-reject-errors": "error",
|
|
402
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
403
|
+
"prefer-rest-params": "error",
|
|
404
|
+
"prefer-spread": "error",
|
|
405
|
+
"prefer-template": "error",
|
|
406
|
+
"symbol-description": "error",
|
|
407
|
+
"unicode-bom": ["error", "never"],
|
|
408
|
+
"use-isnan": ["error", {
|
|
409
|
+
enforceForIndexOf: true,
|
|
410
|
+
enforceForSwitchCase: true
|
|
411
|
+
}],
|
|
412
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
413
|
+
"vars-on-top": "error",
|
|
414
|
+
"yoda": ["error", "never"]
|
|
415
|
+
}
|
|
416
|
+
};
|
|
345
417
|
}
|
|
346
418
|
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/configs/jsonc.ts
|
|
347
421
|
function jsonc() {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
"jsonc/no-sparse-arrays": "warn",
|
|
371
|
-
"jsonc/object-curly-newline": ["warn", { consistent: true }],
|
|
372
|
-
"jsonc/object-curly-spacing": ["warn", "always"]
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
];
|
|
422
|
+
return [{
|
|
423
|
+
files: [
|
|
424
|
+
"**/*.json",
|
|
425
|
+
"**/*.jsonc",
|
|
426
|
+
"**/*.json5"
|
|
427
|
+
],
|
|
428
|
+
languageOptions: { parser: jsoncParser },
|
|
429
|
+
name: "jsonc",
|
|
430
|
+
plugins: { jsonc: pluginJsonc },
|
|
431
|
+
rules: {
|
|
432
|
+
"jsonc/array-bracket-newline": ["warn", "consistent"],
|
|
433
|
+
"jsonc/array-bracket-spacing": ["warn", "never"],
|
|
434
|
+
"jsonc/array-element-newline": ["warn", "consistent"],
|
|
435
|
+
"jsonc/comma-dangle": ["warn", "never"],
|
|
436
|
+
"jsonc/comma-style": ["warn", "last"],
|
|
437
|
+
"jsonc/indent": ["warn", indent],
|
|
438
|
+
"jsonc/key-spacing": "warn",
|
|
439
|
+
"jsonc/no-sparse-arrays": "warn",
|
|
440
|
+
"jsonc/object-curly-newline": ["warn", { consistent: true }],
|
|
441
|
+
"jsonc/object-curly-spacing": ["warn", "always"]
|
|
442
|
+
}
|
|
443
|
+
}];
|
|
376
444
|
}
|
|
377
445
|
|
|
378
|
-
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region package.json
|
|
448
|
+
var version = "4.2.0";
|
|
379
449
|
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/mine/astro-multi-top-level-element-indent.ts
|
|
380
452
|
const name$3 = "astro-multi-top-level-element-indent";
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
}
|
|
453
|
+
var astro_multi_top_level_element_indent_default = createRule({
|
|
454
|
+
name: name$3,
|
|
455
|
+
meta: {
|
|
456
|
+
docs: { description: "Fix astro multi top level element indent" },
|
|
457
|
+
schema: [],
|
|
458
|
+
type: "layout",
|
|
459
|
+
fixable: "whitespace",
|
|
460
|
+
messages: { unexpectedSpace: "Unexpected Space" }
|
|
461
|
+
},
|
|
462
|
+
create(context) {
|
|
463
|
+
return { AstroFragment(node) {
|
|
464
|
+
const children = node.children.filter((it) => it.type === "JSXElement" && it.loc.start.column !== 0);
|
|
465
|
+
if (children.length === 0) return;
|
|
466
|
+
context.report({
|
|
467
|
+
loc: {
|
|
468
|
+
line: 0,
|
|
469
|
+
column: 0
|
|
470
|
+
},
|
|
471
|
+
messageId: "unexpectedSpace",
|
|
472
|
+
fix(fixer) {
|
|
473
|
+
return children.map((it) => {
|
|
474
|
+
return fixer.removeRange([it.range[0] - it.loc.start.column, it.range[0]]);
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
} };
|
|
479
|
+
}
|
|
412
480
|
});
|
|
413
481
|
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/mine/utils.ts
|
|
414
484
|
function isDocumentStart(node) {
|
|
415
|
-
|
|
485
|
+
return node.range[0] === 0;
|
|
416
486
|
}
|
|
417
487
|
function isLineStart(node) {
|
|
418
|
-
|
|
488
|
+
return node.loc.start.column === 0;
|
|
419
489
|
}
|
|
420
490
|
function numOfLines(left, right) {
|
|
421
|
-
|
|
491
|
+
return right.loc.start.line - left.loc.end.line;
|
|
422
492
|
}
|
|
423
493
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region src/mine/astro-no-blank-before-root-element.ts
|
|
496
|
+
const name$2 = "astro-no-blank-before-root-element";
|
|
497
|
+
var astro_no_blank_before_root_element_default = createRule({
|
|
498
|
+
name: name$2,
|
|
499
|
+
meta: {
|
|
500
|
+
docs: { description: "Enforce no blank before astro element" },
|
|
501
|
+
schema: [],
|
|
502
|
+
type: "layout",
|
|
503
|
+
fixable: "whitespace",
|
|
504
|
+
messages: { unexpectedBlank: "Unexpected blank" }
|
|
505
|
+
},
|
|
506
|
+
create(context) {
|
|
507
|
+
return { AstroFragment(node) {
|
|
508
|
+
const token = context.sourceCode.getTokenBefore(node);
|
|
509
|
+
if (!token && !isDocumentStart(node)) context.report({
|
|
510
|
+
fix: (fixer) => fixer.removeRange([0, node.range[0]]),
|
|
511
|
+
loc: {
|
|
512
|
+
start: {
|
|
513
|
+
line: 1,
|
|
514
|
+
column: 0
|
|
515
|
+
},
|
|
516
|
+
end: node.loc.start
|
|
517
|
+
},
|
|
518
|
+
messageId: "unexpectedBlank"
|
|
519
|
+
});
|
|
520
|
+
else if (token && token.value === "---" && (!isLineStart(node) || numOfLines(token, node) !== 2)) context.report({
|
|
521
|
+
fix: (fixer) => fixer.replaceTextRange([token.range[1], node.range[0]], "\n\n"),
|
|
522
|
+
loc: {
|
|
523
|
+
start: token.loc.end,
|
|
524
|
+
end: node.loc.start
|
|
525
|
+
},
|
|
526
|
+
messageId: "unexpectedBlank"
|
|
527
|
+
});
|
|
528
|
+
} };
|
|
529
|
+
}
|
|
458
530
|
});
|
|
459
531
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
messageId: "unexpectedBlank"
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
},
|
|
486
|
-
AstroFragment(node) {
|
|
487
|
-
const [left, right] = context.sourceCode.getTokensBefore(node, { count: 2 });
|
|
488
|
-
if (left && left.value !== "---" && right && right.value === "---" && numOfLines(left, right) !== 1) {
|
|
489
|
-
context.report({
|
|
490
|
-
fix: (fixer) => fixer.replaceTextRange([left.range[1], right.range[0]], "\n"),
|
|
491
|
-
loc: { start: left.loc.end, end: right.loc.start },
|
|
492
|
-
messageId: "unexpectedBlank"
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
}
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/mine/no-newline-in-closing-tag.ts
|
|
534
|
+
const name$1 = "no-newline-in-closing-tag";
|
|
535
|
+
var no_newline_in_closing_tag_default = createRule({
|
|
536
|
+
name: name$1,
|
|
537
|
+
meta: {
|
|
538
|
+
docs: { description: "Enforce no newline in closing tag" },
|
|
539
|
+
schema: [],
|
|
540
|
+
type: "layout",
|
|
541
|
+
fixable: "whitespace",
|
|
542
|
+
messages: { unexpectedSpace: "Unexpected newline in closing tag" }
|
|
543
|
+
},
|
|
544
|
+
create(context) {
|
|
545
|
+
return { JSXClosingElement(node) {
|
|
546
|
+
const code = context.sourceCode.getText(node);
|
|
547
|
+
if (/\n/.test(code)) context.report({
|
|
548
|
+
fix: (fixer) => fixer.replaceText(node, code.replace(/\n/g, "")),
|
|
549
|
+
messageId: "unexpectedSpace",
|
|
550
|
+
node
|
|
551
|
+
});
|
|
552
|
+
} };
|
|
553
|
+
}
|
|
498
554
|
});
|
|
499
555
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
context.report({
|
|
523
|
-
fix: (fixer) => fixer.replaceText(node, replaceValue),
|
|
524
|
-
messageId: "unexpectedSpace",
|
|
525
|
-
node
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
ExportNamedDeclaration(node) {
|
|
530
|
-
if (node.declaration || node.specifiers.length > 0) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
const code = context.sourceCode.getText(node);
|
|
534
|
-
const replaceValue = "export {}";
|
|
535
|
-
if (code !== replaceValue) {
|
|
536
|
-
context.report({
|
|
537
|
-
fix: (fixer) => fixer.replaceText(node, replaceValue),
|
|
538
|
-
messageId: "unexpectedSpace",
|
|
539
|
-
node
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
}
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region src/mine/no-space-before-opening-tag.ts
|
|
558
|
+
const name = "no-space-before-opening-tag";
|
|
559
|
+
var no_space_before_opening_tag_default = createRule({
|
|
560
|
+
name,
|
|
561
|
+
meta: {
|
|
562
|
+
docs: { description: "Enforce no space before opening tag" },
|
|
563
|
+
schema: [],
|
|
564
|
+
type: "layout",
|
|
565
|
+
fixable: "whitespace",
|
|
566
|
+
messages: { unexpectedSpace: "Unexpected space before opening tag" }
|
|
567
|
+
},
|
|
568
|
+
create(context) {
|
|
569
|
+
return { JSXOpeningElement(node) {
|
|
570
|
+
const afterToken = context.sourceCode.getTokenAfter(node);
|
|
571
|
+
if (afterToken?.value.startsWith(" ")) context.report({
|
|
572
|
+
fix: (fixer) => fixer.replaceText(afterToken, afterToken.value.trimStart()),
|
|
573
|
+
messageId: "unexpectedSpace",
|
|
574
|
+
node
|
|
575
|
+
});
|
|
576
|
+
} };
|
|
577
|
+
}
|
|
545
578
|
});
|
|
546
579
|
|
|
580
|
+
//#endregion
|
|
581
|
+
//#region src/mine/index.ts
|
|
547
582
|
const rules = {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
583
|
+
[name$3]: astro_multi_top_level_element_indent_default,
|
|
584
|
+
[name$2]: astro_no_blank_before_root_element_default,
|
|
585
|
+
[name$1]: no_newline_in_closing_tag_default,
|
|
586
|
+
[name]: no_space_before_opening_tag_default
|
|
552
587
|
};
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
588
|
+
var mine_default = {
|
|
589
|
+
meta: {
|
|
590
|
+
name: "mine",
|
|
591
|
+
version
|
|
592
|
+
},
|
|
593
|
+
rules
|
|
559
594
|
};
|
|
560
595
|
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region src/configs/mine.ts
|
|
561
598
|
function mine() {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
};
|
|
599
|
+
return {
|
|
600
|
+
name: "mine",
|
|
601
|
+
plugins: { mine: mine_default },
|
|
602
|
+
rules: {
|
|
603
|
+
"mine/no-newline-in-closing-tag": "warn",
|
|
604
|
+
"mine/no-space-before-opening-tag": "warn"
|
|
605
|
+
}
|
|
606
|
+
};
|
|
572
607
|
}
|
|
573
608
|
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/configs/overrides.ts
|
|
574
611
|
function overrides() {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
612
|
+
const configFileNames = [
|
|
613
|
+
"eslint",
|
|
614
|
+
"astro",
|
|
615
|
+
"vite",
|
|
616
|
+
"build",
|
|
617
|
+
"nuxt",
|
|
618
|
+
"unocss",
|
|
619
|
+
"vitest"
|
|
620
|
+
];
|
|
621
|
+
const extensions = [
|
|
622
|
+
"js",
|
|
623
|
+
"mjs",
|
|
624
|
+
"cjs",
|
|
625
|
+
"ts",
|
|
626
|
+
"mts",
|
|
627
|
+
"cts"
|
|
628
|
+
];
|
|
629
|
+
return [
|
|
630
|
+
{
|
|
631
|
+
name: "override/sort-config-files",
|
|
632
|
+
files: [...configFileNames.reduce((acc, cur) => [...acc, ...extensions.map((ext) => `${cur}.config.${ext}`)], [])],
|
|
633
|
+
rules: { "perfectionist/sort-objects": "warn" }
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
name: "override/jsonc-sort",
|
|
637
|
+
files: ["**/.vscode/settings.json", "**/tsconfig.json"],
|
|
638
|
+
rules: {
|
|
639
|
+
"jsonc/sort-array-values": ["warn", {
|
|
640
|
+
order: { type: "asc" },
|
|
641
|
+
pathPattern: ".*"
|
|
642
|
+
}],
|
|
643
|
+
"jsonc/sort-keys": ["warn", {
|
|
644
|
+
order: { type: "asc" },
|
|
645
|
+
pathPattern: ".*"
|
|
646
|
+
}]
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
name: "override/package-json",
|
|
651
|
+
files: ["**/package.json"],
|
|
652
|
+
rules: {
|
|
653
|
+
"style/no-multiple-empty-lines": ["warn", { max: 0 }],
|
|
654
|
+
"jsonc/sort-array-values": ["warn", {
|
|
655
|
+
order: { type: "asc" },
|
|
656
|
+
pathPattern: "^files$"
|
|
657
|
+
}],
|
|
658
|
+
"jsonc/sort-keys": [
|
|
659
|
+
"warn",
|
|
660
|
+
{
|
|
661
|
+
order: packageJsonTopLevelOrder,
|
|
662
|
+
pathPattern: "^$"
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
order: { type: "asc" },
|
|
666
|
+
pathPattern: "^(?:exports|scripts)"
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
order: { type: "asc" },
|
|
670
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
671
|
+
}
|
|
672
|
+
]
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
];
|
|
619
676
|
}
|
|
620
677
|
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region src/configs/perfectionist.ts
|
|
621
680
|
function perfectionist() {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
681
|
+
return {
|
|
682
|
+
name: "perfectionist",
|
|
683
|
+
plugins: { perfectionist: pluginPerfectionist },
|
|
684
|
+
rules: {
|
|
685
|
+
"perfectionist/sort-exports": ["warn", {
|
|
686
|
+
order: "asc",
|
|
687
|
+
type: "natural"
|
|
688
|
+
}],
|
|
689
|
+
"perfectionist/sort-imports": ["warn", {
|
|
690
|
+
newlinesBetween: 0,
|
|
691
|
+
type: "alphabetical"
|
|
692
|
+
}],
|
|
693
|
+
"perfectionist/sort-named-exports": ["warn", {
|
|
694
|
+
order: "asc",
|
|
695
|
+
type: "natural"
|
|
696
|
+
}],
|
|
697
|
+
"sort-imports": ["warn", {
|
|
698
|
+
ignoreCase: false,
|
|
699
|
+
ignoreDeclarationSort: true,
|
|
700
|
+
ignoreMemberSort: false
|
|
701
|
+
}]
|
|
702
|
+
}
|
|
703
|
+
};
|
|
640
704
|
}
|
|
641
705
|
|
|
706
|
+
//#endregion
|
|
707
|
+
//#region src/configs/regexp.ts
|
|
642
708
|
function regexp() {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
}
|
|
717
|
-
};
|
|
709
|
+
return {
|
|
710
|
+
name: "regexp",
|
|
711
|
+
plugins: { regexp: pluginRegExp },
|
|
712
|
+
rules: {
|
|
713
|
+
"no-control-regex": "warn",
|
|
714
|
+
"no-empty-character-class": "off",
|
|
715
|
+
"no-invalid-regexp": "off",
|
|
716
|
+
"no-misleading-character-class": "warn",
|
|
717
|
+
"no-regex-spaces": "warn",
|
|
718
|
+
"no-useless-backreference": "off",
|
|
719
|
+
"prefer-regex-literals": "warn",
|
|
720
|
+
"regexp/confusing-quantifier": "warn",
|
|
721
|
+
"regexp/control-character-escape": "warn",
|
|
722
|
+
"regexp/match-any": "warn",
|
|
723
|
+
"regexp/negation": "warn",
|
|
724
|
+
"regexp/no-contradiction-with-assertion": "warn",
|
|
725
|
+
"regexp/no-dupe-characters-character-class": "warn",
|
|
726
|
+
"regexp/no-dupe-disjunctions": "warn",
|
|
727
|
+
"regexp/no-empty-alternative": "warn",
|
|
728
|
+
"regexp/no-empty-capturing-group": "warn",
|
|
729
|
+
"regexp/no-empty-character-class": "warn",
|
|
730
|
+
"regexp/no-empty-group": "warn",
|
|
731
|
+
"regexp/no-empty-lookarounds-assertion": "warn",
|
|
732
|
+
"regexp/no-empty-string-literal": "warn",
|
|
733
|
+
"regexp/no-escape-backspace": "warn",
|
|
734
|
+
"regexp/no-extra-lookaround-assertions": "warn",
|
|
735
|
+
"regexp/no-invalid-regexp": "warn",
|
|
736
|
+
"regexp/no-invisible-character": "warn",
|
|
737
|
+
"regexp/no-lazy-ends": "warn",
|
|
738
|
+
"regexp/no-legacy-features": "warn",
|
|
739
|
+
"regexp/no-misleading-capturing-group": "warn",
|
|
740
|
+
"regexp/no-misleading-unicode-character": "warn",
|
|
741
|
+
"regexp/no-missing-g-flag": "warn",
|
|
742
|
+
"regexp/no-non-standard-flag": "warn",
|
|
743
|
+
"regexp/no-obscure-range": "warn",
|
|
744
|
+
"regexp/no-optional-assertion": "warn",
|
|
745
|
+
"regexp/no-potentially-useless-backreference": "warn",
|
|
746
|
+
"regexp/no-super-linear-backtracking": "warn",
|
|
747
|
+
"regexp/no-trivially-nested-assertion": "warn",
|
|
748
|
+
"regexp/no-trivially-nested-quantifier": "warn",
|
|
749
|
+
"regexp/no-unused-capturing-group": "warn",
|
|
750
|
+
"regexp/no-useless-assertions": "warn",
|
|
751
|
+
"regexp/no-useless-backreference": "warn",
|
|
752
|
+
"regexp/no-useless-character-class": "warn",
|
|
753
|
+
"regexp/no-useless-dollar-replacements": "warn",
|
|
754
|
+
"regexp/no-useless-escape": "warn",
|
|
755
|
+
"regexp/no-useless-flag": "warn",
|
|
756
|
+
"regexp/no-useless-lazy": "warn",
|
|
757
|
+
"regexp/no-useless-non-capturing-group": "warn",
|
|
758
|
+
"regexp/no-useless-quantifier": "warn",
|
|
759
|
+
"regexp/no-useless-range": "warn",
|
|
760
|
+
"regexp/no-useless-set-operand": "warn",
|
|
761
|
+
"regexp/no-useless-string-literal": "warn",
|
|
762
|
+
"regexp/no-useless-two-nums-quantifier": "warn",
|
|
763
|
+
"regexp/no-zero-quantifier": "warn",
|
|
764
|
+
"regexp/optimal-lookaround-quantifier": "warn",
|
|
765
|
+
"regexp/optimal-quantifier-concatenation": "warn",
|
|
766
|
+
"regexp/prefer-character-class": "warn",
|
|
767
|
+
"regexp/prefer-d": "warn",
|
|
768
|
+
"regexp/prefer-plus-quantifier": "warn",
|
|
769
|
+
"regexp/prefer-predefined-assertion": "warn",
|
|
770
|
+
"regexp/prefer-question-quantifier": "warn",
|
|
771
|
+
"regexp/prefer-range": "warn",
|
|
772
|
+
"regexp/prefer-set-operation": "warn",
|
|
773
|
+
"regexp/prefer-star-quantifier": "warn",
|
|
774
|
+
"regexp/prefer-unicode-codepoint-escapes": "warn",
|
|
775
|
+
"regexp/prefer-w": "warn",
|
|
776
|
+
"regexp/simplify-set-operations": "warn",
|
|
777
|
+
"regexp/sort-flags": "warn",
|
|
778
|
+
"regexp/strict": "warn",
|
|
779
|
+
"regexp/use-ignore-case": "warn"
|
|
780
|
+
}
|
|
781
|
+
};
|
|
718
782
|
}
|
|
719
783
|
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region src/configs/stylistic.ts
|
|
720
786
|
function stylistic() {
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
787
|
+
return {
|
|
788
|
+
name: "stylistic",
|
|
789
|
+
plugins: { style: pluginStylistic },
|
|
790
|
+
rules: {
|
|
791
|
+
"style/array-bracket-newline": ["warn", "consistent"],
|
|
792
|
+
"style/array-bracket-spacing": "warn",
|
|
793
|
+
"style/arrow-spacing": "warn",
|
|
794
|
+
"style/block-spacing": "warn",
|
|
795
|
+
"style/comma-dangle": ["warn", "always-multiline"],
|
|
796
|
+
"style/comma-spacing": "warn",
|
|
797
|
+
"style/comma-style": "warn",
|
|
798
|
+
"style/curly-newline": "warn",
|
|
799
|
+
"style/eol-last": "warn",
|
|
800
|
+
"style/function-call-spacing": "warn",
|
|
801
|
+
"style/implicit-arrow-linebreak": "warn",
|
|
802
|
+
"style/indent": ["warn", indent],
|
|
803
|
+
"style/indent-binary-ops": ["warn", indent],
|
|
804
|
+
"style/jsx-child-element-spacing": "warn",
|
|
805
|
+
"style/jsx-closing-bracket-location": "warn",
|
|
806
|
+
"style/jsx-closing-tag-location": "warn",
|
|
807
|
+
"style/jsx-curly-brace-presence": "warn",
|
|
808
|
+
"style/jsx-curly-newline": "warn",
|
|
809
|
+
"style/jsx-curly-spacing": ["warn", {
|
|
810
|
+
children: true,
|
|
811
|
+
when: "never"
|
|
812
|
+
}],
|
|
813
|
+
"style/jsx-equals-spacing": "warn",
|
|
814
|
+
"style/jsx-max-props-per-line": "off",
|
|
815
|
+
"style/jsx-pascal-case": "warn",
|
|
816
|
+
"style/jsx-quotes": "warn",
|
|
817
|
+
"style/jsx-self-closing-comp": ["warn", {
|
|
818
|
+
component: true,
|
|
819
|
+
html: false
|
|
820
|
+
}],
|
|
821
|
+
"style/jsx-tag-spacing": ["warn", {
|
|
822
|
+
afterOpening: "never",
|
|
823
|
+
beforeClosing: "never",
|
|
824
|
+
beforeSelfClosing: "always",
|
|
825
|
+
closingSlash: "never"
|
|
826
|
+
}],
|
|
827
|
+
"style/jsx-wrap-multilines": "warn",
|
|
828
|
+
"style/key-spacing": "warn",
|
|
829
|
+
"style/keyword-spacing": "warn",
|
|
830
|
+
"style/no-mixed-spaces-and-tabs": "warn",
|
|
831
|
+
"style/no-multi-spaces": "warn",
|
|
832
|
+
"style/no-multiple-empty-lines": ["warn", {
|
|
833
|
+
max: 1,
|
|
834
|
+
maxBOF: 0,
|
|
835
|
+
maxEOF: 0
|
|
836
|
+
}],
|
|
837
|
+
"style/no-trailing-spaces": "warn",
|
|
838
|
+
"style/no-whitespace-before-property": "warn",
|
|
839
|
+
"style/nonblock-statement-body-position": ["warn", "below"],
|
|
840
|
+
"style/object-curly-newline": ["warn", { consistent: true }],
|
|
841
|
+
"style/object-curly-spacing": ["warn", "always"],
|
|
842
|
+
"style/operator-linebreak": ["warn", "before"],
|
|
843
|
+
"style/quote-props": ["warn", "consistent-as-needed"],
|
|
844
|
+
"style/quotes": ["warn", "single"],
|
|
845
|
+
"style/rest-spread-spacing": "warn",
|
|
846
|
+
"style/semi": ["warn", "never"],
|
|
847
|
+
"style/semi-spacing": "warn",
|
|
848
|
+
"style/space-before-blocks": "warn",
|
|
849
|
+
"style/space-before-function-paren": ["warn", "never"],
|
|
850
|
+
"style/space-in-parens": "warn",
|
|
851
|
+
"style/space-infix-ops": "warn",
|
|
852
|
+
"style/space-unary-ops": "warn",
|
|
853
|
+
"style/spaced-comment": [
|
|
854
|
+
"warn",
|
|
855
|
+
"always",
|
|
856
|
+
{ block: { balanced: true } }
|
|
857
|
+
],
|
|
858
|
+
"style/type-annotation-spacing": "warn",
|
|
859
|
+
"style/type-generic-spacing": "warn",
|
|
860
|
+
"style/type-named-tuple-spacing": "warn"
|
|
861
|
+
}
|
|
862
|
+
};
|
|
780
863
|
}
|
|
781
864
|
|
|
865
|
+
//#endregion
|
|
866
|
+
//#region src/configs/typescript.ts
|
|
782
867
|
function typescript() {
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
868
|
+
return [{
|
|
869
|
+
files: [
|
|
870
|
+
"**/*.?([cm])ts",
|
|
871
|
+
"**/*.?([cm])tsx",
|
|
872
|
+
"**/*.vue"
|
|
873
|
+
],
|
|
874
|
+
languageOptions: {
|
|
875
|
+
parser: tsParser,
|
|
876
|
+
parserOptions: {
|
|
877
|
+
extraFileExtensions: [".vue"],
|
|
878
|
+
sourceType: "module"
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
name: "typescript",
|
|
882
|
+
plugins: { ts: pluginTypescript },
|
|
883
|
+
rules: {
|
|
884
|
+
"constructor-super": "off",
|
|
885
|
+
"getter-return": "off",
|
|
886
|
+
"no-array-constructor": "off",
|
|
887
|
+
"no-class-assign": "off",
|
|
888
|
+
"no-const-assign": "off",
|
|
889
|
+
"no-dupe-args": "off",
|
|
890
|
+
"no-dupe-class-members": "off",
|
|
891
|
+
"no-dupe-keys": "off",
|
|
892
|
+
"no-func-assign": "off",
|
|
893
|
+
"no-import-assign": "off",
|
|
894
|
+
"no-new-native-nonconstructor": "off",
|
|
895
|
+
"no-new-symbol": "off",
|
|
896
|
+
"no-obj-calls": "off",
|
|
897
|
+
"no-redeclare": "off",
|
|
898
|
+
"no-setter-return": "off",
|
|
899
|
+
"no-this-before-super": "off",
|
|
900
|
+
"no-undef": "off",
|
|
901
|
+
"no-unreachable": "off",
|
|
902
|
+
"no-unsafe-negation": "off",
|
|
903
|
+
"no-unused-expressions": "off",
|
|
904
|
+
"no-unused-vars": "off",
|
|
905
|
+
"no-use-before-define": "off",
|
|
906
|
+
"no-useless-constructor": "off",
|
|
907
|
+
"no-var": "error",
|
|
908
|
+
"no-with": "off",
|
|
909
|
+
"prefer-const": "error",
|
|
910
|
+
"prefer-rest-params": "error",
|
|
911
|
+
"prefer-spread": "error",
|
|
912
|
+
"ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
913
|
+
"ts/consistent-type-definitions": ["error", "interface"],
|
|
914
|
+
"ts/consistent-type-imports": ["error", {
|
|
915
|
+
disallowTypeAnnotations: false,
|
|
916
|
+
fixStyle: "separate-type-imports",
|
|
917
|
+
prefer: "type-imports"
|
|
918
|
+
}],
|
|
919
|
+
"ts/explicit-function-return-type": "off",
|
|
920
|
+
"ts/method-signature-style": ["error", "property"],
|
|
921
|
+
"ts/no-array-constructor": "error",
|
|
922
|
+
"ts/no-dupe-class-members": "error",
|
|
923
|
+
"ts/no-duplicate-enum-values": "error",
|
|
924
|
+
"ts/no-dynamic-delete": "off",
|
|
925
|
+
"ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
|
|
926
|
+
"ts/no-explicit-any": "off",
|
|
927
|
+
"ts/no-extra-non-null-assertion": "error",
|
|
928
|
+
"ts/no-extraneous-class": "off",
|
|
929
|
+
"ts/no-import-type-side-effects": "error",
|
|
930
|
+
"ts/no-invalid-void-type": "off",
|
|
931
|
+
"ts/no-misused-new": "error",
|
|
932
|
+
"ts/no-namespace": "error",
|
|
933
|
+
"ts/no-non-null-asserted-nullish-coalescing": "error",
|
|
934
|
+
"ts/no-non-null-asserted-optional-chain": "error",
|
|
935
|
+
"ts/no-non-null-assertion": "off",
|
|
936
|
+
"ts/no-redeclare": ["error", { builtinGlobals: false }],
|
|
937
|
+
"ts/no-require-imports": "error",
|
|
938
|
+
"ts/no-this-alias": "error",
|
|
939
|
+
"ts/no-unnecessary-type-constraint": "error",
|
|
940
|
+
"ts/no-unsafe-declaration-merging": "error",
|
|
941
|
+
"ts/no-unsafe-function-type": "error",
|
|
942
|
+
"ts/no-unused-expressions": ["error", {
|
|
943
|
+
allowShortCircuit: true,
|
|
944
|
+
allowTaggedTemplates: true,
|
|
945
|
+
allowTernary: true
|
|
946
|
+
}],
|
|
947
|
+
"ts/no-unused-vars": "off",
|
|
948
|
+
"ts/no-use-before-define": ["error", {
|
|
949
|
+
classes: false,
|
|
950
|
+
functions: false,
|
|
951
|
+
variables: true
|
|
952
|
+
}],
|
|
953
|
+
"ts/no-useless-constructor": "off",
|
|
954
|
+
"ts/no-wrapper-object-types": "error",
|
|
955
|
+
"ts/prefer-as-const": "error",
|
|
956
|
+
"ts/prefer-literal-enum-member": "error",
|
|
957
|
+
"ts/prefer-namespace-keyword": "error",
|
|
958
|
+
"ts/triple-slash-reference": "off",
|
|
959
|
+
"ts/unified-signatures": "off"
|
|
960
|
+
}
|
|
961
|
+
}];
|
|
871
962
|
}
|
|
872
963
|
|
|
964
|
+
//#endregion
|
|
965
|
+
//#region src/configs/unicorn.ts
|
|
873
966
|
function unicorn() {
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
}
|
|
906
|
-
};
|
|
967
|
+
return {
|
|
968
|
+
name: "unicorn",
|
|
969
|
+
plugins: { unicorn: pluginUnicorn },
|
|
970
|
+
rules: {
|
|
971
|
+
"unicorn/consistent-empty-array-spread": "warn",
|
|
972
|
+
"unicorn/empty-brace-spaces": "warn",
|
|
973
|
+
"unicorn/error-message": "warn",
|
|
974
|
+
"unicorn/escape-case": "warn",
|
|
975
|
+
"unicorn/explicit-length-check": "warn",
|
|
976
|
+
"unicorn/new-for-builtins": "warn",
|
|
977
|
+
"unicorn/no-instanceof-builtins": "warn",
|
|
978
|
+
"unicorn/no-negation-in-equality-check": "warn",
|
|
979
|
+
"unicorn/no-new-array": "warn",
|
|
980
|
+
"unicorn/no-new-buffer": "warn",
|
|
981
|
+
"unicorn/no-useless-length-check": "warn",
|
|
982
|
+
"unicorn/number-literal-case": "warn",
|
|
983
|
+
"unicorn/prefer-array-flat-map": "warn",
|
|
984
|
+
"unicorn/prefer-dom-node-text-content": "warn",
|
|
985
|
+
"unicorn/prefer-includes": "warn",
|
|
986
|
+
"unicorn/prefer-logical-operator-over-ternary": "warn",
|
|
987
|
+
"unicorn/prefer-node-protocol": "warn",
|
|
988
|
+
"unicorn/prefer-number-properties": "warn",
|
|
989
|
+
"unicorn/prefer-string-starts-ends-with": "warn",
|
|
990
|
+
"unicorn/prefer-string-trim-start-end": "warn",
|
|
991
|
+
"unicorn/prefer-ternary": "warn",
|
|
992
|
+
"unicorn/prefer-type-error": "warn",
|
|
993
|
+
"unicorn/string-content": "warn",
|
|
994
|
+
"unicorn/switch-case-braces": "warn",
|
|
995
|
+
"unicorn/throw-new-error": "warn"
|
|
996
|
+
}
|
|
997
|
+
};
|
|
907
998
|
}
|
|
908
999
|
|
|
1000
|
+
//#endregion
|
|
1001
|
+
//#region src/configs/unocss.ts
|
|
909
1002
|
function unocss() {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
rules: {
|
|
916
|
-
"unocss/order": "warn"
|
|
917
|
-
}
|
|
918
|
-
};
|
|
1003
|
+
return {
|
|
1004
|
+
name: "unocss",
|
|
1005
|
+
plugins: { unocss: pluginUnocss },
|
|
1006
|
+
rules: { "unocss/order": "warn" }
|
|
1007
|
+
};
|
|
919
1008
|
}
|
|
920
1009
|
|
|
1010
|
+
//#endregion
|
|
1011
|
+
//#region src/configs/unused-imports.ts
|
|
921
1012
|
function unusedImports() {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
varsIgnorePattern: "^_"
|
|
937
|
-
}
|
|
938
|
-
]
|
|
939
|
-
}
|
|
940
|
-
};
|
|
1013
|
+
return {
|
|
1014
|
+
name: "unused-imports",
|
|
1015
|
+
plugins: { "unused-imports": pluginUnusedImports },
|
|
1016
|
+
rules: {
|
|
1017
|
+
"unused-imports/no-unused-imports": "warn",
|
|
1018
|
+
"unused-imports/no-unused-vars": ["warn", {
|
|
1019
|
+
args: "after-used",
|
|
1020
|
+
argsIgnorePattern: "^_",
|
|
1021
|
+
ignoreRestSiblings: true,
|
|
1022
|
+
vars: "all",
|
|
1023
|
+
varsIgnorePattern: "^_"
|
|
1024
|
+
}]
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
941
1027
|
}
|
|
942
1028
|
|
|
1029
|
+
//#endregion
|
|
1030
|
+
//#region src/configs/vue.ts
|
|
943
1031
|
async function vue() {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1032
|
+
const pluginVue = await findDynamicPlugin("eslint-plugin-vue");
|
|
1033
|
+
return pluginVue && [{
|
|
1034
|
+
files: ["**/*.vue"],
|
|
1035
|
+
languageOptions: {
|
|
1036
|
+
parser: findParser(pluginVue),
|
|
1037
|
+
parserOptions: {
|
|
1038
|
+
ecmaFeatures: { jsx: true },
|
|
1039
|
+
extraFileExtensions: [".vue"],
|
|
1040
|
+
globals: {
|
|
1041
|
+
computed: "readonly",
|
|
1042
|
+
defineEmits: "readonly",
|
|
1043
|
+
defineExpose: "readonly",
|
|
1044
|
+
defineProps: "readonly",
|
|
1045
|
+
onMounted: "readonly",
|
|
1046
|
+
onUnmounted: "readonly",
|
|
1047
|
+
reactive: "readonly",
|
|
1048
|
+
ref: "readonly",
|
|
1049
|
+
shallowReactive: "readonly",
|
|
1050
|
+
shallowRef: "readonly",
|
|
1051
|
+
toRef: "readonly",
|
|
1052
|
+
toRefs: "readonly",
|
|
1053
|
+
watch: "readonly",
|
|
1054
|
+
watchEffect: "readonly"
|
|
1055
|
+
},
|
|
1056
|
+
parser: tsParser,
|
|
1057
|
+
sourceType: "module"
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
name: "vue",
|
|
1061
|
+
plugins: { vue: pluginVue },
|
|
1062
|
+
processor: pluginVue.processors?.[".vue"],
|
|
1063
|
+
rules: {
|
|
1064
|
+
...pluginVue.configs["flat/essential"].map((c) => c.rules).reduce((acc, cur) => ({
|
|
1065
|
+
...acc,
|
|
1066
|
+
...cur
|
|
1067
|
+
}), {}),
|
|
1068
|
+
"vue/attribute-hyphenation": "warn",
|
|
1069
|
+
"vue/attributes-order": ["error", {
|
|
1070
|
+
alphabetical: false,
|
|
1071
|
+
order: [
|
|
1072
|
+
"DEFINITION",
|
|
1073
|
+
"LIST_RENDERING",
|
|
1074
|
+
"CONDITIONALS",
|
|
1075
|
+
"RENDER_MODIFIERS",
|
|
1076
|
+
"UNIQUE",
|
|
1077
|
+
"TWO_WAY_BINDING",
|
|
1078
|
+
"OTHER_DIRECTIVES",
|
|
1079
|
+
"SLOT",
|
|
1080
|
+
"CONTENT",
|
|
1081
|
+
"GLOBAL",
|
|
1082
|
+
"ATTR_SHORTHAND_BOOL",
|
|
1083
|
+
"ATTR_STATIC",
|
|
1084
|
+
"ATTR_DYNAMIC",
|
|
1085
|
+
"EVENTS"
|
|
1086
|
+
]
|
|
1087
|
+
}],
|
|
1088
|
+
"vue/block-order": ["warn", { order: [
|
|
1089
|
+
"script",
|
|
1090
|
+
"template",
|
|
1091
|
+
"style"
|
|
1092
|
+
] }],
|
|
1093
|
+
"vue/block-tag-newline": "warn",
|
|
1094
|
+
"vue/component-name-in-template-casing": "warn",
|
|
1095
|
+
"vue/component-options-name-casing": ["warn", "PascalCase"],
|
|
1096
|
+
"vue/custom-event-name-casing": ["warn", "kebab-case"],
|
|
1097
|
+
"vue/define-emits-declaration": "warn",
|
|
1098
|
+
"vue/define-macros-order": "warn",
|
|
1099
|
+
"vue/define-props-declaration": "warn",
|
|
1100
|
+
"vue/first-attribute-linebreak": "warn",
|
|
1101
|
+
"vue/html-button-has-type": "warn",
|
|
1102
|
+
"vue/html-closing-bracket-newline": "warn",
|
|
1103
|
+
"vue/html-closing-bracket-spacing": "warn",
|
|
1104
|
+
"vue/html-comment-content-newline": "warn",
|
|
1105
|
+
"vue/html-comment-content-spacing": "warn",
|
|
1106
|
+
"vue/html-comment-indent": ["warn", indent],
|
|
1107
|
+
"vue/html-indent": ["warn", indent],
|
|
1108
|
+
"vue/html-quotes": "warn",
|
|
1109
|
+
"vue/html-self-closing": ["warn", {
|
|
1110
|
+
html: {
|
|
1111
|
+
component: "always",
|
|
1112
|
+
normal: "never",
|
|
1113
|
+
void: "never"
|
|
1114
|
+
},
|
|
1115
|
+
math: "always",
|
|
1116
|
+
svg: "always"
|
|
1117
|
+
}],
|
|
1118
|
+
"vue/multi-word-component-names": "off",
|
|
1119
|
+
"vue/mustache-interpolation-spacing": "warn",
|
|
1120
|
+
"vue/no-import-compiler-macros": "warn",
|
|
1121
|
+
"vue/no-multi-spaces": "warn",
|
|
1122
|
+
"vue/no-ref-object-reactivity-loss": "warn",
|
|
1123
|
+
"vue/no-spaces-around-equal-signs-in-attribute": "warn",
|
|
1124
|
+
"vue/no-static-inline-styles": "warn",
|
|
1125
|
+
"vue/no-template-shadow": "warn",
|
|
1126
|
+
"vue/no-template-target-blank": "warn",
|
|
1127
|
+
"vue/no-unused-refs": "warn",
|
|
1128
|
+
"vue/no-use-v-else-with-v-for": "warn",
|
|
1129
|
+
"vue/no-useless-mustaches": "warn",
|
|
1130
|
+
"vue/no-useless-v-bind": "warn",
|
|
1131
|
+
"vue/padding-line-between-blocks": "warn",
|
|
1132
|
+
"vue/prefer-separate-static-class": "warn",
|
|
1133
|
+
"vue/prefer-true-attribute-shorthand": "warn",
|
|
1134
|
+
"vue/prefer-use-template-ref": "warn",
|
|
1135
|
+
"vue/require-macro-variable-name": "warn",
|
|
1136
|
+
"vue/require-typed-ref": "warn",
|
|
1137
|
+
"vue/slot-name-casing": ["warn", "kebab-case"],
|
|
1138
|
+
"vue/v-bind-style": "warn",
|
|
1139
|
+
"vue/v-for-delimiter-style": ["warn", "of"],
|
|
1140
|
+
"vue/v-on-event-hyphenation": "warn",
|
|
1141
|
+
"vue/v-on-style": "warn",
|
|
1142
|
+
"vue/v-slot-style": "warn"
|
|
1143
|
+
}
|
|
1144
|
+
}, {
|
|
1145
|
+
files: ["**/*.vue"],
|
|
1146
|
+
name: "vue/extension",
|
|
1147
|
+
rules: {
|
|
1148
|
+
"vue/array-bracket-newline": ["warn", "consistent"],
|
|
1149
|
+
"vue/array-bracket-spacing": "warn",
|
|
1150
|
+
"vue/arrow-spacing": "warn",
|
|
1151
|
+
"vue/block-spacing": "warn",
|
|
1152
|
+
"vue/comma-dangle": ["warn", "always-multiline"],
|
|
1153
|
+
"vue/comma-spacing": "warn",
|
|
1154
|
+
"vue/comma-style": "warn",
|
|
1155
|
+
"vue/key-spacing": "warn",
|
|
1156
|
+
"vue/keyword-spacing": "warn",
|
|
1157
|
+
"vue/no-multi-spaces": "warn",
|
|
1158
|
+
"vue/object-curly-newline": ["warn", { consistent: true }],
|
|
1159
|
+
"vue/object-curly-spacing": ["warn", "always"],
|
|
1160
|
+
"vue/operator-linebreak": ["warn", "before"],
|
|
1161
|
+
"vue/quote-props": ["warn", "consistent-as-needed"],
|
|
1162
|
+
"vue/space-in-parens": "warn",
|
|
1163
|
+
"vue/space-infix-ops": "warn",
|
|
1164
|
+
"vue/space-unary-ops": "warn"
|
|
1165
|
+
}
|
|
1166
|
+
}];
|
|
1059
1167
|
}
|
|
1060
1168
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
javascript(),
|
|
1066
|
-
typescript(),
|
|
1067
|
-
astro(),
|
|
1068
|
-
vue(),
|
|
1069
|
-
stylistic(),
|
|
1070
|
-
mine(),
|
|
1071
|
-
unusedImports(),
|
|
1072
|
-
perfectionist(),
|
|
1073
|
-
antfu(),
|
|
1074
|
-
importX(),
|
|
1075
|
-
unicorn(),
|
|
1076
|
-
regexp(),
|
|
1077
|
-
command(),
|
|
1078
|
-
unocss(),
|
|
1079
|
-
overrides()
|
|
1080
|
-
);
|
|
1081
|
-
return options.oxlint?.enable === true ? result.append(pluginOxlint.configs["flat/all"]).remove("oxlint/vue-svelte-exceptions").renamePlugins({ "@typescript-eslint": "ts", "import-x": "import" }) : result;
|
|
1169
|
+
//#endregion
|
|
1170
|
+
//#region src/index.ts
|
|
1171
|
+
function src_default(options = {}) {
|
|
1172
|
+
return composer(ignores(options), jsonc(), javascript(), typescript(), astro(), vue(), stylistic(), mine(), unusedImports(), perfectionist(), antfu(), importX(), unicorn(), regexp(), command(), unocss(), overrides());
|
|
1082
1173
|
}
|
|
1083
1174
|
|
|
1084
|
-
|
|
1175
|
+
//#endregion
|
|
1176
|
+
export { src_default as default };
|