@cuiqg/eslint-config 2.1.28 → 2.2.1

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.
Files changed (3) hide show
  1. package/dist/index.js +1118 -1082
  2. package/package.json +13 -25
  3. package/dist/index.cjs +0 -1196
package/dist/index.js CHANGED
@@ -1,1115 +1,1151 @@
1
- // src/presets.js
2
- import { composer } from "eslint-flat-config-utils";
1
+ import { FlatConfigComposer } from "eslint-flat-config-utils";
2
+ import globals from "globals";
3
+ import process from "node:process";
4
+ import { isPackageExists } from "local-pkg";
5
+ import fs from "node:fs";
6
+ import { dirname, resolve } from "node:path";
7
+ import { loadConfig } from "unconfig";
3
8
 
4
- // src/utils.js
9
+ //#region src/utils.js
5
10
  async function interopDefault(m) {
6
- const resolved = await m;
7
- return resolved.default || m;
11
+ const resolved = await m;
12
+ return resolved.default || m;
8
13
  }
9
14
 
10
- // src/configs/comments.js
11
- async function comments() {
12
- const pluginComments = await interopDefault(
13
- import("eslint-plugin-eslint-comments")
14
- );
15
- return [
16
- {
17
- name: "cuiqg/eslint-comments",
18
- plugins: {
19
- "eslint-comments": pluginComments
20
- },
21
- rules: {
22
- ...pluginComments.configs.recommended.rules
23
- }
24
- }
25
- ];
26
- }
15
+ //#endregion
16
+ //#region src/configs/comments.js
17
+ /**
18
+ * Comments
19
+ *
20
+ * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/
21
+ * @returns {import('eslint').Linter.FlatConfig[]}
22
+ */
23
+ const comments = async () => {
24
+ const pluginComments = await interopDefault(import("eslint-plugin-eslint-comments"));
25
+ return [{
26
+ name: "cuiqg/eslint-comments",
27
+ plugins: { "eslint-comments": pluginComments },
28
+ rules: { ...pluginComments.configs.recommended.rules }
29
+ }];
30
+ };
27
31
 
28
- // src/globs.js
29
- var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
30
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
31
- var GLOB_JS = "**/*.?([cm])js";
32
- var GLOB_JSX = "**/*.?([cm])jsx";
33
- var GLOB_STYLE = "**/*.{c,le,sc}ss";
34
- var GLOB_CSS = "**/*.css";
35
- var GLOB_POSTCSS = "**/*.{p,post}css";
36
- var GLOB_LESS = "**/*.less";
37
- var GLOB_SCSS = "**/*.scss";
38
- var GLOB_JSON = "**/*.json";
39
- var GLOB_JSON5 = "**/*.json5";
40
- var GLOB_JSONC = "**/*.jsonc";
41
- var GLOB_VUE = "**/*.vue";
42
- var GLOB_YAML = "**/*.y?(a)ml";
43
- var GLOB_XML = "**/*.xml";
44
- var GLOB_HTML = "**/*.htm?(l)";
45
- var GLOB_TOML = "**/*.toml";
46
- var GLOB_EXCLUDE = [
47
- "**/node_modules",
48
- "**/dist",
49
- "**/package-lock.json",
50
- "**/yarn.lock",
51
- "**/pnpm-lock.yaml",
52
- "**/bun.lockb",
53
- "**/output",
54
- "**/coverage",
55
- "**/tmp",
56
- "**/.tmp",
57
- "**/temp",
58
- "**/.temp",
59
- "**/.history",
60
- "**/.vitepress/cache",
61
- "**/.nuxt",
62
- "**/.next",
63
- "**/.vercel",
64
- "**/.changeset",
65
- "**/.idea",
66
- "**/.cache",
67
- "**/.output",
68
- "**/.vite-inspect",
69
- "**/.yarn",
70
- "**/vite.config.*.timestamp-*",
71
- "**/.eslint-config-inspector",
72
- "**/CHANGELOG*.md",
73
- "**/*.min.*",
74
- "**/LICENSE*",
75
- "**/__snapshots__",
76
- "**/auto-import?(s).d.ts",
77
- "**/components.d.ts"
32
+ //#endregion
33
+ //#region src/globs.js
34
+ const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
35
+ const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
36
+ const GLOB_JS = "**/*.?([cm])js";
37
+ const GLOB_JSX = "**/*.?([cm])jsx";
38
+ const GLOB_STYLE = "**/*.{c,le,sc}ss";
39
+ const GLOB_CSS = "**/*.css";
40
+ const GLOB_POSTCSS = "**/*.{p,post}css";
41
+ const GLOB_LESS = "**/*.less";
42
+ const GLOB_SCSS = "**/*.scss";
43
+ const GLOB_JSON = "**/*.json";
44
+ const GLOB_JSON5 = "**/*.json5";
45
+ const GLOB_JSONC = "**/*.jsonc";
46
+ const GLOB_VUE = "**/*.vue";
47
+ const GLOB_YAML = "**/*.y?(a)ml";
48
+ const GLOB_XML = "**/*.xml";
49
+ const GLOB_HTML = "**/*.htm?(l)";
50
+ const GLOB_TOML = "**/*.toml";
51
+ const GLOB_EXCLUDE = [
52
+ "**/node_modules",
53
+ "**/dist",
54
+ "**/package-lock.json",
55
+ "**/yarn.lock",
56
+ "**/pnpm-lock.yaml",
57
+ "**/bun.lockb",
58
+ "**/output",
59
+ "**/coverage",
60
+ "**/tmp",
61
+ "**/.tmp",
62
+ "**/temp",
63
+ "**/.temp",
64
+ "**/.history",
65
+ "**/.vitepress/cache",
66
+ "**/.nuxt",
67
+ "**/.next",
68
+ "**/.vercel",
69
+ "**/.changeset",
70
+ "**/.idea",
71
+ "**/.cache",
72
+ "**/.output",
73
+ "**/.vite-inspect",
74
+ "**/.yarn",
75
+ "**/vite.config.*.timestamp-*",
76
+ "**/.eslint-config-inspector",
77
+ "**/CHANGELOG*.md",
78
+ "**/*.min.*",
79
+ "**/LICENSE*",
80
+ "**/__snapshots__",
81
+ "**/auto-import?(s).d.ts",
82
+ "**/components.d.ts"
78
83
  ];
79
84
 
80
- // src/configs/ignores.js
81
- async function ignores() {
82
- return [
83
- {
84
- name: "cuiqg/ignores",
85
- ignores: GLOB_EXCLUDE
86
- }
87
- ];
88
- }
85
+ //#endregion
86
+ //#region src/configs/disables.js
87
+ /**
88
+ * Disables
89
+ *
90
+ * @see https://npm.im/@eslint/js
91
+ * @returns {import('eslint').Linter.FlatConfig[]}
92
+ */
93
+ const disables = () => {
94
+ return [{
95
+ files: [
96
+ `**/scripts/${GLOB_SRC}`,
97
+ `**/cli/${GLOB_SRC}`,
98
+ `**/cli.${GLOB_SRC_EXT}`
99
+ ],
100
+ name: "cuiqg/disables",
101
+ rules: { "no-console": "off" }
102
+ }];
103
+ };
89
104
 
90
- // src/configs/imports.js
91
- async function imports() {
92
- const pluginImport = await interopDefault(import("eslint-plugin-import-x"));
93
- return [
94
- {
95
- name: "cuiqg/imports",
96
- plugins: {
97
- import: pluginImport
98
- },
99
- rules: {
100
- "import/first": "error",
101
- "import/no-duplicates": "error",
102
- "import/no-mutable-exports": "error",
103
- "import/no-named-default": "error",
104
- "import/no-self-import": "error",
105
- "import/no-webpack-loader-syntax": "error",
106
- "import/newline-after-import": "error",
107
- "import/order": "error"
108
- }
109
- }
110
- ];
111
- }
105
+ //#endregion
106
+ //#region src/configs/gitignore.js
107
+ /**
108
+ * Gitignore
109
+ *
110
+ * @see https://github.com/antfu/eslint-config-flat-gitignore
111
+ * @returns {import('eslint').Linter.FlatConfig[]}
112
+ */
113
+ const gitignore = async () => {
114
+ const pluginGitignore = await interopDefault(import("eslint-config-flat-gitignore"));
115
+ return [pluginGitignore({
116
+ name: "cuiqg/gitignore",
117
+ strict: false
118
+ })];
119
+ };
112
120
 
113
- // src/configs/javascript.js
114
- import globals from "globals";
121
+ //#endregion
122
+ //#region src/configs/ignores.js
123
+ /**
124
+ * Ignores
125
+ *
126
+ * @returns {import('eslint').Linter.FlatConfig[]}
127
+ */
128
+ const ignores = () => {
129
+ return [{
130
+ name: "cuiqg/ignores",
131
+ ignores: GLOB_EXCLUDE
132
+ }];
133
+ };
115
134
 
116
- // src/env.js
117
- import process from "node:process";
118
- import { isPackageExists } from "local-pkg";
119
- var isInEditor = !!((process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM) && !process.env.CI);
120
- var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
121
- var hasUnocss = isPackageExists("unocss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
122
- var hasTailwindcss = isPackageExists("tailwindcss") || isPackageExists("@tailwindcss/postcss");
135
+ //#endregion
136
+ //#region src/configs/imports.js
137
+ /**
138
+ * Imports
139
+ *
140
+ * @see https://npm.im/eslint-plugin-import-x
141
+ * @returns {import('eslint').Linter.FlatConfig[]}
142
+ */
143
+ const imports = async () => {
144
+ const pluginImport = await interopDefault(import("eslint-plugin-import-x"));
145
+ return [{
146
+ name: "cuiqg/imports",
147
+ plugins: { import: pluginImport },
148
+ rules: {
149
+ "import/first": "error",
150
+ "import/no-duplicates": "error",
151
+ "import/no-mutable-exports": "error",
152
+ "import/no-named-default": "error",
153
+ "import/no-self-import": "error",
154
+ "import/no-webpack-loader-syntax": "error",
155
+ "import/newline-after-import": "error",
156
+ "import/order": "error"
157
+ }
158
+ }];
159
+ };
123
160
 
124
- // src/configs/javascript.js
125
- async function javascript() {
126
- return [
127
- {
128
- name: "cuiqg/javascript",
129
- languageOptions: {
130
- ecmaVersion: 2022,
131
- globals: {
132
- ...globals.browser,
133
- ...globals.es2021,
134
- ...globals.node,
135
- document: "readonly",
136
- navigator: "readonly",
137
- window: "readonly"
138
- },
139
- parserOptions: {
140
- ecmaFeatures: {
141
- jsx: true
142
- },
143
- ecmaVersion: 2022,
144
- sourceType: "module"
145
- },
146
- sourceType: "module"
147
- },
148
- linterOptions: {
149
- reportUnusedDisableDirectives: true
150
- },
151
- rules: {
152
- "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
153
- "array-callback-return": "error",
154
- "block-scoped-var": "error",
155
- "constructor-super": "error",
156
- "default-case-last": "error",
157
- "dot-notation": ["error", { allowKeywords: true }],
158
- "eqeqeq": ["error", "smart"],
159
- "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
160
- "no-alert": "error",
161
- "no-array-constructor": "error",
162
- "no-async-promise-executor": "error",
163
- "no-caller": "error",
164
- "no-case-declarations": "error",
165
- "no-class-assign": "error",
166
- "no-compare-neg-zero": "error",
167
- "no-cond-assign": ["error", "always"],
168
- "no-console": ["error", { allow: ["warn", "error"] }],
169
- "no-const-assign": "error",
170
- "no-control-regex": "error",
171
- "no-debugger": "error",
172
- "no-delete-var": "error",
173
- "no-dupe-args": "error",
174
- "no-dupe-class-members": "error",
175
- "no-dupe-keys": "error",
176
- "no-duplicate-case": "error",
177
- "no-empty": ["error", { allowEmptyCatch: true }],
178
- "no-empty-character-class": "error",
179
- "no-empty-pattern": "error",
180
- "no-eval": "error",
181
- "no-ex-assign": "error",
182
- "no-extend-native": "error",
183
- "no-extra-bind": "error",
184
- "no-extra-boolean-cast": "error",
185
- "no-fallthrough": "error",
186
- "no-func-assign": "error",
187
- "no-global-assign": "error",
188
- "no-implied-eval": "error",
189
- "no-import-assign": "error",
190
- "no-invalid-regexp": "error",
191
- "no-irregular-whitespace": "error",
192
- "no-iterator": "error",
193
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
194
- "no-lone-blocks": "error",
195
- "no-loss-of-precision": "error",
196
- "no-misleading-character-class": "error",
197
- "no-multi-str": "error",
198
- "no-new": "error",
199
- "no-new-func": "error",
200
- "no-new-native-nonconstructor": "error",
201
- "no-new-wrappers": "error",
202
- "no-obj-calls": "error",
203
- "no-octal": "error",
204
- "no-octal-escape": "error",
205
- "no-proto": "error",
206
- "no-prototype-builtins": "error",
207
- "no-redeclare": ["error", { builtinGlobals: false }],
208
- "no-regex-spaces": "error",
209
- "no-restricted-globals": [
210
- "error",
211
- { message: "Use `globalThis` instead.", name: "global" },
212
- { message: "Use `globalThis` instead.", name: "self" }
213
- ],
214
- "no-restricted-properties": [
215
- "error",
216
- { message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
217
- { message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
218
- { message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
219
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
220
- { message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
221
- ],
222
- "no-restricted-syntax": [
223
- "error",
224
- "TSEnumDeclaration[const=true]",
225
- "TSExportAssignment"
226
- ],
227
- "no-self-assign": ["error", { props: true }],
228
- "no-self-compare": "error",
229
- "no-sequences": "error",
230
- "no-shadow-restricted-names": "error",
231
- "no-sparse-arrays": "error",
232
- "no-template-curly-in-string": "error",
233
- "no-this-before-super": "error",
234
- "no-throw-literal": "error",
235
- "no-undef": "error",
236
- "no-undef-init": "error",
237
- "no-unexpected-multiline": "error",
238
- "no-unmodified-loop-condition": "error",
239
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
240
- "no-unreachable": "error",
241
- "no-unreachable-loop": "error",
242
- "no-unsafe-finally": "error",
243
- "no-unsafe-negation": "error",
244
- "no-unused-expressions": ["error", {
245
- allowShortCircuit: true,
246
- allowTaggedTemplates: true,
247
- allowTernary: true
248
- }],
249
- "no-unused-vars": ["error", {
250
- args: "none",
251
- caughtErrors: "none",
252
- ignoreRestSiblings: true,
253
- vars: "all"
254
- }],
255
- "no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
256
- "no-useless-backreference": "error",
257
- "no-useless-call": "error",
258
- "no-useless-catch": "error",
259
- "no-useless-computed-key": "error",
260
- "no-useless-constructor": "error",
261
- "no-useless-rename": "error",
262
- "no-useless-return": "error",
263
- "no-var": "error",
264
- "no-with": "error",
265
- "object-shorthand": [
266
- "error",
267
- "always",
268
- {
269
- avoidQuotes: true,
270
- ignoreConstructors: false
271
- }
272
- ],
273
- "one-var": ["error", { initialized: "never" }],
274
- "prefer-arrow-callback": [
275
- "error",
276
- {
277
- allowNamedFunctions: false,
278
- allowUnboundThis: true
279
- }
280
- ],
281
- "prefer-const": [
282
- isInEditor ? "warn" : "error",
283
- {
284
- destructuring: "all",
285
- ignoreReadBeforeAssign: true
286
- }
287
- ],
288
- "prefer-exponentiation-operator": "error",
289
- "prefer-promise-reject-errors": "error",
290
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
291
- "prefer-rest-params": "error",
292
- "prefer-spread": "error",
293
- "prefer-template": "error",
294
- "symbol-description": "error",
295
- "unicode-bom": ["error", "never"],
296
- "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
297
- "valid-typeof": ["error", { requireStringLiterals: true }],
298
- "vars-on-top": "error",
299
- "yoda": ["error", "never"]
300
- }
301
- }
302
- ];
161
+ //#endregion
162
+ //#region src/env.js
163
+ const hasTypescript = () => isPackageExists("typescript");
164
+ const hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
165
+ const hasUnocss = () => isPackageExists("unocss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
166
+ function isInEditor() {
167
+ if (process.env.CI) return false;
168
+ if (isInGitHooksOrLintStaged()) return false;
169
+ return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
303
170
  }
304
-
305
- // src/configs/jsdoc.js
306
- async function jsdoc() {
307
- const pluginJsdoc = await interopDefault(import("eslint-plugin-jsdoc"));
308
- const files = [GLOB_JS];
309
- return [
310
- {
311
- files,
312
- name: "cuiqg/jsdoc",
313
- plugins: {
314
- jsdoc: pluginJsdoc
315
- },
316
- rules: {
317
- ...pluginJsdoc.configs["flat/recommended"].rules
318
- }
319
- }
320
- ];
171
+ function isInGitHooksOrLintStaged() {
172
+ return !!(process.env.HUSKY || process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
321
173
  }
322
174
 
323
- // src/configs/jsonc.js
324
- async function jsonc() {
325
- const files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC];
326
- const [pluginJsonc, parserJsonc] = await Promise.all([
327
- interopDefault(import("eslint-plugin-jsonc")),
328
- interopDefault(import("jsonc-eslint-parser"))
329
- ]);
330
- return [
331
- {
332
- name: "cuiqg/jsonc",
333
- files,
334
- plugins: {
335
- jsonc: pluginJsonc
336
- },
337
- languageOptions: {
338
- parser: parserJsonc
339
- },
340
- rules: {
341
- ...pluginJsonc.configs["recommended-with-jsonc"].rules,
342
- "jsonc/array-bracket-spacing": ["error", "never"],
343
- "jsonc/comma-dangle": ["error", "never"],
344
- "jsonc/comma-style": ["error", "last"],
345
- "jsonc/indent": ["error", 2],
346
- "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
347
- "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
348
- "jsonc/object-curly-spacing": ["error", "always"],
349
- "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
350
- "jsonc/quote-props": "error",
351
- "jsonc/quotes": "error"
352
- }
353
- }
354
- ];
355
- }
175
+ //#endregion
176
+ //#region src/configs/javascript.js
177
+ /**
178
+ * JavaScript
179
+ *
180
+ * @see https://npm.im/@eslint/js
181
+ * @returns {import('eslint').Linter.FlatConfig[]}
182
+ */
183
+ const javascript = async () => {
184
+ return [{
185
+ name: "cuiqg/javascript",
186
+ languageOptions: {
187
+ globals: {
188
+ ...globals.browser,
189
+ ...globals.es2021,
190
+ ...globals.node
191
+ },
192
+ parserOptions: {
193
+ ecmaFeatures: { jsx: true },
194
+ sourceType: "module"
195
+ },
196
+ sourceType: "module"
197
+ },
198
+ linterOptions: { reportUnusedDisableDirectives: true },
199
+ rules: {
200
+ "accessor-pairs": ["error", {
201
+ enforceForClassMembers: true,
202
+ setWithoutGet: true
203
+ }],
204
+ "array-callback-return": "error",
205
+ "block-scoped-var": "error",
206
+ "constructor-super": "error",
207
+ "default-case-last": "error",
208
+ "dot-notation": ["error", { allowKeywords: true }],
209
+ "eqeqeq": ["error", "smart"],
210
+ "new-cap": ["error", {
211
+ capIsNew: false,
212
+ newIsCap: true,
213
+ properties: true
214
+ }],
215
+ "no-alert": "error",
216
+ "no-array-constructor": "error",
217
+ "no-async-promise-executor": "error",
218
+ "no-caller": "error",
219
+ "no-case-declarations": "error",
220
+ "no-class-assign": "error",
221
+ "no-compare-neg-zero": "error",
222
+ "no-cond-assign": ["error", "always"],
223
+ "no-console": ["error", { allow: ["warn", "error"] }],
224
+ "no-const-assign": "error",
225
+ "no-control-regex": "error",
226
+ "no-debugger": "error",
227
+ "no-delete-var": "error",
228
+ "no-dupe-args": "error",
229
+ "no-dupe-class-members": "error",
230
+ "no-dupe-keys": "error",
231
+ "no-duplicate-case": "error",
232
+ "no-empty": ["error", { allowEmptyCatch: true }],
233
+ "no-empty-character-class": "error",
234
+ "no-empty-pattern": "error",
235
+ "no-eval": "error",
236
+ "no-ex-assign": "error",
237
+ "no-extend-native": "error",
238
+ "no-extra-bind": "error",
239
+ "no-extra-boolean-cast": "error",
240
+ "no-fallthrough": "error",
241
+ "no-func-assign": "error",
242
+ "no-global-assign": "error",
243
+ "no-implied-eval": "error",
244
+ "no-import-assign": "error",
245
+ "no-invalid-regexp": "error",
246
+ "no-irregular-whitespace": "error",
247
+ "no-iterator": "error",
248
+ "no-labels": ["error", {
249
+ allowLoop: false,
250
+ allowSwitch: false
251
+ }],
252
+ "no-lone-blocks": "error",
253
+ "no-loss-of-precision": "error",
254
+ "no-misleading-character-class": "error",
255
+ "no-multi-str": "error",
256
+ "no-new": "error",
257
+ "no-new-func": "error",
258
+ "no-new-native-nonconstructor": "error",
259
+ "no-new-wrappers": "error",
260
+ "no-obj-calls": "error",
261
+ "no-octal": "error",
262
+ "no-octal-escape": "error",
263
+ "no-proto": "error",
264
+ "no-prototype-builtins": "error",
265
+ "no-redeclare": ["error", { builtinGlobals: false }],
266
+ "no-regex-spaces": "error",
267
+ "no-restricted-globals": [
268
+ "error",
269
+ {
270
+ message: "Use `globalThis` instead.",
271
+ name: "global"
272
+ },
273
+ {
274
+ message: "Use `globalThis` instead.",
275
+ name: "self"
276
+ }
277
+ ],
278
+ "no-restricted-properties": [
279
+ "error",
280
+ {
281
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
282
+ property: "__proto__"
283
+ },
284
+ {
285
+ message: "Use `Object.defineProperty` instead.",
286
+ property: "__defineGetter__"
287
+ },
288
+ {
289
+ message: "Use `Object.defineProperty` instead.",
290
+ property: "__defineSetter__"
291
+ },
292
+ {
293
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
294
+ property: "__lookupGetter__"
295
+ },
296
+ {
297
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
298
+ property: "__lookupSetter__"
299
+ }
300
+ ],
301
+ "no-restricted-syntax": [
302
+ "error",
303
+ "TSEnumDeclaration[const=true]",
304
+ "TSExportAssignment"
305
+ ],
306
+ "no-self-assign": ["error", { props: true }],
307
+ "no-self-compare": "error",
308
+ "no-sequences": "error",
309
+ "no-shadow-restricted-names": "error",
310
+ "no-sparse-arrays": "error",
311
+ "no-template-curly-in-string": "error",
312
+ "no-this-before-super": "error",
313
+ "no-throw-literal": "error",
314
+ "no-undef": "error",
315
+ "no-undef-init": "error",
316
+ "no-unexpected-multiline": "error",
317
+ "no-unmodified-loop-condition": "error",
318
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
319
+ "no-unreachable": "error",
320
+ "no-unreachable-loop": "error",
321
+ "no-unsafe-finally": "error",
322
+ "no-unsafe-negation": "error",
323
+ "no-unused-expressions": ["error", {
324
+ allowShortCircuit: true,
325
+ allowTaggedTemplates: true,
326
+ allowTernary: true
327
+ }],
328
+ "no-unused-vars": ["error", {
329
+ args: "none",
330
+ caughtErrors: "none",
331
+ ignoreRestSiblings: true,
332
+ vars: "all"
333
+ }],
334
+ "no-use-before-define": ["error", {
335
+ classes: false,
336
+ functions: false,
337
+ variables: true
338
+ }],
339
+ "no-useless-backreference": "error",
340
+ "no-useless-call": "error",
341
+ "no-useless-catch": "error",
342
+ "no-useless-computed-key": "error",
343
+ "no-useless-constructor": "error",
344
+ "no-useless-rename": "error",
345
+ "no-useless-return": "error",
346
+ "no-var": "error",
347
+ "no-with": "error",
348
+ "object-shorthand": [
349
+ "error",
350
+ "always",
351
+ {
352
+ avoidQuotes: true,
353
+ ignoreConstructors: false
354
+ }
355
+ ],
356
+ "one-var": ["error", { initialized: "never" }],
357
+ "prefer-arrow-callback": ["error", {
358
+ allowNamedFunctions: false,
359
+ allowUnboundThis: true
360
+ }],
361
+ "prefer-const": [isInEditor() ? "warn" : "error", {
362
+ destructuring: "all",
363
+ ignoreReadBeforeAssign: true
364
+ }],
365
+ "prefer-exponentiation-operator": "error",
366
+ "prefer-promise-reject-errors": "error",
367
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
368
+ "prefer-rest-params": "error",
369
+ "prefer-spread": "error",
370
+ "prefer-template": "error",
371
+ "symbol-description": "error",
372
+ "unicode-bom": ["error", "never"],
373
+ "use-isnan": ["error", {
374
+ enforceForIndexOf: true,
375
+ enforceForSwitchCase: true
376
+ }],
377
+ "valid-typeof": ["error", { requireStringLiterals: true }],
378
+ "vars-on-top": "error",
379
+ "yoda": ["error", "never"]
380
+ }
381
+ }];
382
+ };
356
383
 
357
- // src/configs/node.js
358
- async function node() {
359
- const pluginNode = await interopDefault(import("eslint-plugin-n"));
360
- return [
361
- {
362
- name: "cuiqg/node",
363
- plugins: {
364
- node: pluginNode
365
- },
366
- rules: {
367
- "node/handle-callback-err": ["error", "^(err|error)$"],
368
- "node/no-deprecated-api": "error",
369
- "node/no-exports-assign": "error",
370
- "node/no-new-require": "error",
371
- "node/no-path-concat": "error",
372
- "node/prefer-global/buffer": ["error", "never"],
373
- "node/prefer-global/process": ["error", "never"],
374
- "node/process-exit-as-throw": "error"
375
- }
376
- }
377
- ];
378
- }
384
+ //#endregion
385
+ //#region src/configs/jsdoc.js
386
+ /**
387
+ * JsDoc
388
+ * @see https://npm.im/eslint-plugin-jsdoc
389
+ * @returns {import('eslint').Linter.FlatConfig[]}
390
+ */
391
+ const jsdoc = async () => {
392
+ const pluginJsdoc = await interopDefault(import("eslint-plugin-jsdoc"));
393
+ const files = [GLOB_JS];
394
+ return [{
395
+ files,
396
+ name: "cuiqg/jsdoc",
397
+ plugins: { jsdoc: pluginJsdoc },
398
+ rules: { ...pluginJsdoc.configs["flat/recommended"].rules }
399
+ }];
400
+ };
379
401
 
380
- // src/configs/macros.js
381
- async function macros() {
382
- return [
383
- {
384
- name: "cuiqg/macros",
385
- languageOptions: {
386
- globals: {
387
- $: "readonly",
388
- $$: "readonly",
389
- $computed: "readonly",
390
- $customRef: "readonly",
391
- $defineModels: "readonly",
392
- $defineProps: "readonly",
393
- $definePropsRefs: "readonly",
394
- $ref: "readonly",
395
- $shallowRef: "readonly",
396
- $toRef: "readonly",
397
- defineEmit: "readonly",
398
- defineModels: "readonly",
399
- defineOptions: "readonly",
400
- defineProp: "readonly",
401
- defineProps: "readonly",
402
- defineRender: "readonly",
403
- defineSetupComponent: "readonly",
404
- defineSlots: "readonly"
405
- }
406
- },
407
- rules: {
408
- "vue/no-export-in-script-setup": "off",
409
- "vue/valid-attribute-name": "off",
410
- "vue/valid-define-props": "off",
411
- "vue/valid-v-bind": "off"
412
- }
413
- }
414
- ];
415
- }
402
+ //#endregion
403
+ //#region src/configs/jsonc.js
404
+ /**
405
+ * JSONC
406
+ *
407
+ * @link https://ota-meshi.github.io/eslint-plugin-jsonc/
408
+ * @returns {import('eslint').Linter.FlatConfig[]}
409
+ */
410
+ const jsonc = async () => {
411
+ const files = [
412
+ GLOB_JSON,
413
+ GLOB_JSON5,
414
+ GLOB_JSONC
415
+ ];
416
+ const [pluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
417
+ return [{
418
+ name: "cuiqg/jsonc",
419
+ files,
420
+ plugins: { jsonc: pluginJsonc },
421
+ languageOptions: { parser: parserJsonc },
422
+ rules: {
423
+ ...pluginJsonc.configs["recommended-with-jsonc"].rules,
424
+ "jsonc/array-bracket-spacing": ["error", "never"],
425
+ "jsonc/comma-dangle": ["error", "never"],
426
+ "jsonc/comma-style": ["error", "last"],
427
+ "jsonc/indent": ["error", 2],
428
+ "jsonc/key-spacing": ["error", {
429
+ afterColon: true,
430
+ beforeColon: false
431
+ }],
432
+ "jsonc/object-curly-newline": ["error", {
433
+ consistent: true,
434
+ multiline: true
435
+ }],
436
+ "jsonc/object-curly-spacing": ["error", "always"],
437
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
438
+ "jsonc/quote-props": "error",
439
+ "jsonc/quotes": "error"
440
+ }
441
+ }];
442
+ };
416
443
 
417
- // src/configs/prettier.js
418
- async function prettier() {
419
- const [pluginJsonc, pluginPrettier] = await Promise.all([
420
- interopDefault(import("eslint-plugin-jsonc")),
421
- interopDefault(import("eslint-plugin-prettier"))
422
- ]);
423
- return [
424
- {
425
- name: "cuiqg/prettier",
426
- plugins: {
427
- prettier: pluginPrettier
428
- },
429
- rules: {
430
- ...pluginPrettier.configs.recommended.rules,
431
- ...pluginJsonc.configs.prettier.rules,
432
- "prettier/prettier": "warn"
433
- }
434
- }
435
- ];
436
- }
444
+ //#endregion
445
+ //#region src/configs/macros.js
446
+ /**
447
+ * Vue Macros
448
+ * @see https://vue-macros.dev/zh-CN/guide/eslint-integration.html
449
+ * @returns {import('eslint').Linter.FlatConfig[]}
450
+ */
451
+ const macros = () => {
452
+ return [{
453
+ name: "cuiqg/macros",
454
+ languageOptions: { globals: {
455
+ $: "readonly",
456
+ $$: "readonly",
457
+ $computed: "readonly",
458
+ $customRef: "readonly",
459
+ $defineModels: "readonly",
460
+ $defineProps: "readonly",
461
+ $definePropsRefs: "readonly",
462
+ $ref: "readonly",
463
+ $shallowRef: "readonly",
464
+ $toRef: "readonly",
465
+ defineEmit: "readonly",
466
+ defineModels: "readonly",
467
+ defineOptions: "readonly",
468
+ defineProp: "readonly",
469
+ defineProps: "readonly",
470
+ defineRender: "readonly",
471
+ defineSetupComponent: "readonly",
472
+ defineSlots: "readonly"
473
+ } },
474
+ rules: {
475
+ "vue/no-export-in-script-setup": "off",
476
+ "vue/valid-attribute-name": "off",
477
+ "vue/valid-define-props": "off",
478
+ "vue/valid-v-bind": "off"
479
+ }
480
+ }];
481
+ };
437
482
 
438
- // src/configs/sorts.js
439
- async function sortPackageJson() {
440
- return [
441
- {
442
- name: "cuiqg/sort/package-json",
443
- files: ["**/package.json"],
444
- rules: {
445
- "jsonc/sort-array-values": [
446
- "error",
447
- {
448
- order: { type: "asc" },
449
- pathPattern: "^files$"
450
- }
451
- ],
452
- "jsonc/sort-keys": [
453
- "error",
454
- {
455
- order: [
456
- "name",
457
- "version",
458
- "private",
459
- "packageManager",
460
- "description",
461
- "type",
462
- "keywords",
463
- "license",
464
- "homepage",
465
- "bugs",
466
- "repository",
467
- "author",
468
- "contributors",
469
- "funding",
470
- "files",
471
- "main",
472
- "module",
473
- "types",
474
- "exports",
475
- "typesVersions",
476
- "sideEffects",
477
- "unpkg",
478
- "jsdelivr",
479
- "browser",
480
- "bin",
481
- "man",
482
- "directories",
483
- "publishConfig",
484
- "scripts",
485
- "peerDependencies",
486
- "peerDependenciesMeta",
487
- "optionalDependencies",
488
- "dependencies",
489
- "devDependencies",
490
- "engines",
491
- "config",
492
- "overrides",
493
- "pnpm",
494
- "husky",
495
- "lint-staged",
496
- "eslintConfig",
497
- "prettier"
498
- ],
499
- pathPattern: "^$"
500
- },
501
- {
502
- order: { type: "asc" },
503
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
504
- },
505
- {
506
- order: ["types", "require", "import", "default"],
507
- pathPattern: "^exports.*$"
508
- },
509
- {
510
- order: { type: "asc" },
511
- pathPattern: "^resolutions$"
512
- },
513
- {
514
- order: { type: "asc" },
515
- pathPattern: "^pnpm.overrides$"
516
- }
517
- ]
518
- }
519
- }
520
- ];
521
- }
522
- async function sortJsconfig() {
523
- return [
524
- {
525
- name: "cuiqg/sort/jsconfig-json",
526
- files: ["**/jsconfig.json", "**/jsconfig.*.json"],
527
- rules: {
528
- "jsonc/sort-keys": [
529
- "error",
530
- {
531
- order: [
532
- "extends",
533
- "compilerOptions",
534
- "references",
535
- "files",
536
- "include",
537
- "exclude"
538
- ],
539
- pathPattern: "^$"
540
- },
541
- {
542
- order: [
543
- /* Projects */
544
- "incremental",
545
- "composite",
546
- "tsBuildInfoFile",
547
- "disableSourceOfProjectReferenceRedirect",
548
- "disableSolutionSearching",
549
- "disableReferencedProjectLoad",
550
- /* Language and Environment */
551
- "target",
552
- "jsx",
553
- "jsxFactory",
554
- "jsxFragmentFactory",
555
- "jsxImportSource",
556
- "lib",
557
- "moduleDetection",
558
- "noLib",
559
- "reactNamespace",
560
- "useDefineForClassFields",
561
- "emitDecoratorMetadata",
562
- "experimentalDecorators",
563
- /* Modules */
564
- "baseUrl",
565
- "rootDir",
566
- "rootDirs",
567
- "customConditions",
568
- "module",
569
- "moduleResolution",
570
- "moduleSuffixes",
571
- "noResolve",
572
- "paths",
573
- "resolveJsonModule",
574
- "resolvePackageJsonExports",
575
- "resolvePackageJsonImports",
576
- "typeRoots",
577
- "types",
578
- "allowArbitraryExtensions",
579
- "allowImportingTsExtensions",
580
- "allowUmdGlobalAccess",
581
- /* JavaScript Support */
582
- "allowJs",
583
- "checkJs",
584
- "maxNodeModuleJsDepth",
585
- /* Type Checking */
586
- "strict",
587
- "strictBindCallApply",
588
- "strictFunctionTypes",
589
- "strictNullChecks",
590
- "strictPropertyInitialization",
591
- "allowUnreachableCode",
592
- "allowUnusedLabels",
593
- "alwaysStrict",
594
- "exactOptionalPropertyTypes",
595
- "noFallthroughCasesInSwitch",
596
- "noImplicitAny",
597
- "noImplicitOverride",
598
- "noImplicitReturns",
599
- "noImplicitThis",
600
- "noPropertyAccessFromIndexSignature",
601
- "noUncheckedIndexedAccess",
602
- "noUnusedLocals",
603
- "noUnusedParameters",
604
- "useUnknownInCatchVariables",
605
- /* Emit */
606
- "declaration",
607
- "declarationDir",
608
- "declarationMap",
609
- "downlevelIteration",
610
- "emitBOM",
611
- "emitDeclarationOnly",
612
- "importHelpers",
613
- "importsNotUsedAsValues",
614
- "inlineSourceMap",
615
- "inlineSources",
616
- "mapRoot",
617
- "newLine",
618
- "noEmit",
619
- "noEmitHelpers",
620
- "noEmitOnError",
621
- "outDir",
622
- "outFile",
623
- "preserveConstEnums",
624
- "preserveValueImports",
625
- "removeComments",
626
- "sourceMap",
627
- "sourceRoot",
628
- "stripInternal",
629
- /* Interop Constraints */
630
- "allowSyntheticDefaultImports",
631
- "esModuleInterop",
632
- "forceConsistentCasingInFileNames",
633
- "isolatedModules",
634
- "preserveSymlinks",
635
- "verbatimModuleSyntax",
636
- /* Completeness */
637
- "skipDefaultLibCheck",
638
- "skipLibCheck"
639
- ],
640
- pathPattern: "^compilerOptions$"
641
- }
642
- ]
643
- }
644
- }
645
- ];
646
- }
483
+ //#endregion
484
+ //#region src/configs/node.js
485
+ /**
486
+ * Node
487
+ *
488
+ * @see https://github.com/eslint-community/eslint-plugin-n
489
+ * @returns {import('eslint').Linter.FlatConfig[]}
490
+ */
491
+ const node = async () => {
492
+ const pluginNode = await interopDefault(import("eslint-plugin-n"));
493
+ return [{
494
+ name: "cuiqg/node",
495
+ plugins: { node: pluginNode },
496
+ rules: {
497
+ "node/handle-callback-err": ["error", "^(err|error)$"],
498
+ "node/no-deprecated-api": "error",
499
+ "node/no-exports-assign": "error",
500
+ "node/no-new-require": "error",
501
+ "node/no-path-concat": "error",
502
+ "node/prefer-global/buffer": ["error", "never"],
503
+ "node/prefer-global/process": ["error", "never"],
504
+ "node/process-exit-as-throw": "error"
505
+ }
506
+ }];
507
+ };
647
508
 
648
- // src/configs/stylistic.js
649
- async function stylistic() {
650
- const pluginStylistic = await interopDefault(
651
- import("@stylistic/eslint-plugin")
652
- );
653
- const config = pluginStylistic.configs.customize({
654
- flat: true,
655
- pluginName: "style",
656
- indent: 2,
657
- jsx: true,
658
- quotes: "single",
659
- semi: false,
660
- commaDangle: "never"
661
- });
662
- return [
663
- {
664
- name: "cuiqg/stylistic",
665
- plugins: {
666
- style: pluginStylistic
667
- },
668
- rules: {
669
- ...config.rules
670
- }
671
- }
672
- ];
673
- }
509
+ //#endregion
510
+ //#region src/configs/pnpm.js
511
+ const pnpm = async () => {
512
+ const [parserJsonc, parserYaml, pluginPnpm] = await Promise.all([
513
+ interopDefault(import("jsonc-eslint-parser")),
514
+ interopDefault(import("yaml-eslint-parser")),
515
+ interopDefault(import("eslint-plugin-pnpm"))
516
+ ]);
517
+ return [{
518
+ files: ["package.json", "**/package.json"],
519
+ languageOptions: { parser: parserJsonc },
520
+ name: "cuiqg/pnpm/package-json",
521
+ plugins: { pnpm: pluginPnpm },
522
+ rules: {
523
+ "pnpm/json-enforce-catalog": "error",
524
+ "pnpm/json-prefer-workspace-settings": "error",
525
+ "pnpm/json-valid-catalog": "error"
526
+ }
527
+ }, {
528
+ files: ["pnpm-workspace.yaml"],
529
+ languageOptions: { parser: parserYaml },
530
+ name: "cuiqg/pnpm/pnpm-workspace-yaml",
531
+ plugins: { pnpm: pluginPnpm },
532
+ rules: {
533
+ "pnpm/yaml-no-duplicate-catalog-item": "error",
534
+ "pnpm/yaml-no-unused-catalog-item": "error",
535
+ "yaml/sort-keys": [
536
+ "error",
537
+ {
538
+ order: [
539
+ "packages",
540
+ "overrides",
541
+ "patchedDependencies",
542
+ "hoistPattern",
543
+ "catalog",
544
+ "catalogs",
545
+ "allowedDeprecatedVersions",
546
+ "allowNonAppliedPatches",
547
+ "configDependencies",
548
+ "ignoredBuiltDependencies",
549
+ "ignoredOptionalDependencies",
550
+ "neverBuiltDependencies",
551
+ "onlyBuiltDependencies",
552
+ "onlyBuiltDependenciesFile",
553
+ "packageExtensions",
554
+ "peerDependencyRules",
555
+ "supportedArchitectures"
556
+ ],
557
+ pathPattern: "^$"
558
+ },
559
+ {
560
+ order: { type: "asc" },
561
+ pathPattern: ".*"
562
+ }
563
+ ]
564
+ }
565
+ }];
566
+ };
674
567
 
675
- // src/configs/unicorn.js
676
- async function unicorn() {
677
- const pluginUnicorn = await interopDefault(import("eslint-plugin-unicorn"));
678
- return [
679
- {
680
- name: "cuiqg/unicorn",
681
- plugins: {
682
- unicorn: pluginUnicorn
683
- },
684
- rules: {
685
- "unicorn/consistent-empty-array-spread": "error",
686
- "unicorn/error-message": "error",
687
- "unicorn/escape-case": "error",
688
- "unicorn/new-for-builtins": "error",
689
- "unicorn/no-instanceof-array": "error",
690
- "unicorn/no-new-array": "error",
691
- "unicorn/no-new-buffer": "error",
692
- "unicorn/number-literal-case": "error",
693
- "unicorn/prefer-dom-node-text-content": "error",
694
- "unicorn/prefer-includes": "error",
695
- "unicorn/prefer-node-protocol": "error",
696
- "unicorn/prefer-number-properties": "error",
697
- "unicorn/prefer-string-starts-ends-with": "error",
698
- "unicorn/prefer-type-error": "error",
699
- "unicorn/throw-new-error": "error"
700
- }
701
- }
702
- ];
703
- }
568
+ //#endregion
569
+ //#region src/configs/prettier.js
570
+ /**
571
+ * Prettier
572
+ *
573
+ * @see https://github.com/prettier/eslint-plugin-prettier
574
+ * @returns {import('eslint').Linter.FlatConfig[]}
575
+ */
576
+ const prettier = async () => {
577
+ const [pluginJsonc, pluginPrettier] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("eslint-plugin-prettier"))]);
578
+ return [{
579
+ name: "cuiqg/prettier",
580
+ plugins: { prettier: pluginPrettier },
581
+ rules: {
582
+ ...pluginPrettier.configs.recommended.rules,
583
+ ...pluginJsonc.configs.prettier.rules,
584
+ "prettier/prettier": "warn"
585
+ }
586
+ }];
587
+ };
704
588
 
705
- // src/configs/unocss.js
706
- async function unocss() {
707
- const pluginUnoCSS = await interopDefault(import("@unocss/eslint-plugin"));
708
- return [
709
- {
710
- name: "cuiqg/unocss",
711
- plugins: {
712
- unocss: pluginUnoCSS
713
- },
714
- rules: {
715
- "unocss/order": "error",
716
- "unocss/order-attributify": "warn"
717
- }
718
- }
719
- ];
720
- }
589
+ //#endregion
590
+ //#region src/configs/sorts.js
591
+ /**
592
+ * Sort package.json
593
+ *
594
+ * Requires `jsonc` config
595
+ */
596
+ const sortPackageJson = async () => {
597
+ return [{
598
+ name: "cuiqg/sort/package-json",
599
+ files: ["**/package.json"],
600
+ rules: {
601
+ "jsonc/sort-array-values": ["error", {
602
+ order: { type: "asc" },
603
+ pathPattern: "^files$"
604
+ }],
605
+ "jsonc/sort-keys": [
606
+ "error",
607
+ {
608
+ order: [
609
+ "name",
610
+ "version",
611
+ "private",
612
+ "packageManager",
613
+ "description",
614
+ "type",
615
+ "keywords",
616
+ "license",
617
+ "homepage",
618
+ "bugs",
619
+ "repository",
620
+ "author",
621
+ "contributors",
622
+ "funding",
623
+ "files",
624
+ "main",
625
+ "module",
626
+ "types",
627
+ "exports",
628
+ "typesVersions",
629
+ "sideEffects",
630
+ "unpkg",
631
+ "jsdelivr",
632
+ "browser",
633
+ "bin",
634
+ "man",
635
+ "directories",
636
+ "publishConfig",
637
+ "scripts",
638
+ "peerDependencies",
639
+ "peerDependenciesMeta",
640
+ "optionalDependencies",
641
+ "dependencies",
642
+ "devDependencies",
643
+ "engines",
644
+ "config",
645
+ "overrides",
646
+ "pnpm",
647
+ "husky",
648
+ "lint-staged",
649
+ "eslintConfig",
650
+ "prettier"
651
+ ],
652
+ pathPattern: "^$"
653
+ },
654
+ {
655
+ order: { type: "asc" },
656
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
657
+ },
658
+ {
659
+ order: [
660
+ "types",
661
+ "require",
662
+ "import",
663
+ "default"
664
+ ],
665
+ pathPattern: "^exports.*$"
666
+ },
667
+ {
668
+ order: { type: "asc" },
669
+ pathPattern: "^resolutions$"
670
+ },
671
+ {
672
+ order: { type: "asc" },
673
+ pathPattern: "^pnpm.overrides$"
674
+ }
675
+ ]
676
+ }
677
+ }];
678
+ };
679
+ /**
680
+ * Sort jsconfig.json
681
+ *
682
+ * Requires `jsonc` config
683
+ */
684
+ const sortJsconfig = () => {
685
+ return [{
686
+ name: "cuiqg/sort/jsconfig-json",
687
+ files: ["**/jsconfig.json", "**/jsconfig.*.json"],
688
+ rules: { "jsonc/sort-keys": [
689
+ "error",
690
+ {
691
+ order: [
692
+ "extends",
693
+ "compilerOptions",
694
+ "references",
695
+ "files",
696
+ "include",
697
+ "exclude"
698
+ ],
699
+ pathPattern: "^$"
700
+ },
701
+ {
702
+ order: [
703
+ "incremental",
704
+ "composite",
705
+ "tsBuildInfoFile",
706
+ "disableSourceOfProjectReferenceRedirect",
707
+ "disableSolutionSearching",
708
+ "disableReferencedProjectLoad",
709
+ "target",
710
+ "jsx",
711
+ "jsxFactory",
712
+ "jsxFragmentFactory",
713
+ "jsxImportSource",
714
+ "lib",
715
+ "moduleDetection",
716
+ "noLib",
717
+ "reactNamespace",
718
+ "useDefineForClassFields",
719
+ "emitDecoratorMetadata",
720
+ "experimentalDecorators",
721
+ "baseUrl",
722
+ "rootDir",
723
+ "rootDirs",
724
+ "customConditions",
725
+ "module",
726
+ "moduleResolution",
727
+ "moduleSuffixes",
728
+ "noResolve",
729
+ "paths",
730
+ "resolveJsonModule",
731
+ "resolvePackageJsonExports",
732
+ "resolvePackageJsonImports",
733
+ "typeRoots",
734
+ "types",
735
+ "allowArbitraryExtensions",
736
+ "allowImportingTsExtensions",
737
+ "allowUmdGlobalAccess",
738
+ "allowJs",
739
+ "checkJs",
740
+ "maxNodeModuleJsDepth",
741
+ "strict",
742
+ "strictBindCallApply",
743
+ "strictFunctionTypes",
744
+ "strictNullChecks",
745
+ "strictPropertyInitialization",
746
+ "allowUnreachableCode",
747
+ "allowUnusedLabels",
748
+ "alwaysStrict",
749
+ "exactOptionalPropertyTypes",
750
+ "noFallthroughCasesInSwitch",
751
+ "noImplicitAny",
752
+ "noImplicitOverride",
753
+ "noImplicitReturns",
754
+ "noImplicitThis",
755
+ "noPropertyAccessFromIndexSignature",
756
+ "noUncheckedIndexedAccess",
757
+ "noUnusedLocals",
758
+ "noUnusedParameters",
759
+ "useUnknownInCatchVariables",
760
+ "declaration",
761
+ "declarationDir",
762
+ "declarationMap",
763
+ "downlevelIteration",
764
+ "emitBOM",
765
+ "emitDeclarationOnly",
766
+ "importHelpers",
767
+ "importsNotUsedAsValues",
768
+ "inlineSourceMap",
769
+ "inlineSources",
770
+ "mapRoot",
771
+ "newLine",
772
+ "noEmit",
773
+ "noEmitHelpers",
774
+ "noEmitOnError",
775
+ "outDir",
776
+ "outFile",
777
+ "preserveConstEnums",
778
+ "preserveValueImports",
779
+ "removeComments",
780
+ "sourceMap",
781
+ "sourceRoot",
782
+ "stripInternal",
783
+ "allowSyntheticDefaultImports",
784
+ "esModuleInterop",
785
+ "forceConsistentCasingInFileNames",
786
+ "isolatedModules",
787
+ "preserveSymlinks",
788
+ "verbatimModuleSyntax",
789
+ "skipDefaultLibCheck",
790
+ "skipLibCheck"
791
+ ],
792
+ pathPattern: "^compilerOptions$"
793
+ }
794
+ ] }
795
+ }];
796
+ };
721
797
 
722
- // src/configs/unplugin.js
723
- import fs from "node:fs";
724
- import { dirname, resolve } from "node:path";
725
- import process2 from "node:process";
726
- import { loadConfig } from "unconfig";
727
- async function autoImport() {
728
- const resolved = resolve(process2.cwd(), `./.eslintrc-auto-import.json`);
729
- if (fs.existsSync(resolved) && fs.statSync(resolved).isFile) {
730
- const cwd = dirname(resolved);
731
- const { config } = await loadConfig({
732
- sources: [
733
- {
734
- files: resolved,
735
- extensions: [],
736
- rewrite(config2) {
737
- return config2?.globals;
738
- }
739
- }
740
- ],
741
- cwd
742
- });
743
- return [
744
- {
745
- name: "cuiqg/unplugin/auto-import",
746
- languageOptions: {
747
- globals: {
748
- ...config
749
- }
750
- }
751
- }
752
- ];
753
- } else {
754
- return [];
755
- }
756
- }
798
+ //#endregion
799
+ //#region src/configs/stylistic.js
800
+ /**
801
+ * Stylistic
802
+ *
803
+ * @see https://eslint.style/
804
+ * @returns {import('eslint').Linter.FlatConfig[]}
805
+ */
806
+ const stylistic = async () => {
807
+ const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
808
+ const config = pluginStylistic.configs.customize({
809
+ flat: true,
810
+ pluginName: "style",
811
+ indent: 2,
812
+ jsx: true,
813
+ quotes: "single",
814
+ semi: false,
815
+ commaDangle: "never"
816
+ });
817
+ return [{
818
+ name: "cuiqg/stylistic",
819
+ plugins: { style: pluginStylistic },
820
+ rules: { ...config.rules }
821
+ }];
822
+ };
757
823
 
758
- // src/configs/vue.js
759
- async function vue() {
760
- const files = [GLOB_VUE];
761
- const [pluginVue, parserVue] = await Promise.all([
762
- interopDefault(import("eslint-plugin-vue")),
763
- interopDefault(import("vue-eslint-parser"))
764
- ]);
765
- return [
766
- {
767
- files,
768
- languageOptions: {
769
- globals: {
770
- computed: "readonly",
771
- defineModel: "readonly",
772
- defineOptions: "readonly",
773
- defineProps: "readonly",
774
- defineRender: "readonly",
775
- defineSlots: "readonly",
776
- defineEmits: "readonly",
777
- defineExpose: "readonly",
778
- definePage: "readonly",
779
- onMounted: "readonly",
780
- onUnmounted: "readonly",
781
- onActivated: "readonly",
782
- onDeactivated: "readonly",
783
- reactive: "readonly",
784
- ref: "readonly",
785
- shallowReactive: "readonly",
786
- shallowRef: "readonly",
787
- toRef: "readonly",
788
- toRefs: "readonly",
789
- watch: "readonly",
790
- watchEffect: "readonly"
791
- },
792
- parser: parserVue,
793
- parserOptions: {
794
- ecmaFeatures: {
795
- jsx: true
796
- },
797
- extraFileExtensions: [".vue"],
798
- parser: null,
799
- sourceType: "module"
800
- }
801
- },
802
- name: "cuiqg/vue",
803
- plugins: {
804
- vue: pluginVue
805
- },
806
- processor: pluginVue.processors[".vue"],
807
- rules: {
808
- ...pluginVue.configs.base.rules,
809
- ...pluginVue.configs["vue3-essential"].rules,
810
- ...pluginVue.configs["vue3-strongly-recommended"].rules,
811
- ...pluginVue.configs["vue3-recommended"].rules,
812
- "vue/block-order": ["error", {
813
- order: ["script", "template", "style", "route"]
814
- }],
815
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
816
- "vue/component-options-name-casing": ["error", "PascalCase"],
817
- "vue/component-tags-order": "off",
818
- "vue/custom-event-name-casing": ["error", "camelCase"],
819
- "vue/define-macros-order": ["error", {
820
- order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
821
- }],
822
- "vue/dot-location": ["error", "property"],
823
- "vue/dot-notation": ["error", { allowKeywords: true }],
824
- "vue/eqeqeq": ["error", "smart"],
825
- "vue/html-indent": ["error", 2],
826
- "vue/html-quotes": ["error", "double"],
827
- "vue/max-attributes-per-line": ["error", {
828
- singleline: {
829
- max: 1
830
- },
831
- multiline: {
832
- max: 1
833
- }
834
- }],
835
- "vue/multi-word-component-names": "off",
836
- "vue/no-dupe-keys": "off",
837
- "vue/no-empty-pattern": "error",
838
- "vue/no-irregular-whitespace": "error",
839
- "vue/no-loss-of-precision": "error",
840
- "vue/no-restricted-syntax": [
841
- "error",
842
- "DebuggerStatement",
843
- "LabeledStatement",
844
- "WithStatement"
845
- ],
846
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
847
- "vue/no-setup-props-reactivity-loss": "off",
848
- "vue/no-sparse-arrays": "error",
849
- "vue/no-unused-refs": "error",
850
- "vue/no-useless-v-bind": "error",
851
- "vue/no-v-html": "off",
852
- "vue/object-shorthand": [
853
- "error",
854
- "always",
855
- {
856
- avoidQuotes: true,
857
- ignoreConstructors: false
858
- }
859
- ],
860
- "vue/prefer-separate-static-class": "error",
861
- "vue/prefer-template": "error",
862
- "vue/prop-name-casing": ["error", "camelCase"],
863
- "vue/require-default-prop": "off",
864
- "vue/require-prop-types": "off",
865
- "vue/space-infix-ops": "error",
866
- "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
867
- "vue/array-bracket-spacing": ["error", "never"],
868
- "vue/arrow-spacing": ["error", { after: true, before: true }],
869
- "vue/block-spacing": ["error", "always"],
870
- "vue/block-tag-newline": ["error", {
871
- multiline: "always",
872
- singleline: "always"
873
- }],
874
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
875
- "vue/comma-dangle": ["error", "always-multiline"],
876
- "vue/comma-spacing": ["error", { after: true, before: false }],
877
- "vue/comma-style": ["error", "last"],
878
- "vue/html-comment-content-spacing": ["error", "always", {
879
- exceptions: ["-"]
880
- }],
881
- "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
882
- "vue/keyword-spacing": ["error", { after: true, before: true }],
883
- "vue/object-curly-newline": "off",
884
- "vue/object-curly-spacing": ["error", "always"],
885
- "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
886
- "vue/operator-linebreak": ["error", "before"],
887
- "vue/padding-line-between-blocks": ["error", "always"],
888
- "vue/quote-props": ["error", "consistent-as-needed"],
889
- "vue/space-in-parens": ["error", "never"],
890
- "vue/template-curly-spacing": "error",
891
- "vue/no-export-in-script-setup": "off",
892
- // exportRender / exportExpose / exportProps
893
- "vue/valid-attribute-name": "off",
894
- // short-vmodel
895
- "vue/valid-define-props": "off",
896
- // hoistStatic
897
- "vue/valid-v-bind": "off",
898
- "vue/no-unused-vars": "off"
899
- }
900
- }
901
- ];
902
- }
824
+ //#endregion
825
+ //#region src/configs/toml.js
826
+ /**
827
+ * TOML
828
+ *
829
+ * @see https://ota-meshi.github.io/eslint-plugin-yml/
830
+ * @returns {import('eslint').Linter.FlatConfig[]}
831
+ */
832
+ const toml = async () => {
833
+ const files = [GLOB_TOML];
834
+ const [pluginToml, parserToml] = await Promise.all([interopDefault(import("eslint-plugin-toml")), interopDefault(import("toml-eslint-parser"))]);
835
+ return [{
836
+ name: "cuiqg/toml",
837
+ files,
838
+ plugins: { toml: pluginToml },
839
+ languageOptions: { parser: parserToml },
840
+ rules: { ...pluginToml.configs.recommended.rules }
841
+ }];
842
+ };
903
843
 
904
- // src/configs/yaml.js
905
- async function yaml() {
906
- const files = [GLOB_YAML];
907
- const [pluginYaml, parserYaml] = await Promise.all([
908
- interopDefault(import("eslint-plugin-yml")),
909
- interopDefault(import("yaml-eslint-parser"))
910
- ]);
911
- return [
912
- {
913
- name: "cuiqg/yaml",
914
- files,
915
- plugins: {
916
- yaml: pluginYaml
917
- },
918
- languageOptions: {
919
- parser: parserYaml
920
- },
921
- rules: {
922
- ...pluginYaml.configs.recommended.rules,
923
- ...pluginYaml.configs.prettier.rules
924
- }
925
- }
926
- ];
927
- }
844
+ //#endregion
845
+ //#region src/configs/unicorn.js
846
+ /**
847
+ * Unicorn
848
+ *
849
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn
850
+ * @returns {import('eslint').Linter.FlatConfig[]}
851
+ */
852
+ const unicorn = async () => {
853
+ const pluginUnicorn = await interopDefault(import("eslint-plugin-unicorn"));
854
+ return [{
855
+ name: "cuiqg/unicorn",
856
+ plugins: { unicorn: pluginUnicorn },
857
+ rules: {
858
+ "unicorn/consistent-empty-array-spread": "error",
859
+ "unicorn/error-message": "error",
860
+ "unicorn/escape-case": "error",
861
+ "unicorn/new-for-builtins": "error",
862
+ "unicorn/no-new-array": "error",
863
+ "unicorn/no-new-buffer": "error",
864
+ "unicorn/number-literal-case": "error",
865
+ "unicorn/prefer-dom-node-text-content": "error",
866
+ "unicorn/prefer-includes": "error",
867
+ "unicorn/prefer-node-protocol": "error",
868
+ "unicorn/prefer-number-properties": "error",
869
+ "unicorn/prefer-string-starts-ends-with": "error",
870
+ "unicorn/prefer-type-error": "error",
871
+ "unicorn/throw-new-error": "error"
872
+ }
873
+ }];
874
+ };
928
875
 
929
- // src/configs/gitignore.js
930
- async function gitignore() {
931
- const pluginGitignore = await interopDefault(import("eslint-config-flat-gitignore"));
932
- return [
933
- pluginGitignore({
934
- name: "cuiqg/gitignore",
935
- strict: false
936
- })
937
- ];
938
- }
876
+ //#endregion
877
+ //#region src/configs/unocss.js
878
+ /**
879
+ * UnoCSS
880
+ *
881
+ * @see https://unocss.dev/integrations/eslint
882
+ * @returns {import('eslint').Linter.FlatConfig[]}
883
+ */
884
+ const unocss = async () => {
885
+ const pluginUnoCSS = await interopDefault(import("@unocss/eslint-plugin"));
886
+ return [{
887
+ ...pluginUnoCSS.configs.flat,
888
+ name: "cuiqg/unocss"
889
+ }];
890
+ };
939
891
 
940
- // src/configs/disables.js
941
- async function disables() {
942
- return [
943
- {
944
- files: [`**/scripts/${GLOB_SRC}`, `**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
945
- name: "cuiqg/disables",
946
- rules: {
947
- "no-console": "off"
948
- }
949
- }
950
- ];
951
- }
892
+ //#endregion
893
+ //#region src/configs/unplugin.js
894
+ /**
895
+ * UnPlugin
896
+ * @returns {import('eslint').Linter.FlatConfig[]}
897
+ */
898
+ const unplugin = async () => {
899
+ const resolved = resolve(process.cwd(), `./.eslintrc-auto-import.json`);
900
+ let globals$1 = {};
901
+ if (fs.existsSync(resolved) && fs.statSync(resolved).isFile) {
902
+ const cwd = dirname(resolved);
903
+ const { config } = await loadConfig({
904
+ sources: [{
905
+ files: resolved,
906
+ extensions: [],
907
+ rewrite(config$1) {
908
+ return config$1?.globals;
909
+ }
910
+ }],
911
+ cwd
912
+ });
913
+ globals$1 = { ...config };
914
+ }
915
+ return [{
916
+ name: "cuiqg/unplugin/auto-import",
917
+ languageOptions: { globals: globals$1 }
918
+ }];
919
+ };
952
920
 
953
- // src/configs/toml.js
954
- async function toml() {
955
- const files = [GLOB_TOML];
956
- const [pluginToml, parserToml] = await Promise.all([
957
- interopDefault(import("eslint-plugin-toml")),
958
- interopDefault(import("toml-eslint-parser"))
959
- ]);
960
- return [
961
- {
962
- name: "cuiqg/toml",
963
- files,
964
- plugins: {
965
- toml: pluginToml
966
- },
967
- languageOptions: {
968
- parser: parserToml
969
- },
970
- rules: {
971
- ...pluginToml.configs.recommended.rules
972
- }
973
- }
974
- ];
975
- }
921
+ //#endregion
922
+ //#region src/configs/vue.js
923
+ /**
924
+ * Vue
925
+ *
926
+ * @see https://eslint.vuejs.org/
927
+ * @returns {import('eslint').Linter.FlatConfig[]}
928
+ */
929
+ const vue = async () => {
930
+ const files = [GLOB_VUE];
931
+ const [pluginVue, parserVue] = await Promise.all([interopDefault(import("eslint-plugin-vue")), interopDefault(import("vue-eslint-parser"))]);
932
+ return [{
933
+ files,
934
+ languageOptions: {
935
+ globals: {
936
+ computed: "readonly",
937
+ defineModel: "readonly",
938
+ defineOptions: "readonly",
939
+ defineProps: "readonly",
940
+ defineRender: "readonly",
941
+ defineSlots: "readonly",
942
+ defineEmits: "readonly",
943
+ defineExpose: "readonly",
944
+ definePage: "readonly",
945
+ onMounted: "readonly",
946
+ onUnmounted: "readonly",
947
+ onActivated: "readonly",
948
+ onDeactivated: "readonly",
949
+ reactive: "readonly",
950
+ ref: "readonly",
951
+ shallowReactive: "readonly",
952
+ shallowRef: "readonly",
953
+ toRef: "readonly",
954
+ toRefs: "readonly",
955
+ watch: "readonly",
956
+ watchEffect: "readonly"
957
+ },
958
+ parser: parserVue,
959
+ parserOptions: {
960
+ ecmaFeatures: { jsx: true },
961
+ extraFileExtensions: [".vue"],
962
+ parser: null,
963
+ sourceType: "module"
964
+ }
965
+ },
966
+ name: "cuiqg/vue",
967
+ plugins: { vue: pluginVue },
968
+ processor: pluginVue.processors[".vue"],
969
+ rules: {
970
+ ...pluginVue.configs.base.rules,
971
+ ...pluginVue.configs["flat/essential"].rules,
972
+ ...pluginVue.configs["flat/strongly-recommended"].rules,
973
+ ...pluginVue.configs["flat/recommended"].rules,
974
+ "vue/block-order": ["error", { order: [
975
+ "script",
976
+ "template",
977
+ "style",
978
+ "route"
979
+ ] }],
980
+ "vue/component-name-in-template-casing": ["error", "PascalCase"],
981
+ "vue/component-options-name-casing": ["error", "PascalCase"],
982
+ "vue/component-tags-order": "off",
983
+ "vue/custom-event-name-casing": ["error", "camelCase"],
984
+ "vue/define-macros-order": ["error", { order: [
985
+ "defineOptions",
986
+ "defineProps",
987
+ "defineEmits",
988
+ "defineSlots"
989
+ ] }],
990
+ "vue/dot-location": ["error", "property"],
991
+ "vue/dot-notation": ["error", { allowKeywords: true }],
992
+ "vue/eqeqeq": ["error", "smart"],
993
+ "vue/html-indent": ["error", 2],
994
+ "vue/html-quotes": ["error", "double"],
995
+ "vue/max-attributes-per-line": ["error", {
996
+ singleline: { max: 1 },
997
+ multiline: { max: 1 }
998
+ }],
999
+ "vue/multi-word-component-names": "off",
1000
+ "vue/no-dupe-keys": "off",
1001
+ "vue/no-empty-pattern": "error",
1002
+ "vue/no-irregular-whitespace": "error",
1003
+ "vue/no-loss-of-precision": "error",
1004
+ "vue/no-restricted-syntax": [
1005
+ "error",
1006
+ "DebuggerStatement",
1007
+ "LabeledStatement",
1008
+ "WithStatement"
1009
+ ],
1010
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
1011
+ "vue/no-setup-props-reactivity-loss": "off",
1012
+ "vue/no-sparse-arrays": "error",
1013
+ "vue/no-unused-refs": "error",
1014
+ "vue/no-useless-v-bind": "error",
1015
+ "vue/no-v-html": "off",
1016
+ "vue/object-shorthand": [
1017
+ "error",
1018
+ "always",
1019
+ {
1020
+ avoidQuotes: true,
1021
+ ignoreConstructors: false
1022
+ }
1023
+ ],
1024
+ "vue/prefer-separate-static-class": "error",
1025
+ "vue/prefer-template": "error",
1026
+ "vue/prop-name-casing": ["error", "camelCase"],
1027
+ "vue/require-default-prop": "off",
1028
+ "vue/require-prop-types": "off",
1029
+ "vue/space-infix-ops": "error",
1030
+ "vue/space-unary-ops": ["error", {
1031
+ nonwords: false,
1032
+ words: true
1033
+ }],
1034
+ "vue/array-bracket-spacing": ["error", "never"],
1035
+ "vue/arrow-spacing": ["error", {
1036
+ after: true,
1037
+ before: true
1038
+ }],
1039
+ "vue/block-spacing": ["error", "always"],
1040
+ "vue/block-tag-newline": ["error", {
1041
+ multiline: "always",
1042
+ singleline: "always"
1043
+ }],
1044
+ "vue/brace-style": [
1045
+ "error",
1046
+ "stroustrup",
1047
+ { allowSingleLine: true }
1048
+ ],
1049
+ "vue/comma-dangle": ["error", "always-multiline"],
1050
+ "vue/comma-spacing": ["error", {
1051
+ after: true,
1052
+ before: false
1053
+ }],
1054
+ "vue/comma-style": ["error", "last"],
1055
+ "vue/html-comment-content-spacing": [
1056
+ "error",
1057
+ "always",
1058
+ { exceptions: ["-"] }
1059
+ ],
1060
+ "vue/key-spacing": ["error", {
1061
+ afterColon: true,
1062
+ beforeColon: false
1063
+ }],
1064
+ "vue/keyword-spacing": ["error", {
1065
+ after: true,
1066
+ before: true
1067
+ }],
1068
+ "vue/object-curly-newline": "off",
1069
+ "vue/object-curly-spacing": ["error", "always"],
1070
+ "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1071
+ "vue/operator-linebreak": ["error", "before"],
1072
+ "vue/padding-line-between-blocks": ["error", "always"],
1073
+ "vue/quote-props": ["error", "consistent-as-needed"],
1074
+ "vue/space-in-parens": ["error", "never"],
1075
+ "vue/template-curly-spacing": "error",
1076
+ "vue/no-export-in-script-setup": "off",
1077
+ "vue/valid-attribute-name": "off",
1078
+ "vue/valid-define-props": "off",
1079
+ "vue/valid-v-bind": "off",
1080
+ "vue/no-unused-vars": "off"
1081
+ }
1082
+ }];
1083
+ };
976
1084
 
977
- // src/configs/tailwindcss.js
978
- async function tailwindcss() {
979
- const pluginTailwindcss = await interopDefault(import("eslint-plugin-tailwindcss"));
980
- return [
981
- {
982
- name: "cuiqg/tailwindcss",
983
- plugins: {
984
- tailwindcss: pluginTailwindcss
985
- },
986
- rules: {
987
- ...pluginTailwindcss.configs.recommended.rules
988
- }
989
- }
990
- ];
991
- }
1085
+ //#endregion
1086
+ //#region src/configs/yaml.js
1087
+ /**
1088
+ * Yaml
1089
+ *
1090
+ * @see https://ota-meshi.github.io/eslint-plugin-yml/
1091
+ * @returns {import('eslint').Linter.FlatConfig[]}
1092
+ */
1093
+ const yaml = async () => {
1094
+ const files = [GLOB_YAML];
1095
+ const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
1096
+ return [{
1097
+ name: "cuiqg/yaml",
1098
+ files,
1099
+ plugins: { yaml: pluginYaml },
1100
+ languageOptions: { parser: parserYaml },
1101
+ rules: {
1102
+ ...pluginYaml.configs.recommended.rules,
1103
+ ...pluginYaml.configs.prettier.rules
1104
+ }
1105
+ }];
1106
+ };
992
1107
 
993
- // src/presets.js
994
- var defaultPluginRenaming = {
995
- "@stylistic": "style",
996
- "import-x": "import",
997
- "n": "node",
998
- "yml": "yaml"
1108
+ //#endregion
1109
+ //#region src/presets.js
1110
+ const defaultPluginRenaming = {
1111
+ "@stylistic": "style",
1112
+ "import-x": "import",
1113
+ "n": "node",
1114
+ "yml": "yaml"
999
1115
  };
1000
1116
  function cuiqg(options = {}, ...userConfigs) {
1001
- const {
1002
- prettier: enablePrettier = false,
1003
- gitignore: enableGitignore = true,
1004
- unocss: enableUnocss = hasUnocss,
1005
- tailwindcss: enableTailwindcss = hasTailwindcss,
1006
- vue: enableVue = hasVue,
1007
- stylistic: enableStylistic = true,
1008
- jsdoc: enableJsdoc = false
1009
- } = options;
1010
- const configs = [];
1011
- configs.push(
1012
- autoImport(),
1013
- ignores(),
1014
- javascript(),
1015
- comments(),
1016
- node(),
1017
- imports(),
1018
- unicorn(),
1019
- macros(),
1020
- jsonc(),
1021
- sortPackageJson(),
1022
- sortJsconfig(),
1023
- yaml(),
1024
- toml(),
1025
- disables()
1026
- );
1027
- if (enableGitignore) {
1028
- configs.push(
1029
- gitignore()
1030
- );
1031
- }
1032
- if (enableStylistic) {
1033
- configs.push(
1034
- stylistic()
1035
- );
1036
- }
1037
- if (enableVue) {
1038
- configs.push(
1039
- vue()
1040
- );
1041
- }
1042
- if (enableUnocss) {
1043
- configs.push(
1044
- unocss()
1045
- );
1046
- }
1047
- if (enableTailwindcss) {
1048
- configs.push(
1049
- tailwindcss()
1050
- );
1051
- }
1052
- if (enablePrettier) {
1053
- configs.push(
1054
- prettier()
1055
- );
1056
- }
1057
- if (enableJsdoc) {
1058
- configs.push(
1059
- jsdoc()
1060
- );
1061
- }
1062
- return composer(...configs).append(...userConfigs).renamePlugins(defaultPluginRenaming);
1117
+ const { prettier: enablePrettier = false, gitignore: enableGitignore = true, unocss: enableUnocss = hasUnocss, vue: enableVue = hasVue, stylistic: enableStylistic = true, jsdoc: enableJsdoc = false, pnpm: enablePnpm = false } = options;
1118
+ const configs = [
1119
+ unplugin(),
1120
+ ignores(),
1121
+ javascript(),
1122
+ comments(),
1123
+ node(),
1124
+ imports(),
1125
+ unicorn(),
1126
+ macros(),
1127
+ jsonc(),
1128
+ sortPackageJson(),
1129
+ sortJsconfig(),
1130
+ yaml(),
1131
+ toml(),
1132
+ disables()
1133
+ ];
1134
+ if (enableGitignore) configs.push(gitignore());
1135
+ if (enableStylistic) configs.push(stylistic());
1136
+ if (enableVue) configs.push(vue());
1137
+ if (enableUnocss) configs.push(unocss());
1138
+ if (enablePrettier) configs.push(prettier());
1139
+ if (enableJsdoc) configs.push(jsdoc());
1140
+ if (enablePnpm) configs.push(pnpm());
1141
+ let composer = new FlatConfigComposer(...configs, ...userConfigs);
1142
+ composer = composer.renamePlugins(defaultPluginRenaming);
1143
+ return composer;
1063
1144
  }
1064
1145
 
1065
- // src/index.js
1066
- var index_default = cuiqg;
1067
- export {
1068
- GLOB_CSS,
1069
- GLOB_EXCLUDE,
1070
- GLOB_HTML,
1071
- GLOB_JS,
1072
- GLOB_JSON,
1073
- GLOB_JSON5,
1074
- GLOB_JSONC,
1075
- GLOB_JSX,
1076
- GLOB_LESS,
1077
- GLOB_POSTCSS,
1078
- GLOB_SCSS,
1079
- GLOB_SRC,
1080
- GLOB_SRC_EXT,
1081
- GLOB_STYLE,
1082
- GLOB_TOML,
1083
- GLOB_VUE,
1084
- GLOB_XML,
1085
- GLOB_YAML,
1086
- autoImport,
1087
- comments,
1088
- cuiqg,
1089
- index_default as default,
1090
- defaultPluginRenaming,
1091
- disables,
1092
- gitignore,
1093
- hasTailwindcss,
1094
- hasUnocss,
1095
- hasVue,
1096
- ignores,
1097
- imports,
1098
- interopDefault,
1099
- isInEditor,
1100
- javascript,
1101
- jsdoc,
1102
- jsonc,
1103
- macros,
1104
- node,
1105
- prettier,
1106
- sortJsconfig,
1107
- sortPackageJson,
1108
- stylistic,
1109
- tailwindcss,
1110
- toml,
1111
- unicorn,
1112
- unocss,
1113
- vue,
1114
- yaml
1115
- };
1146
+ //#endregion
1147
+ //#region src/index.js
1148
+ var src_default = cuiqg;
1149
+
1150
+ //#endregion
1151
+ export { GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TOML, GLOB_VUE, GLOB_XML, GLOB_YAML, comments, cuiqg, src_default as default, defaultPluginRenaming, disables, gitignore, hasTypescript, hasUnocss, hasVue, ignores, imports, interopDefault, isInEditor, isInGitHooksOrLintStaged, javascript, jsdoc, jsonc, macros, node, pnpm, prettier, sortJsconfig, sortPackageJson, stylistic, toml, unicorn, unocss, unplugin, vue, yaml };