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