@zpcscc/configs 2.0.3 → 2.0.5
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-config/index.js +5 -10
- package/package.json +36 -37
- package/prettier-config/index.js +2 -2
- package/types/any.d.ts +5 -3
package/eslint-config/index.js
CHANGED
@@ -23,15 +23,13 @@ module.exports = {
|
|
23
23
|
'plugin:unicorn/recommended',
|
24
24
|
// 对promise的推荐配置
|
25
25
|
'plugin:promise/recommended',
|
26
|
-
// sonarjs的推荐配置
|
27
|
-
'plugin:sonarjs/recommended',
|
28
26
|
/**
|
29
27
|
* eslint-plugin-prettier的推荐配置,需要放在最后一位,内部启用了eslint-plugin-prettier插件
|
30
28
|
* 用于关闭eslint中的所有格式化配置,全部在.prettierrc中进行格式化配置
|
31
29
|
*/
|
32
30
|
'plugin:prettier/recommended'],
|
33
31
|
// 如果要在rules中针对某个插件做具体配置,则需要在plugins里先引入对应插件
|
34
|
-
plugins: ['@typescript-eslint', '
|
32
|
+
plugins: ['@typescript-eslint', 'unicorn', 'promise', 'import'],
|
35
33
|
parserOptions: {
|
36
34
|
ecmaVersion: 'latest'
|
37
35
|
},
|
@@ -53,6 +51,8 @@ module.exports = {
|
|
53
51
|
rules: {
|
54
52
|
// 数组类型。这里不限制写法
|
55
53
|
'@typescript-eslint/array-type': 'off',
|
54
|
+
// 强制要求注释描述,这里关闭
|
55
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
56
56
|
// 强制使用一致性类型断言。<>语法,或者as语法
|
57
57
|
'@typescript-eslint/consistent-type-assertions': 'off',
|
58
58
|
// 强制ts类型使用type关键字,好处是,type关键字可以让ts类型更加明确,鼠标悬浮可以显示具体类型,且有interface的所有功能;
|
@@ -82,6 +82,8 @@ module.exports = {
|
|
82
82
|
allowShortCircuit: true,
|
83
83
|
allowTernary: true
|
84
84
|
}],
|
85
|
+
// 禁止使用类型断言,应使用 !进行断言,这里关闭。类型断言更语意化,会好些。
|
86
|
+
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
|
85
87
|
// 限制命名规则。这里关闭。命名希望灵活些
|
86
88
|
'@typescript-eslint/naming-convention': 'off',
|
87
89
|
// 为了安全使用 ?? 替换 ||。关闭此选项,部分场景,需要手动选择??还是||; ??会把空字符串也认为是true
|
@@ -119,8 +121,6 @@ module.exports = {
|
|
119
121
|
'no-unused-expressions': 'off',
|
120
122
|
// 函数名称后需要跟一个空格。这里关闭
|
121
123
|
'space-before-function-paren': 'off',
|
122
|
-
// 返回值必须被使用。这里关闭
|
123
|
-
'sonarjs/no-ignored-return': 'off',
|
124
124
|
// 在属性上使用析构函数变量。这里关闭
|
125
125
|
'unicorn/consistent-destructuring': 'off',
|
126
126
|
// 箭头函数移动到外部作用于。这里关闭。在react组件内,经常会使用到箭头函数
|
@@ -238,11 +238,6 @@ module.exports = {
|
|
238
238
|
quotes: ['error'],
|
239
239
|
'require-atomic-updates': ['error'],
|
240
240
|
semi: ['error', 'always'],
|
241
|
-
'sonarjs/cognitive-complexity': 'off',
|
242
|
-
'sonarjs/no-nested-template-literals': 'off',
|
243
|
-
'sonarjs/no-duplicate-string': 'off',
|
244
|
-
'sonarjs/no-small-switch': 'off',
|
245
|
-
'sonarjs/prefer-immediate-return': 'off',
|
246
241
|
'space-before-blocks': ['error', 'always'],
|
247
242
|
'space-in-parens': ['error', 'never'],
|
248
243
|
'space-unary-ops': ['error', {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zpcscc/configs",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.5",
|
4
4
|
"description": "项目通用配置",
|
5
5
|
"keywords": [
|
6
6
|
"commitlint",
|
@@ -43,58 +43,57 @@
|
|
43
43
|
"start": "dumi dev"
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@babel/core": "7.
|
47
|
-
"@babel/plugin-syntax-flow": "7.
|
46
|
+
"@babel/core": "7.24.5",
|
47
|
+
"@babel/plugin-syntax-flow": "7.24.1",
|
48
48
|
"@babel/plugin-transform-react-jsx": "7.23.4",
|
49
|
-
"@babel/runtime": "7.
|
50
|
-
"@commitlint/cz-commitlint": "
|
51
|
-
"@rushstack/eslint-patch": "1.
|
52
|
-
"@types/node": "20.
|
53
|
-
"@types/react": "18.2
|
54
|
-
"@types/react-dom": "18.
|
55
|
-
"@typescript-eslint/eslint-plugin": "6.
|
56
|
-
"@typescript-eslint/parser": "6.
|
57
|
-
"@vue/eslint-config-prettier": "
|
58
|
-
"@vue/eslint-config-typescript": "
|
49
|
+
"@babel/runtime": "7.24.5",
|
50
|
+
"@commitlint/cz-commitlint": "19.2.0",
|
51
|
+
"@rushstack/eslint-patch": "1.10.2",
|
52
|
+
"@types/node": "20.12.12",
|
53
|
+
"@types/react": "18.3.2",
|
54
|
+
"@types/react-dom": "18.3.0",
|
55
|
+
"@typescript-eslint/eslint-plugin": "6.21.0",
|
56
|
+
"@typescript-eslint/parser": "6.19.1",
|
57
|
+
"@vue/eslint-config-prettier": "9.0.0",
|
58
|
+
"@vue/eslint-config-typescript": "13.0.0",
|
59
59
|
"commitizen": "4.3.0",
|
60
60
|
"cosmiconfig": "9.0.0",
|
61
|
-
"eslint": "8.
|
61
|
+
"eslint": "8.57.0",
|
62
62
|
"eslint-config-prettier": "9.1.0",
|
63
63
|
"eslint-config-standard": "17.1.0",
|
64
|
-
"eslint-config-standard-with-typescript": "43.0.
|
64
|
+
"eslint-config-standard-with-typescript": "43.0.1",
|
65
65
|
"eslint-import-resolver-typescript": "3.6.1",
|
66
66
|
"eslint-plugin-eslint-comments": "3.2.0",
|
67
67
|
"eslint-plugin-import": "2.29.1",
|
68
68
|
"eslint-plugin-jsx-a11y": "6.8.0",
|
69
|
-
"eslint-plugin-n": "16.
|
70
|
-
"eslint-plugin-prettier": "5.1.
|
69
|
+
"eslint-plugin-n": "16.6.2",
|
70
|
+
"eslint-plugin-prettier": "5.1.3",
|
71
71
|
"eslint-plugin-promise": "6.1.1",
|
72
|
-
"eslint-plugin-react": "7.
|
73
|
-
"eslint-plugin-react-hooks": "4.6.
|
74
|
-
"eslint-plugin-
|
75
|
-
"eslint-plugin-
|
76
|
-
"
|
77
|
-
"
|
78
|
-
"
|
79
|
-
"prettier": "3.1.1",
|
72
|
+
"eslint-plugin-react": "7.34.1",
|
73
|
+
"eslint-plugin-react-hooks": "4.6.2",
|
74
|
+
"eslint-plugin-unicorn": "53.0.0",
|
75
|
+
"eslint-plugin-vue": "9.26.0",
|
76
|
+
"inquirer": "9.2.21",
|
77
|
+
"postcss": "8.4.38",
|
78
|
+
"prettier": "3.2.5",
|
80
79
|
"prettier-plugin-organize-imports": "3.2.4",
|
81
|
-
"prettier-plugin-packagejson": "2.
|
80
|
+
"prettier-plugin-packagejson": "2.5.0",
|
82
81
|
"stylelint": "14.16.1",
|
83
82
|
"stylelint-config-idiomatic-order": "10.0.0",
|
84
|
-
"stylelint-declaration-block-no-ignored-properties": "2.
|
85
|
-
"typescript": "5.
|
86
|
-
"vue-eslint-parser": "9.
|
83
|
+
"stylelint-declaration-block-no-ignored-properties": "2.8.0",
|
84
|
+
"typescript": "5.4.5",
|
85
|
+
"vue-eslint-parser": "9.4.2"
|
87
86
|
},
|
88
87
|
"devDependencies": {
|
89
|
-
"dumi": "2.
|
90
|
-
"father": "4.
|
91
|
-
"gh-pages": "6.1.
|
92
|
-
"react": "18.
|
93
|
-
"react-dom": "18.
|
94
|
-
"react-is": "18.
|
95
|
-
"styled-components": "6.1.
|
88
|
+
"dumi": "2.3.4",
|
89
|
+
"father": "4.4.1",
|
90
|
+
"gh-pages": "6.1.1",
|
91
|
+
"react": "18.3.1",
|
92
|
+
"react-dom": "18.3.1",
|
93
|
+
"react-is": "18.3.1",
|
94
|
+
"styled-components": "6.1.11",
|
96
95
|
"tslib": "2.6.2",
|
97
|
-
"webpack": "5.
|
96
|
+
"webpack": "5.91.0"
|
98
97
|
},
|
99
98
|
"publishConfig": {
|
100
99
|
"access": "public",
|
package/prettier-config/index.js
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
module.exports = {
|
3
3
|
// 额外的插件
|
4
4
|
plugins: [
|
5
|
-
// import
|
5
|
+
// 格式化时对import自动排序
|
6
6
|
require.resolve('prettier-plugin-organize-imports'),
|
7
|
-
// package.json
|
7
|
+
// 格式化时对package.json自动排序
|
8
8
|
require.resolve('prettier-plugin-packagejson')],
|
9
9
|
// import格式化自动排序时,不删除未使用的import
|
10
10
|
organizeImportsSkipDestructiveCodeActions: true,
|
package/types/any.d.ts
CHANGED