-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.eslintrc.js
56 lines (56 loc) · 1.52 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
55
56
module.exports = {
root: true,
env: {
browser: true,
node: true,
es2021: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
modules: true,
},
},
plugins: ['@typescript-eslint'],
extends: ['plugin:vue/vue3-essential', 'eslint:recommended'],
rules: {
'no-var': 'warn', // 不能使用var声明变量
'no-unused-vars': 'off',
'no-extra-semi': 'error',
'@typescript-eslint/indent': ['error', 2], // 缩进2个空格
'import/extensions': 'off',
'linebreak-style': [0, 'error', 'windows'],
'space-before-function-paren': 0, // 在函数左括号的前面是否有空格
'eol-last': 0, // 不检测新文件末尾是否有空行
semi: [2, 'never'], // 在语句后面加分号
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'arrow-parens': 0,
'no-new': 0, //允许使用 new 关键字
'no-undef': 0,
'vue/no-multiple-template-root': 'off',
'vue/multi-word-component-names': 'off',
'vue/valid-v-slot': 'off',
'vue/script-indent': [
'error',
2,
{
// script标签缩进设置
baseIndent: 1,
switchCase: 1,
ignores: [],
},
],
},
overrides: [
{
files: ['*.vue'],
rules: {
'@typescript-eslint/indent': 'off', // 关闭.vue默认缩进规则
},
},
],
}