@ziloen/eslint-config 0.1.4 → 0.1.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 -811
- package/dist/index.js +1 -770
- package/package.json +17 -15
package/dist/index.js
CHANGED
|
@@ -1,770 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import js from "@eslint/js";
|
|
3
|
-
|
|
4
|
-
// src/plugins.ts
|
|
5
|
-
import { default as default2 } from "eslint-plugin-unicorn";
|
|
6
|
-
import { default as default3 } from "eslint-plugin-promise";
|
|
7
|
-
import { default as default4 } from "eslint-plugin-vue";
|
|
8
|
-
import { default as default5 } from "@typescript-eslint/eslint-plugin";
|
|
9
|
-
import { default as default6 } from "eslint-plugin-react";
|
|
10
|
-
import { default as default7 } from "eslint-plugin-ziloen";
|
|
11
|
-
import * as parserTs from "@typescript-eslint/parser";
|
|
12
|
-
import { default as default8 } from "vue-eslint-parser";
|
|
13
|
-
|
|
14
|
-
// src/configs/javascript.ts
|
|
15
|
-
var javascript = [
|
|
16
|
-
js.configs.recommended,
|
|
17
|
-
{
|
|
18
|
-
plugins: {
|
|
19
|
-
unicorn: default2,
|
|
20
|
-
promise: default3
|
|
21
|
-
},
|
|
22
|
-
ignores: [
|
|
23
|
-
// files
|
|
24
|
-
"*.min.*",
|
|
25
|
-
"CHANGELOG.md",
|
|
26
|
-
"LICENSE*",
|
|
27
|
-
// lock files
|
|
28
|
-
"package-lock.json",
|
|
29
|
-
"pnpm-lock.yaml",
|
|
30
|
-
"yarn.lock",
|
|
31
|
-
// directories
|
|
32
|
-
"node_modules",
|
|
33
|
-
"dist",
|
|
34
|
-
// not support yet
|
|
35
|
-
"*.html"
|
|
36
|
-
],
|
|
37
|
-
rules: {
|
|
38
|
-
/** 检查数组方法返回值 */
|
|
39
|
-
"array-callback-return": ["error", { allowImplicit: true }],
|
|
40
|
-
/** 禁止定义块作用域外的访问 var 变量 */
|
|
41
|
-
"block-scoped-var": "error",
|
|
42
|
-
/** 派生 class 必须要有 super() */
|
|
43
|
-
"constructor-super": "error",
|
|
44
|
-
/**
|
|
45
|
-
* 倾向使用全等 ===
|
|
46
|
-
*
|
|
47
|
-
* FIXME: 使用 always 时 autofix 可能导致语义改变,暂时沿用 'smart',
|
|
48
|
-
* 如果可以取消 autofix,将 option 设置为 'always'
|
|
49
|
-
*/
|
|
50
|
-
eqeqeq: ["error", "smart"],
|
|
51
|
-
/** `a = a || b` 可以简写为 `a ||= b` */
|
|
52
|
-
"logical-assignment-operators": ["warn"],
|
|
53
|
-
/** 限制最大回调嵌套数量 */
|
|
54
|
-
"max-nested-callbacks": ["warn", 5],
|
|
55
|
-
/** for 与 await 一起使用会串行阻塞线程,可以使用 Promise.all() 一次发起多个 Promise */
|
|
56
|
-
"no-await-in-loop": "warn",
|
|
57
|
-
/**
|
|
58
|
-
* 不要嵌套 promise
|
|
59
|
-
*
|
|
60
|
-
* 但有时需要 async executor,如:
|
|
61
|
-
* ```js
|
|
62
|
-
* new Promise(async (resolve, reject) => {
|
|
63
|
-
* const result = await doSomething();
|
|
64
|
-
* const result2 = await doSomething2(result);
|
|
65
|
-
* resolve(result2);
|
|
66
|
-
* })
|
|
67
|
-
* ```
|
|
68
|
-
* 无法配置,故关闭
|
|
69
|
-
*/
|
|
70
|
-
"no-async-promise-executor": "off",
|
|
71
|
-
/** 别用 */
|
|
72
|
-
"no-caller": "error",
|
|
73
|
-
/** 错误使用 */
|
|
74
|
-
"no-constant-binary-expression": "error",
|
|
75
|
-
/**
|
|
76
|
-
* console.log使用后删除
|
|
77
|
-
*/
|
|
78
|
-
"no-console": ["off", {
|
|
79
|
-
allow: ["warn", "error"]
|
|
80
|
-
}],
|
|
81
|
-
/** `constructor` 中不应有返回值(允许作为控制流使用) */
|
|
82
|
-
"no-constructor-return": "warn",
|
|
83
|
-
/** 允许空函数声明 */
|
|
84
|
-
"no-empty": "off",
|
|
85
|
-
/** 禁止使用 eval */
|
|
86
|
-
"no-eval": "warn",
|
|
87
|
-
/** 防止`switch case`忘写`break` */
|
|
88
|
-
"no-fallthrough": ["error", {
|
|
89
|
-
allowEmptyCase: true
|
|
90
|
-
}],
|
|
91
|
-
/** 不允许 new Symbol 与 new BigInt 这种错误用法 */
|
|
92
|
-
"no-new-native-nonconstructor": "error",
|
|
93
|
-
/**
|
|
94
|
-
* Promise 内 return 没有意义,使用 resolve 或 reject
|
|
95
|
-
* 无法配置允许箭头函数,故关闭 https://github.com/eslint/eslint/issues/17278
|
|
96
|
-
*/
|
|
97
|
-
"no-promise-executor-return": "off",
|
|
98
|
-
/** 令人混淆的 window 上的变量 */
|
|
99
|
-
"no-restricted-globals": [
|
|
100
|
-
"error",
|
|
101
|
-
"event",
|
|
102
|
-
"name",
|
|
103
|
-
"length",
|
|
104
|
-
"status"
|
|
105
|
-
],
|
|
106
|
-
/** 禁止不必要的 await */
|
|
107
|
-
"no-return-await": "warn",
|
|
108
|
-
/** 允许未使用的变量 */
|
|
109
|
-
"no-unused-vars": "off",
|
|
110
|
-
/** 禁止使用 var 定义变量 */
|
|
111
|
-
"no-var": "error",
|
|
112
|
-
/**
|
|
113
|
-
* 优先使用 const
|
|
114
|
-
*
|
|
115
|
-
* 有时解构会出现不变的变量也是用 let,autofix 会导致运行时错误,故关闭
|
|
116
|
-
*/
|
|
117
|
-
"prefer-const": ["off", {
|
|
118
|
-
destructuring: "all",
|
|
119
|
-
ignoreReadBeforeAssign: false
|
|
120
|
-
}],
|
|
121
|
-
/** 使用 `a ** b` 替代 `Math.pow(a, b)` */
|
|
122
|
-
"prefer-exponentiation-operator": "warn",
|
|
123
|
-
/** 使用 `Object.hasOwn()` 替代 `Object.prototype.hasOwnProperty.call()` */
|
|
124
|
-
"prefer-object-has-own": "warn",
|
|
125
|
-
/** 偏好 reject Error 对象 */
|
|
126
|
-
"prefer-promise-reject-errors": ["warn", {
|
|
127
|
-
allowEmptyReject: true
|
|
128
|
-
}],
|
|
129
|
-
/**
|
|
130
|
-
* 这可能会导致数据竞争
|
|
131
|
-
* ```ts
|
|
132
|
-
* let a: string | undefined
|
|
133
|
-
*
|
|
134
|
-
* async function doSomething() {
|
|
135
|
-
* const b = a ||= await getA()
|
|
136
|
-
* // ^^^^^^^^^^^^^^^^^^确实在多次调用时有数据竞争,但暂未找到两全之法,故关闭
|
|
137
|
-
* }
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
"require-atomic-updates": "off",
|
|
141
|
-
// Node 插件 未安装
|
|
142
|
-
/** 同步发方法会阻塞线程,使用异步方法代替 */
|
|
143
|
-
// 'node/no-sync': 'warn',
|
|
144
|
-
// -------------------------------------------------------------
|
|
145
|
-
// unicorn https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
146
|
-
// -------------------------------------------------------------
|
|
147
|
-
/** 🔧更好的正则 */
|
|
148
|
-
"unicorn/better-regex": ["warn", {
|
|
149
|
-
sortCharacterClasses: false
|
|
150
|
-
}],
|
|
151
|
-
/** Error 应有错误信息 */
|
|
152
|
-
"unicorn/error-message": "warn",
|
|
153
|
-
// 暂时未使用
|
|
154
|
-
// 'unicorn/expiring-todo-comments': 'warn',
|
|
155
|
-
/** 手动操作原生 Cookie 很麻烦容易出错 */
|
|
156
|
-
"unicorn/no-document-cookie": "warn",
|
|
157
|
-
/** 🔧不要使用 instanceof Array 判断数组 */
|
|
158
|
-
"unicorn/no-instanceof-array": "warn",
|
|
159
|
-
/** 事件监听移除字面量函数是无效的 */
|
|
160
|
-
"unicorn/no-invalid-remove-event-listener": "error",
|
|
161
|
-
/** 警告嵌套三元运算符 (可以通过 indent 来表示,不警告) */
|
|
162
|
-
// 'no-nested-ternary': 'off',
|
|
163
|
-
// 'unicorn/no-nested-ternary': 'warn',
|
|
164
|
-
/** 🔧使用 Buffer.from() 或 Buffer.alloc() 代替 */
|
|
165
|
-
"unicorn/no-new-buffer": "error",
|
|
166
|
-
/** 禁止声明`then`属性,以免和`Promsie`混淆 */
|
|
167
|
-
"unicorn/no-thenable": "error",
|
|
168
|
-
/** 使用 var === undefined 来检查 而不是 typeof var === 'undefined',除了全局变量 */
|
|
169
|
-
"unicorn/no-typeof-undefined": ["warn", {
|
|
170
|
-
checkGlobalVariables: false
|
|
171
|
-
}],
|
|
172
|
-
/** 🔧去除多余的 `await` */
|
|
173
|
-
"unicorn/no-unnecessary-await": "off",
|
|
174
|
-
/** 禁止令人迷惑的数组解构 */
|
|
175
|
-
"unicorn/no-unreadable-array-destructuring": "error",
|
|
176
|
-
/** 🔧去除多余的 fallback */
|
|
177
|
-
"unicorn/no-useless-fallback-in-spread": "warn",
|
|
178
|
-
/** 🔧去除多余的 `Promise.resove/reject` */
|
|
179
|
-
"unicorn/no-useless-promise-resolve-reject": "warn",
|
|
180
|
-
/** 🔧去除多余的 `...` */
|
|
181
|
-
"unicorn/no-useless-spread": "warn",
|
|
182
|
-
/** 🔧去除多余的 undefined */
|
|
183
|
-
"unicorn/no-useless-undefined": ["warn", {
|
|
184
|
-
checkArguments: false
|
|
185
|
-
}],
|
|
186
|
-
/** 🔧`1`, `1.0`, `1.` 没有区别 */
|
|
187
|
-
"unicorn/no-zero-fractions": "warn",
|
|
188
|
-
"unicorn/number-literal-case": "warn",
|
|
189
|
-
/** 🔧使用 `Array#flat()` 替代 `Array#concat()` */
|
|
190
|
-
"unicorn/prefer-array-flat": "warn",
|
|
191
|
-
/** 🔧使用 `Array#flatMap()` 替代 `Array#concat().map()` */
|
|
192
|
-
"unicorn/prefer-array-flat-map": "warn",
|
|
193
|
-
/** 🔧使用 indexOf 代替简单查找 findIndex */
|
|
194
|
-
"unicorn/prefer-array-index-of": "warn",
|
|
195
|
-
/** 🔧偏好使用 `Array#some()` */
|
|
196
|
-
"unicorn/prefer-array-some": "warn",
|
|
197
|
-
/** 🔧偏好使用 `Array#at()` 和 `String#at()` */
|
|
198
|
-
"unicorn/prefer-at": "warn",
|
|
199
|
-
/** 使用 `Blob#arrayBuffer()` 和 `Blob#text()` */
|
|
200
|
-
"unicorn/prefer-blob-reading-methods": "warn",
|
|
201
|
-
/** */
|
|
202
|
-
"unicorn/prefer-code-point": "warn",
|
|
203
|
-
/** 🔧使用 `Node#append()` 代替 `Node#appendChild()` */
|
|
204
|
-
"unicorn/prefer-dom-node-append": "warn",
|
|
205
|
-
/** 🔧使用 HTML#dataset 而不是直接操作 attribute `data-*` */
|
|
206
|
-
"unicorn/prefer-dom-node-dataset": "warn",
|
|
207
|
-
/** 🔧使用 Node#remove 代替 node.parentNode.removeChild() */
|
|
208
|
-
"unicorn/prefer-dom-node-remove": "warn",
|
|
209
|
-
/** 使用 textContent 代替 innerText,参考 [Differences from innerText](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#differences_from_innertext) */
|
|
210
|
-
"unicorn/prefer-dom-node-text-content": "warn",
|
|
211
|
-
/** 🔧使用 export...from 如果导入导出未使用 */
|
|
212
|
-
"unicorn/prefer-export-from": ["warn", {
|
|
213
|
-
ignoreUsedVariables: true
|
|
214
|
-
}],
|
|
215
|
-
/** 🔧使用 Array#includes 代替 indexOf / some 代替存在性检查 */
|
|
216
|
-
"unicorn/prefer-includes": "warn",
|
|
217
|
-
/** 🔧使用新的 KeyboradEvent#key 而不是 KeyboardEvent#keyCode */
|
|
218
|
-
"unicorn/prefer-keyboard-event-key": "warn",
|
|
219
|
-
/** 🔧使用更现代的 DOM API */
|
|
220
|
-
"unicorn/prefer-modern-dom-apis": "warn",
|
|
221
|
-
/** 🔧使用更现代的 Math API */
|
|
222
|
-
"unicorn/prefer-modern-math-apis": "warn",
|
|
223
|
-
/** 🔧使用负数 -index 代替 xxx.length - index */
|
|
224
|
-
"unicorn/prefer-negative-index": "warn",
|
|
225
|
-
/** 🔧来自 Node 的方法应添加 node: 协议前缀,避免混淆 */
|
|
226
|
-
"unicorn/prefer-node-protocol": "warn",
|
|
227
|
-
/** 🔧使用 Object.fromEntries 代替手动 */
|
|
228
|
-
"unicorn/prefer-object-from-entries": "warn",
|
|
229
|
-
/** 🔧省略 catch 如果未使用 */
|
|
230
|
-
"unicorn/prefer-optional-catch-binding": "warn",
|
|
231
|
-
/** 🔧使用 prototype 上而不是实例上的 prototype */
|
|
232
|
-
"unicorn/prefer-prototype-methods": "warn",
|
|
233
|
-
/** 🔧使用同一种方法来选择 DOM 元素,避免混淆 */
|
|
234
|
-
"unicorn/prefer-query-selector": "warn",
|
|
235
|
-
/** 🔧使用 Set#size 直接获得数量而不是先转换为 Array 再读取 Array#length */
|
|
236
|
-
"unicorn/prefer-set-size": "warn",
|
|
237
|
-
/** 🔧偏好使用 string.slice 而不是 string.substring / string.substr */
|
|
238
|
-
"unicorn/prefer-string-slice": "warn",
|
|
239
|
-
/** 🔧throw 应使用 new Error */
|
|
240
|
-
"unicorn/throw-new-error": "warn",
|
|
241
|
-
// -------------------------------------------------------------
|
|
242
|
-
// eslint-plugin-promise
|
|
243
|
-
// -------------------------------------------------------------
|
|
244
|
-
/** 🔧Promise 上的静态方法应直接使用 */
|
|
245
|
-
"promise/no-new-statics": "error"
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
];
|
|
249
|
-
|
|
250
|
-
// src/configs/typescript.ts
|
|
251
|
-
import { cwd } from "node:process";
|
|
252
|
-
function typescript({ tsconfigPath }) {
|
|
253
|
-
return [
|
|
254
|
-
...javascript,
|
|
255
|
-
{
|
|
256
|
-
plugins: {
|
|
257
|
-
"@typescript-eslint": default5
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
files: ["**/*.?([cm])[tj]s?(x)", "**/*.vue"],
|
|
262
|
-
languageOptions: {
|
|
263
|
-
parser: parserTs,
|
|
264
|
-
sourceType: "module",
|
|
265
|
-
parserOptions: {
|
|
266
|
-
ecmaVersion: "latest",
|
|
267
|
-
project: tsconfigPath,
|
|
268
|
-
tsconfigRootDir: cwd()
|
|
269
|
-
// extraFileExtensions: ['.vue']
|
|
270
|
-
// project: true,
|
|
271
|
-
// EXPERIMENTAL_useProjectService: true,
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
rules: {
|
|
275
|
-
...default5.configs["strict-type-checked"].rules,
|
|
276
|
-
/** ✅禁止不必要的 await */
|
|
277
|
-
// '@typescript-eslint/await-thenable': 'warn',
|
|
278
|
-
/** 🎨不限制只使用 interface 或者 type */
|
|
279
|
-
"@typescript-eslint/consistent-type-definitions": "off",
|
|
280
|
-
/** 可选参数必须放在最后 */
|
|
281
|
-
"default-param-last": "off",
|
|
282
|
-
"@typescript-eslint/default-param-last": "error",
|
|
283
|
-
/** 🎨不强制使用 `.`(点) 来访问属性 */
|
|
284
|
-
"dot-notation": "off",
|
|
285
|
-
"@typescript-eslint/dot-notation": "off",
|
|
286
|
-
/** 🔒禁止使用 void 函数的返回值 ("off" 因为 return voidExpression() 这种缩写 { voidExpress(); return } 也会报错) */
|
|
287
|
-
"@typescript-eslint/no-confusing-void-expression": [
|
|
288
|
-
"off",
|
|
289
|
-
{
|
|
290
|
-
ignoreArrowShorthand: true
|
|
291
|
-
}
|
|
292
|
-
],
|
|
293
|
-
/** 不允许 class 有重复的成员 (TypeScript 已检查,禁用此规则) */
|
|
294
|
-
"no-dupe-class-members": "off",
|
|
295
|
-
"@typescript-eslint/no-dupe-class-members": "off",
|
|
296
|
-
/** 🎨允许空函数 */
|
|
297
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
298
|
-
/** ✅允许显式 any */
|
|
299
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
300
|
-
/** ✅允许未处理的 Promise */
|
|
301
|
-
"@typescript-eslint/no-floating-promises": "off",
|
|
302
|
-
/** 🔒不允许隐式 eval */
|
|
303
|
-
// "no-implied-eval": "off",
|
|
304
|
-
// "@typescript-eslint/no-implied-eval": "error",
|
|
305
|
-
/** 禁止 for 循环内声明的函数引用函数外变量 */
|
|
306
|
-
"no-loop-func": "off",
|
|
307
|
-
"@typescript-eslint/no-loop-func": "error",
|
|
308
|
-
/** 禁止 promise 错误用法 */
|
|
309
|
-
"@typescript-eslint/no-misused-promises": [
|
|
310
|
-
"error",
|
|
311
|
-
{
|
|
312
|
-
/** 允许快捷写法 */
|
|
313
|
-
checksVoidReturn: false
|
|
314
|
-
}
|
|
315
|
-
],
|
|
316
|
-
/** ✅禁止超出精度范围的数字 */
|
|
317
|
-
// 'no-loss-of-precision': 'off',
|
|
318
|
-
// '@typescript-eslint/no-loss-of-precision': 'error',
|
|
319
|
-
/** 允许非空断言 */
|
|
320
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
321
|
-
/** 允许 TypeScript 重载声明 */
|
|
322
|
-
"no-redeclare": "off",
|
|
323
|
-
"@typescript-eslint/no-redeclare": ["error"],
|
|
324
|
-
/** ✅禁止冗余类型定义 */
|
|
325
|
-
"@typescript-eslint/no-redundant-type-constituents": "warn",
|
|
326
|
-
/** 🔒Disallow throwing literals as exceptions. */
|
|
327
|
-
"no-throw-literal": "off",
|
|
328
|
-
"@typescript-eslint/no-throw-literal": [
|
|
329
|
-
"error",
|
|
330
|
-
{
|
|
331
|
-
allowThrowingAny: false,
|
|
332
|
-
allowThrowingUnknown: false
|
|
333
|
-
}
|
|
334
|
-
],
|
|
335
|
-
/** 禁用默认`no-undef`,eslint 不会检查`*.d.ts`,导致误报全局变量与类型不存在 */
|
|
336
|
-
"no-undef": "off",
|
|
337
|
-
/**
|
|
338
|
-
* 🔒不必要的条件判断
|
|
339
|
-
*
|
|
340
|
-
* 因为有时类型不正确,autofix 会导致运行时错误,故关闭
|
|
341
|
-
*/
|
|
342
|
-
"@typescript-eslint/no-unnecessary-condition": "off",
|
|
343
|
-
/**
|
|
344
|
-
* ✅不必要的类型断言
|
|
345
|
-
*
|
|
346
|
-
* 因为有时类型不正确,autofix 会导致 TS 错误,故关闭
|
|
347
|
-
*/
|
|
348
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
349
|
-
/** 警告未使用的表达式 */
|
|
350
|
-
"no-unused-expressions": "off",
|
|
351
|
-
"@typescript-eslint/no-unused-expressions": [
|
|
352
|
-
"warn",
|
|
353
|
-
{
|
|
354
|
-
allowShortCircuit: true,
|
|
355
|
-
enforceForJSX: true
|
|
356
|
-
}
|
|
357
|
-
],
|
|
358
|
-
/** 允许未使用变量 */
|
|
359
|
-
"no-unused-vars": "off",
|
|
360
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
361
|
-
/**
|
|
362
|
-
*
|
|
363
|
-
*/
|
|
364
|
-
"@typescript-eslint/prefer-nullish-coalescing": [
|
|
365
|
-
"warn",
|
|
366
|
-
{
|
|
367
|
-
ignorePrimitives: {
|
|
368
|
-
bigint: true,
|
|
369
|
-
boolean: true,
|
|
370
|
-
number: true,
|
|
371
|
-
string: true
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
],
|
|
375
|
-
/**
|
|
376
|
-
* 使用可选链`a?.b`替代`a && a.b`
|
|
377
|
-
*
|
|
378
|
-
* FIXME:
|
|
379
|
-
* ```ts
|
|
380
|
-
* if (!a || !a.b)
|
|
381
|
-
* // ^ 也会被要求改成 ?.,降低可读性,且无配置,故关闭
|
|
382
|
-
* ```
|
|
383
|
-
*/
|
|
384
|
-
"@typescript-eslint/prefer-optional-chain": "off",
|
|
385
|
-
/**
|
|
386
|
-
* 🔧返回 promise 的函数必须有 async 关键字
|
|
387
|
-
*
|
|
388
|
-
* 不写也行,不限制此偏好,故关闭
|
|
389
|
-
*/
|
|
390
|
-
"@typescript-eslint/promise-function-async": [
|
|
391
|
-
"off",
|
|
392
|
-
{
|
|
393
|
-
checkArrowFunctions: false
|
|
394
|
-
}
|
|
395
|
-
],
|
|
396
|
-
/**
|
|
397
|
-
* 数组排序需显式指明排序方法,默认行为可能并不是想要的结果
|
|
398
|
-
* ```ts
|
|
399
|
-
* [1, 2, 3, 10, 20, 30].sort(); //→ [1, 10, 2, 20, 3, 30]
|
|
400
|
-
* ```
|
|
401
|
-
*/
|
|
402
|
-
"@typescript-eslint/require-array-sort-compare": ["error"],
|
|
403
|
-
/** ✅模板字符串只允许数字字符串 */
|
|
404
|
-
"@typescript-eslint/restrict-template-expressions": [
|
|
405
|
-
"error",
|
|
406
|
-
{
|
|
407
|
-
allowNumber: true
|
|
408
|
-
}
|
|
409
|
-
],
|
|
410
|
-
/** 允许可合为一个联合类型的函数声明多个函数签名 */
|
|
411
|
-
"@typescript-eslint/unified-signatures": "off"
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
];
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// src/configs/vue.ts
|
|
418
|
-
function vue({ tsconfigPath }) {
|
|
419
|
-
return [
|
|
420
|
-
...typescript({ tsconfigPath }),
|
|
421
|
-
{
|
|
422
|
-
plugins: {
|
|
423
|
-
vue: default4
|
|
424
|
-
}
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
files: ["**/*.vue"],
|
|
428
|
-
// plugins: {
|
|
429
|
-
// vue: pluginVue,
|
|
430
|
-
// },
|
|
431
|
-
languageOptions: {
|
|
432
|
-
parser: default8,
|
|
433
|
-
parserOptions: {
|
|
434
|
-
ecmaFeatures: {
|
|
435
|
-
jsx: true
|
|
436
|
-
},
|
|
437
|
-
ecmaVersion: "latest",
|
|
438
|
-
extraFileExtensions: [".vue"],
|
|
439
|
-
parser: parserTs,
|
|
440
|
-
sourceType: "module",
|
|
441
|
-
project: true
|
|
442
|
-
// EXPERIMENTAL_useProjectService: true,
|
|
443
|
-
}
|
|
444
|
-
},
|
|
445
|
-
processor: default4.processors[".vue"],
|
|
446
|
-
rules: {
|
|
447
|
-
...default4.configs["vue3-essential"].rules,
|
|
448
|
-
/** allow ununed vars */
|
|
449
|
-
"vue/no-unused-vars": "off",
|
|
450
|
-
"vue/html-self-closing": "off",
|
|
451
|
-
"vue/max-attributes-per-line": "off",
|
|
452
|
-
"vue/multi-word-component-names": "off",
|
|
453
|
-
// 'vue/no-v-html': 'off',
|
|
454
|
-
"vue/require-default-prop": "off",
|
|
455
|
-
"vue/require-prop-types": "off",
|
|
456
|
-
"vue/singleline-html-element-content-newline": "off"
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
];
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
// src/configs/react.ts
|
|
463
|
-
function react({ tsconfigPath }) {
|
|
464
|
-
return [
|
|
465
|
-
...typescript({ tsconfigPath }),
|
|
466
|
-
{
|
|
467
|
-
files: ["**/*.jsx", "**/*.tsx"],
|
|
468
|
-
plugins: {
|
|
469
|
-
react: default6,
|
|
470
|
-
ziloen: default7
|
|
471
|
-
},
|
|
472
|
-
languageOptions: {
|
|
473
|
-
parser: parserTs,
|
|
474
|
-
parserOptions: {
|
|
475
|
-
ecmaFeatures: {
|
|
476
|
-
jsx: true
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
},
|
|
480
|
-
rules: {
|
|
481
|
-
/** 16+ 不需要此导入 React */
|
|
482
|
-
"react/react-in-jsx-scope": "off",
|
|
483
|
-
/** ✅需要 key */
|
|
484
|
-
"react/jsx-key": ["error", {
|
|
485
|
-
// checkFragmentShorthand: true
|
|
486
|
-
}],
|
|
487
|
-
/** 让 TS 检查 */
|
|
488
|
-
"react/jsx-no-undef": "off",
|
|
489
|
-
/** 简写 <React.Fragment></React.Fragment> => <></> */
|
|
490
|
-
"react/jsx-fragments": ["warn", "syntax"],
|
|
491
|
-
/** 避免错误用法 */
|
|
492
|
-
"react/no-invalid-html-attribute": "warn",
|
|
493
|
-
/** 不允许可能出错的的 render 类型(number | string | object),(即使是 bool 也会报错,太蠢了) */
|
|
494
|
-
// 'react/jsx-no-leaked-render': 'error',
|
|
495
|
-
/** 严格 jsx render 类型,支持 TS 检查,替代 react/jsx-no-leaked-render */
|
|
496
|
-
"ziloen/jsx-strict-logical-expressions": "error"
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
];
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// src/configs/format.ts
|
|
503
|
-
var format = [
|
|
504
|
-
{
|
|
505
|
-
plugins: {
|
|
506
|
-
"@typescript-eslint": default5,
|
|
507
|
-
ziloen: default7
|
|
508
|
-
},
|
|
509
|
-
rules: {
|
|
510
|
-
/** 🔧数组括号换行 */
|
|
511
|
-
"array-bracket-newline": ["warn", "consistent"],
|
|
512
|
-
/** 🔧数组前后空格 */
|
|
513
|
-
"array-bracket-spacing": ["warn", "never"],
|
|
514
|
-
/** 🔧数组内元素换行 */
|
|
515
|
-
"array-element-newline": ["warn", "consistent"],
|
|
516
|
-
/** 🔧箭头函数括号 */
|
|
517
|
-
"arrow-parens": ["warn", "as-needed"],
|
|
518
|
-
/** 🔧箭头左右空格 */
|
|
519
|
-
"arrow-spacing": "warn",
|
|
520
|
-
/** 🔧计算属性名内部空格 */
|
|
521
|
-
"computed-property-spacing": "warn",
|
|
522
|
-
/** 🔧逗号位置 */
|
|
523
|
-
"comma-style": "warn",
|
|
524
|
-
/** 🔧属性`o.p`点号位置 */
|
|
525
|
-
"dot-location": ["warn", "property"],
|
|
526
|
-
/** 🔧函数调用参数换行 */
|
|
527
|
-
"function-call-argument-newline": ["warn", "consistent"],
|
|
528
|
-
/** 🔧生成器函数星号前后空格 */
|
|
529
|
-
"generator-star-spacing": ["warn", {
|
|
530
|
-
before: false,
|
|
531
|
-
after: true,
|
|
532
|
-
named: "after",
|
|
533
|
-
anonymous: "after",
|
|
534
|
-
method: "neither"
|
|
535
|
-
}],
|
|
536
|
-
/** 最大长度 */
|
|
537
|
-
"max-len": ["warn", {
|
|
538
|
-
code: 120,
|
|
539
|
-
tabWidth: 2,
|
|
540
|
-
ignoreComments: true,
|
|
541
|
-
ignoreTrailingComments: true,
|
|
542
|
-
ignoreStrings: true,
|
|
543
|
-
ignoreTemplateLiterals: true,
|
|
544
|
-
ignoreRegExpLiterals: true
|
|
545
|
-
}],
|
|
546
|
-
/** 多行三元表达式 */
|
|
547
|
-
// 'multiline-ternary': ['warn'],
|
|
548
|
-
/**
|
|
549
|
-
* 🔧new 表达式括号
|
|
550
|
-
* ```ts
|
|
551
|
-
* const a = new A().a()
|
|
552
|
-
* // ^ 会被改成 (new A).a(),且无法配置,故关闭
|
|
553
|
-
* ```
|
|
554
|
-
*/
|
|
555
|
-
"new-parens": "off",
|
|
556
|
-
/** 🔧链式调用换行 */
|
|
557
|
-
"newline-per-chained-call": ["warn", { ignoreChainWithDepth: 2 }],
|
|
558
|
-
/** 禁止混用空格和 tab 作为 indent */
|
|
559
|
-
"no-mixed-spaces-and-tabs": "warn",
|
|
560
|
-
/** 多余的空格 */
|
|
561
|
-
"no-multi-spaces": "warn",
|
|
562
|
-
/** 多行空行 */
|
|
563
|
-
"no-multiple-empty-lines": ["warn", { max: 3 }],
|
|
564
|
-
/** 尾随空格 */
|
|
565
|
-
"no-trailing-spaces": ["warn", {
|
|
566
|
-
/** 注释内可能有 markdown,尾随空格会影响显示格式 */
|
|
567
|
-
ignoreComments: true
|
|
568
|
-
}],
|
|
569
|
-
/** 禁止不必要的重命名 */
|
|
570
|
-
"no-useless-rename": "warn",
|
|
571
|
-
/** 对象与属性间的空格 */
|
|
572
|
-
"no-whitespace-before-property": "warn",
|
|
573
|
-
/** 对象花括号换行 */
|
|
574
|
-
"object-curly-newline": ["warn", { consistent: true }],
|
|
575
|
-
/** 对象键快捷写法 */
|
|
576
|
-
"object-shorthand": ["warn", "always", {
|
|
577
|
-
avoidQuotes: true
|
|
578
|
-
}],
|
|
579
|
-
/** 偏好模板字符串 */
|
|
580
|
-
"prefer-template": "warn",
|
|
581
|
-
/** 属性名的引号 */
|
|
582
|
-
"quote-props": ["warn", "as-needed"],
|
|
583
|
-
/** 展开操作符前后空格 */
|
|
584
|
-
"rest-spread-spacing": ["warn", "never"],
|
|
585
|
-
/** 分号前后空格 */
|
|
586
|
-
"semi-spacing": ["warn", { before: false, after: true }],
|
|
587
|
-
/** 分号位置 */
|
|
588
|
-
"semi-style": "warn",
|
|
589
|
-
/**
|
|
590
|
-
* 排序
|
|
591
|
-
*
|
|
592
|
-
* FIXME: 不支持 import { type foo } from 'bar' type import 语法,故关闭
|
|
593
|
-
*/
|
|
594
|
-
"sort-imports": ["off", {
|
|
595
|
-
ignoreDeclarationSort: true
|
|
596
|
-
}],
|
|
597
|
-
/** 括号中前后空格 */
|
|
598
|
-
"space-in-parens": "warn",
|
|
599
|
-
/** 一元操作符前后空格 */
|
|
600
|
-
"space-unary-ops": ["warn", { words: true, nonwords: false }],
|
|
601
|
-
/** switch case 冒号前后空格 */
|
|
602
|
-
"switch-colon-spacing": "warn",
|
|
603
|
-
/** 模板字符串花括号中前后空格 */
|
|
604
|
-
"template-curly-spacing": "warn",
|
|
605
|
-
/** 生成器函数星号空格 */
|
|
606
|
-
"yield-star-spacing": ["warn", "after"],
|
|
607
|
-
// -------------------------------------------------------------
|
|
608
|
-
// 以下需要覆盖原配置 以在 ts 文件中生效
|
|
609
|
-
// -------------------------------------------------------------
|
|
610
|
-
/** 语句块内部前后空格 */
|
|
611
|
-
"block-spacing": "off",
|
|
612
|
-
"@typescript-eslint/block-spacing": "warn",
|
|
613
|
-
/** 括号风格 */
|
|
614
|
-
"brace-style": "off",
|
|
615
|
-
"@typescript-eslint/brace-style": ["warn", "1tbs", { allowSingleLine: true }],
|
|
616
|
-
/** 尾随逗号 */
|
|
617
|
-
"comma-dangle": "off",
|
|
618
|
-
"@typescript-eslint/comma-dangle": ["warn", "only-multiline"],
|
|
619
|
-
/** 逗号前后空格 */
|
|
620
|
-
"comma-spacing": "off",
|
|
621
|
-
"@typescript-eslint/comma-spacing": "warn",
|
|
622
|
-
/** 🔧函数调用空格 */
|
|
623
|
-
"func-call-spacing": "off",
|
|
624
|
-
"@typescript-eslint/func-call-spacing": "warn",
|
|
625
|
-
/** 🔧缩进 */
|
|
626
|
-
// https://github.com/typescript-eslint/typescript-eslint/issues/1824
|
|
627
|
-
// indent: ['warn', 2, {
|
|
628
|
-
// /** 同时定义多个变量时,对齐到第一个变量定义 */
|
|
629
|
-
// VariableDeclarator: 'first',
|
|
630
|
-
// /** swtich case 增加 1 indent */
|
|
631
|
-
// SwitchCase: 1,
|
|
632
|
-
// /** 三元表达式偏移 */
|
|
633
|
-
// offsetTernaryExpressions: true
|
|
634
|
-
// }],
|
|
635
|
-
indent: "off",
|
|
636
|
-
"@typescript-eslint/indent": ["warn", 2, {
|
|
637
|
-
/** 同时定义多个变量时,对齐到第一个变量定义 */
|
|
638
|
-
VariableDeclarator: "first",
|
|
639
|
-
/** swtich case 增加 1 indent */
|
|
640
|
-
SwitchCase: 1,
|
|
641
|
-
/** 三元表达式偏移 */
|
|
642
|
-
offsetTernaryExpressions: true,
|
|
643
|
-
/** 嵌套三元表达式不增加 indent */
|
|
644
|
-
flatTernaryExpressions: false,
|
|
645
|
-
/** 忽略一些无法正确处理的边缘情况,手动添加 indent */
|
|
646
|
-
ignoredNodes: [
|
|
647
|
-
"PropertyDefinition[decorators]",
|
|
648
|
-
"TSUnionType",
|
|
649
|
-
"FunctionExpression[params]:has(Identifier[decorators])",
|
|
650
|
-
// 类型泛型参数
|
|
651
|
-
"TSTypeParameterInstantiation",
|
|
652
|
-
"TSIntersectionType"
|
|
653
|
-
]
|
|
654
|
-
}],
|
|
655
|
-
/** 🔧对象键名空格 */
|
|
656
|
-
"key-spacing": "off",
|
|
657
|
-
"@typescript-eslint/key-spacing": ["warn"],
|
|
658
|
-
/** 关键词 空格 */
|
|
659
|
-
"keyword-spacing": "off",
|
|
660
|
-
"@typescript-eslint/keyword-spacing": "warn",
|
|
661
|
-
/** 多余的括号 */
|
|
662
|
-
"no-extra-parens": "off",
|
|
663
|
-
"@typescript-eslint/no-extra-parens": ["warn", "all", {
|
|
664
|
-
/** 允许 JSDoc 类型转换 */
|
|
665
|
-
allowParensAfterCommentPattern: "@type",
|
|
666
|
-
/** 忽略 JSX */
|
|
667
|
-
ignoreJSX: "all",
|
|
668
|
-
/** 允许条件赋值包围括号 */
|
|
669
|
-
conditionalAssign: false,
|
|
670
|
-
/** 允许 return 赋值包围括号 */
|
|
671
|
-
returnAssign: false,
|
|
672
|
-
/** 允许三元表达式内包围括号 */
|
|
673
|
-
ternaryOperandBinaryExpressions: false,
|
|
674
|
-
/** 允许嵌套二元表达式包围括号 */
|
|
675
|
-
nestedBinaryExpressions: false
|
|
676
|
-
}],
|
|
677
|
-
/** 多余的分号 */
|
|
678
|
-
"no-extra-semi": "off",
|
|
679
|
-
"@typescript-eslint/no-extra-semi": ["warn"],
|
|
680
|
-
/** 对象花括号内部前后空格 */
|
|
681
|
-
"object-curly-spacing": "off",
|
|
682
|
-
"@typescript-eslint/object-curly-spacing": ["warn", "always"],
|
|
683
|
-
/** 🔧字符串引号 */
|
|
684
|
-
quotes: "off",
|
|
685
|
-
"@typescript-eslint/quotes": ["warn", "single", {
|
|
686
|
-
avoidEscape: true,
|
|
687
|
-
allowTemplateLiterals: true
|
|
688
|
-
}],
|
|
689
|
-
/** 分号 */
|
|
690
|
-
semi: "off",
|
|
691
|
-
"@typescript-eslint/semi": ["warn", "never"],
|
|
692
|
-
/** 块语句前的空格 */
|
|
693
|
-
"space-before-blocks": "off",
|
|
694
|
-
"@typescript-eslint/space-before-blocks": "warn",
|
|
695
|
-
/** 函数声明参数括号前的空格 */
|
|
696
|
-
"space-before-function-paren": "off",
|
|
697
|
-
"@typescript-eslint/space-before-function-paren": ["warn", {
|
|
698
|
-
anonymous: "always",
|
|
699
|
-
named: "never",
|
|
700
|
-
asyncArrow: "always"
|
|
701
|
-
}],
|
|
702
|
-
/** 操作符左右空格 */
|
|
703
|
-
"space-infix-ops": "off",
|
|
704
|
-
"@typescript-eslint/space-infix-ops": "warn",
|
|
705
|
-
// -------------------------------------------------------------
|
|
706
|
-
// 以下为 TS Plugin Rules
|
|
707
|
-
// -------------------------------------------------------------
|
|
708
|
-
/** 类型定义属性间隔符 `;` / `,` / none */
|
|
709
|
-
"@typescript-eslint/member-delimiter-style": ["warn", {
|
|
710
|
-
multiline: { delimiter: "none", requireLast: false },
|
|
711
|
-
singleline: { requireLast: false },
|
|
712
|
-
multilineDetection: "brackets"
|
|
713
|
-
}],
|
|
714
|
-
/** 🔧多余的限定符 */
|
|
715
|
-
"@typescript-eslint/no-unnecessary-qualifier": "warn",
|
|
716
|
-
/** 类型标注空格 */
|
|
717
|
-
"@typescript-eslint/type-annotation-spacing": ["warn"],
|
|
718
|
-
// -------------------------------------------------------------
|
|
719
|
-
// 以下为其他规则
|
|
720
|
-
// -------------------------------------------------------------
|
|
721
|
-
"ziloen/generic-spacing": "warn"
|
|
722
|
-
}
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
files: ["**/*.jsx", "**/*.tsx"],
|
|
726
|
-
plugins: {
|
|
727
|
-
react: default6
|
|
728
|
-
},
|
|
729
|
-
rules: {
|
|
730
|
-
// -------------------------------------------------------------
|
|
731
|
-
// 以下为 React Plugin Rules
|
|
732
|
-
// -------------------------------------------------------------
|
|
733
|
-
/**
|
|
734
|
-
* JSX 自闭合
|
|
735
|
-
*
|
|
736
|
-
* 经常还没写内容就被自动闭合
|
|
737
|
-
*/
|
|
738
|
-
"react/self-closing-comp": ["off", {
|
|
739
|
-
component: true,
|
|
740
|
-
html: false
|
|
741
|
-
}],
|
|
742
|
-
/** JSX 标签空格 */
|
|
743
|
-
"react/jsx-tag-spacing": ["warn", {
|
|
744
|
-
closingSlash: "never",
|
|
745
|
-
beforeSelfClosing: "proportional-always",
|
|
746
|
-
afterOpening: "never",
|
|
747
|
-
beforeClosing: "never"
|
|
748
|
-
}],
|
|
749
|
-
/** 括号内前后空格 */
|
|
750
|
-
"react/jsx-curly-spacing": ["warn"],
|
|
751
|
-
/** 🔧JSX 缩进,会和 TS indent 冲突,关闭 */
|
|
752
|
-
"react/jsx-indent": "off",
|
|
753
|
-
// 'react/jsx-indent': ['warn', 2, {
|
|
754
|
-
// checkAttributes: true,
|
|
755
|
-
// indentLogicalExpressions: true,
|
|
756
|
-
// }],
|
|
757
|
-
/** 🔧属性缩进 */
|
|
758
|
-
"react/jsx-indent-props": ["warn", {
|
|
759
|
-
indentMode: 2
|
|
760
|
-
}]
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
];
|
|
764
|
-
export {
|
|
765
|
-
format,
|
|
766
|
-
javascript,
|
|
767
|
-
react,
|
|
768
|
-
typescript,
|
|
769
|
-
vue
|
|
770
|
-
};
|
|
1
|
+
import u from"@eslint/js";import{default as i}from"@stylistic/eslint-plugin";import{default as n}from"@typescript-eslint/eslint-plugin";import{default as l}from"eslint-plugin-promise";import{default as t}from"eslint-plugin-react";import{default as p}from"eslint-plugin-unicorn";import{default as o}from"eslint-plugin-vue";import{default as s}from"eslint-plugin-ziloen";import*as e from"@typescript-eslint/parser";import{default as c}from"vue-eslint-parser";var f=[u.configs.recommended,{plugins:{unicorn:p,promise:l},ignores:["*.min.*","CHANGELOG.md","LICENSE*","package-lock.json","pnpm-lock.yaml","yarn.lock","node_modules","dist","*.html"],rules:{"array-callback-return":["error",{allowImplicit:!0}],"block-scoped-var":"error","constructor-super":"error",eqeqeq:["error","smart"],"logical-assignment-operators":["warn"],"max-nested-callbacks":["warn",5],"no-await-in-loop":"warn","no-async-promise-executor":"off","no-caller":"error","no-constant-binary-expression":"error","no-console":["off",{allow:["warn","error"]}],"no-constructor-return":"warn","no-empty":"off","no-eval":"warn","no-fallthrough":["error",{allowEmptyCase:!0}],"no-new-native-nonconstructor":"error","no-promise-executor-return":"off","no-restricted-globals":["error","event","name","length","status"],"no-return-await":"warn","no-unused-vars":"off","no-var":"error","prefer-const":["off",{destructuring:"all",ignoreReadBeforeAssign:!1}],"prefer-exponentiation-operator":"warn","prefer-object-has-own":"warn","prefer-promise-reject-errors":["warn",{allowEmptyReject:!0}],"require-atomic-updates":"off","unicorn/better-regex":["warn",{sortCharacterClasses:!1}],"unicorn/error-message":"warn","unicorn/no-document-cookie":"warn","unicorn/no-instanceof-array":"warn","unicorn/no-invalid-remove-event-listener":"error","unicorn/no-new-buffer":"error","unicorn/no-thenable":"error","unicorn/no-typeof-undefined":["warn",{checkGlobalVariables:!1}],"unicorn/no-unnecessary-await":"off","unicorn/no-unreadable-array-destructuring":"error","unicorn/no-useless-fallback-in-spread":"warn","unicorn/no-useless-promise-resolve-reject":"warn","unicorn/no-useless-spread":"warn","unicorn/no-useless-undefined":["warn",{checkArguments:!1}],"unicorn/no-zero-fractions":"warn","unicorn/number-literal-case":"warn","unicorn/prefer-array-flat":"warn","unicorn/prefer-array-flat-map":"warn","unicorn/prefer-array-index-of":"warn","unicorn/prefer-array-some":"warn","unicorn/prefer-at":"warn","unicorn/prefer-blob-reading-methods":"warn","unicorn/prefer-code-point":"warn","unicorn/prefer-dom-node-append":"warn","unicorn/prefer-dom-node-dataset":"warn","unicorn/prefer-dom-node-remove":"warn","unicorn/prefer-dom-node-text-content":"warn","unicorn/prefer-export-from":["warn",{ignoreUsedVariables:!0}],"unicorn/prefer-includes":"warn","unicorn/prefer-keyboard-event-key":"warn","unicorn/prefer-modern-dom-apis":"warn","unicorn/prefer-modern-math-apis":"warn","unicorn/prefer-negative-index":"warn","unicorn/prefer-node-protocol":"warn","unicorn/prefer-object-from-entries":"warn","unicorn/prefer-optional-catch-binding":"warn","unicorn/prefer-prototype-methods":"warn","unicorn/prefer-query-selector":"warn","unicorn/prefer-set-size":"warn","unicorn/prefer-string-slice":"warn","unicorn/throw-new-error":"warn","promise/no-new-statics":"error"}}];import{cwd as m}from"node:process";function a({tsconfigPath:r}){return[...f,{plugins:{"@typescript-eslint":n}},{files:["**/*.?([cm])[tj]s?(x)","**/*.vue"],languageOptions:{parser:e,sourceType:"module",parserOptions:{ecmaVersion:"latest",project:r,tsconfigRootDir:m()}},rules:{...n.configs["strict-type-checked"].rules,"@typescript-eslint/consistent-type-definitions":"off","default-param-last":"off","@typescript-eslint/default-param-last":"error","dot-notation":"off","@typescript-eslint/dot-notation":"off","@typescript-eslint/no-confusing-void-expression":["off",{ignoreArrowShorthand:!0}],"no-dupe-class-members":"off","@typescript-eslint/no-dupe-class-members":"off","@typescript-eslint/no-empty-function":"off","@typescript-eslint/no-explicit-any":"off","@typescript-eslint/no-floating-promises":"off","no-loop-func":"off","@typescript-eslint/no-loop-func":"error","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:!1}],"@typescript-eslint/no-non-null-assertion":"off","no-redeclare":"off","@typescript-eslint/no-redeclare":["error"],"@typescript-eslint/no-redundant-type-constituents":"warn","no-throw-literal":"off","@typescript-eslint/no-throw-literal":["error",{allowThrowingAny:!1,allowThrowingUnknown:!1}],"no-undef":"off","@typescript-eslint/no-unnecessary-condition":"off","@typescript-eslint/no-unnecessary-type-assertion":"off","@typescript-eslint/no-unsafe-unary-minus":"error","no-unused-expressions":"off","@typescript-eslint/no-unused-expressions":["warn",{allowShortCircuit:!0,enforceForJSX:!0}],"no-unused-vars":"off","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/prefer-nullish-coalescing":["warn",{ignorePrimitives:{bigint:!0,boolean:!0,number:!0,string:!0}}],"@typescript-eslint/prefer-optional-chain":"off","@typescript-eslint/promise-function-async":["off",{checkArrowFunctions:!1}],"@typescript-eslint/require-array-sort-compare":["error"],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}],"@typescript-eslint/unified-signatures":"off"}}]}function A({tsconfigPath:r}){return[...a({tsconfigPath:r}),{plugins:{vue:o}},{files:["**/*.vue"],languageOptions:{parser:c,parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:"latest",extraFileExtensions:[".vue"],parser:e,sourceType:"module",project:!0}},processor:o.processors[".vue"],rules:{...o.configs["vue3-essential"].rules,"vue/no-unused-vars":"off","vue/html-self-closing":"off","vue/max-attributes-per-line":"off","vue/multi-word-component-names":"off","vue/require-default-prop":"off","vue/require-prop-types":"off","vue/singleline-html-element-content-newline":"off"}}]}function D({tsconfigPath:r}){return[...a({tsconfigPath:r}),{files:["**/*.jsx","**/*.tsx"],plugins:{react:t,ziloen:s},languageOptions:{parser:e,parserOptions:{ecmaFeatures:{jsx:!0}}},rules:{"react/react-in-jsx-scope":"off","react/jsx-key":["error",{}],"react/jsx-no-undef":"off","react/jsx-fragments":["warn","syntax"],"react/no-invalid-html-attribute":"warn","ziloen/jsx-strict-logical-expressions":"error"}}]}var B=[{plugins:{"@typescript-eslint":n,ziloen:s,style:i},rules:{"style/array-bracket-newline":["warn","consistent"],"style/array-bracket-spacing":["warn","never"],"style/array-element-newline":["warn","consistent"],"style/arrow-parens":["warn","as-needed"],"style/arrow-spacing":"warn","style/computed-property-spacing":"warn","style/comma-style":"warn","style/dot-location":["warn","property"],"style/function-call-argument-newline":["warn","consistent"],"style/generator-star-spacing":["warn",{before:!1,after:!0,named:"after",anonymous:"after",method:"neither"}],"style/max-len":["warn",{code:120,tabWidth:2,ignoreComments:!0,ignoreTrailingComments:!0,ignoreStrings:!0,ignoreTemplateLiterals:!0,ignoreRegExpLiterals:!0}],"style/new-parens":"off","style/newline-per-chained-call":["warn",{ignoreChainWithDepth:2}],"style/no-mixed-spaces-and-tabs":"warn","style/no-multi-spaces":"warn","style/no-multiple-empty-lines":["warn",{max:3}],"style/no-trailing-spaces":["warn",{ignoreComments:!0}],"no-useless-rename":"warn","style/no-whitespace-before-property":"warn","style/object-curly-newline":["warn",{consistent:!0}],"object-shorthand":["warn","always",{avoidQuotes:!0}],"prefer-template":"warn","style/quote-props":["warn","as-needed"],"style/rest-spread-spacing":["warn","never"],"style/semi-spacing":["warn",{before:!1,after:!0}],"style/semi-style":"warn","sort-imports":["off",{ignoreDeclarationSort:!0}],"style/space-in-parens":"warn","style/space-unary-ops":["warn",{words:!0,nonwords:!1}],"style/switch-colon-spacing":"warn","style/template-curly-spacing":"warn","style/yield-star-spacing":["warn","after"],"style/block-spacing":"warn","style/brace-style":["warn","1tbs",{allowSingleLine:!0}],"style/comma-dangle":["warn","only-multiline"],"style/comma-spacing":"warn","style/func-call-spacing":"warn","style/indent":["warn",2,{VariableDeclarator:"first",SwitchCase:1,offsetTernaryExpressions:!0,flatTernaryExpressions:!1,ignoredNodes:["PropertyDefinition[decorators]","TSUnionType","FunctionExpression[params]:has(Identifier[decorators])","TSTypeParameterInstantiation","TSIntersectionType"]}],"style/key-spacing":["warn"],"style/keyword-spacing":"warn","style/no-extra-parens":["warn","all",{allowParensAfterCommentPattern:"@type",ignoreJSX:"all",conditionalAssign:!1,returnAssign:!1,ternaryOperandBinaryExpressions:!1,nestedBinaryExpressions:!1}],"style/no-extra-semi":["warn"],"style/object-curly-spacing":["warn","always"],"style/quotes":["warn","single",{avoidEscape:!0,allowTemplateLiterals:!0}],"style/semi":["warn","never"],"style/space-before-blocks":"warn","style/space-before-function-paren":["warn",{anonymous:"always",named:"never",asyncArrow:"always"}],"style/space-infix-ops":"warn","style/member-delimiter-style":["warn",{multiline:{delimiter:"none",requireLast:!1},singleline:{requireLast:!1},multilineDetection:"brackets"}],"@typescript-eslint/no-unnecessary-qualifier":"warn","style/type-annotation-spacing":["warn"],"ziloen/generic-spacing":"warn"}},{files:["**/*.jsx","**/*.tsx"],plugins:{react:t,style:i},rules:{"react/self-closing-comp":["off",{component:!0,html:!1}],"style/jsx-tag-spacing":["warn",{closingSlash:"never",beforeSelfClosing:"proportional-always",afterOpening:"never",beforeClosing:"never"}],"style/jsx-curly-spacing":["warn"],"style/jsx-indent":"off","style/jsx-indent-props":["warn",{indentMode:2}]}}];export{B as format,f as javascript,D as react,a as typescript,A as vue};
|