@blueking/eslint-config-bk 2.0.1 → 2.1.0-beta.3
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/index.js +26 -1
- package/package.json +10 -9
- package/ts.js +27 -336
- package/tsvue.js +25 -0
- package/vue.js +25 -0
- package/vue.rule.js +25 -0
- package/base.js +0 -686
- package/import.js +0 -26
package/index.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making
|
|
3
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
|
8
|
+
*
|
|
9
|
+
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
|
10
|
+
*
|
|
11
|
+
* ---------------------------------------------------
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
13
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
14
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
15
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
18
|
+
* the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
21
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
23
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
24
|
+
* IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
1
26
|
module.exports = {
|
|
2
|
-
extends: ['
|
|
27
|
+
extends: ['eslint-config-tencent'],
|
|
3
28
|
};
|
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueking/eslint-config-bk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-beta.03",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@babel/eslint-parser": "^7.14.3",
|
|
7
|
-
"@typescript-eslint/eslint-plugin": "~
|
|
8
|
-
"@typescript-eslint/parser": "~
|
|
7
|
+
"@typescript-eslint/eslint-plugin": "~5.20.0",
|
|
8
|
+
"@typescript-eslint/parser": "~5.20.0",
|
|
9
9
|
"@vue/eslint-config-standard": "~6.1.0",
|
|
10
|
-
"@vue/eslint-config-typescript": "~
|
|
11
|
-
"eslint": "^
|
|
10
|
+
"@vue/eslint-config-typescript": "~10.0.0",
|
|
11
|
+
"eslint": "^8.14.0",
|
|
12
|
+
"eslint-config-tencent": "^1.0.4",
|
|
12
13
|
"eslint-plugin-import": "^2.23.3",
|
|
13
14
|
"eslint-plugin-node": "~11.1.0",
|
|
14
|
-
"eslint-plugin-promise": "~
|
|
15
|
-
"eslint-plugin-standard": "~
|
|
16
|
-
"eslint-plugin-vue": "^7.
|
|
17
|
-
"typescript": "~4.
|
|
15
|
+
"eslint-plugin-promise": "~6.0.0",
|
|
16
|
+
"eslint-plugin-standard": "~5.0.0",
|
|
17
|
+
"eslint-plugin-vue": "^8.7.1",
|
|
18
|
+
"typescript": "~4.6.3"
|
|
18
19
|
},
|
|
19
20
|
"keywords": [
|
|
20
21
|
"eslint-config-bk",
|
package/ts.js
CHANGED
|
@@ -1,337 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making
|
|
3
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
|
8
|
+
*
|
|
9
|
+
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
|
10
|
+
*
|
|
11
|
+
* ---------------------------------------------------
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
13
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
14
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
15
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
18
|
+
* the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
21
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
23
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
24
|
+
* IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
1
26
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
project: [
|
|
5
|
-
'./tsconfig.json',
|
|
6
|
-
],
|
|
7
|
-
},
|
|
8
|
-
plugins: ['@typescript-eslint'],
|
|
9
|
-
rules: {
|
|
10
|
-
'brace-style': 'off',
|
|
11
|
-
'no-empty-function': 'off',
|
|
12
|
-
// https://github.com/typescript-eslint/typescript-eslint/issues/491
|
|
13
|
-
'no-invalid-this': 'off',
|
|
14
|
-
'no-magic-numbers': 'off',
|
|
15
|
-
'react/sort-comp': 'off',
|
|
16
|
-
'func-call-spacing': 'off',
|
|
17
|
-
'comma-spacing': 'off',
|
|
18
|
-
'dot-notation': 'off',
|
|
19
|
-
indent: 'off',
|
|
20
|
-
'keyword-spacing': 'off',
|
|
21
|
-
camelcase: 'off',
|
|
22
|
-
'no-underscore-dangle': 'off',
|
|
23
|
-
'no-array-constructor': 'off',
|
|
24
|
-
'no-dupe-class-members': 'off',
|
|
25
|
-
'no-undef': 'off',
|
|
26
|
-
'no-unused-vars': 'off',
|
|
27
|
-
'no-useless-constructor': 'off',
|
|
28
|
-
quotes: 'off',
|
|
29
|
-
semi: 'off',
|
|
30
|
-
'space-before-function-paren': 'off',
|
|
31
|
-
/**
|
|
32
|
-
* 重载的函数必须写在一起
|
|
33
|
-
* @reason 增加可读性
|
|
34
|
-
*/
|
|
35
|
-
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
36
|
-
/** 同 JS 规则的 TS 版本 */
|
|
37
|
-
'@typescript-eslint/brace-style': 'error',
|
|
38
|
-
/**
|
|
39
|
-
* 类的只读属性若是一个字面量,则必须使用只读属性而不是 getter
|
|
40
|
-
*/
|
|
41
|
-
'@typescript-eslint/class-literal-property-style': [
|
|
42
|
-
'error',
|
|
43
|
-
'fields',
|
|
44
|
-
],
|
|
45
|
-
/** 同 JS 规则的 TS 版本 */
|
|
46
|
-
'@typescript-eslint/comma-spacing': [
|
|
47
|
-
'error',
|
|
48
|
-
{
|
|
49
|
-
before: false,
|
|
50
|
-
after: true,
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
/**
|
|
54
|
-
* 类型断言必须使用 as Type,禁止使用 <Type>,禁止对对象字面量进行类型断言(断言成 any 是允许的)
|
|
55
|
-
* @reason <Type> 容易被理解为 jsx
|
|
56
|
-
*/
|
|
57
|
-
'@typescript-eslint/consistent-type-assertions': [
|
|
58
|
-
'error',
|
|
59
|
-
{
|
|
60
|
-
assertionStyle: 'as',
|
|
61
|
-
objectLiteralTypeAssertions: 'never',
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
/**
|
|
65
|
-
* 优先使用 interface 而不是 type
|
|
66
|
-
*/
|
|
67
|
-
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
68
|
-
/** 同 JS 规则的 TS 版本 */
|
|
69
|
-
'@typescript-eslint/dot-notation': 'warn',
|
|
70
|
-
/**
|
|
71
|
-
* 必须设置类的成员的可访问性
|
|
72
|
-
* @reason 将不需要公开的成员设为私有的,可以增强代码的可理解性,对文档输出也很友好
|
|
73
|
-
*/
|
|
74
|
-
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
75
|
-
/**
|
|
76
|
-
* 要求或禁止在函数标识符和其调用之间有空格
|
|
77
|
-
*/
|
|
78
|
-
'@typescript-eslint/func-call-spacing': [
|
|
79
|
-
'error',
|
|
80
|
-
'never',
|
|
81
|
-
],
|
|
82
|
-
/** 同 JS 规则的 TS 版本 */
|
|
83
|
-
'@typescript-eslint/indent': [
|
|
84
|
-
'warn',
|
|
85
|
-
2,
|
|
86
|
-
{
|
|
87
|
-
SwitchCase: 1,
|
|
88
|
-
VariableDeclarator: 1,
|
|
89
|
-
outerIIFEBody: 1,
|
|
90
|
-
FunctionDeclaration: {
|
|
91
|
-
parameters: 1,
|
|
92
|
-
body: 1,
|
|
93
|
-
},
|
|
94
|
-
FunctionExpression: {
|
|
95
|
-
parameters: 1,
|
|
96
|
-
body: 1,
|
|
97
|
-
},
|
|
98
|
-
CallExpression: {
|
|
99
|
-
arguments: 1,
|
|
100
|
-
},
|
|
101
|
-
ArrayExpression: 1,
|
|
102
|
-
ObjectExpression: 1,
|
|
103
|
-
ImportDeclaration: 1,
|
|
104
|
-
flatTernaryExpressions: false,
|
|
105
|
-
ignoredNodes: [
|
|
106
|
-
'JSXElement',
|
|
107
|
-
'JSXElement > *',
|
|
108
|
-
'JSXAttribute',
|
|
109
|
-
'JSXIdentifier',
|
|
110
|
-
'JSXNamespacedName',
|
|
111
|
-
'JSXMemberExpression',
|
|
112
|
-
'JSXSpreadAttribute',
|
|
113
|
-
'JSXExpressionContainer',
|
|
114
|
-
'JSXOpeningElement',
|
|
115
|
-
'JSXClosingElement',
|
|
116
|
-
'JSXFragment',
|
|
117
|
-
'JSXOpeningFragment',
|
|
118
|
-
'JSXClosingFragment',
|
|
119
|
-
'JSXText',
|
|
120
|
-
'JSXEmptyExpression',
|
|
121
|
-
'JSXSpreadChild',
|
|
122
|
-
],
|
|
123
|
-
ignoreComments: false,
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
/** 同 JS 规则的 TS 版本 */
|
|
127
|
-
'@typescript-eslint/keyword-spacing': [
|
|
128
|
-
'error',
|
|
129
|
-
{
|
|
130
|
-
overrides: {
|
|
131
|
-
if: {
|
|
132
|
-
after: true,
|
|
133
|
-
},
|
|
134
|
-
for: {
|
|
135
|
-
after: true,
|
|
136
|
-
},
|
|
137
|
-
while: {
|
|
138
|
-
after: true,
|
|
139
|
-
},
|
|
140
|
-
else: {
|
|
141
|
-
after: true,
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
before: true,
|
|
145
|
-
after: true,
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
/**
|
|
149
|
-
* 指定类成员的排序规则
|
|
150
|
-
* @reason 优先级:
|
|
151
|
-
* 1. static > instance
|
|
152
|
-
* 2. field > constructor > method
|
|
153
|
-
* 3. public > protected > private
|
|
154
|
-
*/
|
|
155
|
-
'@typescript-eslint/member-ordering': [
|
|
156
|
-
'error',
|
|
157
|
-
{
|
|
158
|
-
default: [
|
|
159
|
-
'public-static-field',
|
|
160
|
-
'protected-static-field',
|
|
161
|
-
'private-static-field',
|
|
162
|
-
'static-field',
|
|
163
|
-
'public-static-method',
|
|
164
|
-
'protected-static-method',
|
|
165
|
-
'private-static-method',
|
|
166
|
-
'static-method',
|
|
167
|
-
'public-instance-field',
|
|
168
|
-
'protected-instance-field',
|
|
169
|
-
'private-instance-field',
|
|
170
|
-
'public-field',
|
|
171
|
-
'protected-field',
|
|
172
|
-
'private-field',
|
|
173
|
-
'instance-field',
|
|
174
|
-
'field',
|
|
175
|
-
'constructor',
|
|
176
|
-
'public-instance-method',
|
|
177
|
-
'protected-instance-method',
|
|
178
|
-
'private-instance-method',
|
|
179
|
-
'public-method',
|
|
180
|
-
'protected-method',
|
|
181
|
-
'private-method',
|
|
182
|
-
'instance-method',
|
|
183
|
-
'method',
|
|
184
|
-
],
|
|
185
|
-
},
|
|
186
|
-
],
|
|
187
|
-
/**
|
|
188
|
-
* 接口中的方法必须用属性的方式定义
|
|
189
|
-
*/
|
|
190
|
-
'@typescript-eslint/method-signature-style': 'off',
|
|
191
|
-
/** 同 JS 规则的 TS 版本 */
|
|
192
|
-
'@typescript-eslint/no-array-constructor': 'error',
|
|
193
|
-
/** 同 JS 规则的 TS 版本 */
|
|
194
|
-
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
195
|
-
/**
|
|
196
|
-
* 禁止定义空的接口
|
|
197
|
-
*/
|
|
198
|
-
'@typescript-eslint/no-empty-interface': 'error',
|
|
199
|
-
/**
|
|
200
|
-
* 禁止给一个初始化时直接赋值为 number, string 的变量显式的声明类型
|
|
201
|
-
* @reason 可以简化代码
|
|
202
|
-
*/
|
|
203
|
-
'@typescript-eslint/no-inferrable-types': 'warn',
|
|
204
|
-
/**
|
|
205
|
-
* 禁止使用 namespace 来定义命名空间
|
|
206
|
-
* @reason 使用 es6 引入模块,才是更标准的方式。
|
|
207
|
-
* 但是允许使用 declare namespace ... {} 来定义外部命名空间
|
|
208
|
-
*/
|
|
209
|
-
'@typescript-eslint/no-namespace': [
|
|
210
|
-
'error',
|
|
211
|
-
{
|
|
212
|
-
allowDeclarations: true,
|
|
213
|
-
allowDefinitionFiles: true,
|
|
214
|
-
},
|
|
215
|
-
],
|
|
216
|
-
/**
|
|
217
|
-
* 禁止在 optional chaining 之后使用 non-null 断言(感叹号)
|
|
218
|
-
* @reason optional chaining 后面的属性一定是非空的
|
|
219
|
-
*/
|
|
220
|
-
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
221
|
-
/**
|
|
222
|
-
* 禁止给类的构造函数的参数添加修饰符
|
|
223
|
-
*/
|
|
224
|
-
'@typescript-eslint/no-parameter-properties': 'off',
|
|
225
|
-
/**
|
|
226
|
-
* 禁止使用 require
|
|
227
|
-
* @reason 统一使用 import 来引入模块,特殊情况使用单行注释允许 require 引入
|
|
228
|
-
*/
|
|
229
|
-
'@typescript-eslint/no-require-imports': 'error',
|
|
230
|
-
/**
|
|
231
|
-
* 禁止将 this 赋值给其他变量,除非是解构赋值
|
|
232
|
-
*/
|
|
233
|
-
'@typescript-eslint/no-this-alias': [
|
|
234
|
-
'error',
|
|
235
|
-
{
|
|
236
|
-
allowDestructuring: true,
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
/**
|
|
240
|
-
* 禁止无用的表达式
|
|
241
|
-
*/
|
|
242
|
-
'@typescript-eslint/no-unused-expressions': [
|
|
243
|
-
'error',
|
|
244
|
-
{
|
|
245
|
-
allowShortCircuit: true,
|
|
246
|
-
allowTernary: true,
|
|
247
|
-
allowTaggedTemplates: true,
|
|
248
|
-
},
|
|
249
|
-
],
|
|
250
|
-
/** 同 JS 规则的 TS 版本 */
|
|
251
|
-
'@typescript-eslint/no-unused-vars': [
|
|
252
|
-
'error',
|
|
253
|
-
{
|
|
254
|
-
args: 'after-used',
|
|
255
|
-
ignoreRestSiblings: true,
|
|
256
|
-
},
|
|
257
|
-
],
|
|
258
|
-
/**
|
|
259
|
-
* 禁止出现没必要的 constructor
|
|
260
|
-
*/
|
|
261
|
-
'@typescript-eslint/no-useless-constructor': 'warn',
|
|
262
|
-
/**
|
|
263
|
-
* 使用 for 循环遍历数组时,如果索引仅用于获取成员,则必须使用 for of 循环替代 for 循环
|
|
264
|
-
* @reason for of 循环更加易读
|
|
265
|
-
*/
|
|
266
|
-
'@typescript-eslint/prefer-for-of': 'warn',
|
|
267
|
-
/**
|
|
268
|
-
* 使用函数类型别名替代包含函数调用声明的接口
|
|
269
|
-
*/
|
|
270
|
-
'@typescript-eslint/prefer-function-type': 'warn',
|
|
271
|
-
/**
|
|
272
|
-
* 禁止使用 module 来定义命名空间
|
|
273
|
-
* @reason module 已成为 js 的关键字
|
|
274
|
-
*/
|
|
275
|
-
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
276
|
-
/**
|
|
277
|
-
* 使用 optional chaining 替代 &&
|
|
278
|
-
*/
|
|
279
|
-
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
280
|
-
/** 同 JS 规则的 TS 版本 */
|
|
281
|
-
'@typescript-eslint/quotes': [
|
|
282
|
-
'warn',
|
|
283
|
-
'single',
|
|
284
|
-
{
|
|
285
|
-
allowTemplateLiterals: false,
|
|
286
|
-
},
|
|
287
|
-
],
|
|
288
|
-
/** 同 JS 规则的 TS 版本 */
|
|
289
|
-
'@typescript-eslint/semi': [
|
|
290
|
-
'error',
|
|
291
|
-
'always',
|
|
292
|
-
],
|
|
293
|
-
/** 同 JS 规则的 TS 版本 */
|
|
294
|
-
'@typescript-eslint/space-before-function-paren': [
|
|
295
|
-
'error',
|
|
296
|
-
{
|
|
297
|
-
anonymous: 'always',
|
|
298
|
-
named: 'never',
|
|
299
|
-
asyncArrow: 'always',
|
|
300
|
-
},
|
|
301
|
-
],
|
|
302
|
-
/**
|
|
303
|
-
* 禁止使用三斜杠导入文件
|
|
304
|
-
* @reason 三斜杠是已废弃的语法,但在类型声明文件中还是可以使用的
|
|
305
|
-
*/
|
|
306
|
-
'@typescript-eslint/triple-slash-reference': [
|
|
307
|
-
'error',
|
|
308
|
-
{
|
|
309
|
-
path: 'never',
|
|
310
|
-
types: 'always',
|
|
311
|
-
lib: 'always',
|
|
312
|
-
},
|
|
313
|
-
],
|
|
314
|
-
/**
|
|
315
|
-
* 在类型注释周围需要一致的间距
|
|
316
|
-
*/
|
|
317
|
-
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
318
|
-
/**
|
|
319
|
-
* interface 和 type 定义时必须声明成员的类型
|
|
320
|
-
*/
|
|
321
|
-
'@typescript-eslint/typedef': [
|
|
322
|
-
'error',
|
|
323
|
-
{
|
|
324
|
-
arrayDestructuring: false,
|
|
325
|
-
arrowParameter: false,
|
|
326
|
-
memberVariableDeclaration: false,
|
|
327
|
-
objectDestructuring: false,
|
|
328
|
-
parameter: false,
|
|
329
|
-
propertyDeclaration: true,
|
|
330
|
-
variableDeclaration: false,
|
|
331
|
-
},
|
|
332
|
-
],
|
|
333
|
-
/**
|
|
334
|
-
* 函数重载时,若能通过联合类型将两个函数的类型声明合为一个,则使用联合类型而不是两个函数声明
|
|
335
|
-
*/
|
|
336
|
-
'@typescript-eslint/unified-signatures': 'error' },
|
|
337
|
-
};
|
|
27
|
+
extends: ['eslint-config-tencent', 'eslint-config-tencent/ts'],
|
|
28
|
+
}
|
package/tsvue.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making
|
|
3
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
|
8
|
+
*
|
|
9
|
+
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
|
10
|
+
*
|
|
11
|
+
* ---------------------------------------------------
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
13
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
14
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
15
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
18
|
+
* the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
21
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
23
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
24
|
+
* IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
1
26
|
const rules = require('./vue.rule');
|
|
2
27
|
|
|
3
28
|
module.exports = {
|
package/vue.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making
|
|
3
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
|
8
|
+
*
|
|
9
|
+
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
|
10
|
+
*
|
|
11
|
+
* ---------------------------------------------------
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
13
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
14
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
15
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
18
|
+
* the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
21
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
23
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
24
|
+
* IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
1
26
|
const rules = require('./vue.rule');
|
|
2
27
|
|
|
3
28
|
module.exports = {
|
package/vue.rule.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making
|
|
3
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
|
8
|
+
*
|
|
9
|
+
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
|
10
|
+
*
|
|
11
|
+
* ---------------------------------------------------
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
13
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
14
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
15
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
18
|
+
* the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
21
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
23
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
24
|
+
* IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
1
26
|
module.exports = {
|
|
2
27
|
// https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/array-bracket-spacing.md
|
|
3
28
|
'vue/array-bracket-spacing': ['error', 'never'],
|
package/base.js
DELETED
|
@@ -1,686 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@babel/eslint-parser',
|
|
3
|
-
parserOptions: {
|
|
4
|
-
ecmaVersion: 2019,
|
|
5
|
-
// ECMAScript modules 模式
|
|
6
|
-
sourceType: 'module',
|
|
7
|
-
ecmaFeatures: {
|
|
8
|
-
// 不允许 return 语句出现在 global 环境下
|
|
9
|
-
globalReturn: false,
|
|
10
|
-
// 开启全局 script 模式
|
|
11
|
-
impliedStrict: true,
|
|
12
|
-
jsx: true,
|
|
13
|
-
},
|
|
14
|
-
// 即使没有 babelrc 配置文件,也使用 babel-eslint 来解析
|
|
15
|
-
requireConfigFile: false,
|
|
16
|
-
// 仅允许 import export 语句出现在模块的顶层
|
|
17
|
-
allowImportExportEverywhere: false,
|
|
18
|
-
},
|
|
19
|
-
env: {
|
|
20
|
-
browser: true,
|
|
21
|
-
node: true,
|
|
22
|
-
commonjs: true,
|
|
23
|
-
es6: true,
|
|
24
|
-
},
|
|
25
|
-
// 以当前目录为根目录,不再向上查找 .eslintrc.js
|
|
26
|
-
root: true,
|
|
27
|
-
rules: {
|
|
28
|
-
/**
|
|
29
|
-
* 不要在中括号中添加空格
|
|
30
|
-
*/
|
|
31
|
-
'array-bracket-spacing': [
|
|
32
|
-
'error',
|
|
33
|
-
'never',
|
|
34
|
-
],
|
|
35
|
-
/**
|
|
36
|
-
* 数组的方法除了 forEach 之外,回调函数必须有返回值
|
|
37
|
-
*/
|
|
38
|
-
'array-callback-return': 'warn',
|
|
39
|
-
/**
|
|
40
|
-
* 要求箭头函数体使用大括号
|
|
41
|
-
*/
|
|
42
|
-
'arrow-body-style': [
|
|
43
|
-
'warn',
|
|
44
|
-
'as-needed',
|
|
45
|
-
],
|
|
46
|
-
/**
|
|
47
|
-
* 要求箭头函数的参数使用圆括号
|
|
48
|
-
*/
|
|
49
|
-
'arrow-parens': [
|
|
50
|
-
'warn',
|
|
51
|
-
'as-needed',
|
|
52
|
-
{
|
|
53
|
-
requireForBlockBody: true,
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
/**
|
|
57
|
-
* 强制箭头函数的箭头前后使用一致的空格
|
|
58
|
-
*/
|
|
59
|
-
'arrow-spacing': 'warn',
|
|
60
|
-
/**
|
|
61
|
-
* 要求打开的块标志和同一行上的标志拥有一致的间距。此规则还会在同一行关闭的块标记和前边的标记强制实施一致的间距。
|
|
62
|
-
*/
|
|
63
|
-
'block-spacing': 'error',
|
|
64
|
-
/**
|
|
65
|
-
* 强制在代码块中使用一致的大括号风格
|
|
66
|
-
*/
|
|
67
|
-
'brace-style': 'error',
|
|
68
|
-
/**
|
|
69
|
-
* 使用驼峰命名法(camelCase)命名对象、函数和实例。
|
|
70
|
-
*/
|
|
71
|
-
camelcase: [
|
|
72
|
-
'error',
|
|
73
|
-
{
|
|
74
|
-
ignoreDestructuring: true,
|
|
75
|
-
properties: 'never',
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
/**
|
|
79
|
-
* 添加尾随逗号
|
|
80
|
-
*/
|
|
81
|
-
'comma-dangle': [
|
|
82
|
-
'warn',
|
|
83
|
-
'always-multiline',
|
|
84
|
-
],
|
|
85
|
-
/**
|
|
86
|
-
* 强制在逗号前后使用一致的空格
|
|
87
|
-
*/
|
|
88
|
-
'comma-spacing': [
|
|
89
|
-
'error',
|
|
90
|
-
{
|
|
91
|
-
before: false,
|
|
92
|
-
after: true,
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
/**
|
|
96
|
-
* 强制使用一致的逗号风格
|
|
97
|
-
*/
|
|
98
|
-
'comma-style': [
|
|
99
|
-
'error',
|
|
100
|
-
'last',
|
|
101
|
-
],
|
|
102
|
-
/**
|
|
103
|
-
* 强制在计算的属性的方括号中使用一致的空格
|
|
104
|
-
*/
|
|
105
|
-
'computed-property-spacing': [
|
|
106
|
-
'warn',
|
|
107
|
-
'never',
|
|
108
|
-
],
|
|
109
|
-
/**
|
|
110
|
-
* 禁止使用 foo['bar'],必须写成 foo.bar
|
|
111
|
-
*/
|
|
112
|
-
'dot-notation': 'warn',
|
|
113
|
-
/**
|
|
114
|
-
* 要求或禁止文件末尾存在空行
|
|
115
|
-
*/
|
|
116
|
-
'eol-last': [
|
|
117
|
-
'error',
|
|
118
|
-
'always',
|
|
119
|
-
],
|
|
120
|
-
/**
|
|
121
|
-
* 必须使用 === 或 !==,禁止使用 == 或 !=
|
|
122
|
-
*/
|
|
123
|
-
eqeqeq: [
|
|
124
|
-
'warn',
|
|
125
|
-
'always',
|
|
126
|
-
],
|
|
127
|
-
/**
|
|
128
|
-
* 要求或禁止在函数标识符和其调用之间有空格
|
|
129
|
-
*/
|
|
130
|
-
'func-call-spacing': [
|
|
131
|
-
'error',
|
|
132
|
-
'never',
|
|
133
|
-
],
|
|
134
|
-
/**
|
|
135
|
-
* 必须只使用函数声明或只使用函数表达式
|
|
136
|
-
*/
|
|
137
|
-
'func-style': [
|
|
138
|
-
'off',
|
|
139
|
-
'expression',
|
|
140
|
-
],
|
|
141
|
-
/**
|
|
142
|
-
* 强制在函数括号内使用一致的换行
|
|
143
|
-
*/
|
|
144
|
-
'function-paren-newline': [
|
|
145
|
-
'warn',
|
|
146
|
-
'multiline',
|
|
147
|
-
],
|
|
148
|
-
/**
|
|
149
|
-
* 强制 generator 函数中 * 号周围使用一致的空格
|
|
150
|
-
*/
|
|
151
|
-
'generator-star-spacing': [
|
|
152
|
-
'warn',
|
|
153
|
-
{
|
|
154
|
-
before: false,
|
|
155
|
-
after: true,
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
/**
|
|
159
|
-
* 限制变量名长度
|
|
160
|
-
*/
|
|
161
|
-
'id-length': 'off',
|
|
162
|
-
/**
|
|
163
|
-
* 强制隐式返回的箭头函数体的位置
|
|
164
|
-
*/
|
|
165
|
-
'implicit-arrow-linebreak': [
|
|
166
|
-
'warn',
|
|
167
|
-
'beside',
|
|
168
|
-
],
|
|
169
|
-
/**
|
|
170
|
-
* 使用 2 个空格缩进
|
|
171
|
-
*/
|
|
172
|
-
indent: [
|
|
173
|
-
'warn',
|
|
174
|
-
2,
|
|
175
|
-
{
|
|
176
|
-
SwitchCase: 1,
|
|
177
|
-
VariableDeclarator: 1,
|
|
178
|
-
outerIIFEBody: 1,
|
|
179
|
-
FunctionDeclaration: {
|
|
180
|
-
parameters: 1,
|
|
181
|
-
body: 1,
|
|
182
|
-
},
|
|
183
|
-
FunctionExpression: {
|
|
184
|
-
parameters: 1,
|
|
185
|
-
body: 1,
|
|
186
|
-
},
|
|
187
|
-
CallExpression: {
|
|
188
|
-
arguments: 1,
|
|
189
|
-
},
|
|
190
|
-
ArrayExpression: 1,
|
|
191
|
-
ObjectExpression: 1,
|
|
192
|
-
ImportDeclaration: 1,
|
|
193
|
-
flatTernaryExpressions: false,
|
|
194
|
-
ignoredNodes: [
|
|
195
|
-
'JSXElement',
|
|
196
|
-
'JSXElement > *',
|
|
197
|
-
'JSXAttribute',
|
|
198
|
-
'JSXIdentifier',
|
|
199
|
-
'JSXNamespacedName',
|
|
200
|
-
'JSXMemberExpression',
|
|
201
|
-
'JSXSpreadAttribute',
|
|
202
|
-
'JSXExpressionContainer',
|
|
203
|
-
'JSXOpeningElement',
|
|
204
|
-
'JSXClosingElement',
|
|
205
|
-
'JSXFragment',
|
|
206
|
-
'JSXOpeningFragment',
|
|
207
|
-
'JSXClosingFragment',
|
|
208
|
-
'JSXText',
|
|
209
|
-
'JSXEmptyExpression',
|
|
210
|
-
'JSXSpreadChild',
|
|
211
|
-
],
|
|
212
|
-
ignoreComments: false,
|
|
213
|
-
},
|
|
214
|
-
],
|
|
215
|
-
/**
|
|
216
|
-
* 强制在对象字面量的属性中键和值之间使用一致的间距
|
|
217
|
-
*/
|
|
218
|
-
'key-spacing': 'error',
|
|
219
|
-
/**
|
|
220
|
-
* 强制在关键字前后使用一致的空格
|
|
221
|
-
*/
|
|
222
|
-
'keyword-spacing': [
|
|
223
|
-
'error',
|
|
224
|
-
{
|
|
225
|
-
overrides: {
|
|
226
|
-
if: {
|
|
227
|
-
after: true,
|
|
228
|
-
},
|
|
229
|
-
for: {
|
|
230
|
-
after: true,
|
|
231
|
-
},
|
|
232
|
-
while: {
|
|
233
|
-
after: true,
|
|
234
|
-
},
|
|
235
|
-
else: {
|
|
236
|
-
after: true,
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
],
|
|
241
|
-
/**
|
|
242
|
-
* 只允许使用 unix 的 LF 作为换行符,Windows 的 CRLF 不可以使用
|
|
243
|
-
*/
|
|
244
|
-
'linebreak-style': [
|
|
245
|
-
'warn',
|
|
246
|
-
'unix',
|
|
247
|
-
],
|
|
248
|
-
/**
|
|
249
|
-
* 强制一行的最大长度,限制单行不能超过100个字符,字符串和正则表达式除外。
|
|
250
|
-
*/
|
|
251
|
-
'max-len': [
|
|
252
|
-
'error',
|
|
253
|
-
{
|
|
254
|
-
code: 120,
|
|
255
|
-
ignoreStrings: true,
|
|
256
|
-
ignoreUrls: true,
|
|
257
|
-
ignoreRegExpLiterals: true,
|
|
258
|
-
ignoreTemplateLiterals: true,
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
/**
|
|
262
|
-
* 只有在命名构造器或者类的时候,才用帕斯卡拼命名法(PascalCase),即首字母大写。
|
|
263
|
-
*/
|
|
264
|
-
'new-cap': [
|
|
265
|
-
'error',
|
|
266
|
-
{
|
|
267
|
-
newIsCap: true,
|
|
268
|
-
newIsCapExceptions: [],
|
|
269
|
-
capIsNew: false,
|
|
270
|
-
capIsNewExceptions: [
|
|
271
|
-
'Immutable.Map',
|
|
272
|
-
'Immutable.Set',
|
|
273
|
-
'Immutable.List',
|
|
274
|
-
],
|
|
275
|
-
properties: false,
|
|
276
|
-
},
|
|
277
|
-
],
|
|
278
|
-
/**
|
|
279
|
-
* 在编写多个方法链式调用(超过两个方法链式调用)时。 使用前导点,强调这行是一个方法调用,而不是一个语句。
|
|
280
|
-
*/
|
|
281
|
-
'newline-per-chained-call': [
|
|
282
|
-
'warn',
|
|
283
|
-
{
|
|
284
|
-
ignoreChainWithDepth: 2,
|
|
285
|
-
},
|
|
286
|
-
],
|
|
287
|
-
/**
|
|
288
|
-
* 使用字面量语法创建数组。
|
|
289
|
-
*/
|
|
290
|
-
'no-array-constructor': [
|
|
291
|
-
'error',
|
|
292
|
-
],
|
|
293
|
-
/**
|
|
294
|
-
* 在 case 和 default 的子句中,如果存在声明 (例如. let, const, function, 和 class),使用大括号来创建块级作用域。
|
|
295
|
-
*/
|
|
296
|
-
'no-case-declarations': 'error',
|
|
297
|
-
/**
|
|
298
|
-
* 避免搞混箭头函数符号 (=>) 和比较运算符 (<=, >=)。
|
|
299
|
-
*/
|
|
300
|
-
'no-confusing-arrow': 'warn',
|
|
301
|
-
/**
|
|
302
|
-
* 禁止对使用 const 定义的常量重新赋值
|
|
303
|
-
*/
|
|
304
|
-
'no-const-assign': 'error',
|
|
305
|
-
/**
|
|
306
|
-
* 禁止重复定义类的成员
|
|
307
|
-
*/
|
|
308
|
-
'no-dupe-class-members': 'error',
|
|
309
|
-
/**
|
|
310
|
-
* 禁止在 else 内使用 return,必须改为提前结束
|
|
311
|
-
*/
|
|
312
|
-
'no-else-return': [
|
|
313
|
-
'warn',
|
|
314
|
-
{
|
|
315
|
-
allowElseIf: false,
|
|
316
|
-
},
|
|
317
|
-
],
|
|
318
|
-
/**
|
|
319
|
-
* 禁止使用 eval
|
|
320
|
-
*/
|
|
321
|
-
'no-eval': 'error',
|
|
322
|
-
/**
|
|
323
|
-
* 不要使用迭代器。
|
|
324
|
-
* @reason 推荐使用 JavaScript 的高阶函数代替 for-in。
|
|
325
|
-
*/
|
|
326
|
-
'no-iterator': 'warn',
|
|
327
|
-
/**
|
|
328
|
-
* 禁止在循环内的函数内部出现循环体条件语句中定义的变量
|
|
329
|
-
*/
|
|
330
|
-
'no-loop-func': 'error',
|
|
331
|
-
/**
|
|
332
|
-
* 禁止混合使用不同的操作符:
|
|
333
|
-
* - 禁止 `%`, `**` 之间混用
|
|
334
|
-
* - 禁止 `%` 与其它运算符之间混用
|
|
335
|
-
* - 禁止乘除运算符之间混用
|
|
336
|
-
* - 禁止位运算符之间的任何混用
|
|
337
|
-
* - 禁止比较运算符之间混用
|
|
338
|
-
* - 禁止 `&&`, `||` 之间混用
|
|
339
|
-
*/
|
|
340
|
-
'no-mixed-operators': [
|
|
341
|
-
'error',
|
|
342
|
-
{
|
|
343
|
-
groups: [
|
|
344
|
-
[
|
|
345
|
-
'%',
|
|
346
|
-
'**',
|
|
347
|
-
],
|
|
348
|
-
[
|
|
349
|
-
'%',
|
|
350
|
-
'+',
|
|
351
|
-
],
|
|
352
|
-
[
|
|
353
|
-
'%',
|
|
354
|
-
'-',
|
|
355
|
-
],
|
|
356
|
-
[
|
|
357
|
-
'%',
|
|
358
|
-
'*',
|
|
359
|
-
],
|
|
360
|
-
[
|
|
361
|
-
'%',
|
|
362
|
-
'/',
|
|
363
|
-
],
|
|
364
|
-
[
|
|
365
|
-
'&',
|
|
366
|
-
'|',
|
|
367
|
-
'<<',
|
|
368
|
-
'>>',
|
|
369
|
-
'>>>',
|
|
370
|
-
],
|
|
371
|
-
[
|
|
372
|
-
'==',
|
|
373
|
-
'!=',
|
|
374
|
-
'===',
|
|
375
|
-
'!==',
|
|
376
|
-
],
|
|
377
|
-
[
|
|
378
|
-
'&&',
|
|
379
|
-
'||',
|
|
380
|
-
],
|
|
381
|
-
],
|
|
382
|
-
allowSamePrecedence: false,
|
|
383
|
-
},
|
|
384
|
-
],
|
|
385
|
-
/**
|
|
386
|
-
* 禁止连续赋值,比如 foo = bar = 1
|
|
387
|
-
*/
|
|
388
|
-
'no-multi-assign': 'error',
|
|
389
|
-
/**
|
|
390
|
-
* 不要使用多个空行填充代码。
|
|
391
|
-
*/
|
|
392
|
-
'no-multiple-empty-lines': 'error',
|
|
393
|
-
/**
|
|
394
|
-
* 禁止使用嵌套的三元表达式,比如 a ? b : c ? d : e
|
|
395
|
-
*/
|
|
396
|
-
'no-nested-ternary': 'warn',
|
|
397
|
-
/**
|
|
398
|
-
* 禁止使用 new Function
|
|
399
|
-
* @reason 这和 eval 是等价的
|
|
400
|
-
*/
|
|
401
|
-
'no-new-func': 'error',
|
|
402
|
-
/**
|
|
403
|
-
* 禁止直接 new Object
|
|
404
|
-
*/
|
|
405
|
-
'no-new-object': 'error',
|
|
406
|
-
/**
|
|
407
|
-
* 禁止使用 new 来生成 String, Number 或 Boolean
|
|
408
|
-
*/
|
|
409
|
-
'no-new-wrappers': 'warn',
|
|
410
|
-
/**
|
|
411
|
-
* 禁止对函数的参数重新赋值
|
|
412
|
-
*/
|
|
413
|
-
'no-param-reassign': [
|
|
414
|
-
'warn',
|
|
415
|
-
{
|
|
416
|
-
props: true,
|
|
417
|
-
ignorePropertyModificationsFor: [
|
|
418
|
-
'acc',
|
|
419
|
-
'accumulator',
|
|
420
|
-
'e',
|
|
421
|
-
'ctx',
|
|
422
|
-
'req',
|
|
423
|
-
'request',
|
|
424
|
-
'res',
|
|
425
|
-
'response',
|
|
426
|
-
'$scope',
|
|
427
|
-
'staticContext',
|
|
428
|
-
'state',
|
|
429
|
-
],
|
|
430
|
-
},
|
|
431
|
-
],
|
|
432
|
-
/**
|
|
433
|
-
* 禁止使用 ++ 或 --
|
|
434
|
-
*/
|
|
435
|
-
'no-plusplus': [
|
|
436
|
-
'error',
|
|
437
|
-
{
|
|
438
|
-
allowForLoopAfterthoughts: true,
|
|
439
|
-
},
|
|
440
|
-
],
|
|
441
|
-
/**
|
|
442
|
-
* 禁止使用 hasOwnProperty, isPrototypeOf 或 propertyIsEnumerable
|
|
443
|
-
*/
|
|
444
|
-
'no-prototype-builtins': 'error',
|
|
445
|
-
/**
|
|
446
|
-
* 计算指数时,可以使用 ** 运算符。
|
|
447
|
-
*/
|
|
448
|
-
'no-restricted-properties': [
|
|
449
|
-
'warn',
|
|
450
|
-
{
|
|
451
|
-
object: 'Math',
|
|
452
|
-
property: 'pow',
|
|
453
|
-
message: 'Please use ** instand',
|
|
454
|
-
},
|
|
455
|
-
],
|
|
456
|
-
/**
|
|
457
|
-
* 推荐使用 JavaScript 的高阶函数代替 for-in
|
|
458
|
-
*/
|
|
459
|
-
'no-restricted-syntax': [
|
|
460
|
-
'warn',
|
|
461
|
-
{
|
|
462
|
-
selector: 'ForInStatement',
|
|
463
|
-
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
selector: 'LabeledStatement',
|
|
467
|
-
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
selector: 'WithStatement',
|
|
471
|
-
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
|
472
|
-
},
|
|
473
|
-
],
|
|
474
|
-
/**
|
|
475
|
-
* 避免在行尾添加空格。
|
|
476
|
-
*/
|
|
477
|
-
'no-trailing-spaces': 'error',
|
|
478
|
-
/**
|
|
479
|
-
* 变量应先声明再使用,禁止引用任何未声明的变量,除非你明确知道引用的变量存在于当前作用域链上。
|
|
480
|
-
*/
|
|
481
|
-
'no-undef': [
|
|
482
|
-
'error',
|
|
483
|
-
],
|
|
484
|
-
/**
|
|
485
|
-
* 禁止变量名出现下划线
|
|
486
|
-
*/
|
|
487
|
-
'no-underscore-dangle': 'warn',
|
|
488
|
-
/**
|
|
489
|
-
* 必须使用 !a 替代 a ? false : true
|
|
490
|
-
*/
|
|
491
|
-
'no-unneeded-ternary': 'warn',
|
|
492
|
-
/**
|
|
493
|
-
* 已定义的变量必须使用
|
|
494
|
-
* 但不检查最后一个使用的参数之前的参数
|
|
495
|
-
* 也不检查 rest 属性的兄弟属性
|
|
496
|
-
*/
|
|
497
|
-
'no-unused-vars': [
|
|
498
|
-
'error',
|
|
499
|
-
{
|
|
500
|
-
args: 'after-used',
|
|
501
|
-
ignoreRestSiblings: true,
|
|
502
|
-
},
|
|
503
|
-
],
|
|
504
|
-
/**
|
|
505
|
-
* 禁止出现没必要的 constructor
|
|
506
|
-
*/
|
|
507
|
-
'no-useless-constructor': 'warn',
|
|
508
|
-
/**
|
|
509
|
-
* 禁止出现没必要的转义
|
|
510
|
-
*/
|
|
511
|
-
'no-useless-escape': 'error',
|
|
512
|
-
/**
|
|
513
|
-
* 禁止使用 var
|
|
514
|
-
*/
|
|
515
|
-
'no-var': 'error',
|
|
516
|
-
/**
|
|
517
|
-
* 禁止属性前有空白
|
|
518
|
-
*/
|
|
519
|
-
'no-whitespace-before-property': 'warn',
|
|
520
|
-
/**
|
|
521
|
-
* 强制单个语句的位置
|
|
522
|
-
*/
|
|
523
|
-
'nonblock-statement-body-position': [
|
|
524
|
-
'error',
|
|
525
|
-
'beside',
|
|
526
|
-
],
|
|
527
|
-
/**
|
|
528
|
-
* 强制在大括号中使用一致的空格
|
|
529
|
-
*/
|
|
530
|
-
'object-curly-spacing': [
|
|
531
|
-
'warn',
|
|
532
|
-
'always',
|
|
533
|
-
],
|
|
534
|
-
/**
|
|
535
|
-
* 将对象方法、属性简写,且间歇属性放在前面。
|
|
536
|
-
*/
|
|
537
|
-
'object-shorthand': 'warn',
|
|
538
|
-
/**
|
|
539
|
-
* 禁止变量申明时用逗号一次申明多个
|
|
540
|
-
*/
|
|
541
|
-
'one-var': [
|
|
542
|
-
'warn',
|
|
543
|
-
'never',
|
|
544
|
-
],
|
|
545
|
-
/**
|
|
546
|
-
* 避免在赋值语句 = 前后换行。如果你的代码单行长度超过了 max-len 定义的长度而不得不换行,那么使用括号包裹。
|
|
547
|
-
*/
|
|
548
|
-
'operator-linebreak': [
|
|
549
|
-
'error',
|
|
550
|
-
'before',
|
|
551
|
-
{
|
|
552
|
-
overrides: {
|
|
553
|
-
'=': 'none',
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
],
|
|
557
|
-
/**
|
|
558
|
-
* 要求或禁止块内填充
|
|
559
|
-
*/
|
|
560
|
-
'padded-blocks': [
|
|
561
|
-
'error',
|
|
562
|
-
'never',
|
|
563
|
-
],
|
|
564
|
-
/**
|
|
565
|
-
* 要求回调函数使用箭头函数
|
|
566
|
-
*/
|
|
567
|
-
'prefer-arrow-callback': 'warn',
|
|
568
|
-
/**
|
|
569
|
-
* 申明后不再被修改的变量必须使用 const 来申明
|
|
570
|
-
*/
|
|
571
|
-
'prefer-const': [
|
|
572
|
-
'error',
|
|
573
|
-
{
|
|
574
|
-
destructuring: 'any',
|
|
575
|
-
ignoreReadBeforeAssign: false,
|
|
576
|
-
},
|
|
577
|
-
],
|
|
578
|
-
/**
|
|
579
|
-
* 优先使用解构赋值
|
|
580
|
-
*/
|
|
581
|
-
'prefer-destructuring': [
|
|
582
|
-
'warn',
|
|
583
|
-
{
|
|
584
|
-
VariableDeclarator: {
|
|
585
|
-
array: false,
|
|
586
|
-
object: true,
|
|
587
|
-
},
|
|
588
|
-
AssignmentExpression: {
|
|
589
|
-
array: true,
|
|
590
|
-
object: false,
|
|
591
|
-
},
|
|
592
|
-
},
|
|
593
|
-
{
|
|
594
|
-
enforceForRenamedProperties: false,
|
|
595
|
-
},
|
|
596
|
-
],
|
|
597
|
-
/**
|
|
598
|
-
* 必须使用 ...args 而不是 arguments
|
|
599
|
-
*/
|
|
600
|
-
'prefer-rest-params': 'warn',
|
|
601
|
-
/**
|
|
602
|
-
* 必须使用 ... 而不是 apply,比如 foo(...args)
|
|
603
|
-
*/
|
|
604
|
-
'prefer-spread': 'warn',
|
|
605
|
-
/**
|
|
606
|
-
* 必须使用模版字符串而不是字符串连接
|
|
607
|
-
*/
|
|
608
|
-
'prefer-template': 'error',
|
|
609
|
-
/**
|
|
610
|
-
* 要求对象字面量属性名称用引号括起来
|
|
611
|
-
*/
|
|
612
|
-
'quote-props': [
|
|
613
|
-
'error',
|
|
614
|
-
'as-needed',
|
|
615
|
-
{
|
|
616
|
-
keywords: false,
|
|
617
|
-
},
|
|
618
|
-
],
|
|
619
|
-
/**
|
|
620
|
-
* 使用单引号 '' 定义字符串
|
|
621
|
-
*/
|
|
622
|
-
quotes: [
|
|
623
|
-
'warn',
|
|
624
|
-
'single',
|
|
625
|
-
{
|
|
626
|
-
allowTemplateLiterals: false,
|
|
627
|
-
},
|
|
628
|
-
],
|
|
629
|
-
/**
|
|
630
|
-
* parseInt 必须传入第二个参数
|
|
631
|
-
*/
|
|
632
|
-
radix: 'warn',
|
|
633
|
-
/**
|
|
634
|
-
* 要加分号
|
|
635
|
-
*/
|
|
636
|
-
semi: [
|
|
637
|
-
'error',
|
|
638
|
-
'always',
|
|
639
|
-
],
|
|
640
|
-
/**
|
|
641
|
-
* 强制在块之前使用一致的空格
|
|
642
|
-
*/
|
|
643
|
-
'space-before-blocks': 'error',
|
|
644
|
-
/**
|
|
645
|
-
* 强制在 function 的左括号之前使用一致的空格
|
|
646
|
-
*/
|
|
647
|
-
'space-before-function-paren': [
|
|
648
|
-
'error',
|
|
649
|
-
{
|
|
650
|
-
anonymous: 'always',
|
|
651
|
-
named: 'never',
|
|
652
|
-
asyncArrow: 'always',
|
|
653
|
-
},
|
|
654
|
-
],
|
|
655
|
-
/**
|
|
656
|
-
* 强制在圆括号内使用一致的空格
|
|
657
|
-
*/
|
|
658
|
-
'space-in-parens': [
|
|
659
|
-
'error',
|
|
660
|
-
'never',
|
|
661
|
-
],
|
|
662
|
-
/**
|
|
663
|
-
* 要求操作符周围有空格
|
|
664
|
-
*/
|
|
665
|
-
'space-infix-ops': 'error',
|
|
666
|
-
/**
|
|
667
|
-
* 注释的斜线或 * 后必须有空格
|
|
668
|
-
*/
|
|
669
|
-
'spaced-comment': [
|
|
670
|
-
'error',
|
|
671
|
-
'always',
|
|
672
|
-
],
|
|
673
|
-
/**
|
|
674
|
-
* 要求或禁止模板字符串中的嵌入表达式周围空格的使用
|
|
675
|
-
*/
|
|
676
|
-
'template-curly-spacing': [
|
|
677
|
-
'error',
|
|
678
|
-
'never',
|
|
679
|
-
],
|
|
680
|
-
/**
|
|
681
|
-
* 要求立即执行的函数使用括号括起来
|
|
682
|
-
*/
|
|
683
|
-
'wrap-iife': [
|
|
684
|
-
'error',
|
|
685
|
-
'outside',
|
|
686
|
-
] } };
|
package/import.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports = {
|
|
3
|
-
plugins: ['import'],
|
|
4
|
-
rules: {
|
|
5
|
-
/**
|
|
6
|
-
* 导入语句前不允许有任何非导入语句
|
|
7
|
-
*/
|
|
8
|
-
'import/first': 'error',
|
|
9
|
-
/**
|
|
10
|
-
* 禁止重复导入模块
|
|
11
|
-
*/
|
|
12
|
-
'import/no-duplicates': 'error',
|
|
13
|
-
/**
|
|
14
|
-
* 禁止使用 let 导出
|
|
15
|
-
*/
|
|
16
|
-
'import/no-mutable-exports': 'warn',
|
|
17
|
-
/**
|
|
18
|
-
* 禁用导入的模块时使用 webpack 特有的语法(感叹号)
|
|
19
|
-
*/
|
|
20
|
-
'import/no-webpack-loader-syntax': 'warn',
|
|
21
|
-
/**
|
|
22
|
-
* 当只有一个导出时,必须使用 export default 来导出
|
|
23
|
-
*/
|
|
24
|
-
'import/prefer-default-export': 'off',
|
|
25
|
-
},
|
|
26
|
-
};
|