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