@jiakun-zhao/eslint-config 4.1.8 → 4.3.0

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