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