@lntvow/eslint-config 9.3.10 → 9.3.11
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.cjs +1 -1014
- package/dist/index.d.cts +27 -27
- package/dist/index.d.ts +27 -27
- package/dist/index.mjs +1 -0
- package/package.json +4 -4
- package/dist/index.js +0 -935
package/dist/index.cjs
CHANGED
|
@@ -1,1014 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var src_exports = {};
|
|
32
|
-
__export(src_exports, {
|
|
33
|
-
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
|
-
GLOB_ASTRO: () => GLOB_ASTRO,
|
|
35
|
-
GLOB_CSS: () => GLOB_CSS,
|
|
36
|
-
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
37
|
-
GLOB_GRAPHQL: () => GLOB_GRAPHQL,
|
|
38
|
-
GLOB_HTML: () => GLOB_HTML,
|
|
39
|
-
GLOB_JS: () => GLOB_JS,
|
|
40
|
-
GLOB_JSON: () => GLOB_JSON,
|
|
41
|
-
GLOB_JSON5: () => GLOB_JSON5,
|
|
42
|
-
GLOB_JSONC: () => GLOB_JSONC,
|
|
43
|
-
GLOB_JSX: () => GLOB_JSX,
|
|
44
|
-
GLOB_LESS: () => GLOB_LESS,
|
|
45
|
-
GLOB_MARKDOWN: () => GLOB_MARKDOWN,
|
|
46
|
-
GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
|
|
47
|
-
GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
|
|
48
|
-
GLOB_POSTCSS: () => GLOB_POSTCSS,
|
|
49
|
-
GLOB_SCSS: () => GLOB_SCSS,
|
|
50
|
-
GLOB_SRC: () => GLOB_SRC,
|
|
51
|
-
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
52
|
-
GLOB_STYLE: () => GLOB_STYLE,
|
|
53
|
-
GLOB_SVELTE: () => GLOB_SVELTE,
|
|
54
|
-
GLOB_TESTS: () => GLOB_TESTS,
|
|
55
|
-
GLOB_TOML: () => GLOB_TOML,
|
|
56
|
-
GLOB_TS: () => GLOB_TS,
|
|
57
|
-
GLOB_TSX: () => GLOB_TSX,
|
|
58
|
-
GLOB_VUE: () => GLOB_VUE,
|
|
59
|
-
GLOB_XML: () => GLOB_XML,
|
|
60
|
-
GLOB_YAML: () => GLOB_YAML,
|
|
61
|
-
StylisticConfigDefaults: () => StylisticConfigDefaults,
|
|
62
|
-
custom: () => custom,
|
|
63
|
-
default: () => src_default,
|
|
64
|
-
getVueVersion: () => getVueVersion,
|
|
65
|
-
gitignore: () => gitignore,
|
|
66
|
-
ignores: () => ignores,
|
|
67
|
-
imports: () => imports,
|
|
68
|
-
javascript: () => javascript,
|
|
69
|
-
lntvow: () => lntvow,
|
|
70
|
-
prettier: () => prettier,
|
|
71
|
-
regexp: () => regexp,
|
|
72
|
-
renameRules: () => renameRules,
|
|
73
|
-
stylistic: () => stylistic,
|
|
74
|
-
test: () => test,
|
|
75
|
-
typescript: () => typescript,
|
|
76
|
-
vue: () => vue
|
|
77
|
-
});
|
|
78
|
-
module.exports = __toCommonJS(src_exports);
|
|
79
|
-
|
|
80
|
-
// src/factory.ts
|
|
81
|
-
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
82
|
-
var import_utils3 = require("@lntvow/utils");
|
|
83
|
-
var import_local_pkg2 = require("local-pkg");
|
|
84
|
-
|
|
85
|
-
// src/configs/custom.ts
|
|
86
|
-
var import_eslint_plugin = __toESM(require("@lntvow/eslint-plugin"), 1);
|
|
87
|
-
async function custom() {
|
|
88
|
-
return [
|
|
89
|
-
{
|
|
90
|
-
name: "lntvow/custom",
|
|
91
|
-
plugins: {
|
|
92
|
-
lntvow: import_eslint_plugin.default
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// src/configs/gitignore.ts
|
|
99
|
-
var import_fs = __toESM(require("fs"), 1);
|
|
100
|
-
var import_find_up = require("find-up");
|
|
101
|
-
var import_utils = require("@lntvow/utils");
|
|
102
|
-
var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
103
|
-
async function gitignore(options) {
|
|
104
|
-
const { name = ".gitignore", root = false, files: _files = root ? name : (0, import_find_up.findUpSync)(name) || [] } = options;
|
|
105
|
-
const files = (0, import_utils.castArray)(_files);
|
|
106
|
-
const ignores2 = [];
|
|
107
|
-
for (const file of files) {
|
|
108
|
-
try {
|
|
109
|
-
const content = import_fs.default.readFileSync(file, "utf8");
|
|
110
|
-
const globs = (0, import_parse_gitignore.default)(content).globs();
|
|
111
|
-
for (const glob of globs) {
|
|
112
|
-
if (glob.type === "ignore") {
|
|
113
|
-
ignores2.push(...glob.patterns);
|
|
114
|
-
} else if (glob.type === "unignore") {
|
|
115
|
-
ignores2.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
} catch (error) {
|
|
119
|
-
throw new Error(`Failed to read file: ${file}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return [
|
|
123
|
-
{
|
|
124
|
-
ignores: ignores2
|
|
125
|
-
}
|
|
126
|
-
];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// src/globs.ts
|
|
130
|
-
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
131
|
-
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
132
|
-
var GLOB_JS = "**/*.?([cm])js";
|
|
133
|
-
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
134
|
-
var GLOB_TS = "**/*.?([cm])ts";
|
|
135
|
-
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
136
|
-
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
137
|
-
var GLOB_CSS = "**/*.css";
|
|
138
|
-
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
139
|
-
var GLOB_LESS = "**/*.less";
|
|
140
|
-
var GLOB_SCSS = "**/*.scss";
|
|
141
|
-
var GLOB_JSON = "**/*.json";
|
|
142
|
-
var GLOB_JSON5 = "**/*.json5";
|
|
143
|
-
var GLOB_JSONC = "**/*.jsonc";
|
|
144
|
-
var GLOB_MARKDOWN = "**/*.md";
|
|
145
|
-
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
146
|
-
var GLOB_SVELTE = "**/*.svelte";
|
|
147
|
-
var GLOB_VUE = "**/*.vue";
|
|
148
|
-
var GLOB_YAML = "**/*.y?(a)ml";
|
|
149
|
-
var GLOB_TOML = "**/*.toml";
|
|
150
|
-
var GLOB_XML = "**/*.xml";
|
|
151
|
-
var GLOB_HTML = "**/*.htm?(l)";
|
|
152
|
-
var GLOB_ASTRO = "**/*.astro";
|
|
153
|
-
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
154
|
-
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
155
|
-
var GLOB_TESTS = [
|
|
156
|
-
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
157
|
-
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
158
|
-
`**/*.test.${GLOB_SRC_EXT}`,
|
|
159
|
-
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
160
|
-
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
161
|
-
];
|
|
162
|
-
var GLOB_ALL_SRC = [
|
|
163
|
-
GLOB_SRC,
|
|
164
|
-
GLOB_STYLE,
|
|
165
|
-
GLOB_JSON,
|
|
166
|
-
GLOB_JSON5,
|
|
167
|
-
GLOB_MARKDOWN,
|
|
168
|
-
GLOB_SVELTE,
|
|
169
|
-
GLOB_VUE,
|
|
170
|
-
GLOB_YAML,
|
|
171
|
-
GLOB_XML,
|
|
172
|
-
GLOB_HTML
|
|
173
|
-
];
|
|
174
|
-
var GLOB_EXCLUDE = [
|
|
175
|
-
"**/node_modules",
|
|
176
|
-
"**/dist",
|
|
177
|
-
"**/package-lock.json",
|
|
178
|
-
"**/yarn.lock",
|
|
179
|
-
"**/pnpm-lock.yaml",
|
|
180
|
-
"**/bun.lockb",
|
|
181
|
-
"**/output",
|
|
182
|
-
"**/coverage",
|
|
183
|
-
"**/temp",
|
|
184
|
-
"**/.temp",
|
|
185
|
-
"**/tmp",
|
|
186
|
-
"**/.tmp",
|
|
187
|
-
"**/.history",
|
|
188
|
-
"**/.vitepress/cache",
|
|
189
|
-
"**/.nuxt",
|
|
190
|
-
"**/.next",
|
|
191
|
-
"**/.vercel",
|
|
192
|
-
"**/.changeset",
|
|
193
|
-
"**/.idea",
|
|
194
|
-
"**/.cache",
|
|
195
|
-
"**/.output",
|
|
196
|
-
"**/.vite-inspect",
|
|
197
|
-
"**/.yarn",
|
|
198
|
-
"**/CHANGELOG*.md",
|
|
199
|
-
"**/*.min.*",
|
|
200
|
-
"**/LICENSE*",
|
|
201
|
-
"**/__snapshots__",
|
|
202
|
-
"**/auto-import?(s).d.ts",
|
|
203
|
-
"**/components.d.ts"
|
|
204
|
-
];
|
|
205
|
-
|
|
206
|
-
// src/configs/ignores.ts
|
|
207
|
-
async function ignores() {
|
|
208
|
-
return [
|
|
209
|
-
{
|
|
210
|
-
ignores: [...GLOB_EXCLUDE]
|
|
211
|
-
}
|
|
212
|
-
];
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// src/configs/imports.ts
|
|
216
|
-
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
217
|
-
async function imports() {
|
|
218
|
-
return [
|
|
219
|
-
{
|
|
220
|
-
name: "lntvow/imports/rules",
|
|
221
|
-
plugins: {
|
|
222
|
-
import: import_eslint_plugin_import_x.default
|
|
223
|
-
},
|
|
224
|
-
rules: {
|
|
225
|
-
"import/order": "error",
|
|
226
|
-
"import/newline-after-import": "error"
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
];
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// src/configs/javascript.ts
|
|
233
|
-
var import_js = __toESM(require("@eslint/js"), 1);
|
|
234
|
-
var import_globals = __toESM(require("globals"), 1);
|
|
235
|
-
async function javascript(options = {}) {
|
|
236
|
-
const { overrides = {} } = options;
|
|
237
|
-
return [
|
|
238
|
-
{
|
|
239
|
-
name: "lntvow/javascript/rules",
|
|
240
|
-
languageOptions: {
|
|
241
|
-
ecmaVersion: 2022,
|
|
242
|
-
sourceType: "module",
|
|
243
|
-
parserOptions: {
|
|
244
|
-
ecmaVersion: 2022,
|
|
245
|
-
sourceType: "module",
|
|
246
|
-
ecmaFeatures: {
|
|
247
|
-
jsx: true
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
globals: {
|
|
251
|
-
...import_globals.default.browser,
|
|
252
|
-
...import_globals.default.es2021,
|
|
253
|
-
...import_globals.default.node,
|
|
254
|
-
document: "readonly",
|
|
255
|
-
navigator: "readonly",
|
|
256
|
-
window: "readonly"
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
linterOptions: {
|
|
260
|
-
reportUnusedDisableDirectives: true
|
|
261
|
-
},
|
|
262
|
-
rules: {
|
|
263
|
-
// Update to eslint-plugin-vue v9.3.0
|
|
264
|
-
...import_js.default.configs.all.rules,
|
|
265
|
-
// 禁止未使用过的变量
|
|
266
|
-
"no-unused-vars": "warn",
|
|
267
|
-
// 禁止定义前使用
|
|
268
|
-
"no-use-before-define": ["error", { functions: false, variables: false }],
|
|
269
|
-
// 禁止无用的分配 有时候需要置空变量时候需要用到
|
|
270
|
-
"no-useless-assignment": "off",
|
|
271
|
-
// 禁止使用 await 或 yield 导致竞争条件的分配
|
|
272
|
-
"require-atomic-updates": "off",
|
|
273
|
-
// 强制使用骆驼拼写法命名约定
|
|
274
|
-
"camelcase": "warn",
|
|
275
|
-
// 强制注释首字母大写或小写
|
|
276
|
-
"capitalized-comments": "off",
|
|
277
|
-
// 强制类方法使用this
|
|
278
|
-
"class-methods-use-this": "off",
|
|
279
|
-
// 指定程序中允许的最大环路复杂度
|
|
280
|
-
"complexity": "off",
|
|
281
|
-
// 强制保证多行所有的花括号,
|
|
282
|
-
"curly": ["error", "multi-line"],
|
|
283
|
-
// 要求使用命名的 function 表达式 便于调试
|
|
284
|
-
"func-names": "off",
|
|
285
|
-
// 强制一致地使用 function 声明或表达式
|
|
286
|
-
"func-style": "off",
|
|
287
|
-
// 要求 for-in 循环中有一个 if 语句
|
|
288
|
-
"guard-for-in": "off",
|
|
289
|
-
// 禁用指定的标识符
|
|
290
|
-
"id-denylist": "off",
|
|
291
|
-
// 强制标识符的最小和最大长度
|
|
292
|
-
"id-length": "off",
|
|
293
|
-
// 禁止使用指定的标识符
|
|
294
|
-
"id-match": "off",
|
|
295
|
-
// 要求变量声明并同时初始化
|
|
296
|
-
"init-declarations": "off",
|
|
297
|
-
// 强制每个文件中包含的的类的最大数量
|
|
298
|
-
"max-classes-per-file": "off",
|
|
299
|
-
// 强制可嵌套的块的最大深度
|
|
300
|
-
"max-depth": "off",
|
|
301
|
-
// 强制最大行数
|
|
302
|
-
"max-lines": "off",
|
|
303
|
-
// 强制函数最大行数
|
|
304
|
-
"max-lines-per-function": "off",
|
|
305
|
-
// 强制回调函数最大嵌套深度
|
|
306
|
-
"max-nested-callbacks": "off",
|
|
307
|
-
// 强制函数定义中最多允许的参数数量
|
|
308
|
-
"max-params": "off",
|
|
309
|
-
// 强制函数块最多允许的的语句数量
|
|
310
|
-
"max-statements": "off",
|
|
311
|
-
// 要求构造函数首字母大写
|
|
312
|
-
"new-cap": ["error", { capIsNew: false }],
|
|
313
|
-
// 禁止使用按位操作符
|
|
314
|
-
"no-bitwise": "off",
|
|
315
|
-
// 禁止在 case 或 default 子句中出现词法声明
|
|
316
|
-
"no-case-declarations": "off",
|
|
317
|
-
// 禁止使用 console
|
|
318
|
-
"no-console": "warn",
|
|
319
|
-
// 禁用 continue 语句
|
|
320
|
-
"no-continue": "off",
|
|
321
|
-
// 禁止空块语句
|
|
322
|
-
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
323
|
-
// 禁止使用短符号进行类型转换
|
|
324
|
-
"no-implicit-coercion": "off",
|
|
325
|
-
// 禁止在全局范围内使用变量声明和 function 声明
|
|
326
|
-
"no-implicit-globals": "off",
|
|
327
|
-
// 禁用魔术数字
|
|
328
|
-
"no-magic-numbers": 0,
|
|
329
|
-
// 禁用嵌套的三元表达式
|
|
330
|
-
"no-nested-ternary": "off",
|
|
331
|
-
// 禁止空 new 以避免产生副作用
|
|
332
|
-
"no-new": "off",
|
|
333
|
-
// 禁止对 function 的参数进行重新赋值
|
|
334
|
-
"no-param-reassign": "off",
|
|
335
|
-
// 禁用一元操作符 ++ 和 --
|
|
336
|
-
"no-plusplus": "off",
|
|
337
|
-
// 禁用特定导出名称
|
|
338
|
-
"no-restricted-exports": "off",
|
|
339
|
-
// 禁用特定的全局变量
|
|
340
|
-
"no-restricted-globals": [
|
|
341
|
-
"error",
|
|
342
|
-
{ message: "Use `globalThis` instead.", name: "global" },
|
|
343
|
-
{ message: "Use `globalThis` instead.", name: "self" }
|
|
344
|
-
],
|
|
345
|
-
// 禁用特定的导入
|
|
346
|
-
"no-restricted-imports": "off",
|
|
347
|
-
// 禁止使用对象的某些属性
|
|
348
|
-
"no-restricted-properties": [
|
|
349
|
-
"error",
|
|
350
|
-
{ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
|
|
351
|
-
{ message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
|
|
352
|
-
{ message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
|
|
353
|
-
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
|
|
354
|
-
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
|
|
355
|
-
],
|
|
356
|
-
// 禁用特定的语法
|
|
357
|
-
"no-restricted-syntax": "off",
|
|
358
|
-
// 禁止变量声明与外层作用域的变量同名
|
|
359
|
-
"no-shadow": "off",
|
|
360
|
-
// 禁用三元操作符
|
|
361
|
-
"no-ternary": "off",
|
|
362
|
-
// 禁止抛出异常字面量
|
|
363
|
-
"no-throw-literal": "off",
|
|
364
|
-
// 禁用undefined
|
|
365
|
-
"no-undefined": "off",
|
|
366
|
-
// 禁止标识符中有下划线
|
|
367
|
-
"no-underscore-dangle": "off",
|
|
368
|
-
// 禁用 void 操作符
|
|
369
|
-
"no-void": "off",
|
|
370
|
-
// 禁止在注释中使用特定的警告术语
|
|
371
|
-
"no-warning-comments": "off",
|
|
372
|
-
// 强制函数中的变量在一起声明
|
|
373
|
-
"one-var": "off",
|
|
374
|
-
// 禁止使用 Math.pow 幂运算符
|
|
375
|
-
"prefer-exponentiation-operator": "off",
|
|
376
|
-
// 要求使用 Error 对象作为 Promise 拒绝的原因
|
|
377
|
-
"prefer-promise-reject-errors": "off",
|
|
378
|
-
// 强制在parseInt()使用基数参数
|
|
379
|
-
"radix": "off",
|
|
380
|
-
// 禁止使用不带 await 表达式的 async 函数
|
|
381
|
-
"require-await": "off",
|
|
382
|
-
// 强制在RegExp上使用u标志
|
|
383
|
-
"require-unicode-regexp": "off",
|
|
384
|
-
// imports排序 不好用
|
|
385
|
-
"sort-imports": "off",
|
|
386
|
-
// 要求对象属性按序排列
|
|
387
|
-
"sort-keys": "off",
|
|
388
|
-
// 要求同一个声明块中的变量按顺序排列
|
|
389
|
-
"sort-vars": "off",
|
|
390
|
-
// 要求或禁止使用严格模式指令
|
|
391
|
-
"strict": "off",
|
|
392
|
-
// Overrides
|
|
393
|
-
...overrides
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
files: [`scripts/${GLOB_SRC}`],
|
|
398
|
-
name: "lntvow/javascript/disables",
|
|
399
|
-
rules: {
|
|
400
|
-
"no-console": "off"
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
];
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// src/configs/prettier.ts
|
|
407
|
-
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
408
|
-
var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
|
|
409
|
-
async function prettier() {
|
|
410
|
-
return [
|
|
411
|
-
{
|
|
412
|
-
name: "lntvow/prettier/rules",
|
|
413
|
-
plugins: {
|
|
414
|
-
prettier: import_eslint_plugin_prettier.default
|
|
415
|
-
},
|
|
416
|
-
rules: {
|
|
417
|
-
...import_eslint_config_prettier.default.rules,
|
|
418
|
-
"prettier/prettier": "warn"
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
];
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// src/configs/regexp.ts
|
|
425
|
-
var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
426
|
-
async function regexp(options = {}) {
|
|
427
|
-
const { overrides } = options;
|
|
428
|
-
const pluginRegexp = import_eslint_plugin_regexp.configs["flat/recommended"].plugins.regexp;
|
|
429
|
-
const { rules } = import_eslint_plugin_regexp.configs["flat/recommended"];
|
|
430
|
-
return [
|
|
431
|
-
{
|
|
432
|
-
name: "lntvow/regexp/rules",
|
|
433
|
-
plugins: {
|
|
434
|
-
regexp: pluginRegexp
|
|
435
|
-
},
|
|
436
|
-
rules: {
|
|
437
|
-
// Update to eslint-plugin-regexp v2.6.0
|
|
438
|
-
...rules,
|
|
439
|
-
// Overrides
|
|
440
|
-
...overrides
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
];
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
// src/configs/stylistic.ts
|
|
447
|
-
var import_eslint_plugin2 = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
448
|
-
var StylisticConfigDefaults = {
|
|
449
|
-
indent: 2,
|
|
450
|
-
jsx: true,
|
|
451
|
-
quotes: "single",
|
|
452
|
-
semi: false
|
|
453
|
-
};
|
|
454
|
-
async function stylistic(options = {}) {
|
|
455
|
-
const {
|
|
456
|
-
indent,
|
|
457
|
-
jsx,
|
|
458
|
-
overrides = {},
|
|
459
|
-
quotes,
|
|
460
|
-
semi
|
|
461
|
-
} = {
|
|
462
|
-
...StylisticConfigDefaults,
|
|
463
|
-
...options
|
|
464
|
-
};
|
|
465
|
-
const config = import_eslint_plugin2.default.configs.customize({
|
|
466
|
-
flat: true,
|
|
467
|
-
indent,
|
|
468
|
-
jsx,
|
|
469
|
-
pluginName: "style",
|
|
470
|
-
quotes,
|
|
471
|
-
semi
|
|
472
|
-
});
|
|
473
|
-
return [
|
|
474
|
-
{
|
|
475
|
-
name: "lntvow/stylistic/rules",
|
|
476
|
-
plugins: {
|
|
477
|
-
style: import_eslint_plugin2.default
|
|
478
|
-
},
|
|
479
|
-
rules: {
|
|
480
|
-
// ...config.rules,
|
|
481
|
-
// Custom rules
|
|
482
|
-
"style/spaced-comment": "error",
|
|
483
|
-
"style/padding-line-between-statements": [
|
|
484
|
-
"error",
|
|
485
|
-
{ blankLine: "always", prev: "*", next: "cjs-export" },
|
|
486
|
-
{ blankLine: "always", prev: "*", next: "export" },
|
|
487
|
-
{ blankLine: "always", prev: "*", next: "function" }
|
|
488
|
-
],
|
|
489
|
-
// overrides
|
|
490
|
-
...overrides
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
];
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
// src/configs/test.ts
|
|
497
|
-
var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
|
|
498
|
-
async function test(options = {}) {
|
|
499
|
-
const { overrides } = options;
|
|
500
|
-
return [
|
|
501
|
-
{
|
|
502
|
-
name: "lntvow/test/setup",
|
|
503
|
-
plugins: {
|
|
504
|
-
test: import_eslint_plugin_vitest.default
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
name: "lntvow/test/rules",
|
|
509
|
-
files: [...GLOB_TESTS],
|
|
510
|
-
rules: {
|
|
511
|
-
"lntvow/newline-before-describe-test": "error",
|
|
512
|
-
// Overrides
|
|
513
|
-
...overrides
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
];
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// src/configs/typescript.ts
|
|
520
|
-
var import_eslint_plugin3 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
521
|
-
var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
|
|
522
|
-
|
|
523
|
-
// src/utils/index.ts
|
|
524
|
-
function renameRules(rules, map) {
|
|
525
|
-
return Object.fromEntries(
|
|
526
|
-
Object.entries(rules).map(([key, value]) => {
|
|
527
|
-
for (const [from, to] of Object.entries(map)) {
|
|
528
|
-
if (key.startsWith(`${from}/`))
|
|
529
|
-
return [to + key.slice(from.length), value];
|
|
530
|
-
}
|
|
531
|
-
return [key, value];
|
|
532
|
-
})
|
|
533
|
-
);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
// src/configs/typescript.ts
|
|
537
|
-
async function typescript(options = {}) {
|
|
538
|
-
const { componentExts = [], overrides = {}, parserOptions = {} } = options;
|
|
539
|
-
const files = [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)];
|
|
540
|
-
return [
|
|
541
|
-
{
|
|
542
|
-
name: "lntvow/typescript/setup",
|
|
543
|
-
plugins: {
|
|
544
|
-
ts: import_eslint_plugin3.default
|
|
545
|
-
}
|
|
546
|
-
},
|
|
547
|
-
{
|
|
548
|
-
name: "lntvow/typescript/rules",
|
|
549
|
-
languageOptions: {
|
|
550
|
-
parser: import_parser.default,
|
|
551
|
-
parserOptions: {
|
|
552
|
-
sourceType: "module"
|
|
553
|
-
}
|
|
554
|
-
},
|
|
555
|
-
files,
|
|
556
|
-
rules: {
|
|
557
|
-
...renameRules(import_eslint_plugin3.default.configs["eslint-recommended"].overrides[0].rules, {
|
|
558
|
-
"@typescript-eslint": "ts"
|
|
559
|
-
}),
|
|
560
|
-
...renameRules(import_eslint_plugin3.default.configs.strict.rules, { "@typescript-eslint": "ts" }),
|
|
561
|
-
// Override default configuration
|
|
562
|
-
// 禁止使用!断言
|
|
563
|
-
"ts/no-non-null-assertion": "off",
|
|
564
|
-
// 禁止使用any
|
|
565
|
-
"ts/no-explicit-any": "off",
|
|
566
|
-
// 禁止使用ts注释
|
|
567
|
-
"ts/ban-ts-comment": "off",
|
|
568
|
-
// 未使用的变量
|
|
569
|
-
"ts/no-unused-vars": "warn",
|
|
570
|
-
// Override javascript configuration
|
|
571
|
-
"no-use-before-define": "off",
|
|
572
|
-
"ts/no-use-before-define": ["error", { functions: false, variables: false }],
|
|
573
|
-
// Overrides
|
|
574
|
-
...overrides
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
];
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
// src/configs/vue.ts
|
|
581
|
-
var import_local_pkg = require("local-pkg");
|
|
582
|
-
var import_parser2 = __toESM(require("@typescript-eslint/parser"), 1);
|
|
583
|
-
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
584
|
-
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
585
|
-
async function vue(options = {}) {
|
|
586
|
-
const { overrides = {}, vueVersion = getVueVersion() } = options;
|
|
587
|
-
const vue3Rules = {
|
|
588
|
-
...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
|
|
589
|
-
...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
|
|
590
|
-
...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules,
|
|
591
|
-
"vue/block-lang": ["error", { script: { lang: ["ts", "tsx"] } }],
|
|
592
|
-
"vue/block-order": ["error", { order: ["script[setup]", "template", "style[scoped]"] }],
|
|
593
|
-
"vue/component-api-style": "error"
|
|
594
|
-
};
|
|
595
|
-
const vue2Rules = {
|
|
596
|
-
...import_eslint_plugin_vue.default.configs.essential.rules,
|
|
597
|
-
...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
|
|
598
|
-
...import_eslint_plugin_vue.default.configs.recommended.rules,
|
|
599
|
-
"vue/block-lang": ["error", { script: { allowNoLang: true } }],
|
|
600
|
-
"vue/block-order": ["error", { order: [["script", "template"], "style[scoped]"] }]
|
|
601
|
-
};
|
|
602
|
-
return [
|
|
603
|
-
{
|
|
604
|
-
name: "lntvow/vue/setup",
|
|
605
|
-
plugins: {
|
|
606
|
-
vue: import_eslint_plugin_vue.default
|
|
607
|
-
}
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
name: "lntvow/vue/rules",
|
|
611
|
-
languageOptions: {
|
|
612
|
-
parser: import_vue_eslint_parser.default,
|
|
613
|
-
parserOptions: {
|
|
614
|
-
ecmaFeatures: {
|
|
615
|
-
jsx: true
|
|
616
|
-
},
|
|
617
|
-
parser: {
|
|
618
|
-
ts: import_parser2.default,
|
|
619
|
-
tsx: import_parser2.default
|
|
620
|
-
},
|
|
621
|
-
sourceType: "module"
|
|
622
|
-
}
|
|
623
|
-
// globals: {
|
|
624
|
-
// computed: 'readonly',
|
|
625
|
-
// defineEmits: 'readonly',
|
|
626
|
-
// defineExpose: 'readonly',
|
|
627
|
-
// defineProps: 'readonly',
|
|
628
|
-
// onMounted: 'readonly',
|
|
629
|
-
// onUnmounted: 'readonly',
|
|
630
|
-
// reactive: 'readonly',
|
|
631
|
-
// ref: 'readonly',
|
|
632
|
-
// shallowReactive: 'readonly',
|
|
633
|
-
// shallowRef: 'readonly',
|
|
634
|
-
// toRef: 'readonly',
|
|
635
|
-
// toRefs: 'readonly',
|
|
636
|
-
// watch: 'readonly',
|
|
637
|
-
// watchEffect: 'readonly',
|
|
638
|
-
// },
|
|
639
|
-
},
|
|
640
|
-
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
641
|
-
files: [GLOB_VUE],
|
|
642
|
-
rules: {
|
|
643
|
-
// Update to eslint-plugin-vue v9.26.0
|
|
644
|
-
...import_eslint_plugin_vue.default.configs.base.rules,
|
|
645
|
-
...vueVersion === 3 ? vue3Rules : vue2Rules,
|
|
646
|
-
// Override default configuration
|
|
647
|
-
// vue禁用多个单词组件名
|
|
648
|
-
"vue/multi-word-component-names": "off",
|
|
649
|
-
// vue禁用 属性-连接 个人喜欢驼峰
|
|
650
|
-
"vue/attribute-hyphenation": ["error", "never"],
|
|
651
|
-
// vue禁用标签缩进
|
|
652
|
-
"vue/html-indent": "off",
|
|
653
|
-
// 标签自闭合
|
|
654
|
-
"vue/html-self-closing": [
|
|
655
|
-
"error",
|
|
656
|
-
{
|
|
657
|
-
html: { void: "always", normal: "always", component: "always" },
|
|
658
|
-
svg: "always",
|
|
659
|
-
math: "always"
|
|
660
|
-
}
|
|
661
|
-
],
|
|
662
|
-
// vue禁用标签属性换行
|
|
663
|
-
"vue/max-attributes-per-line": "off",
|
|
664
|
-
// vue内容强制换行
|
|
665
|
-
"vue/singleline-html-element-content-newline": "off",
|
|
666
|
-
// 禁用事件驼峰 个人喜欢驼峰
|
|
667
|
-
"vue/v-on-event-hyphenation": ["error", "never"],
|
|
668
|
-
// Custom rules
|
|
669
|
-
// 标签换行
|
|
670
|
-
"vue/block-tag-newline": "error",
|
|
671
|
-
// 强制模板组件名称为PascalCase
|
|
672
|
-
"vue/component-name-in-template-casing": ["error", "PascalCase", { ignores: ["/-/"] }],
|
|
673
|
-
// 强制组件名大驼峰
|
|
674
|
-
"vue/component-options-name-casing": "error",
|
|
675
|
-
// 强制事件名小驼峰
|
|
676
|
-
"vue/custom-event-name-casing": "error",
|
|
677
|
-
// 强制定义emits
|
|
678
|
-
"vue/define-emits-declaration": "error",
|
|
679
|
-
// 强制定义宏defineProps defineEmits的顺序
|
|
680
|
-
"vue/define-macros-order": "error",
|
|
681
|
-
// 强制定义props
|
|
682
|
-
"vue/define-props-declaration": "error",
|
|
683
|
-
// 强制style属性
|
|
684
|
-
"vue/enforce-style-attribute": "error",
|
|
685
|
-
// 禁止button没有type
|
|
686
|
-
"vue/html-button-has-type": "off",
|
|
687
|
-
// 强制html注释换行
|
|
688
|
-
"vue/html-comment-content-newline": "error",
|
|
689
|
-
// 强制html注释空格
|
|
690
|
-
"vue/html-comment-content-spacing": "error",
|
|
691
|
-
// 强制html注释缩进
|
|
692
|
-
"vue/html-comment-indent": "off",
|
|
693
|
-
// 强制组件名和文件名一致
|
|
694
|
-
"vue/match-component-file-name": ["error", { extensions: ["jsx", "tsx"], shouldMatchCase: true }],
|
|
695
|
-
// 强制组件名导入名称一致
|
|
696
|
-
"vue/match-component-import-name": "error",
|
|
697
|
-
// 强制单个标签最大行数
|
|
698
|
-
"vue/max-lines-per-block": "off",
|
|
699
|
-
// 强制多行属性空行
|
|
700
|
-
"vue/new-line-between-multi-line-property": "off",
|
|
701
|
-
// 强制nextTick风格
|
|
702
|
-
"vue/next-tick-style": "off",
|
|
703
|
-
// 禁止模板中出现未翻译的字符串
|
|
704
|
-
"vue/no-bare-strings-in-template": "off",
|
|
705
|
-
// 布尔类型默认值校验
|
|
706
|
-
"vue/no-boolean-default": "off",
|
|
707
|
-
// 禁止使用已弃用的v-model定义
|
|
708
|
-
"vue/no-deprecated-model-definition": "error",
|
|
709
|
-
// 禁止重复继承属性
|
|
710
|
-
"vue/no-duplicate-attr-inheritance": "error",
|
|
711
|
-
// 禁止空的标签
|
|
712
|
-
"vue/no-empty-component-block": "off",
|
|
713
|
-
// 禁止class 中出现多个对象
|
|
714
|
-
"vue/no-multiple-objects-in-class": "error",
|
|
715
|
-
// 禁止潜在的组件选项拼写错误
|
|
716
|
-
"vue/no-potential-component-option-typo": "error",
|
|
717
|
-
// 禁止ref对象丢失响应性
|
|
718
|
-
"vue/no-ref-object-reactivity-loss": "error",
|
|
719
|
-
// 禁止default和required同时存在
|
|
720
|
-
"vue/no-required-prop-with-default": "error",
|
|
721
|
-
// 禁止特定的模板语法
|
|
722
|
-
"vue/no-restricted-block": "off",
|
|
723
|
-
// 禁止await后调用特定的函数
|
|
724
|
-
"vue/no-restricted-call-after-await": "off",
|
|
725
|
-
// 禁止特定的class
|
|
726
|
-
"vue/no-restricted-class": "off",
|
|
727
|
-
// 禁止特定的组件名
|
|
728
|
-
"vue/no-restricted-component-names": "off",
|
|
729
|
-
// 禁止特定的组件选项
|
|
730
|
-
"vue/no-restricted-component-options": "off",
|
|
731
|
-
// 禁止特定的事件名
|
|
732
|
-
"vue/no-restricted-custom-event": "off",
|
|
733
|
-
// 禁止特定的html标签
|
|
734
|
-
"vue/no-restricted-html-elements": "off",
|
|
735
|
-
// 禁止特定的props
|
|
736
|
-
"vue/no-restricted-props": "off",
|
|
737
|
-
// 禁止特定的静态属性
|
|
738
|
-
"vue/no-restricted-static-attribute": "off",
|
|
739
|
-
// 禁止特定的v-bind
|
|
740
|
-
"vue/no-restricted-v-bind": "off",
|
|
741
|
-
// 禁止根元素使用v-if
|
|
742
|
-
"vue/no-root-v-if": "off",
|
|
743
|
-
// 禁止setup中props丢失响应性
|
|
744
|
-
"vue/no-setup-props-reactivity-loss": "error",
|
|
745
|
-
// 禁止内联样式
|
|
746
|
-
"vue/no-static-inline-styles": "error",
|
|
747
|
-
// 禁止target="_blank"
|
|
748
|
-
"vue/no-template-target-blank": "error",
|
|
749
|
-
// 禁止在beforeRouteEnter中使用this
|
|
750
|
-
"vue/no-this-in-before-route-enter": "error",
|
|
751
|
-
// 禁止未定义的组件
|
|
752
|
-
"vue/no-undef-components": "off",
|
|
753
|
-
// 禁止未定义的属性 mixin vuex冲突
|
|
754
|
-
"vue/no-undef-properties": "error",
|
|
755
|
-
// 禁止不支持的特性
|
|
756
|
-
"vue/no-unsupported-features": "off",
|
|
757
|
-
// 禁止未使用的emits
|
|
758
|
-
"vue/no-unused-emit-declarations": "error",
|
|
759
|
-
// 未使用属性校验
|
|
760
|
-
"vue/no-unused-properties": ["warn", { groups: ["props", "data", "computed", "methods", "setup"] }],
|
|
761
|
-
// 禁止未使用属性ref
|
|
762
|
-
"vue/no-unused-refs": "error",
|
|
763
|
-
// 禁止v-else和v-for同时使用
|
|
764
|
-
"vue/no-use-v-else-with-v-for": "error",
|
|
765
|
-
// 禁止使用无效的模板语法
|
|
766
|
-
"vue/no-useless-mustaches": "error",
|
|
767
|
-
// v-bind强制简写
|
|
768
|
-
"vue/no-useless-v-bind": "error",
|
|
769
|
-
// 禁止使用v-text
|
|
770
|
-
"vue/no-v-text": "error",
|
|
771
|
-
// 模板三标签之间强制空一行
|
|
772
|
-
"vue/padding-line-between-blocks": "error",
|
|
773
|
-
// 禁止模板空行
|
|
774
|
-
"vue/padding-line-between-tags": ["error", [{ blankLine: "never", prev: "*", next: "*" }]],
|
|
775
|
-
// 组件定义强制空行
|
|
776
|
-
"vue/padding-lines-in-component-definition": ["error", { betweenOptions: "never" }],
|
|
777
|
-
// 宏定义选项强制
|
|
778
|
-
"vue/prefer-define-options": "error",
|
|
779
|
-
// props强制boolean类型在前
|
|
780
|
-
"vue/prefer-prop-type-boolean-first": "error",
|
|
781
|
-
// 要求模板中的静态类名位于单独的class属性中
|
|
782
|
-
"vue/prefer-separate-static-class": "error",
|
|
783
|
-
// props 强制true简写
|
|
784
|
-
"vue/prefer-true-attribute-shorthand": "error",
|
|
785
|
-
// 要求组件直接导出
|
|
786
|
-
"vue/require-direct-export": "error",
|
|
787
|
-
// 要求emit事件校验
|
|
788
|
-
"vue/require-emit-validator": "off",
|
|
789
|
-
// 要求明确的插槽
|
|
790
|
-
"vue/require-explicit-slots": "error",
|
|
791
|
-
// 强制expose
|
|
792
|
-
"vue/require-expose": "error",
|
|
793
|
-
// 宏定义变量名强制
|
|
794
|
-
"vue/require-macro-variable-name": "error",
|
|
795
|
-
// 强制name属性
|
|
796
|
-
"vue/require-name-property": "off",
|
|
797
|
-
// 强制prop注释
|
|
798
|
-
"vue/require-prop-comment": "off",
|
|
799
|
-
// 强制对象类型
|
|
800
|
-
"vue/require-typed-object-prop": "error",
|
|
801
|
-
// 强制ref类型
|
|
802
|
-
"vue/require-typed-ref": "error",
|
|
803
|
-
// script缩进
|
|
804
|
-
"vue/script-indent": "off",
|
|
805
|
-
// 强制属性排序
|
|
806
|
-
"vue/sort-keys": "off",
|
|
807
|
-
// class排序
|
|
808
|
-
"vue/static-class-names-order": "error",
|
|
809
|
-
// 强制v-for指令的分隔符样式
|
|
810
|
-
"vue/v-for-delimiter-style": "error",
|
|
811
|
-
// 强制v-on指令的风格
|
|
812
|
-
"vue/v-on-handler-style": "off",
|
|
813
|
-
// 宏定义选项校验
|
|
814
|
-
"vue/valid-define-options": "error",
|
|
815
|
-
// Stylistic
|
|
816
|
-
"vue/array-bracket-newline": "off",
|
|
817
|
-
"vue/array-bracket-spacing": "off",
|
|
818
|
-
"vue/array-element-newline": "off",
|
|
819
|
-
"vue/arrow-spacing": "off",
|
|
820
|
-
"vue/block-spacing": "off",
|
|
821
|
-
"vue/brace-style": "off",
|
|
822
|
-
// 强制驼峰
|
|
823
|
-
"vue/camelcase": "error",
|
|
824
|
-
"vue/comma-dangle": "off",
|
|
825
|
-
"vue/comma-spacing": "off",
|
|
826
|
-
"vue/comma-style": "off",
|
|
827
|
-
"vue/dot-location": "off",
|
|
828
|
-
// 要求使用点号
|
|
829
|
-
"vue/dot-notation": "error",
|
|
830
|
-
// 要求使用 === 和 !==
|
|
831
|
-
"vue/eqeqeq": "error",
|
|
832
|
-
"vue/func-call-spacing": "off",
|
|
833
|
-
"vue/key-spacing": "off",
|
|
834
|
-
"vue/keyword-spacing": "off",
|
|
835
|
-
"vue/max-len": "off",
|
|
836
|
-
"vue/multiline-ternary": "off",
|
|
837
|
-
"vue/no-console": "off",
|
|
838
|
-
// 禁止在条件中使用常量表达式
|
|
839
|
-
"vue/no-constant-condition": "error",
|
|
840
|
-
"vue/no-extra-parens": "off",
|
|
841
|
-
// 禁止使用空解构模式
|
|
842
|
-
"vue/no-empty-pattern": "error",
|
|
843
|
-
// 禁止不规则的空白
|
|
844
|
-
"vue/no-irregular-whitespace": "error",
|
|
845
|
-
"vue/no-loss-of-precision": "off",
|
|
846
|
-
"vue/no-restricted-syntax": "off",
|
|
847
|
-
// 禁用稀疏数组
|
|
848
|
-
"vue/no-sparse-arrays": "error",
|
|
849
|
-
// 禁止没有必要的字符拼接
|
|
850
|
-
"vue/no-useless-concat": "error",
|
|
851
|
-
"vue/object-curly-newline": "off",
|
|
852
|
-
"vue/object-curly-spacing": "off",
|
|
853
|
-
"vue/object-property-newline": "off",
|
|
854
|
-
// 要求对象字面量简写语法
|
|
855
|
-
"vue/object-shorthand": "error",
|
|
856
|
-
"vue/operator-linebreak": "off",
|
|
857
|
-
// 优先使用模板字符串
|
|
858
|
-
"vue/prefer-template": "error",
|
|
859
|
-
"vue/quote-props": "off",
|
|
860
|
-
"vue/space-in-parens": "off",
|
|
861
|
-
"vue/space-infix-ops": "off",
|
|
862
|
-
"vue/space-unary-ops": "off",
|
|
863
|
-
"vue/template-curly-spacing": "off",
|
|
864
|
-
// Overrides
|
|
865
|
-
...overrides
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
];
|
|
869
|
-
}
|
|
870
|
-
function getVueVersion() {
|
|
871
|
-
const pkg = (0, import_local_pkg.getPackageInfoSync)("vue", { paths: [process.cwd()] });
|
|
872
|
-
if (pkg && pkg.version) {
|
|
873
|
-
return +pkg.version[0];
|
|
874
|
-
}
|
|
875
|
-
return 3;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
// src/factory.ts
|
|
879
|
-
var flatConfigProps = [
|
|
880
|
-
"name",
|
|
881
|
-
"files",
|
|
882
|
-
"ignores",
|
|
883
|
-
"languageOptions",
|
|
884
|
-
"linterOptions",
|
|
885
|
-
"processor",
|
|
886
|
-
"plugins",
|
|
887
|
-
"rules",
|
|
888
|
-
"settings"
|
|
889
|
-
];
|
|
890
|
-
var defaultPluginRenaming = {
|
|
891
|
-
"@stylistic": "style",
|
|
892
|
-
"@typescript-eslint": "typescript",
|
|
893
|
-
"import-x": "import",
|
|
894
|
-
"vitest": "test"
|
|
895
|
-
};
|
|
896
|
-
function lntvow(options = {}, ...userConfigs) {
|
|
897
|
-
const {
|
|
898
|
-
autoRenamePlugins = true,
|
|
899
|
-
componentExts = [],
|
|
900
|
-
gitignore: enableGitignore = true,
|
|
901
|
-
regexp: enableRegexp = true,
|
|
902
|
-
typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
|
|
903
|
-
vue: enableVue = ["vue", "nuxt", "vitepress"].some((i) => (0, import_local_pkg2.isPackageExists)(i)),
|
|
904
|
-
test: enableTest = (0, import_local_pkg2.isPackageExists)("vitest"),
|
|
905
|
-
stylistic: enableStylistic = true
|
|
906
|
-
} = options;
|
|
907
|
-
const configs2 = [];
|
|
908
|
-
configs2.push(
|
|
909
|
-
ignores(),
|
|
910
|
-
custom(),
|
|
911
|
-
javascript({
|
|
912
|
-
...resolveSubOptions(options, "javascript")
|
|
913
|
-
}),
|
|
914
|
-
imports()
|
|
915
|
-
// comments(),
|
|
916
|
-
// node(),
|
|
917
|
-
// jsdoc({
|
|
918
|
-
// stylistic: stylisticOptions,
|
|
919
|
-
// }),
|
|
920
|
-
// unicorn(),
|
|
921
|
-
// command(),
|
|
922
|
-
// Optional plugins (installed but not enabled by default)
|
|
923
|
-
// perfectionist(),
|
|
924
|
-
);
|
|
925
|
-
if (enableGitignore) {
|
|
926
|
-
configs2.push(gitignore({ ...resolveSubOptions(options, "gitignore") }));
|
|
927
|
-
}
|
|
928
|
-
if (enableVue) {
|
|
929
|
-
componentExts.push("vue");
|
|
930
|
-
}
|
|
931
|
-
if (enableTypeScript) {
|
|
932
|
-
configs2.push(typescript({ ...resolveSubOptions(options, "typescript"), componentExts }));
|
|
933
|
-
}
|
|
934
|
-
if (enableVue) {
|
|
935
|
-
configs2.push(vue({ ...resolveSubOptions(options, "vue") }));
|
|
936
|
-
}
|
|
937
|
-
if (enableRegexp) {
|
|
938
|
-
configs2.push(regexp({ ...resolveSubOptions(options, "regexp") }));
|
|
939
|
-
}
|
|
940
|
-
if (enableTest) {
|
|
941
|
-
configs2.push(test({ ...resolveSubOptions(options, "test") }));
|
|
942
|
-
}
|
|
943
|
-
if (enableStylistic) {
|
|
944
|
-
configs2.push(stylistic({ ...resolveSubOptions(options, "stylistic") }));
|
|
945
|
-
}
|
|
946
|
-
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
947
|
-
if (key in options) {
|
|
948
|
-
acc[key] = options[key];
|
|
949
|
-
}
|
|
950
|
-
return acc;
|
|
951
|
-
}, {});
|
|
952
|
-
if (Object.keys(fusedConfig).length) {
|
|
953
|
-
configs2.push([fusedConfig]);
|
|
954
|
-
}
|
|
955
|
-
configs2.push(prettier());
|
|
956
|
-
let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
957
|
-
composer = composer.append(...configs2, ...userConfigs);
|
|
958
|
-
if (autoRenamePlugins) {
|
|
959
|
-
composer = composer.renamePlugins(defaultPluginRenaming);
|
|
960
|
-
}
|
|
961
|
-
return composer;
|
|
962
|
-
}
|
|
963
|
-
function resolveSubOptions(options, key) {
|
|
964
|
-
return (0, import_utils3.isBoolean)(options[key]) ? {} : options[key] || {};
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
// src/index.ts
|
|
968
|
-
var src_default = lntvow;
|
|
969
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
970
|
-
0 && (module.exports = {
|
|
971
|
-
GLOB_ALL_SRC,
|
|
972
|
-
GLOB_ASTRO,
|
|
973
|
-
GLOB_CSS,
|
|
974
|
-
GLOB_EXCLUDE,
|
|
975
|
-
GLOB_GRAPHQL,
|
|
976
|
-
GLOB_HTML,
|
|
977
|
-
GLOB_JS,
|
|
978
|
-
GLOB_JSON,
|
|
979
|
-
GLOB_JSON5,
|
|
980
|
-
GLOB_JSONC,
|
|
981
|
-
GLOB_JSX,
|
|
982
|
-
GLOB_LESS,
|
|
983
|
-
GLOB_MARKDOWN,
|
|
984
|
-
GLOB_MARKDOWN_CODE,
|
|
985
|
-
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
986
|
-
GLOB_POSTCSS,
|
|
987
|
-
GLOB_SCSS,
|
|
988
|
-
GLOB_SRC,
|
|
989
|
-
GLOB_SRC_EXT,
|
|
990
|
-
GLOB_STYLE,
|
|
991
|
-
GLOB_SVELTE,
|
|
992
|
-
GLOB_TESTS,
|
|
993
|
-
GLOB_TOML,
|
|
994
|
-
GLOB_TS,
|
|
995
|
-
GLOB_TSX,
|
|
996
|
-
GLOB_VUE,
|
|
997
|
-
GLOB_XML,
|
|
998
|
-
GLOB_YAML,
|
|
999
|
-
StylisticConfigDefaults,
|
|
1000
|
-
custom,
|
|
1001
|
-
getVueVersion,
|
|
1002
|
-
gitignore,
|
|
1003
|
-
ignores,
|
|
1004
|
-
imports,
|
|
1005
|
-
javascript,
|
|
1006
|
-
lntvow,
|
|
1007
|
-
prettier,
|
|
1008
|
-
regexp,
|
|
1009
|
-
renameRules,
|
|
1010
|
-
stylistic,
|
|
1011
|
-
test,
|
|
1012
|
-
typescript,
|
|
1013
|
-
vue
|
|
1014
|
-
});
|
|
1
|
+
"use strict";var ge=Object.create;var x=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty;var we=(e,o)=>{for(var r in o)x(e,r,{get:o[r],enumerable:!0})},M=(e,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of xe(o))!be.call(e,t)&&t!==r&&x(e,t,{get:()=>o[t],enumerable:!(n=ye(o,t))||n.enumerable});return e};var s=(e,o,r)=>(r=e!=null?ge(Oe(e)):{},M(o||!e||!e.__esModule?x(r,"default",{value:e,enumerable:!0}):r,e)),he=e=>M(x({},"__esModule",{value:!0}),e);var Ve={};we(Ve,{GLOB_ALL_SRC:()=>qe,GLOB_ASTRO:()=>Pe,GLOB_CSS:()=>Se,GLOB_EXCLUDE:()=>F,GLOB_GRAPHQL:()=>Ee,GLOB_HTML:()=>re,GLOB_JS:()=>Ce,GLOB_JSON:()=>Y,GLOB_JSON5:()=>Q,GLOB_JSONC:()=>Ie,GLOB_JSX:()=>_e,GLOB_LESS:()=>je,GLOB_MARKDOWN:()=>G,GLOB_MARKDOWN_CODE:()=>Re,GLOB_MARKDOWN_IN_MARKDOWN:()=>Be,GLOB_POSTCSS:()=>Ge,GLOB_SCSS:()=>Fe,GLOB_SRC:()=>l,GLOB_SRC_EXT:()=>m,GLOB_STYLE:()=>z,GLOB_SVELTE:()=>Z,GLOB_TESTS:()=>j,GLOB_TOML:()=>ke,GLOB_TS:()=>Te,GLOB_TSX:()=>Le,GLOB_VUE:()=>b,GLOB_XML:()=>oe,GLOB_YAML:()=>ee,StylisticConfigDefaults:()=>pe,custom:()=>L,getVueVersion:()=>ce,gitignore:()=>S,ignores:()=>I,imports:()=>B,javascript:()=>k,lntvow:()=>de,prettier:()=>P,regexp:()=>R,renameRules:()=>O,stylistic:()=>N,test:()=>A,typescript:()=>V,vue:()=>D});module.exports=he(Ve);function O(e,o){return Object.fromEntries(Object.entries(e).map(([r,n])=>{for(let[t,f]of Object.entries(o))if(r.startsWith(`${t}/`))return[f+r.slice(t.length),n];return[r,n]}))}var K=s(require("@lntvow/eslint-plugin"),1);async function L(){return[{name:"lntvow/custom",plugins:{lntvow:K.default}}]}var X=s(require("fs"),1),J=require("find-up"),W=require("@lntvow/utils"),H=s(require("parse-gitignore"),1);async function S(e){let{name:o=".gitignore",root:r=!1,files:n=r?o:(0,J.findUpSync)(o)||[]}=e,t=(0,W.castArray)(n),f=[];for(let v of t)try{let d=X.default.readFileSync(v,"utf8"),_=(0,H.default)(d).globs();for(let c of _)c.type==="ignore"?f.push(...c.patterns):c.type==="unignore"&&f.push(...c.patterns.map(p=>`!${p}`))}catch{throw new Error(`Failed to read file: ${v}`)}return[{ignores:f}]}var m="?([cm])[jt]s?(x)",l="**/*.?([cm])[jt]s?(x)",Ce="**/*.?([cm])js",_e="**/*.?([cm])jsx",Te="**/*.?([cm])ts",Le="**/*.?([cm])tsx",z="**/*.{c,le,sc}ss",Se="**/*.css",Ge="**/*.{p,post}css",je="**/*.less",Fe="**/*.scss",Y="**/*.json",Q="**/*.json5",Ie="**/*.jsonc",G="**/*.md",Be="**/*.md/*.md",Z="**/*.svelte",b="**/*.vue",ee="**/*.y?(a)ml",ke="**/*.toml",oe="**/*.xml",re="**/*.htm?(l)",Pe="**/*.astro",Ee="**/*.{g,graph}ql",Re=`${G}/${l}`,j=[`**/__tests__/**/*.${m}`,`**/*.spec.${m}`,`**/*.test.${m}`,`**/*.bench.${m}`,`**/*.benchmark.${m}`],qe=[l,z,Y,Q,G,Z,b,ee,oe,re],F=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];async function I(){return[{ignores:[...F]}]}var te=s(require("eslint-plugin-import-x"),1);async function B(){return[{name:"lntvow/imports/rules",plugins:{import:te.default},rules:{"import/order":"error","import/newline-after-import":"error"}}]}var ne=s(require("@eslint/js"),1),w=s(require("globals"),1);async function k(e={}){let{overrides:o={}}=e;return[{name:"lntvow/javascript/rules",languageOptions:{ecmaVersion:2022,sourceType:"module",parserOptions:{ecmaVersion:2022,sourceType:"module",ecmaFeatures:{jsx:!0}},globals:{...w.default.browser,...w.default.es2021,...w.default.node,document:"readonly",navigator:"readonly",window:"readonly"}},linterOptions:{reportUnusedDisableDirectives:!0},rules:{...ne.default.configs.all.rules,"no-unused-vars":"warn","no-use-before-define":["error",{functions:!1,variables:!1}],"no-useless-assignment":"off","require-atomic-updates":"off",camelcase:"warn","capitalized-comments":"off","class-methods-use-this":"off",complexity:"off",curly:["error","multi-line"],"func-names":"off","func-style":"off","guard-for-in":"off","id-denylist":"off","id-length":"off","id-match":"off","init-declarations":"off","max-classes-per-file":"off","max-depth":"off","max-lines":"off","max-lines-per-function":"off","max-nested-callbacks":"off","max-params":"off","max-statements":"off","new-cap":["error",{capIsNew:!1}],"no-bitwise":"off","no-case-declarations":"off","no-console":"warn","no-continue":"off","no-empty":["error",{allowEmptyCatch:!0}],"no-implicit-coercion":"off","no-implicit-globals":"off","no-magic-numbers":0,"no-nested-ternary":"off","no-new":"off","no-param-reassign":"off","no-plusplus":"off","no-restricted-exports":"off","no-restricted-globals":["error",{message:"Use `globalThis` instead.",name:"global"},{message:"Use `globalThis` instead.",name:"self"}],"no-restricted-imports":"off","no-restricted-properties":["error",{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:"__proto__"},{message:"Use `Object.defineProperty` instead.",property:"__defineGetter__"},{message:"Use `Object.defineProperty` instead.",property:"__defineSetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupGetter__"},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:"__lookupSetter__"}],"no-restricted-syntax":"off","no-shadow":"off","no-ternary":"off","no-throw-literal":"off","no-undefined":"off","no-underscore-dangle":"off","no-void":"off","no-warning-comments":"off","one-var":"off","prefer-exponentiation-operator":"off","prefer-promise-reject-errors":"off",radix:"off","require-await":"off","require-unicode-regexp":"off","sort-imports":"off","sort-keys":"off","sort-vars":"off",strict:"off",...o}},{files:[`scripts/${l}`],name:"lntvow/javascript/disables",rules:{"no-console":"off"}}]}var se=s(require("eslint-plugin-prettier"),1),ie=s(require("eslint-config-prettier"),1);async function P(){return[{name:"lntvow/prettier/rules",plugins:{prettier:se.default},rules:{...ie.default.rules,"prettier/prettier":"warn"}}]}var E=require("eslint-plugin-regexp");async function R(e={}){let{overrides:o}=e,r=E.configs["flat/recommended"].plugins.regexp,{rules:n}=E.configs["flat/recommended"];return[{name:"lntvow/regexp/rules",plugins:{regexp:r},rules:{...n,...o}}]}var q=s(require("@stylistic/eslint-plugin"),1),pe={indent:2,jsx:!0,quotes:"single",semi:!1};async function N(e={}){let{indent:o,jsx:r,overrides:n={},quotes:t,semi:f}={...pe,...e},v=q.default.configs.customize({flat:!0,indent:o,jsx:r,pluginName:"style",quotes:t,semi:f});return[{name:"lntvow/stylistic/rules",plugins:{style:q.default},rules:{"style/spaced-comment":"error","style/padding-line-between-statements":["error",{blankLine:"always",prev:"*",next:"cjs-export"},{blankLine:"always",prev:"*",next:"export"},{blankLine:"always",prev:"*",next:"function"}],...n}}]}var fe=s(require("eslint-plugin-vitest"),1);async function A(e={}){let{overrides:o}=e;return[{name:"lntvow/test/setup",plugins:{test:fe.default}},{name:"lntvow/test/rules",files:[...j],rules:{"lntvow/newline-before-describe-test":"error",...o}}]}var h=s(require("@typescript-eslint/eslint-plugin"),1),ae=s(require("@typescript-eslint/parser"),1);async function V(e={}){let{componentExts:o=[],overrides:r={},parserOptions:n={}}=e,t=[l,...o.map(f=>`**/*.${f}`)];return[{name:"lntvow/typescript/setup",plugins:{ts:h.default}},{name:"lntvow/typescript/rules",languageOptions:{parser:ae.default,parserOptions:{sourceType:"module"}},files:t,rules:{...O(h.default.configs["eslint-recommended"].overrides[0].rules,{"@typescript-eslint":"ts"}),...O(h.default.configs.strict.rules,{"@typescript-eslint":"ts"}),"ts/no-non-null-assertion":"off","ts/no-explicit-any":"off","ts/ban-ts-comment":"off","ts/no-unused-vars":"warn","no-use-before-define":"off","ts/no-use-before-define":["error",{functions:!1,variables:!1}],...r}}]}var le=require("local-pkg"),U=s(require("@typescript-eslint/parser"),1),ue=s(require("vue-eslint-parser"),1),a=s(require("eslint-plugin-vue"),1);async function D(e={}){let{overrides:o={},vueVersion:r=ce()}=e,n={...a.default.configs["vue3-essential"].rules,...a.default.configs["vue3-strongly-recommended"].rules,...a.default.configs["vue3-recommended"].rules,"vue/block-lang":["error",{script:{lang:["ts","tsx"]}}],"vue/block-order":["error",{order:["script[setup]","template","style[scoped]"]}],"vue/component-api-style":"error"},t={...a.default.configs.essential.rules,...a.default.configs["strongly-recommended"].rules,...a.default.configs.recommended.rules,"vue/block-lang":["error",{script:{allowNoLang:!0}}],"vue/block-order":["error",{order:[["script","template"],"style[scoped]"]}]};return[{name:"lntvow/vue/setup",plugins:{vue:a.default}},{name:"lntvow/vue/rules",languageOptions:{parser:ue.default,parserOptions:{ecmaFeatures:{jsx:!0},parser:{ts:U.default,tsx:U.default},sourceType:"module"}},processor:a.default.processors[".vue"],files:[b],rules:{...a.default.configs.base.rules,...r===3?n:t,"vue/multi-word-component-names":"off","vue/attribute-hyphenation":["error","never"],"vue/html-indent":"off","vue/html-self-closing":["error",{html:{void:"always",normal:"always",component:"always"},svg:"always",math:"always"}],"vue/max-attributes-per-line":"off","vue/singleline-html-element-content-newline":"off","vue/v-on-event-hyphenation":["error","never"],"vue/block-tag-newline":"error","vue/component-name-in-template-casing":["error","PascalCase",{ignores:["/-/"]}],"vue/component-options-name-casing":"error","vue/custom-event-name-casing":"error","vue/define-emits-declaration":"error","vue/define-macros-order":"error","vue/define-props-declaration":"error","vue/enforce-style-attribute":"error","vue/html-button-has-type":"off","vue/html-comment-content-newline":"error","vue/html-comment-content-spacing":"error","vue/html-comment-indent":"off","vue/match-component-file-name":["error",{extensions:["jsx","tsx"],shouldMatchCase:!0}],"vue/match-component-import-name":"error","vue/max-lines-per-block":"off","vue/new-line-between-multi-line-property":"off","vue/next-tick-style":"off","vue/no-bare-strings-in-template":"off","vue/no-boolean-default":"off","vue/no-deprecated-model-definition":"error","vue/no-duplicate-attr-inheritance":"error","vue/no-empty-component-block":"off","vue/no-multiple-objects-in-class":"error","vue/no-potential-component-option-typo":"error","vue/no-ref-object-reactivity-loss":"error","vue/no-required-prop-with-default":"error","vue/no-restricted-block":"off","vue/no-restricted-call-after-await":"off","vue/no-restricted-class":"off","vue/no-restricted-component-names":"off","vue/no-restricted-component-options":"off","vue/no-restricted-custom-event":"off","vue/no-restricted-html-elements":"off","vue/no-restricted-props":"off","vue/no-restricted-static-attribute":"off","vue/no-restricted-v-bind":"off","vue/no-root-v-if":"off","vue/no-setup-props-reactivity-loss":"error","vue/no-static-inline-styles":"error","vue/no-template-target-blank":"error","vue/no-this-in-before-route-enter":"error","vue/no-undef-components":"off","vue/no-undef-properties":"error","vue/no-unsupported-features":"off","vue/no-unused-emit-declarations":"error","vue/no-unused-properties":["warn",{groups:["props","data","computed","methods","setup"]}],"vue/no-unused-refs":"error","vue/no-use-v-else-with-v-for":"error","vue/no-useless-mustaches":"error","vue/no-useless-v-bind":"error","vue/no-v-text":"error","vue/padding-line-between-blocks":"error","vue/padding-line-between-tags":["error",[{blankLine:"never",prev:"*",next:"*"}]],"vue/padding-lines-in-component-definition":["error",{betweenOptions:"never"}],"vue/prefer-define-options":"error","vue/prefer-prop-type-boolean-first":"error","vue/prefer-separate-static-class":"error","vue/prefer-true-attribute-shorthand":"error","vue/require-direct-export":"error","vue/require-emit-validator":"off","vue/require-explicit-slots":"error","vue/require-expose":"error","vue/require-macro-variable-name":"error","vue/require-name-property":"off","vue/require-prop-comment":"off","vue/require-typed-object-prop":"error","vue/require-typed-ref":"error","vue/script-indent":"off","vue/sort-keys":"off","vue/static-class-names-order":"error","vue/v-for-delimiter-style":"error","vue/v-on-handler-style":"off","vue/valid-define-options":"error","vue/array-bracket-newline":"off","vue/array-bracket-spacing":"off","vue/array-element-newline":"off","vue/arrow-spacing":"off","vue/block-spacing":"off","vue/brace-style":"off","vue/camelcase":"error","vue/comma-dangle":"off","vue/comma-spacing":"off","vue/comma-style":"off","vue/dot-location":"off","vue/dot-notation":"error","vue/eqeqeq":"error","vue/func-call-spacing":"off","vue/key-spacing":"off","vue/keyword-spacing":"off","vue/max-len":"off","vue/multiline-ternary":"off","vue/no-console":"off","vue/no-constant-condition":"error","vue/no-extra-parens":"off","vue/no-empty-pattern":"error","vue/no-irregular-whitespace":"error","vue/no-loss-of-precision":"off","vue/no-restricted-syntax":"off","vue/no-sparse-arrays":"error","vue/no-useless-concat":"error","vue/object-curly-newline":"off","vue/object-curly-spacing":"off","vue/object-property-newline":"off","vue/object-shorthand":"error","vue/operator-linebreak":"off","vue/prefer-template":"error","vue/quote-props":"off","vue/space-in-parens":"off","vue/space-infix-ops":"off","vue/space-unary-ops":"off","vue/template-curly-spacing":"off",...o}}]}function ce(){let e=(0,le.getPackageInfoSync)("vue",{paths:[process.cwd()]});return e&&e.version?+e.version[0]:3}var me=require("eslint-flat-config-utils"),ve=require("@lntvow/utils"),C=require("local-pkg");var Ne=["name","files","ignores","languageOptions","linterOptions","processor","plugins","rules","settings"],Ae={"@stylistic":"style","@typescript-eslint":"typescript","import-x":"import",vitest:"test"};function de(e={},...o){let{autoRenamePlugins:r=!0,componentExts:n=[],gitignore:t=!0,regexp:f=!0,typescript:v=(0,C.isPackageExists)("typescript"),vue:d=["vue","nuxt","vitepress"].some(y=>(0,C.isPackageExists)(y)),test:_=(0,C.isPackageExists)("vitest"),stylistic:c=!0}=e,p=[];p.push(I(),L(),k({...u(e,"javascript")}),B()),t&&p.push(S({...u(e,"gitignore")})),d&&n.push("vue"),v&&p.push(V({...u(e,"typescript"),componentExts:n})),d&&p.push(D({...u(e,"vue")})),f&&p.push(R({...u(e,"regexp")})),_&&p.push(A({...u(e,"test")})),c&&p.push(N({...u(e,"stylistic")}));let $=Ne.reduce((y,T)=>(T in e&&(y[T]=e[T]),y),{});Object.keys($).length&&p.push([$]),p.push(P());let g=new me.FlatConfigComposer;return g=g.append(...p,...o),r&&(g=g.renamePlugins(Ae)),g}function u(e,o){return(0,ve.isBoolean)(e[o])?{}:e[o]||{}}0&&(module.exports={GLOB_ALL_SRC,GLOB_ASTRO,GLOB_CSS,GLOB_EXCLUDE,GLOB_GRAPHQL,GLOB_HTML,GLOB_JS,GLOB_JSON,GLOB_JSON5,GLOB_JSONC,GLOB_JSX,GLOB_LESS,GLOB_MARKDOWN,GLOB_MARKDOWN_CODE,GLOB_MARKDOWN_IN_MARKDOWN,GLOB_POSTCSS,GLOB_SCSS,GLOB_SRC,GLOB_SRC_EXT,GLOB_STYLE,GLOB_SVELTE,GLOB_TESTS,GLOB_TOML,GLOB_TS,GLOB_TSX,GLOB_VUE,GLOB_XML,GLOB_YAML,StylisticConfigDefaults,custom,getVueVersion,gitignore,ignores,imports,javascript,lntvow,prettier,regexp,renameRules,stylistic,test,typescript,vue});
|