@huangjunsen/eslint-config 1.0.0 → 1.0.2
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/.editorconfig +17 -17
- package/.eslintignore +17 -17
- package/.eslintrc.js +5 -5
- package/CHANGELOG.md +7 -0
- package/README.md +0 -286
- package/__tests__/fixtures/es5.js +4 -4
- package/__tests__/fixtures/index.js +3 -3
- package/__tests__/fixtures/node.js +23 -23
- package/__tests__/fixtures/react-display-name.js +7 -7
- package/__tests__/fixtures/react.jsx +132 -132
- package/__tests__/fixtures/ts-import-a.ts +3 -3
- package/__tests__/fixtures/ts-import-b.ts +3 -3
- package/__tests__/fixtures/ts-node.ts +19 -19
- package/__tests__/fixtures/ts-react.tsx +27 -27
- package/__tests__/fixtures/ts-vue.vue +36 -36
- package/__tests__/fixtures/ts.ts +17 -17
- package/__tests__/fixtures/vue.vue +16 -16
- package/__tests__/validate-js-configs.test.js +259 -259
- package/es5.js +10 -10
- package/essential/es5.js +12 -12
- package/essential/index.js +12 -12
- package/essential/react.js +76 -76
- package/essential/rules/blacklist.js +48 -48
- package/essential/rules/es6-blacklist.js +62 -62
- package/essential/rules/set-style-to-warn.js +30 -30
- package/essential/rules/ts-blacklist.js +15 -15
- package/essential/typescript/index.js +7 -7
- package/essential/typescript/react.js +7 -7
- package/essential/typescript/vue.js +9 -9
- package/essential/vue.js +8 -8
- package/flat/index.js +32 -0
- package/flat/react.js +19 -0
- package/flat/typescript.js +15 -0
- package/flat/vue.js +12 -0
- package/index.js +23 -23
- package/jsx-a11y.js +5 -5
- package/node.js +6 -6
- package/package.json +28 -10
- package/react.js +11 -11
- package/rules/base/best-practices.js +284 -284
- package/rules/base/es6.js +168 -168
- package/rules/base/possible-errors.js +126 -126
- package/rules/base/strict.js +6 -6
- package/rules/base/style.js +445 -445
- package/rules/base/variables.js +48 -48
- package/rules/es5.js +11 -11
- package/rules/imports.js +167 -167
- package/rules/jsx-a11y.js +23 -23
- package/rules/node.js +11 -11
- package/rules/react.js +354 -354
- package/rules/vue.js +96 -96
- package/typescript/node.js +6 -6
- package/typescript/react.js +6 -6
- package/typescript/vue.js +10 -10
- package/vue.js +10 -10
- package/LICENSE +0 -21
package/rules/base/variables.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
// 预设的环境,使用这些环境中的全局变量不会被 no-undef 报错
|
|
3
|
-
// @link https://eslint.org/docs/user-guide/configuring#specifying-environments
|
|
4
|
-
env: {
|
|
5
|
-
browser: true,
|
|
6
|
-
es6: true,
|
|
7
|
-
jasmine: true,
|
|
8
|
-
jest: true,
|
|
9
|
-
jquery: true,
|
|
10
|
-
mocha: true,
|
|
11
|
-
node: true,
|
|
12
|
-
},
|
|
13
|
-
rules: {
|
|
14
|
-
// 强制或禁止在变量声明时进行赋值
|
|
15
|
-
'init-declarations': 'off',
|
|
16
|
-
|
|
17
|
-
// 禁止 delete 变量
|
|
18
|
-
'no-delete-var': 'error',
|
|
19
|
-
|
|
20
|
-
// 禁止标签与变量同名
|
|
21
|
-
'no-label-var': 'error',
|
|
22
|
-
|
|
23
|
-
// 禁用使用特定的全局变量
|
|
24
|
-
'no-restricted-globals': 'off',
|
|
25
|
-
|
|
26
|
-
// 禁止变量与外层作用域已存在的变量同名
|
|
27
|
-
// @unessential
|
|
28
|
-
'no-shadow': 'error',
|
|
29
|
-
|
|
30
|
-
// 禁止使用保留字命名变量
|
|
31
|
-
'no-shadow-restricted-names': 'error',
|
|
32
|
-
|
|
33
|
-
// 禁止使用未声明的变量
|
|
34
|
-
'no-undef': 'error',
|
|
35
|
-
|
|
36
|
-
// 不要将变量初始化成 undefined
|
|
37
|
-
'no-undef-init': 'error',
|
|
38
|
-
|
|
39
|
-
// 禁止使用 undefined
|
|
40
|
-
'no-undefined': 'off',
|
|
41
|
-
|
|
42
|
-
// 声明的变量必须被使用
|
|
43
|
-
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
|
|
44
|
-
|
|
45
|
-
// 不要在声明前就使用变量
|
|
46
|
-
'no-use-before-define': ['error', { functions: false, classes: false, variables: false }],
|
|
47
|
-
},
|
|
48
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
// 预设的环境,使用这些环境中的全局变量不会被 no-undef 报错
|
|
3
|
+
// @link https://eslint.org/docs/user-guide/configuring#specifying-environments
|
|
4
|
+
env: {
|
|
5
|
+
browser: true,
|
|
6
|
+
es6: true,
|
|
7
|
+
jasmine: true,
|
|
8
|
+
jest: true,
|
|
9
|
+
jquery: true,
|
|
10
|
+
mocha: true,
|
|
11
|
+
node: true,
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
// 强制或禁止在变量声明时进行赋值
|
|
15
|
+
'init-declarations': 'off',
|
|
16
|
+
|
|
17
|
+
// 禁止 delete 变量
|
|
18
|
+
'no-delete-var': 'error',
|
|
19
|
+
|
|
20
|
+
// 禁止标签与变量同名
|
|
21
|
+
'no-label-var': 'error',
|
|
22
|
+
|
|
23
|
+
// 禁用使用特定的全局变量
|
|
24
|
+
'no-restricted-globals': 'off',
|
|
25
|
+
|
|
26
|
+
// 禁止变量与外层作用域已存在的变量同名
|
|
27
|
+
// @unessential
|
|
28
|
+
'no-shadow': 'error',
|
|
29
|
+
|
|
30
|
+
// 禁止使用保留字命名变量
|
|
31
|
+
'no-shadow-restricted-names': 'error',
|
|
32
|
+
|
|
33
|
+
// 禁止使用未声明的变量
|
|
34
|
+
'no-undef': 'error',
|
|
35
|
+
|
|
36
|
+
// 不要将变量初始化成 undefined
|
|
37
|
+
'no-undef-init': 'error',
|
|
38
|
+
|
|
39
|
+
// 禁止使用 undefined
|
|
40
|
+
'no-undefined': 'off',
|
|
41
|
+
|
|
42
|
+
// 声明的变量必须被使用
|
|
43
|
+
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
|
|
44
|
+
|
|
45
|
+
// 不要在声明前就使用变量
|
|
46
|
+
'no-use-before-define': ['error', { functions: false, classes: false, variables: false }],
|
|
47
|
+
},
|
|
48
|
+
};
|
package/rules/es5.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 本文件用于覆盖掉个别 ES5 与 ES6 不同的规则
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
rules: {
|
|
7
|
-
// 逗号风格 - ES5 中不加最后一个逗号
|
|
8
|
-
// @unessential
|
|
9
|
-
'comma-dangle': ['error', 'never'],
|
|
10
|
-
},
|
|
11
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* 本文件用于覆盖掉个别 ES5 与 ES6 不同的规则
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
rules: {
|
|
7
|
+
// 逗号风格 - ES5 中不加最后一个逗号
|
|
8
|
+
// @unessential
|
|
9
|
+
'comma-dangle': ['error', 'never'],
|
|
10
|
+
},
|
|
11
|
+
};
|
package/rules/imports.js
CHANGED
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 本文件的规则由 eslint-plugin-import 提供
|
|
3
|
-
* 与 eslint-plugin-import 推荐配置对齐
|
|
4
|
-
* @see https://github.com/import-js/eslint-plugin-import
|
|
5
|
-
* @see https://github.com/import-js/eslint-plugin-import/blob/main/config/recommended.js
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
plugins: [
|
|
10
|
-
'import',
|
|
11
|
-
],
|
|
12
|
-
settings: {
|
|
13
|
-
'import/ignore': [
|
|
14
|
-
'node_modules',
|
|
15
|
-
'\\.(coffee|scss|css|less|hbs|svg|json)$',
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
rules: {
|
|
19
|
-
/**
|
|
20
|
-
* Static analysis
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
// ensure imports point to files/modules that can be resolved
|
|
24
|
-
'import/no-unresolved': 'error',
|
|
25
|
-
|
|
26
|
-
// ensure named imports coupled with named exports
|
|
27
|
-
'import/named': 'error',
|
|
28
|
-
|
|
29
|
-
// ensure default import coupled with default export
|
|
30
|
-
'import/default': 'error',
|
|
31
|
-
|
|
32
|
-
// ensure imported namespaces contain dereferenced properties as they are dereferenced
|
|
33
|
-
'import/namespace': 'error',
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Helpful warnings
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
// disallow invalid exports, e.g. multiple defaults
|
|
40
|
-
'import/export': 'error',
|
|
41
|
-
|
|
42
|
-
// import 一个文件时,禁止 default import 的名字跟文件内的命名 export 相同
|
|
43
|
-
'import/no-named-as-default': 'error',
|
|
44
|
-
|
|
45
|
-
// 访问 default export 的属性时,如果该文件有与属性同名的命名 export,则给出警告
|
|
46
|
-
'import/no-named-as-default-member': 'warn',
|
|
47
|
-
|
|
48
|
-
// disallow use of jsdoc-marked-deprecated imports
|
|
49
|
-
'import/no-deprecated': 'off',
|
|
50
|
-
|
|
51
|
-
// Forbid the use of extraneous packages
|
|
52
|
-
'import/no-extraneous-dependencies': 'off',
|
|
53
|
-
|
|
54
|
-
// Forbid mutable exports
|
|
55
|
-
'import/no-mutable-exports': 'off',
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Module systems
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
// Report potentially ambiguous parse goal (script vs. module)
|
|
62
|
-
'import/unambiguous': 'off',
|
|
63
|
-
|
|
64
|
-
// disallow require()
|
|
65
|
-
'import/no-commonjs': 'off',
|
|
66
|
-
|
|
67
|
-
// disallow AMD require/define
|
|
68
|
-
'import/no-amd': 'warn',
|
|
69
|
-
|
|
70
|
-
// No Node.js builtin modules
|
|
71
|
-
'import/no-nodejs-modules': 'off',
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Style guide
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
// import 语句需要放到模块的最上方
|
|
78
|
-
// @unessential
|
|
79
|
-
'import/first': 'error',
|
|
80
|
-
|
|
81
|
-
// 不要用多个 import 引入同一模块
|
|
82
|
-
'import/no-duplicates': 'error',
|
|
83
|
-
|
|
84
|
-
// disallow namespace imports
|
|
85
|
-
'import/no-namespace': 'off',
|
|
86
|
-
|
|
87
|
-
// Ensure consistent use of file extension within the import path
|
|
88
|
-
'import/extensions': 'off',
|
|
89
|
-
|
|
90
|
-
// import 语句的排序
|
|
91
|
-
'import/order': ['off', {
|
|
92
|
-
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
93
|
-
'newlines-between': 'never',
|
|
94
|
-
}],
|
|
95
|
-
|
|
96
|
-
// 在最后一个 import / require 语句后保留一个空行
|
|
97
|
-
'import/newline-after-import': 'warn',
|
|
98
|
-
|
|
99
|
-
// 当模块内只有一个 export 时,使用 default export
|
|
100
|
-
'import/prefer-default-export': 'off',
|
|
101
|
-
|
|
102
|
-
// Restrict which files can be imported in a given folder
|
|
103
|
-
'import/no-restricted-paths': 'off',
|
|
104
|
-
|
|
105
|
-
// Forbid modules to have too many dependencies
|
|
106
|
-
'import/max-dependencies': ['off', { max: 10 }],
|
|
107
|
-
|
|
108
|
-
// Forbid import of modules using absolute paths
|
|
109
|
-
'import/no-absolute-path': 'off',
|
|
110
|
-
|
|
111
|
-
// Forbid require() calls with expressions
|
|
112
|
-
'import/no-dynamic-require': 'off',
|
|
113
|
-
|
|
114
|
-
// prevent importing the submodules of other modules
|
|
115
|
-
'import/no-internal-modules': ['off', {
|
|
116
|
-
allow: [],
|
|
117
|
-
}],
|
|
118
|
-
|
|
119
|
-
// Forbid Webpack loader syntax in imports
|
|
120
|
-
'import/no-webpack-loader-syntax': 'off',
|
|
121
|
-
|
|
122
|
-
// Prevent unassigned imports
|
|
123
|
-
// importing for side effects is perfectly acceptable, if you need side effects.
|
|
124
|
-
'import/no-unassigned-import': 'off',
|
|
125
|
-
|
|
126
|
-
// 禁止 import { default as foo } from './foo.js'
|
|
127
|
-
// 应写成 import foo from './foo.js'
|
|
128
|
-
'import/no-named-default': 'off',
|
|
129
|
-
|
|
130
|
-
// Reports if a module's default export is unnamed
|
|
131
|
-
'import/no-anonymous-default-export': ['off', {
|
|
132
|
-
allowArray: false,
|
|
133
|
-
allowArrowFunction: false,
|
|
134
|
-
allowAnonymousClass: false,
|
|
135
|
-
allowAnonymousFunction: false,
|
|
136
|
-
allowLiteral: false,
|
|
137
|
-
allowObject: false,
|
|
138
|
-
}],
|
|
139
|
-
|
|
140
|
-
// This rule enforces that all exports are declared at the bottom of the file.
|
|
141
|
-
'import/exports-last': 'off',
|
|
142
|
-
|
|
143
|
-
// Prefer named exports to be grouped together in a single export declaration
|
|
144
|
-
'import/group-exports': 'off',
|
|
145
|
-
|
|
146
|
-
// forbid default exports. this is a terrible rule, do not use it.
|
|
147
|
-
'import/no-default-export': 'off',
|
|
148
|
-
|
|
149
|
-
// 不要产生自引用
|
|
150
|
-
'import/no-self-import': 'error',
|
|
151
|
-
|
|
152
|
-
// 不要产生循环引用
|
|
153
|
-
'import/no-cycle': ['error', { maxDepth: Infinity }],
|
|
154
|
-
|
|
155
|
-
// Ensures that there are no useless path segments
|
|
156
|
-
'import/no-useless-path-segments': 'off',
|
|
157
|
-
|
|
158
|
-
// dynamic imports require a leading comment with a webpackChunkName
|
|
159
|
-
'import/dynamic-import-chunkname': ['off', {
|
|
160
|
-
importFunctions: [],
|
|
161
|
-
webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
|
|
162
|
-
}],
|
|
163
|
-
|
|
164
|
-
// Use this rule to prevent imports to folders in relative parent paths.
|
|
165
|
-
'import/no-relative-parent-imports': 'off',
|
|
166
|
-
},
|
|
167
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* 本文件的规则由 eslint-plugin-import 提供
|
|
3
|
+
* 与 eslint-plugin-import 推荐配置对齐
|
|
4
|
+
* @see https://github.com/import-js/eslint-plugin-import
|
|
5
|
+
* @see https://github.com/import-js/eslint-plugin-import/blob/main/config/recommended.js
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
plugins: [
|
|
10
|
+
'import',
|
|
11
|
+
],
|
|
12
|
+
settings: {
|
|
13
|
+
'import/ignore': [
|
|
14
|
+
'node_modules',
|
|
15
|
+
'\\.(coffee|scss|css|less|hbs|svg|json)$',
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
/**
|
|
20
|
+
* Static analysis
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// ensure imports point to files/modules that can be resolved
|
|
24
|
+
'import/no-unresolved': 'error',
|
|
25
|
+
|
|
26
|
+
// ensure named imports coupled with named exports
|
|
27
|
+
'import/named': 'error',
|
|
28
|
+
|
|
29
|
+
// ensure default import coupled with default export
|
|
30
|
+
'import/default': 'error',
|
|
31
|
+
|
|
32
|
+
// ensure imported namespaces contain dereferenced properties as they are dereferenced
|
|
33
|
+
'import/namespace': 'error',
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Helpful warnings
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// disallow invalid exports, e.g. multiple defaults
|
|
40
|
+
'import/export': 'error',
|
|
41
|
+
|
|
42
|
+
// import 一个文件时,禁止 default import 的名字跟文件内的命名 export 相同
|
|
43
|
+
'import/no-named-as-default': 'error',
|
|
44
|
+
|
|
45
|
+
// 访问 default export 的属性时,如果该文件有与属性同名的命名 export,则给出警告
|
|
46
|
+
'import/no-named-as-default-member': 'warn',
|
|
47
|
+
|
|
48
|
+
// disallow use of jsdoc-marked-deprecated imports
|
|
49
|
+
'import/no-deprecated': 'off',
|
|
50
|
+
|
|
51
|
+
// Forbid the use of extraneous packages
|
|
52
|
+
'import/no-extraneous-dependencies': 'off',
|
|
53
|
+
|
|
54
|
+
// Forbid mutable exports
|
|
55
|
+
'import/no-mutable-exports': 'off',
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Module systems
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
// Report potentially ambiguous parse goal (script vs. module)
|
|
62
|
+
'import/unambiguous': 'off',
|
|
63
|
+
|
|
64
|
+
// disallow require()
|
|
65
|
+
'import/no-commonjs': 'off',
|
|
66
|
+
|
|
67
|
+
// disallow AMD require/define
|
|
68
|
+
'import/no-amd': 'warn',
|
|
69
|
+
|
|
70
|
+
// No Node.js builtin modules
|
|
71
|
+
'import/no-nodejs-modules': 'off',
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Style guide
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
// import 语句需要放到模块的最上方
|
|
78
|
+
// @unessential
|
|
79
|
+
'import/first': 'error',
|
|
80
|
+
|
|
81
|
+
// 不要用多个 import 引入同一模块
|
|
82
|
+
'import/no-duplicates': 'error',
|
|
83
|
+
|
|
84
|
+
// disallow namespace imports
|
|
85
|
+
'import/no-namespace': 'off',
|
|
86
|
+
|
|
87
|
+
// Ensure consistent use of file extension within the import path
|
|
88
|
+
'import/extensions': 'off',
|
|
89
|
+
|
|
90
|
+
// import 语句的排序
|
|
91
|
+
'import/order': ['off', {
|
|
92
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
93
|
+
'newlines-between': 'never',
|
|
94
|
+
}],
|
|
95
|
+
|
|
96
|
+
// 在最后一个 import / require 语句后保留一个空行
|
|
97
|
+
'import/newline-after-import': 'warn',
|
|
98
|
+
|
|
99
|
+
// 当模块内只有一个 export 时,使用 default export
|
|
100
|
+
'import/prefer-default-export': 'off',
|
|
101
|
+
|
|
102
|
+
// Restrict which files can be imported in a given folder
|
|
103
|
+
'import/no-restricted-paths': 'off',
|
|
104
|
+
|
|
105
|
+
// Forbid modules to have too many dependencies
|
|
106
|
+
'import/max-dependencies': ['off', { max: 10 }],
|
|
107
|
+
|
|
108
|
+
// Forbid import of modules using absolute paths
|
|
109
|
+
'import/no-absolute-path': 'off',
|
|
110
|
+
|
|
111
|
+
// Forbid require() calls with expressions
|
|
112
|
+
'import/no-dynamic-require': 'off',
|
|
113
|
+
|
|
114
|
+
// prevent importing the submodules of other modules
|
|
115
|
+
'import/no-internal-modules': ['off', {
|
|
116
|
+
allow: [],
|
|
117
|
+
}],
|
|
118
|
+
|
|
119
|
+
// Forbid Webpack loader syntax in imports
|
|
120
|
+
'import/no-webpack-loader-syntax': 'off',
|
|
121
|
+
|
|
122
|
+
// Prevent unassigned imports
|
|
123
|
+
// importing for side effects is perfectly acceptable, if you need side effects.
|
|
124
|
+
'import/no-unassigned-import': 'off',
|
|
125
|
+
|
|
126
|
+
// 禁止 import { default as foo } from './foo.js'
|
|
127
|
+
// 应写成 import foo from './foo.js'
|
|
128
|
+
'import/no-named-default': 'off',
|
|
129
|
+
|
|
130
|
+
// Reports if a module's default export is unnamed
|
|
131
|
+
'import/no-anonymous-default-export': ['off', {
|
|
132
|
+
allowArray: false,
|
|
133
|
+
allowArrowFunction: false,
|
|
134
|
+
allowAnonymousClass: false,
|
|
135
|
+
allowAnonymousFunction: false,
|
|
136
|
+
allowLiteral: false,
|
|
137
|
+
allowObject: false,
|
|
138
|
+
}],
|
|
139
|
+
|
|
140
|
+
// This rule enforces that all exports are declared at the bottom of the file.
|
|
141
|
+
'import/exports-last': 'off',
|
|
142
|
+
|
|
143
|
+
// Prefer named exports to be grouped together in a single export declaration
|
|
144
|
+
'import/group-exports': 'off',
|
|
145
|
+
|
|
146
|
+
// forbid default exports. this is a terrible rule, do not use it.
|
|
147
|
+
'import/no-default-export': 'off',
|
|
148
|
+
|
|
149
|
+
// 不要产生自引用
|
|
150
|
+
'import/no-self-import': 'error',
|
|
151
|
+
|
|
152
|
+
// 不要产生循环引用
|
|
153
|
+
'import/no-cycle': ['error', { maxDepth: Infinity }],
|
|
154
|
+
|
|
155
|
+
// Ensures that there are no useless path segments
|
|
156
|
+
'import/no-useless-path-segments': 'off',
|
|
157
|
+
|
|
158
|
+
// dynamic imports require a leading comment with a webpackChunkName
|
|
159
|
+
'import/dynamic-import-chunkname': ['off', {
|
|
160
|
+
importFunctions: [],
|
|
161
|
+
webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
|
|
162
|
+
}],
|
|
163
|
+
|
|
164
|
+
// Use this rule to prevent imports to folders in relative parent paths.
|
|
165
|
+
'import/no-relative-parent-imports': 'off',
|
|
166
|
+
},
|
|
167
|
+
};
|
package/rules/jsx-a11y.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 本文件的规则由 eslint-plugin-jsx-a11y 提供
|
|
3
|
-
* @link https://github.com/evcohen/eslint-plugin-jsx-a11y
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
plugins: ['jsx-a11y'],
|
|
8
|
-
rules: {
|
|
9
|
-
'jsx-a11y/alt-text': 'warn',
|
|
10
|
-
'jsx-a11y/img-redundant-alt': 'warn',
|
|
11
|
-
'jsx-a11y/anchor-has-content': 'warn',
|
|
12
|
-
'jsx-a11y/aria-props': 'warn',
|
|
13
|
-
'jsx-a11y/aria-proptypes': 'warn',
|
|
14
|
-
'jsx-a11y/aria-unsupported-elements': 'warn',
|
|
15
|
-
'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }], // ignoreNonDom 为 true 时不检查用户自定义元素
|
|
16
|
-
'jsx-a11y/role-has-required-aria-props': 'warn',
|
|
17
|
-
'jsx-a11y/role-supports-aria-props': 'warn',
|
|
18
|
-
'jsx-a11y/iframe-has-title': 'warn',
|
|
19
|
-
'jsx-a11y/no-access-key': 'warn',
|
|
20
|
-
'jsx-a11y/no-distracting-elements': 'warn',
|
|
21
|
-
'jsx-a11y/scope': 'warn',
|
|
22
|
-
},
|
|
23
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* 本文件的规则由 eslint-plugin-jsx-a11y 提供
|
|
3
|
+
* @link https://github.com/evcohen/eslint-plugin-jsx-a11y
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
plugins: ['jsx-a11y'],
|
|
8
|
+
rules: {
|
|
9
|
+
'jsx-a11y/alt-text': 'warn',
|
|
10
|
+
'jsx-a11y/img-redundant-alt': 'warn',
|
|
11
|
+
'jsx-a11y/anchor-has-content': 'warn',
|
|
12
|
+
'jsx-a11y/aria-props': 'warn',
|
|
13
|
+
'jsx-a11y/aria-proptypes': 'warn',
|
|
14
|
+
'jsx-a11y/aria-unsupported-elements': 'warn',
|
|
15
|
+
'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }], // ignoreNonDom 为 true 时不检查用户自定义元素
|
|
16
|
+
'jsx-a11y/role-has-required-aria-props': 'warn',
|
|
17
|
+
'jsx-a11y/role-supports-aria-props': 'warn',
|
|
18
|
+
'jsx-a11y/iframe-has-title': 'warn',
|
|
19
|
+
'jsx-a11y/no-access-key': 'warn',
|
|
20
|
+
'jsx-a11y/no-distracting-elements': 'warn',
|
|
21
|
+
'jsx-a11y/scope': 'warn',
|
|
22
|
+
},
|
|
23
|
+
};
|
package/rules/node.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 本文件继承了 egg-config-egg 的 node 规则,规则由 eslint-plugin-node 提供
|
|
3
|
-
* @link https://github.com/eggjs/eslint-config-egg/blob/master/lib/rules/node.js
|
|
4
|
-
* @link https://github.com/mysticatea/eslint-plugin-node
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
extends: [
|
|
9
|
-
'eslint-config-egg/lib/rules/node',
|
|
10
|
-
],
|
|
11
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* 本文件继承了 egg-config-egg 的 node 规则,规则由 eslint-plugin-node 提供
|
|
3
|
+
* @link https://github.com/eggjs/eslint-config-egg/blob/master/lib/rules/node.js
|
|
4
|
+
* @link https://github.com/mysticatea/eslint-plugin-node
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
extends: [
|
|
9
|
+
'eslint-config-egg/lib/rules/node',
|
|
10
|
+
],
|
|
11
|
+
};
|