@apdesign/code-style-react 1.2.9 → 1.3.0
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/.prettierrc.js +10 -10
- package/cli.js +15 -15
- package/eslint/.eslintrc.build.js +116 -116
- package/eslint/.eslintrc.js +114 -114
- package/husky/_/h +27 -27
- package/husky/_/pre-commit +1 -1
- package/husky/_/pre-push +1 -1
- package/husky/pre-commit +1 -1
- package/husky/pre-push +25 -25
- package/index.js +13 -13
- package/package.json +45 -45
- package/scripts/buildEslint.sh +59 -59
- package/scripts/buildStylelint.sh +49 -49
- package/scripts/initConfigs.js +98 -98
- package/scripts/initHusky.js +33 -33
- package/scripts/initScripts.js +36 -36
- package/scripts/runEslint.js +176 -176
- package/scripts/runStylelint.js +137 -137
- package/stylelint/.stylelintrc.js +39 -39
- package/stylelint/rules/color-must-use-variable.js +61 -61
package/.prettierrc.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
useTabs: false,
|
|
3
|
-
tabWidth: 2,
|
|
4
|
-
printWidth: 100,
|
|
5
|
-
singleQuote: true,
|
|
6
|
-
trailingComma: 'all',
|
|
7
|
-
bracketSpacing: true,
|
|
8
|
-
semi: true,
|
|
9
|
-
embeddedLanguageFormatting: 'auto',
|
|
10
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
useTabs: false,
|
|
3
|
+
tabWidth: 2,
|
|
4
|
+
printWidth: 100,
|
|
5
|
+
singleQuote: true,
|
|
6
|
+
trailingComma: 'all',
|
|
7
|
+
bracketSpacing: true,
|
|
8
|
+
semi: true,
|
|
9
|
+
embeddedLanguageFormatting: 'auto',
|
|
10
|
+
};
|
package/cli.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const main = require('./index');
|
|
4
|
-
|
|
5
|
-
const args = process.argv.slice(2);
|
|
6
|
-
const command = args[0];
|
|
7
|
-
|
|
8
|
-
if (command === 'init') {
|
|
9
|
-
main();
|
|
10
|
-
} else if (command === 'eslint') {
|
|
11
|
-
const runEslint = require('./scripts/runEslint');
|
|
12
|
-
runEslint(args.slice(1));
|
|
13
|
-
} else {
|
|
14
|
-
console.log(`Unknown command: "${command}"`);
|
|
15
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const main = require('./index');
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const command = args[0];
|
|
7
|
+
|
|
8
|
+
if (command === 'init') {
|
|
9
|
+
main();
|
|
10
|
+
} else if (command === 'eslint') {
|
|
11
|
+
const runEslint = require('./scripts/runEslint');
|
|
12
|
+
runEslint(args.slice(1));
|
|
13
|
+
} else {
|
|
14
|
+
console.log(`Unknown command: "${command}"`);
|
|
15
|
+
}
|
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
env: {
|
|
4
|
-
browser: true,
|
|
5
|
-
node: true,
|
|
6
|
-
es2021: true,
|
|
7
|
-
},
|
|
8
|
-
parser: '@typescript-eslint/parser',
|
|
9
|
-
extends: [
|
|
10
|
-
'airbnb',
|
|
11
|
-
'airbnb/hooks',
|
|
12
|
-
'plugin:@typescript-eslint/recommended',
|
|
13
|
-
'plugin:import/errors',
|
|
14
|
-
'plugin:import/warnings',
|
|
15
|
-
'prettier',
|
|
16
|
-
],
|
|
17
|
-
plugins: ['@typescript-eslint', 'import', 'jsx-a11y', 'react', 'react-hooks'],
|
|
18
|
-
rules: {
|
|
19
|
-
'arrow-body-style': 'off',
|
|
20
|
-
'array-callback-return': 'warn',
|
|
21
|
-
|
|
22
|
-
camelcase: 'off',
|
|
23
|
-
'class-methods-use-this': 'off',
|
|
24
|
-
'consistent-return': 'warn',
|
|
25
|
-
|
|
26
|
-
'dot-notation': 'warn',
|
|
27
|
-
'default-param-last': 'off',
|
|
28
|
-
|
|
29
|
-
'import/order': 'warn',
|
|
30
|
-
'import/first': 'off',
|
|
31
|
-
'import/extensions': 'off',
|
|
32
|
-
'import/prefer-default-export': 'off',
|
|
33
|
-
'import/newline-after-import': 'warn',
|
|
34
|
-
|
|
35
|
-
'jsx-a11y/anchor-is-valid': 'warn',
|
|
36
|
-
'jsx-a11y/click-events-have-key-events': 'off',
|
|
37
|
-
'jsx-a11y/no-static-element-interactions': 'off',
|
|
38
|
-
'jsx-a11y/no-noninteractive-element-interactions': 'off',
|
|
39
|
-
|
|
40
|
-
'linebreak-style': 'off',
|
|
41
|
-
'lines-between-class-members': 'warn',
|
|
42
|
-
|
|
43
|
-
'max-classes-per-file': 'off',
|
|
44
|
-
|
|
45
|
-
'no-undef': 'off',
|
|
46
|
-
'no-plusplus': 'off',
|
|
47
|
-
'no-nested-ternary': 'warn',
|
|
48
|
-
|
|
49
|
-
'prefer-template': 'warn',
|
|
50
|
-
'prefer-exponentiation-operator': 'off',
|
|
51
|
-
|
|
52
|
-
radix: 'off',
|
|
53
|
-
|
|
54
|
-
'react/function-component-definition': 'off',
|
|
55
|
-
'react-hooks/exhaustive-deps': 'off',
|
|
56
|
-
'react/prop-types': 'off',
|
|
57
|
-
'react/react-in-jsx-scope': 'off',
|
|
58
|
-
'react/require-default-props': 'off',
|
|
59
|
-
'react/jsx-boolean-value': 'off',
|
|
60
|
-
'react/jsx-filename-extension': 'off',
|
|
61
|
-
'react/jsx-props-no-spreading': 'off',
|
|
62
|
-
'react/self-closing-comp': 'off',
|
|
63
|
-
'react/jsx-no-useless-fragment': 'off',
|
|
64
|
-
'react/no-array-index-key': 'warn',
|
|
65
|
-
'react/jsx-curly-brace-presence': 'warn',
|
|
66
|
-
'react/destructuring-assignment': ['warn', 'always'],
|
|
67
|
-
|
|
68
|
-
'spaced-comment': 'warn',
|
|
69
|
-
|
|
70
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
71
|
-
|
|
72
|
-
'no-use-before-define': 'off',
|
|
73
|
-
'@typescript-eslint/no-use-before-define': ['warn'],
|
|
74
|
-
|
|
75
|
-
'no-unused-vars': 'off',
|
|
76
|
-
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
77
|
-
|
|
78
|
-
'no-useless-constructor': 'off',
|
|
79
|
-
'@typescript-eslint/no-useless-constructor': 'warn',
|
|
80
|
-
|
|
81
|
-
'no-shadow': 'off',
|
|
82
|
-
'@typescript-eslint/no-shadow': 'warn',
|
|
83
|
-
|
|
84
|
-
'no-empty-function': ['warn', { allow: ['constructors', 'arrowFunctions'] }],
|
|
85
|
-
'no-param-reassign': ['warn', { props: true, ignorePropertyModificationsFor: ['draft'] }],
|
|
86
|
-
'no-restricted-syntax': [
|
|
87
|
-
'warn',
|
|
88
|
-
{
|
|
89
|
-
selector: "CallExpression[callee.name='useMemo']",
|
|
90
|
-
message: 'Avoid using useMemo unless caching a computed value improves performance.',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
selector: "CallExpression[callee.name='useCallback']",
|
|
94
|
-
message:
|
|
95
|
-
'Avoid using useCallback unless you need to cache a function to prevent unnecessary re-renders.',
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
parserOptions: {
|
|
100
|
-
sourceType: 'module',
|
|
101
|
-
},
|
|
102
|
-
ignorePatterns: ['dist/', 'node_modules/', '*.d.ts', 'mock', '.eslintrc.cjs'],
|
|
103
|
-
settings: {
|
|
104
|
-
react: {
|
|
105
|
-
version: 'detect',
|
|
106
|
-
},
|
|
107
|
-
'import/resolver': {
|
|
108
|
-
alias: {
|
|
109
|
-
map: [
|
|
110
|
-
['@', './src'], // 将 '@' 映射到 'src' 目录
|
|
111
|
-
],
|
|
112
|
-
extensions: ['.ts', '.tsx', '.js', '.jsx', '.d.ts'],
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
browser: true,
|
|
5
|
+
node: true,
|
|
6
|
+
es2021: true,
|
|
7
|
+
},
|
|
8
|
+
parser: '@typescript-eslint/parser',
|
|
9
|
+
extends: [
|
|
10
|
+
'airbnb',
|
|
11
|
+
'airbnb/hooks',
|
|
12
|
+
'plugin:@typescript-eslint/recommended',
|
|
13
|
+
'plugin:import/errors',
|
|
14
|
+
'plugin:import/warnings',
|
|
15
|
+
'prettier',
|
|
16
|
+
],
|
|
17
|
+
plugins: ['@typescript-eslint', 'import', 'jsx-a11y', 'react', 'react-hooks'],
|
|
18
|
+
rules: {
|
|
19
|
+
'arrow-body-style': 'off',
|
|
20
|
+
'array-callback-return': 'warn',
|
|
21
|
+
|
|
22
|
+
camelcase: 'off',
|
|
23
|
+
'class-methods-use-this': 'off',
|
|
24
|
+
'consistent-return': 'warn',
|
|
25
|
+
|
|
26
|
+
'dot-notation': 'warn',
|
|
27
|
+
'default-param-last': 'off',
|
|
28
|
+
|
|
29
|
+
'import/order': 'warn',
|
|
30
|
+
'import/first': 'off',
|
|
31
|
+
'import/extensions': 'off',
|
|
32
|
+
'import/prefer-default-export': 'off',
|
|
33
|
+
'import/newline-after-import': 'warn',
|
|
34
|
+
|
|
35
|
+
'jsx-a11y/anchor-is-valid': 'warn',
|
|
36
|
+
'jsx-a11y/click-events-have-key-events': 'off',
|
|
37
|
+
'jsx-a11y/no-static-element-interactions': 'off',
|
|
38
|
+
'jsx-a11y/no-noninteractive-element-interactions': 'off',
|
|
39
|
+
|
|
40
|
+
'linebreak-style': 'off',
|
|
41
|
+
'lines-between-class-members': 'warn',
|
|
42
|
+
|
|
43
|
+
'max-classes-per-file': 'off',
|
|
44
|
+
|
|
45
|
+
'no-undef': 'off',
|
|
46
|
+
'no-plusplus': 'off',
|
|
47
|
+
'no-nested-ternary': 'warn',
|
|
48
|
+
|
|
49
|
+
'prefer-template': 'warn',
|
|
50
|
+
'prefer-exponentiation-operator': 'off',
|
|
51
|
+
|
|
52
|
+
radix: 'off',
|
|
53
|
+
|
|
54
|
+
'react/function-component-definition': 'off',
|
|
55
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
56
|
+
'react/prop-types': 'off',
|
|
57
|
+
'react/react-in-jsx-scope': 'off',
|
|
58
|
+
'react/require-default-props': 'off',
|
|
59
|
+
'react/jsx-boolean-value': 'off',
|
|
60
|
+
'react/jsx-filename-extension': 'off',
|
|
61
|
+
'react/jsx-props-no-spreading': 'off',
|
|
62
|
+
'react/self-closing-comp': 'off',
|
|
63
|
+
'react/jsx-no-useless-fragment': 'off',
|
|
64
|
+
'react/no-array-index-key': 'warn',
|
|
65
|
+
'react/jsx-curly-brace-presence': 'warn',
|
|
66
|
+
'react/destructuring-assignment': ['warn', 'always'],
|
|
67
|
+
|
|
68
|
+
'spaced-comment': 'warn',
|
|
69
|
+
|
|
70
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
71
|
+
|
|
72
|
+
'no-use-before-define': 'off',
|
|
73
|
+
'@typescript-eslint/no-use-before-define': ['warn'],
|
|
74
|
+
|
|
75
|
+
'no-unused-vars': 'off',
|
|
76
|
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
77
|
+
|
|
78
|
+
'no-useless-constructor': 'off',
|
|
79
|
+
'@typescript-eslint/no-useless-constructor': 'warn',
|
|
80
|
+
|
|
81
|
+
'no-shadow': 'off',
|
|
82
|
+
'@typescript-eslint/no-shadow': 'warn',
|
|
83
|
+
|
|
84
|
+
'no-empty-function': ['warn', { allow: ['constructors', 'arrowFunctions'] }],
|
|
85
|
+
'no-param-reassign': ['warn', { props: true, ignorePropertyModificationsFor: ['draft'] }],
|
|
86
|
+
'no-restricted-syntax': [
|
|
87
|
+
'warn',
|
|
88
|
+
{
|
|
89
|
+
selector: "CallExpression[callee.name='useMemo']",
|
|
90
|
+
message: 'Avoid using useMemo unless caching a computed value improves performance.',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
selector: "CallExpression[callee.name='useCallback']",
|
|
94
|
+
message:
|
|
95
|
+
'Avoid using useCallback unless you need to cache a function to prevent unnecessary re-renders.',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
parserOptions: {
|
|
100
|
+
sourceType: 'module',
|
|
101
|
+
},
|
|
102
|
+
ignorePatterns: ['dist/', 'node_modules/', '*.d.ts', 'mock', '.eslintrc.cjs'],
|
|
103
|
+
settings: {
|
|
104
|
+
react: {
|
|
105
|
+
version: 'detect',
|
|
106
|
+
},
|
|
107
|
+
'import/resolver': {
|
|
108
|
+
alias: {
|
|
109
|
+
map: [
|
|
110
|
+
['@', './src'], // 将 '@' 映射到 'src' 目录
|
|
111
|
+
],
|
|
112
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.d.ts'],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
package/eslint/.eslintrc.js
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
env: {
|
|
4
|
-
browser: true,
|
|
5
|
-
node: true,
|
|
6
|
-
es2021: true,
|
|
7
|
-
},
|
|
8
|
-
parser: '@typescript-eslint/parser',
|
|
9
|
-
extends: [
|
|
10
|
-
'airbnb',
|
|
11
|
-
'airbnb/hooks',
|
|
12
|
-
'plugin:@typescript-eslint/recommended',
|
|
13
|
-
'plugin:import/errors',
|
|
14
|
-
'plugin:import/warnings',
|
|
15
|
-
'prettier',
|
|
16
|
-
],
|
|
17
|
-
plugins: ['@typescript-eslint', 'import', 'jsx-a11y', 'react', 'react-hooks'],
|
|
18
|
-
rules: {
|
|
19
|
-
'arrow-body-style': 'off',
|
|
20
|
-
|
|
21
|
-
camelcase: 'off',
|
|
22
|
-
'class-methods-use-this': 'off',
|
|
23
|
-
'consistent-return': 'warn',
|
|
24
|
-
|
|
25
|
-
'dot-notation': 'warn',
|
|
26
|
-
'default-param-last': 'off',
|
|
27
|
-
|
|
28
|
-
'import/order': 'warn',
|
|
29
|
-
'import/first': 'off',
|
|
30
|
-
'import/extensions': 'off',
|
|
31
|
-
'import/prefer-default-export': 'off',
|
|
32
|
-
'import/newline-after-import': 'warn',
|
|
33
|
-
|
|
34
|
-
'jsx-a11y/anchor-is-valid': 'warn',
|
|
35
|
-
'jsx-a11y/click-events-have-key-events': 'off',
|
|
36
|
-
'jsx-a11y/no-static-element-interactions': 'off',
|
|
37
|
-
'jsx-a11y/no-noninteractive-element-interactions': 'off',
|
|
38
|
-
|
|
39
|
-
'linebreak-style': 'off',
|
|
40
|
-
'lines-between-class-members': 'warn',
|
|
41
|
-
|
|
42
|
-
'max-classes-per-file': 'off',
|
|
43
|
-
|
|
44
|
-
'no-undef': 'off',
|
|
45
|
-
'no-plusplus': 'off',
|
|
46
|
-
'no-nested-ternary': 'warn',
|
|
47
|
-
|
|
48
|
-
'prefer-template': 'warn',
|
|
49
|
-
'prefer-exponentiation-operator': 'off',
|
|
50
|
-
|
|
51
|
-
radix: 'off',
|
|
52
|
-
|
|
53
|
-
'react/function-component-definition': 'off',
|
|
54
|
-
'react-hooks/exhaustive-deps': 'off',
|
|
55
|
-
'react/prop-types': 'off',
|
|
56
|
-
'react/react-in-jsx-scope': 'off',
|
|
57
|
-
'react/require-default-props': 'off',
|
|
58
|
-
'react/jsx-boolean-value': 'off',
|
|
59
|
-
'react/jsx-filename-extension': 'off',
|
|
60
|
-
'react/jsx-props-no-spreading': 'off',
|
|
61
|
-
'react/self-closing-comp': 'off',
|
|
62
|
-
'react/jsx-no-useless-fragment': 'off',
|
|
63
|
-
'react/no-array-index-key': 'warn',
|
|
64
|
-
'react/jsx-curly-brace-presence': 'warn',
|
|
65
|
-
|
|
66
|
-
'spaced-comment': 'warn',
|
|
67
|
-
|
|
68
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
69
|
-
|
|
70
|
-
'no-use-before-define': 'off',
|
|
71
|
-
'@typescript-eslint/no-use-before-define': ['error'],
|
|
72
|
-
|
|
73
|
-
'no-unused-vars': 'off',
|
|
74
|
-
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
75
|
-
|
|
76
|
-
'no-useless-constructor': 'off',
|
|
77
|
-
'@typescript-eslint/no-useless-constructor': 'error',
|
|
78
|
-
|
|
79
|
-
'no-shadow': 'off',
|
|
80
|
-
'@typescript-eslint/no-shadow': 'error',
|
|
81
|
-
|
|
82
|
-
'no-empty-function': ['error', { allow: ['constructors', 'arrowFunctions'] }],
|
|
83
|
-
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['draft'] }],
|
|
84
|
-
'no-restricted-syntax': [
|
|
85
|
-
'warn',
|
|
86
|
-
{
|
|
87
|
-
selector: "CallExpression[callee.name='useMemo']",
|
|
88
|
-
message: 'Avoid using useMemo unless caching a computed value improves performance.',
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
selector: "CallExpression[callee.name='useCallback']",
|
|
92
|
-
message:
|
|
93
|
-
'Avoid using useCallback unless you need to cache a function to prevent unnecessary re-renders.',
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
parserOptions: {
|
|
98
|
-
sourceType: 'module',
|
|
99
|
-
},
|
|
100
|
-
ignorePatterns: ['dist/', 'node_modules/', '*.d.ts', 'mock', '.eslintrc.cjs'],
|
|
101
|
-
settings: {
|
|
102
|
-
react: {
|
|
103
|
-
version: 'detect',
|
|
104
|
-
},
|
|
105
|
-
'import/resolver': {
|
|
106
|
-
alias: {
|
|
107
|
-
map: [
|
|
108
|
-
['@', './src'], // 将 '@' 映射到 'src' 目录
|
|
109
|
-
],
|
|
110
|
-
extensions: ['.ts', '.tsx', '.js', '.jsx', '.d.ts'],
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
browser: true,
|
|
5
|
+
node: true,
|
|
6
|
+
es2021: true,
|
|
7
|
+
},
|
|
8
|
+
parser: '@typescript-eslint/parser',
|
|
9
|
+
extends: [
|
|
10
|
+
'airbnb',
|
|
11
|
+
'airbnb/hooks',
|
|
12
|
+
'plugin:@typescript-eslint/recommended',
|
|
13
|
+
'plugin:import/errors',
|
|
14
|
+
'plugin:import/warnings',
|
|
15
|
+
'prettier',
|
|
16
|
+
],
|
|
17
|
+
plugins: ['@typescript-eslint', 'import', 'jsx-a11y', 'react', 'react-hooks'],
|
|
18
|
+
rules: {
|
|
19
|
+
'arrow-body-style': 'off',
|
|
20
|
+
|
|
21
|
+
camelcase: 'off',
|
|
22
|
+
'class-methods-use-this': 'off',
|
|
23
|
+
'consistent-return': 'warn',
|
|
24
|
+
|
|
25
|
+
'dot-notation': 'warn',
|
|
26
|
+
'default-param-last': 'off',
|
|
27
|
+
|
|
28
|
+
'import/order': 'warn',
|
|
29
|
+
'import/first': 'off',
|
|
30
|
+
'import/extensions': 'off',
|
|
31
|
+
'import/prefer-default-export': 'off',
|
|
32
|
+
'import/newline-after-import': 'warn',
|
|
33
|
+
|
|
34
|
+
'jsx-a11y/anchor-is-valid': 'warn',
|
|
35
|
+
'jsx-a11y/click-events-have-key-events': 'off',
|
|
36
|
+
'jsx-a11y/no-static-element-interactions': 'off',
|
|
37
|
+
'jsx-a11y/no-noninteractive-element-interactions': 'off',
|
|
38
|
+
|
|
39
|
+
'linebreak-style': 'off',
|
|
40
|
+
'lines-between-class-members': 'warn',
|
|
41
|
+
|
|
42
|
+
'max-classes-per-file': 'off',
|
|
43
|
+
|
|
44
|
+
'no-undef': 'off',
|
|
45
|
+
'no-plusplus': 'off',
|
|
46
|
+
'no-nested-ternary': 'warn',
|
|
47
|
+
|
|
48
|
+
'prefer-template': 'warn',
|
|
49
|
+
'prefer-exponentiation-operator': 'off',
|
|
50
|
+
|
|
51
|
+
radix: 'off',
|
|
52
|
+
|
|
53
|
+
'react/function-component-definition': 'off',
|
|
54
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
55
|
+
'react/prop-types': 'off',
|
|
56
|
+
'react/react-in-jsx-scope': 'off',
|
|
57
|
+
'react/require-default-props': 'off',
|
|
58
|
+
'react/jsx-boolean-value': 'off',
|
|
59
|
+
'react/jsx-filename-extension': 'off',
|
|
60
|
+
'react/jsx-props-no-spreading': 'off',
|
|
61
|
+
'react/self-closing-comp': 'off',
|
|
62
|
+
'react/jsx-no-useless-fragment': 'off',
|
|
63
|
+
'react/no-array-index-key': 'warn',
|
|
64
|
+
'react/jsx-curly-brace-presence': 'warn',
|
|
65
|
+
|
|
66
|
+
'spaced-comment': 'warn',
|
|
67
|
+
|
|
68
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
69
|
+
|
|
70
|
+
'no-use-before-define': 'off',
|
|
71
|
+
'@typescript-eslint/no-use-before-define': ['error'],
|
|
72
|
+
|
|
73
|
+
'no-unused-vars': 'off',
|
|
74
|
+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
75
|
+
|
|
76
|
+
'no-useless-constructor': 'off',
|
|
77
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
78
|
+
|
|
79
|
+
'no-shadow': 'off',
|
|
80
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
81
|
+
|
|
82
|
+
'no-empty-function': ['error', { allow: ['constructors', 'arrowFunctions'] }],
|
|
83
|
+
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['draft'] }],
|
|
84
|
+
'no-restricted-syntax': [
|
|
85
|
+
'warn',
|
|
86
|
+
{
|
|
87
|
+
selector: "CallExpression[callee.name='useMemo']",
|
|
88
|
+
message: 'Avoid using useMemo unless caching a computed value improves performance.',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
selector: "CallExpression[callee.name='useCallback']",
|
|
92
|
+
message:
|
|
93
|
+
'Avoid using useCallback unless you need to cache a function to prevent unnecessary re-renders.',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
parserOptions: {
|
|
98
|
+
sourceType: 'module',
|
|
99
|
+
},
|
|
100
|
+
ignorePatterns: ['dist/', 'node_modules/', '*.d.ts', 'mock', '.eslintrc.cjs'],
|
|
101
|
+
settings: {
|
|
102
|
+
react: {
|
|
103
|
+
version: 'detect',
|
|
104
|
+
},
|
|
105
|
+
'import/resolver': {
|
|
106
|
+
alias: {
|
|
107
|
+
map: [
|
|
108
|
+
['@', './src'], // 将 '@' 映射到 'src' 目录
|
|
109
|
+
],
|
|
110
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.d.ts'],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
package/husky/_/h
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
[ "$HUSKY" = "2" ] && set -x
|
|
3
|
-
n=$(basename "$0")
|
|
4
|
-
s=$(dirname "$(dirname "$0")")/$n
|
|
5
|
-
|
|
6
|
-
if [[ "$(uname)" == "Darwin" ]]; then
|
|
7
|
-
elif [[ "$(uname -o)" == "Msys" || "$(uname)" == "CYGWIN" || "$(uname)" == "MINGW"* ]]; then
|
|
8
|
-
sed -i 's/\r//' "$0"
|
|
9
|
-
fi
|
|
10
|
-
|
|
11
|
-
[ ! -f "$s" ] && exit 0
|
|
12
|
-
|
|
13
|
-
if [ -f "$HOME/.huskyrc" ]; then
|
|
14
|
-
echo "husky - '~/.huskyrc' is DEPRECATED, please move your code to ~/.config/husky/init.sh"
|
|
15
|
-
fi
|
|
16
|
-
i="${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
|
|
17
|
-
[ -f "$i" ] && . "$i"
|
|
18
|
-
|
|
19
|
-
[ "${HUSKY-}" = "0" ] && exit 0
|
|
20
|
-
|
|
21
|
-
export PATH="node_modules/.bin:$PATH"
|
|
22
|
-
sh -e "$s" "$@"
|
|
23
|
-
c=$?
|
|
24
|
-
|
|
25
|
-
[ $c != 0 ] && echo "husky - $n script failed (code $c)"
|
|
26
|
-
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
|
|
27
|
-
exit $c
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
[ "$HUSKY" = "2" ] && set -x
|
|
3
|
+
n=$(basename "$0")
|
|
4
|
+
s=$(dirname "$(dirname "$0")")/$n
|
|
5
|
+
|
|
6
|
+
if [[ "$(uname)" == "Darwin" ]]; then
|
|
7
|
+
elif [[ "$(uname -o)" == "Msys" || "$(uname)" == "CYGWIN" || "$(uname)" == "MINGW"* ]]; then
|
|
8
|
+
sed -i 's/\r//' "$0"
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
[ ! -f "$s" ] && exit 0
|
|
12
|
+
|
|
13
|
+
if [ -f "$HOME/.huskyrc" ]; then
|
|
14
|
+
echo "husky - '~/.huskyrc' is DEPRECATED, please move your code to ~/.config/husky/init.sh"
|
|
15
|
+
fi
|
|
16
|
+
i="${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
|
|
17
|
+
[ -f "$i" ] && . "$i"
|
|
18
|
+
|
|
19
|
+
[ "${HUSKY-}" = "0" ] && exit 0
|
|
20
|
+
|
|
21
|
+
export PATH="node_modules/.bin:$PATH"
|
|
22
|
+
sh -e "$s" "$@"
|
|
23
|
+
c=$?
|
|
24
|
+
|
|
25
|
+
[ $c != 0 ] && echo "husky - $n script failed (code $c)"
|
|
26
|
+
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
|
|
27
|
+
exit $c
|
package/husky/_/pre-commit
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
2
|
. "$(dirname "$0")/h"
|
package/husky/_/pre-push
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
2
|
. "$(dirname "$0")/h"
|
package/husky/pre-commit
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
2
|
npx lint-staged
|
package/husky/pre-push
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
branch_name=$(git symbolic-ref --short HEAD)
|
|
3
|
-
|
|
4
|
-
branch_regex_master="^master$"
|
|
5
|
-
branch_regex_env="^(master|uat|dev)-[a-z]+$"
|
|
6
|
-
branch_regex_feature="^(feature|test|hotfix)-[a-z]+-[a-zA-Z0-9]+(-[A-Z]+[0-9]+)?$"
|
|
7
|
-
branch_regex_release="^release-[a-z]+-[0-9]{8}$"
|
|
8
|
-
|
|
9
|
-
if echo "$branch_name" | grep -Eq "$branch_regex_master"; then
|
|
10
|
-
exit 0
|
|
11
|
-
elif echo "$branch_name" | grep -Eq "$branch_regex_env"; then
|
|
12
|
-
exit 0
|
|
13
|
-
elif echo "$branch_name" | grep -Eq "$branch_regex_feature"; then
|
|
14
|
-
exit 0
|
|
15
|
-
elif echo "$branch_name" | grep -Eq "$branch_regex_release"; then
|
|
16
|
-
exit 0
|
|
17
|
-
else
|
|
18
|
-
echo -e "❌ \033[31m[ERROR] 当前分支名 '$branch_name' 不符合规范!\033[0m"
|
|
19
|
-
echo "分支命名规范要求如下:"
|
|
20
|
-
echo "✅ master"
|
|
21
|
-
echo "✅ master|uat|dev-[小写字母]"
|
|
22
|
-
echo "✅ feature|test|hotfix-[小写字母]+-[字母或数字]+(可选 -大写字母+数字)"
|
|
23
|
-
echo "✅ release-[小写字母]+-8位日期"
|
|
24
|
-
exit 1
|
|
25
|
-
fi
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
branch_name=$(git symbolic-ref --short HEAD)
|
|
3
|
+
|
|
4
|
+
branch_regex_master="^master$"
|
|
5
|
+
branch_regex_env="^(master|uat|dev)-[a-z]+$"
|
|
6
|
+
branch_regex_feature="^(feature|test|hotfix)-[a-z]+-[a-zA-Z0-9]+(-[A-Z]+[0-9]+)?$"
|
|
7
|
+
branch_regex_release="^release-[a-z]+-[0-9]{8}$"
|
|
8
|
+
|
|
9
|
+
if echo "$branch_name" | grep -Eq "$branch_regex_master"; then
|
|
10
|
+
exit 0
|
|
11
|
+
elif echo "$branch_name" | grep -Eq "$branch_regex_env"; then
|
|
12
|
+
exit 0
|
|
13
|
+
elif echo "$branch_name" | grep -Eq "$branch_regex_feature"; then
|
|
14
|
+
exit 0
|
|
15
|
+
elif echo "$branch_name" | grep -Eq "$branch_regex_release"; then
|
|
16
|
+
exit 0
|
|
17
|
+
else
|
|
18
|
+
echo -e "❌ \033[31m[ERROR] 当前分支名 '$branch_name' 不符合规范!\033[0m"
|
|
19
|
+
echo "分支命名规范要求如下:"
|
|
20
|
+
echo "✅ master"
|
|
21
|
+
echo "✅ master|uat|dev-[小写字母]"
|
|
22
|
+
echo "✅ feature|test|hotfix-[小写字母]+-[字母或数字]+(可选 -大写字母+数字)"
|
|
23
|
+
echo "✅ release-[小写字母]+-8位日期"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|