-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc.js
54 lines (53 loc) · 1.49 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// 支持 .vue 文件中 包含 jsx
const ts = require('typescript');
const { ensureScriptKind } = ts;
ts.ensureScriptKind = function (fileName, ...args) {
if (fileName.endsWith('.vue')) {
return ts.ScriptKind.TSX;
}
return ensureScriptKind.call(this, fileName, ...args);
};
module.exports = {
extends: ['wkts', 'wkvue/vue3'],
plugins: [],
globals: {},
rules: {
'no-magic-numbers': 'off',
'vue/no-deprecated-slot-attribute': 'off',
'vue/multi-word-component-names': 'off',
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
project: 'tsconfig.json',
sourceType: 'module',
ecmaVersion: 'latest',
extraFileExtensions: ['.vue'],
},
env: {
browser: true,
es2020: true,
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
// 使用 typescript 检查
'@typescript-eslint/return-await': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
},
parser: '@typescript-eslint/parser',
parserOptions: {
warnOnUnsupportedTypeScriptVersion: true,
ecmaVersion: 'latest',
lib: ['esNext'],
project: './tsconfig.json',
},
},
],
};