@apdesign/code-style-react 1.2.2 → 1.2.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/eslint/.eslintrc.build.js +7 -0
- package/eslint/.eslintrc.js +7 -0
- package/package.json +1 -1
- package/scripts/runEslint.js +5 -1
@@ -27,6 +27,8 @@ module.exports = {
|
|
27
27
|
'import/first': 'off',
|
28
28
|
'import/extensions': 'off',
|
29
29
|
'import/prefer-default-export': 'off',
|
30
|
+
'import/newline-after-import': 'warn',
|
31
|
+
'react/jsx-curly-brace-presence': 'warn',
|
30
32
|
|
31
33
|
'jsx-a11y/click-events-have-key-events': 'off',
|
32
34
|
'jsx-a11y/no-static-element-interactions': 'off',
|
@@ -40,6 +42,8 @@ module.exports = {
|
|
40
42
|
'no-undef': 'off',
|
41
43
|
'no-plusplus': 'off',
|
42
44
|
|
45
|
+
'prefer-template': 'warn',
|
46
|
+
|
43
47
|
'react/function-component-definition': 'off',
|
44
48
|
'react-hooks/exhaustive-deps': 'off',
|
45
49
|
'react/prop-types': 'off',
|
@@ -50,6 +54,9 @@ module.exports = {
|
|
50
54
|
'react/jsx-props-no-spreading': 'off',
|
51
55
|
'react/self-closing-comp': 'off',
|
52
56
|
'react/jsx-no-useless-fragment': 'off',
|
57
|
+
'react/no-array-index-key': 'warn',
|
58
|
+
|
59
|
+
'spaced-comment': 'warn',
|
53
60
|
|
54
61
|
'@typescript-eslint/no-explicit-any': 'warn',
|
55
62
|
|
package/eslint/.eslintrc.js
CHANGED
@@ -27,6 +27,7 @@ module.exports = {
|
|
27
27
|
'import/first': 'off',
|
28
28
|
'import/extensions': 'off',
|
29
29
|
'import/prefer-default-export': 'off',
|
30
|
+
'import/newline-after-import': 'warn',
|
30
31
|
|
31
32
|
'jsx-a11y/click-events-have-key-events': 'off',
|
32
33
|
'jsx-a11y/no-static-element-interactions': 'off',
|
@@ -40,6 +41,8 @@ module.exports = {
|
|
40
41
|
'no-undef': 'off',
|
41
42
|
'no-plusplus': 'off',
|
42
43
|
|
44
|
+
'prefer-template': 'warn',
|
45
|
+
|
43
46
|
'react/function-component-definition': 'off',
|
44
47
|
'react-hooks/exhaustive-deps': 'off',
|
45
48
|
'react/prop-types': 'off',
|
@@ -50,6 +53,10 @@ module.exports = {
|
|
50
53
|
'react/jsx-props-no-spreading': 'off',
|
51
54
|
'react/self-closing-comp': 'off',
|
52
55
|
'react/jsx-no-useless-fragment': 'off',
|
56
|
+
'react/no-array-index-key': 'warn',
|
57
|
+
'react/jsx-curly-brace-presence': 'warn',
|
58
|
+
|
59
|
+
'spaced-comment': 'warn',
|
53
60
|
|
54
61
|
'@typescript-eslint/no-explicit-any': 'warn',
|
55
62
|
|
package/package.json
CHANGED
package/scripts/runEslint.js
CHANGED
@@ -170,8 +170,12 @@ async function runEslint(targetPathArg) {
|
|
170
170
|
console.log('🚀 开始执行 ESLint ...\n');
|
171
171
|
|
172
172
|
const results = await eslint.lintFiles(files);
|
173
|
+
const errorsOnly = results.map((result) => {
|
174
|
+
result.messages = result.messages.filter((message) => message.severity === 2); // 只保留错误
|
175
|
+
return result;
|
176
|
+
});
|
173
177
|
const formatter = await eslint.loadFormatter('stylish');
|
174
|
-
const resultText = formatter.format(
|
178
|
+
const resultText = formatter.format(errorsOnly);
|
175
179
|
console.log(resultText);
|
176
180
|
|
177
181
|
const hasError = results.some((r) => r.errorCount > 0);
|