-
Notifications
You must be signed in to change notification settings - Fork 21
/
.eslintrc
195 lines (194 loc) · 3.97 KB
/
.eslintrc
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
{
"parserOptions":
{
"parser": "babel-eslint",
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures":
{
"jsx": true
}
},
"env":
{
"browser": true,
"node": true,
"es6": true,
"mocha": true
},
// 四个级别: base/essential/strongly-recommended/recommended, 使用最高约束
"extends": ["plugin:vue/recommended", "airbnb-base"],
"plugins": [
"markdown",
"babel",
"vue"
],
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".vue"
]
}
}
},
"rules":
{
// vue https://github.com/vuejs/eslint-plugin-vue
"vue/html-indent": ["warn", "tab"],
"vue/max-attributes-per-line": ["warn", {
"singleline": 4, // 一行最多四个
"multiline": {
"max": 1,
"allowFirstLine": false
}
}],
"vue/require-default-prop": 0, // 可以不传递props
"vue/name-property-casing": ["warn", "kebab-case"],
"vue/component-definition-name-casing": ["warn", "kebab-case"],
// -- start TODO: Fix, 临时处理
"vue/no-v-html": 0,
"vue/no-unused-vars": 0,
"vue/no-unused-components": 0,
"vue/no-use-v-if-with-v-for": 0,
"vue/no-template-shadow": 0,
"vue/require-prop-type-constructor": 0,
"vue/singleline-html-element-content-newline": 0,
"no-mixed-operators": 0,
"no-async-promise-executor": 0,
"no-self-assign": 0,
"operator-assignment": 0,
// -- end
// airbnb
"comma-dangle": ["warn", {
"arrays": "never",
"objects": "ignore",
"imports": "never",
"exports": "never",
"functions": "ignore"
}],
"new-parens": ["warn"],
"no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
"object-curly-newline": 0, // { a, b, c } 允许不换行
"arrow-body-style": 0, // a => 1
"arrow-parens": 0, // a => 1
"quote-props": 0, // "a-1": 2
"guard-for-in": 0, // xx.hasOwnProperty(key)
"no-restricted-syntax": 0,
"global-require": 0,
"eqeqeq": 0,
"no-plusplus": 0,
"no-unused-expressions": 0,
"no-undef": 0,
"no-unused-vars": 0,
"import/no-extraneous-dependencies": 0,
"import/prefer-default-export": 0,
"import/newline-after-import": ["warn"],
"import/first": 0,
"import/no-unresolved": 0,
"import/extensions": 0,
"no-multiple-empty-lines": 0,
"no-restricted-globals": 0,
"no-param-reassign": 0,
"consistent-return": 0,
"no-useless-return": 0,
"prefer-const": 0,
"no-else-return": 0,
"func-names": 0,
"prefer-arrow-callback": 0,
"no-bitwise": 0,
"padded-blocks": 0, // {} 允许空行
"no-return-assign": 0,
"max-len": ["warn", { "code": 150, "ignoreComments": true }],
"prefer-destructuring": 0,
"prefer-template": 0,
"no-nested-ternary": 0,
"prefer-rest-params": 0,
"class-methods-use-this": 0,
"no-shadow": 0,
// tab缩进
"indent": ["warn", "tab",
{
"SwitchCase": 1
}],
"no-tabs": 0,
"quotes": 0,
"no-console": 0,
"no-debugger": 1,
"no-var": 1,
"import/named": 0,
"semi": [
1,
"always"
],
"no-trailing-spaces": 0,
"eol-last": 0,
"no-underscore-dangle": 0,
"no-alert": 0,
"no-lone-blocks": 0,
// 关键字周围强制使用空格
"keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
// 大括号中强制使用空格
"object-curly-spacing": [
"warn",
"always"
],
// 单行代码块前后要加空格
"block-spacing": [
"warn",
"always"
],
// 逗号后面加空格
"comma-spacing": [
"warn",
{
"before": false,
"after": true
}
],
// 分号后面加空格
"semi-spacing": [
"warn",
{
"before": false,
"after": true
}
],
// 在注释前有空白
"spaced-comment": [
"warn",
"always"
],
// 箭头函数前后要有空格
"arrow-spacing": [
"warn",
{
"before": true,
"after": true
}
],
// 对象字面量的属性中键和值之间使用一致的间距
"key-spacing": [
"warn",
{
"beforeColon": false,
"afterColon": true
}
],
// 要求操作符周围有空格
"space-infix-ops": [
"warn",
{
"int32Hint": false
}
],
"jsx-quotes": 1,
}
}