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