@zpcscc/configs 2.1.2 → 3.0.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/README.md +3 -61
- package/eslint-config/index.js +0 -4
- package/package.json +9 -22
- package/prettier-config/index.js +0 -2
- package/types/index.d.ts +1 -0
- package/types/react.d.ts +0 -1
- package/eslint-config/node/index.js +0 -11
- package/eslint-config/vue/index.js +0 -16
- package/stylelint-config/index.js +0 -43
- package/tsconfig/tsconfig.base.json +0 -50
- package/tsconfig/tsconfig.react.json +0 -9
- package/tsconfig/tsconfig.vue.json +0 -13
- package/types/vue.d.ts +0 -3
package/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# @zpcscc/configs
|
2
2
|
|
3
|
-
[](https://www.npmjs.com/package/@zpcscc/configs)
|
3
|
+
[](https://www.npmjs.com/package/@zpcscc/configs)
|
4
|
+
|
4
5
|
[](https://www.npmjs.com/package/@zpcscc/configs)
|
5
6
|
|
6
7
|
# 简介
|
@@ -36,22 +37,6 @@ module.exports = {
|
|
36
37
|
};
|
37
38
|
```
|
38
39
|
|
39
|
-
#### vue的eslint配置
|
40
|
-
|
41
|
-
```javascript
|
42
|
-
module.exports = {
|
43
|
-
extends: [require.resolve('@zpcscc/configs/eslint-config/vue')],
|
44
|
-
};
|
45
|
-
```
|
46
|
-
|
47
|
-
#### node的eslint配置
|
48
|
-
|
49
|
-
```javascript
|
50
|
-
module.exports = {
|
51
|
-
extends: [require.resolve('@zpcscc/configs/eslint-config/node')],
|
52
|
-
};
|
53
|
-
```
|
54
|
-
|
55
40
|
#### 补充配置
|
56
41
|
|
57
42
|
```javascript
|
@@ -94,26 +79,6 @@ module.exports = {
|
|
94
79
|
|
95
80
|
|
96
81
|
|
97
|
-
### stylelint
|
98
|
-
|
99
|
-
`.stylelintrc`
|
100
|
-
|
101
|
-
```json
|
102
|
-
{
|
103
|
-
"extends": "@zpcscc/configs/stylelint-config"
|
104
|
-
}
|
105
|
-
```
|
106
|
-
|
107
|
-
`stylelint.config.js`
|
108
|
-
|
109
|
-
```js
|
110
|
-
module.exports = {
|
111
|
-
extends: ['@zpcscc/configs/stylelint-config'],
|
112
|
-
}
|
113
|
-
```
|
114
|
-
|
115
|
-
|
116
|
-
|
117
82
|
### tsconfig
|
118
83
|
|
119
84
|
`tsconfig.json`
|
@@ -122,23 +87,7 @@ module.exports = {
|
|
122
87
|
|
123
88
|
```json
|
124
89
|
{
|
125
|
-
"extends": "@zpcscc/configs/tsconfig/tsconfig.
|
126
|
-
}
|
127
|
-
```
|
128
|
-
|
129
|
-
#### react的tsconfig配置
|
130
|
-
|
131
|
-
```json
|
132
|
-
{
|
133
|
-
"extends": "@zpcscc/configs/tsconfig/tsconfig.react.json",
|
134
|
-
}
|
135
|
-
```
|
136
|
-
|
137
|
-
#### vue的tsconfig配置
|
138
|
-
|
139
|
-
```json
|
140
|
-
{
|
141
|
-
"extends": "@zpcscc/configs/tsconfig/tsconfig.vue.json",
|
90
|
+
"extends": "@zpcscc/configs/tsconfig/tsconfig.json",
|
142
91
|
}
|
143
92
|
```
|
144
93
|
|
@@ -189,16 +138,9 @@ npm i -g commitizen inquirer@8 @commitlint/cz-commitlint
|
|
189
138
|
```bash
|
190
139
|
// 基础配置
|
191
140
|
/// <reference types="@zpcscc/configs/types" />
|
192
|
-
// react配置
|
193
|
-
/// <reference types="@zpcscc/configs/types/react" />
|
194
|
-
// vue配置
|
195
|
-
/// <reference types="@zpcscc/configs/types/vue" />
|
196
141
|
```
|
197
142
|
|
198
143
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
144
|
## License
|
203
145
|
|
204
146
|
MIT © [zpcscc](https://github.com/zpcscc)
|
package/eslint-config/index.js
CHANGED
@@ -19,8 +19,6 @@ module.exports = {
|
|
19
19
|
'plugin:import/typescript',
|
20
20
|
// unicorn的推荐配置
|
21
21
|
'plugin:unicorn/recommended',
|
22
|
-
// n的推荐配置
|
23
|
-
'plugin:n/recommended',
|
24
22
|
// 对promise的推荐配置
|
25
23
|
'plugin:promise/recommended',
|
26
24
|
/**
|
@@ -128,8 +126,6 @@ module.exports = {
|
|
128
126
|
'no-return-await': 'off',
|
129
127
|
// 禁止未使用的表达式
|
130
128
|
'no-unused-expressions': 'off',
|
131
|
-
// 禁止无效的import导入;此配置有bug;这里关闭;
|
132
|
-
'n/no-missing-import': 'off',
|
133
129
|
// 函数名称后需要跟一个空格。这里关闭
|
134
130
|
'space-before-function-paren': 'off',
|
135
131
|
// 在属性上使用析构函数变量。这里关闭
|
package/package.json
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zpcscc/configs",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.0",
|
4
4
|
"description": "项目通用配置",
|
5
5
|
"keywords": [
|
6
6
|
"commitlint",
|
7
7
|
"eslint",
|
8
8
|
"prettier",
|
9
|
-
"stylelint",
|
10
9
|
"tsconfig",
|
11
10
|
"types",
|
12
11
|
"react",
|
13
|
-
"vue",
|
14
12
|
"configs"
|
15
13
|
],
|
16
14
|
"homepage": "https://zpcscc.github.io/configs",
|
@@ -25,7 +23,6 @@
|
|
25
23
|
"commitlint-config",
|
26
24
|
"eslint-config",
|
27
25
|
"prettier-config",
|
28
|
-
"stylelint-config",
|
29
26
|
"tsconfig",
|
30
27
|
"types"
|
31
28
|
],
|
@@ -46,18 +43,14 @@
|
|
46
43
|
"@babel/core": "7.25.2",
|
47
44
|
"@babel/plugin-syntax-flow": "7.24.7",
|
48
45
|
"@babel/plugin-transform-react-jsx": "7.25.2",
|
49
|
-
"@babel/runtime": "7.25.
|
46
|
+
"@babel/runtime": "7.25.4",
|
50
47
|
"@commitlint/cz-commitlint": "19.4.0",
|
51
|
-
"@
|
52
|
-
"@types/
|
53
|
-
"@types/react": "18.3.3",
|
48
|
+
"@types/node": "22.5.0",
|
49
|
+
"@types/react": "18.3.4",
|
54
50
|
"@types/react-dom": "18.3.0",
|
55
|
-
"@typescript-eslint/eslint-plugin": "8.
|
56
|
-
"@typescript-eslint/parser": "8.
|
57
|
-
"@vue/eslint-config-prettier": "9.0.0",
|
58
|
-
"@vue/eslint-config-typescript": "13.0.0",
|
51
|
+
"@typescript-eslint/eslint-plugin": "8.2.0",
|
52
|
+
"@typescript-eslint/parser": "8.2.0",
|
59
53
|
"commitizen": "4.3.0",
|
60
|
-
"cosmiconfig": "9.0.0",
|
61
54
|
"eslint": "8.57.0",
|
62
55
|
"eslint-config-prettier": "9.1.0",
|
63
56
|
"eslint-config-standard": "17.1.0",
|
@@ -65,26 +58,20 @@
|
|
65
58
|
"eslint-plugin-eslint-comments": "3.2.0",
|
66
59
|
"eslint-plugin-import": "2.29.1",
|
67
60
|
"eslint-plugin-jsx-a11y": "6.9.0",
|
68
|
-
"eslint-plugin-n": "16.6.2",
|
69
61
|
"eslint-plugin-prettier": "5.2.1",
|
70
62
|
"eslint-plugin-promise": "6.6.0",
|
71
63
|
"eslint-plugin-react": "7.35.0",
|
72
64
|
"eslint-plugin-react-hooks": "4.6.2",
|
73
65
|
"eslint-plugin-unicorn": "55.0.0",
|
74
|
-
"eslint-plugin-vue": "9.27.0",
|
75
66
|
"inquirer": "9.3.5",
|
76
67
|
"postcss": "8.4.41",
|
77
68
|
"prettier": "3.3.3",
|
78
69
|
"prettier-plugin-organize-imports": "4.0.0",
|
79
70
|
"prettier-plugin-packagejson": "2.5.1",
|
80
|
-
"
|
81
|
-
"stylelint-config-idiomatic-order": "10.0.0",
|
82
|
-
"stylelint-declaration-block-no-ignored-properties": "2.8.0",
|
83
|
-
"typescript": "5.5.4",
|
84
|
-
"vue-eslint-parser": "9.4.3"
|
71
|
+
"typescript": "5.5.4"
|
85
72
|
},
|
86
73
|
"devDependencies": {
|
87
|
-
"dumi": "2.4.
|
74
|
+
"dumi": "2.4.8",
|
88
75
|
"father": "4.5.0",
|
89
76
|
"gh-pages": "6.1.1",
|
90
77
|
"react": "18.3.1",
|
@@ -92,7 +79,7 @@
|
|
92
79
|
"react-is": "18.3.1",
|
93
80
|
"styled-components": "6.1.12",
|
94
81
|
"tslib": "2.6.3",
|
95
|
-
"webpack": "5.
|
82
|
+
"webpack": "5.94.0"
|
96
83
|
},
|
97
84
|
"publishConfig": {
|
98
85
|
"access": "public",
|
package/prettier-config/index.js
CHANGED
@@ -40,8 +40,6 @@ module.exports = {
|
|
40
40
|
insertPragma: false,
|
41
41
|
// 根据显示样式决定 html 要不要折行, 默认css
|
42
42
|
htmlWhitespaceSensitivity: 'css',
|
43
|
-
// vue 文件中的 script 和 style 内不用缩进
|
44
|
-
vueIndentScriptAndStyle: false,
|
45
43
|
// 格式化嵌入的内容
|
46
44
|
embeddedLanguageFormatting: 'auto',
|
47
45
|
// html, vue, jsx 中每个属性占一行
|
package/types/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/* eslint-disable @typescript-eslint/triple-slash-reference */
|
2
2
|
/* eslint-disable multiline-comment-style */
|
3
3
|
/// <reference types="node" />
|
4
|
+
/// <reference types="./react" />
|
4
5
|
/// <reference types="./files" />
|
5
6
|
// * 这里自定义的一些全局 type 类型。记得在 eslint 的 globals 中添加。避免全局使用时类型报错未定义;
|
6
7
|
/// <reference types="./any" />
|
package/types/react.d.ts
CHANGED
@@ -1,16 +0,0 @@
|
|
1
|
-
// 官方文档 https://eslint.org/
|
2
|
-
/* eslint-env node */
|
3
|
-
require('@rushstack/eslint-patch/modern-module-resolution');
|
4
|
-
|
5
|
-
// @ts-check
|
6
|
-
/**
|
7
|
-
* @type {import("eslint").Linter.Config}
|
8
|
-
*/
|
9
|
-
module.exports = {
|
10
|
-
extends: ['plugin:vue/vue3-recommended', '@vue/eslint-config-typescript', '@vue/eslint-config-prettier', require.resolve("../index")],
|
11
|
-
parser: 'vue-eslint-parser',
|
12
|
-
parserOptions: {
|
13
|
-
parser: '@typescript-eslint/parser',
|
14
|
-
sourceType: 'module'
|
15
|
-
}
|
16
|
-
};
|
@@ -1,43 +0,0 @@
|
|
1
|
-
// 官方文档 https://stylelint.io/
|
2
|
-
module.exports = {
|
3
|
-
extends: [
|
4
|
-
// 标准配置
|
5
|
-
'stylelint-config-standard',
|
6
|
-
// 惯用样式排序规则
|
7
|
-
'stylelint-config-idiomatic-order'],
|
8
|
-
plugins: [
|
9
|
-
// 避免属性冲突而忽略某些属性
|
10
|
-
'stylelint-declaration-block-no-ignored-properties'],
|
11
|
-
rules: {
|
12
|
-
// 缩进采用 2 个空格
|
13
|
-
indentation: 2,
|
14
|
-
// 声明中不允许出现“unknown”属性
|
15
|
-
'declaration-property-value-no-unknown': null,
|
16
|
-
// 不能为空css样式块
|
17
|
-
'block-no-empty': true,
|
18
|
-
// 指定css函数名为小写
|
19
|
-
'function-name-case': 'lower',
|
20
|
-
// 禁止低权重选择权出现在高权重选择器之后
|
21
|
-
'no-descending-specificity': true,
|
22
|
-
// 不允许重复选择器
|
23
|
-
'no-duplicate-selectors': true,
|
24
|
-
// 统一使用双引号
|
25
|
-
'string-quotes': 'double',
|
26
|
-
// 禁止使用!important
|
27
|
-
'declaration-no-important': true,
|
28
|
-
// 指定每行最大长度
|
29
|
-
'max-line-length': 80,
|
30
|
-
// 关键字大小写
|
31
|
-
'value-keyword-case': null,
|
32
|
-
// 指定类选择器的模式。
|
33
|
-
'selector-class-pattern': null,
|
34
|
-
// 指定关键帧名称的模式。
|
35
|
-
'keyframes-name-pattern': null,
|
36
|
-
// 声明前是否需要空行
|
37
|
-
'declaration-empty-line-before': null,
|
38
|
-
// 注释前是否需要空行
|
39
|
-
'comment-empty-line-before': null,
|
40
|
-
// 不允许出现用双斜杠注释掉的样式
|
41
|
-
'no-invalid-double-slash-comments': null
|
42
|
-
}
|
43
|
-
};
|
@@ -1,50 +0,0 @@
|
|
1
|
-
// 官方文档 https://www.typescriptlang.org/tsconfig
|
2
|
-
{
|
3
|
-
// 从外部引用的基础配置
|
4
|
-
"compilerOptions": {
|
5
|
-
// 启用后,会开启ts所有的严格检查,可在下方单独某项进行关闭;
|
6
|
-
"strict": true,
|
7
|
-
// 启用后,TypeScript 将检查函数中的所有代码路径以确保它们返回值;
|
8
|
-
"noImplicitReturns": true,
|
9
|
-
// 启用后,不允许使用any;
|
10
|
-
"noImplicitAny": false,
|
11
|
-
// 设置项目的模块类型
|
12
|
-
"module": "ESNext",
|
13
|
-
// 指定模块的解析策略.
|
14
|
-
"moduleResolution": "Node",
|
15
|
-
// 指定编译后的版本。编译后的代码需要在什么版本的环境下运行
|
16
|
-
"target": "ESNext",
|
17
|
-
// 提供全局的ts类型api
|
18
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
19
|
-
// 模块导入修复。启用此项会自动启用 allowSyntheticDefaultImports
|
20
|
-
"esModuleInterop": true,
|
21
|
-
// 为你工程中的每个 TypeScript 或 JavaScript 文件生成 .d.ts 文件。
|
22
|
-
"declaration": true,
|
23
|
-
// 跳过声明文件的类型检查
|
24
|
-
"skipLibCheck": true,
|
25
|
-
// 解析json模块,允许导入带有“.json”扩展名的模块
|
26
|
-
"resolveJsonModule": true,
|
27
|
-
// 只发出.d.ts文件;不发出.js文件。仅用作导出ts类型时开启;
|
28
|
-
"emitDeclarationOnly": false,
|
29
|
-
// 在文件名中强制使用一致的大小写
|
30
|
-
"forceConsistentCasingInFileNames": true,
|
31
|
-
// 启用生成 sourcemap files;这些文件允许调试器和其他工具在使用实际生成的 JavaScript 文件时,显示原始的 TypeScript 代码。
|
32
|
-
"sourceMap": true,
|
33
|
-
// 报告未使用的局部变量的错误。建议开启
|
34
|
-
"noUnusedLocals": true,
|
35
|
-
// 严格的空检查;建议开启,方便提示某字段可能为null,undefined,false等情况
|
36
|
-
"strictNullChecks": true,
|
37
|
-
// 启用对装饰器的实验性支持
|
38
|
-
"experimentalDecorators": true,
|
39
|
-
// 允许默认全部导出,而不是 * as newName的形式
|
40
|
-
"allowSyntheticDefaultImports": true,
|
41
|
-
// 开启后,所有的文件都应是模块
|
42
|
-
"isolatedModules": false
|
43
|
-
// 模块导入修复。启用此项会自动启用 allowSyntheticDefaultImports // ts 5.0后才支持。
|
44
|
-
// "verbatimModuleSyntax": true
|
45
|
-
// 允许在项目中导入js文件
|
46
|
-
// "allowJs": true,
|
47
|
-
// 为js文件提供类型检查,与allowJs配合使用。开启后,需要同时配置 outDir
|
48
|
-
// "checkJs": true,
|
49
|
-
}
|
50
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
// 官方文档 https://www.typescriptlang.org/tsconfig
|
2
|
-
{
|
3
|
-
"extends": "./tsconfig.base.json",
|
4
|
-
"compilerOptions": {
|
5
|
-
"useDefineForClassFields": true,
|
6
|
-
// vue 项目中,必须是preserve
|
7
|
-
"jsx": "preserve",
|
8
|
-
// 没有隐含的this。防止this指向错误
|
9
|
-
"noImplicitThis": true,
|
10
|
-
// Vite项目中必须开启
|
11
|
-
"isolatedModules": true
|
12
|
-
}
|
13
|
-
}
|
package/types/vue.d.ts
DELETED