-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc.js
118 lines (117 loc) · 3.1 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
module.exports = {
root: true,
env: {
es6: true,
node: true,
jest: true,
browser: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
ecmaVersion: 2020,
parser: '@typescript-eslint/parser',
sourceType: 'module',
extraFileExtensions: ['.vue'],
},
plugins: ['vue', '@typescript-eslint'],
extends: [
'plugin:json/recommended',
'plugin:vue/vue3-recommended',
'@vue/airbnb',
'@vue/typescript/recommended',
],
rules: {
'@typescript-eslint/padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: ['interface', 'type'],
next: '*',
},
],
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: ['const', 'let', 'var'],
next: '*',
},
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
{
blankLine: 'always',
prev: '*',
next: 'return',
},
{
blankLine: 'always',
prev: '*',
next: 'function',
},
],
'brace-style': ['error', '1tbs', { allowSingleLine: false }],
'eol-last': ['error', 'always'],
'comma-spacing': [
'error',
{
before: false,
after: true,
},
],
quotes: ['error', 'single'],
'jsx-quotes': ['error', 'prefer-double'],
'vue/html-quotes': ['error', 'double', { avoidEscape: true }],
'max-statements-per-line': ['error', { max: 1 }],
'vue/multiline-html-element-content-newline': ['error'], // 多行html中的内容是否独占一行
'vue/singleline-html-element-content-newline': ['error'],
'vue/max-attributes-per-line': [
'error',
{
singleline: {
max: 1,
},
multiline: {
max: 1,
},
},
],
'array-element-newline': ['error', 'consistent'],
'array-bracket-newline': ['error', 'consistent'], // []新一行
'vue/array-bracket-newline': ['error', 'consistent'],
'comma-dangle': ['error', 'always-multiline'], // 最后一个对象元素加逗号
'object-property-newline': ['error', { allowAllPropertiesOnSameLine: false }],
'vue/object-property-newline': ['error', { allowAllPropertiesOnSameLine: false }],
'vue/space-infix-ops': ['error', { int32Hint: true }],
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'import/prefer-default-export': 0,
'import/no-extraneous-dependencies': 0,
'import/no-unresolved': 0,
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
mjs: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
curly: 'error', // 强制if括号包裹,无效
"max-len": ["error", {"code": 150}],
},
overrides: [
{
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
env: {
jest: true,
},
},
],
};