create-comate-pagebuilder 1.0.14 → 1.0.16
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/package.json +1 -1
- package/template/.claude/settings.local.json +12 -0
- package/template/.eslintignore +2 -0
- package/template/.eslintrc.js +17 -0
- package/template/README.md +37 -0
- package/template/package-lock.json +4405 -590
- package/template/package.json +13 -3
- package/template/src/App.jsx +7 -7
- package/template/src/main.jsx +3 -3
- package/template/src/pages/Home/index.jsx +10 -12
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
parser: '@babel/eslint-parser',
|
|
3
|
+
parserOptions: {
|
|
4
|
+
requireConfigFile: false,
|
|
5
|
+
babelOptions: {
|
|
6
|
+
presets: [
|
|
7
|
+
[require.resolve('@babel/preset-react'), {runtime: 'automatic'}],
|
|
8
|
+
],
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
extends: [
|
|
12
|
+
'@ecomfe/eslint-config',
|
|
13
|
+
'@ecomfe/eslint-config/baidu/default',
|
|
14
|
+
'@ecomfe/eslint-config/baidu/defect',
|
|
15
|
+
'@ecomfe/eslint-config/react',
|
|
16
|
+
],
|
|
17
|
+
};
|
package/template/README.md
CHANGED
|
@@ -50,6 +50,43 @@ src/
|
|
|
50
50
|
└── index.css # 全局样式
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
## 🔍 代码规范
|
|
54
|
+
|
|
55
|
+
项目使用 ESLint 进行代码质量检查,基于 **@ecomfe/eslint-config** 规范(百度前端团队代码规范)。
|
|
56
|
+
|
|
57
|
+
### 运行 Lint 检查
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# 检查代码
|
|
61
|
+
npm run lint
|
|
62
|
+
|
|
63
|
+
# 自动修复可修复的问题
|
|
64
|
+
npm run lint:fix
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 主要规范要点
|
|
68
|
+
|
|
69
|
+
- **缩进**:4 个空格(JavaScript)+ 4 个空格(JSX)
|
|
70
|
+
- **未使用变量**:报错级别(`no-unused-vars: error`)
|
|
71
|
+
- **对象/数组空格**:紧凑风格,不允许空格(`{a: 1}` ✅ / `{ a: 1 }` ❌)
|
|
72
|
+
- **React Hooks**:强制遵循 Hooks 规则
|
|
73
|
+
- **JSX 文件扩展名**:`.js`, `.jsx`, `.tsx` 均可
|
|
74
|
+
|
|
75
|
+
### 自定义规则
|
|
76
|
+
|
|
77
|
+
如需调整规则,在 [.eslintrc.json](.eslintrc.json) 中添加 `rules` 字段:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"rules": {
|
|
82
|
+
"no-unused-vars": "warn", // 改为警告
|
|
83
|
+
"indent": ["error", 2] // 改为 2 空格缩进
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
> 💡 提示:在 VSCode 中安装 ESLint 插件可实时查看代码问题
|
|
89
|
+
|
|
53
90
|
## 🎨 配色系统
|
|
54
91
|
|
|
55
92
|
模板提供标准化的配色结构,在 `tailwind.config.js` 中定义:
|