@jupiterjs/biome-config 0.2.2
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 +87 -0
- package/biome.json +107 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
# Jupiter Biome Config
|
|
3
|
+
|
|
4
|
+
**用途** ✅
|
|
5
|
+
|
|
6
|
+
本仓库包含 Jupiter 项目使用的 **Biome** 配置(`biome.json`)。此配置定义了代码格式化、静态检查、文件包含规则以及与 JavaScript/TypeScript 和 CSS 相关的约束与修复策略,旨在统一团队代码风格并提高代码质量。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 主要内容 / Features 🔧
|
|
11
|
+
|
|
12
|
+
- 使用 `biome` 作为项目的格式化器和 linter。
|
|
13
|
+
- 预设了 **formatter**(缩进、行宽、引号风格等)和 **linter**(推荐规则、可疑代码规则、可及性 a11y 规则等)。
|
|
14
|
+
- 指定了要包含/排除的文件模式(`files.includes`),避免在二进制、构建产物或第三方包中运行检查。
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 快速上手 / Usage 🚀
|
|
19
|
+
|
|
20
|
+
1. 在项目中安装 Biome(若尚未安装):
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add -D @biomejs/biome
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. 在项目根目录放置本仓库的 `biome.json`(已包含在本包内),或将其内容合并到你的 `biome.json` 中。
|
|
27
|
+
|
|
28
|
+
3. 在 package.json 中添加脚本(可选):
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
"scripts": {
|
|
32
|
+
"format": "biome format",
|
|
33
|
+
"lint": "biome check"
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
然后运行:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm run format
|
|
41
|
+
pnpm run lint
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 配置说明(关键点) 📋
|
|
47
|
+
|
|
48
|
+
- **files.includes**:控制 Biome 要检查的文件和要忽略的路径(例如 `node_modules`、`dist`、`build`、`coverage` 等)。
|
|
49
|
+
- **formatter**:设置缩进、行宽、换行、引号风格、尾逗号策略等。
|
|
50
|
+
- **linter.rules**:启用推荐规则并对特定规则覆盖(如 `noExplicitAny`、`noConsole` 等)。
|
|
51
|
+
- **overrides**:针对特定文件类型(如 `*.ts/tsx`)做更严格的规则(例如将 `noExplicitAny` 设置为 `error`)。
|
|
52
|
+
|
|
53
|
+
如果需要修改规则,以团队共识的方式更新 `biome.json` 并在必要时同步到各个子项目。
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 常见变更示例 / Example tweaks
|
|
58
|
+
|
|
59
|
+
- 将 TypeScript 文件中 `noExplicitAny` 升级为错误:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
"overrides": [
|
|
63
|
+
{
|
|
64
|
+
"includes": ["**/*.{ts,tsx}"],
|
|
65
|
+
"linter": { "rules": { "suspicious": { "noExplicitAny": "error" } } }
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 贡献 & 联系 🤝
|
|
73
|
+
|
|
74
|
+
欢迎提交 PR 或 issue 来改进配置。请在变更中说明动机和影响范围(例如会影响哪些包或 CI 步骤)。
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 许可
|
|
79
|
+
|
|
80
|
+
本仓库使用 **MIT License**,详情见 `package.json` 中的 `license` 字段。
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 参考
|
|
85
|
+
|
|
86
|
+
- Biome 官方文档: https://biomejs.dev/
|
|
87
|
+
|
package/biome.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": false,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": false
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false,
|
|
10
|
+
"includes": [
|
|
11
|
+
"**/*.{ts,tsx,js,jsx,json,css,scss,less}",
|
|
12
|
+
"!**/styles/icons/*",
|
|
13
|
+
"!**/node_modules",
|
|
14
|
+
"!**/dist",
|
|
15
|
+
"!**/build",
|
|
16
|
+
"!**/coverage",
|
|
17
|
+
"!**/.turbo",
|
|
18
|
+
"!**/.pnpm",
|
|
19
|
+
"!**/.changeset",
|
|
20
|
+
"!**/CHANGELOG.md",
|
|
21
|
+
"!**/*.lock",
|
|
22
|
+
"!**/pnpm-lock.yaml",
|
|
23
|
+
"!**/*.d.ts",
|
|
24
|
+
"!**/*.map",
|
|
25
|
+
"!**/*.min.js",
|
|
26
|
+
"!**/*.generated.*",
|
|
27
|
+
"!**/*.gen.*",
|
|
28
|
+
"!**/scripts",
|
|
29
|
+
"!**/temp",
|
|
30
|
+
"!**/tmp",
|
|
31
|
+
"!**/.server",
|
|
32
|
+
"!**/storybook-static",
|
|
33
|
+
"!**/playwright-report"
|
|
34
|
+
],
|
|
35
|
+
"maxSize": 1048576
|
|
36
|
+
},
|
|
37
|
+
"linter": {
|
|
38
|
+
"enabled": true,
|
|
39
|
+
"rules": {
|
|
40
|
+
"recommended": true,
|
|
41
|
+
"style":{
|
|
42
|
+
"noNonNullAssertion":"off",
|
|
43
|
+
"noDescendingSpecificity":"on"
|
|
44
|
+
},
|
|
45
|
+
"correctness":{
|
|
46
|
+
"useExhaustiveDependencies":"off",
|
|
47
|
+
"noChildrenProp": "off"
|
|
48
|
+
},
|
|
49
|
+
"nursery": {
|
|
50
|
+
"useSortedClasses": {
|
|
51
|
+
"level": "warn",
|
|
52
|
+
"fix": "safe",
|
|
53
|
+
"options": {
|
|
54
|
+
"functions": ["clsx", "cva", "tv", "cn"]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"suspicious": {
|
|
59
|
+
"noExplicitAny": "warn",
|
|
60
|
+
"noConsole": "off",
|
|
61
|
+
"noArrayIndexKey": "off"
|
|
62
|
+
},
|
|
63
|
+
"complexity":{
|
|
64
|
+
"noImportantStyles":"off"
|
|
65
|
+
},
|
|
66
|
+
"a11y": {
|
|
67
|
+
"useButtonType": "off",
|
|
68
|
+
"useSemanticElements": "off",
|
|
69
|
+
"useKeyWithClickEvents": "off",
|
|
70
|
+
"noStaticElementInteractions": "off",
|
|
71
|
+
"useValidAnchor": "off",
|
|
72
|
+
"noLabelWithoutControl": "off"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"formatter": {
|
|
77
|
+
"enabled": true,
|
|
78
|
+
"indentStyle": "space",
|
|
79
|
+
"indentWidth": 2,
|
|
80
|
+
"lineWidth": 120,
|
|
81
|
+
"includes": ["packages/**/*.{ts,tsx,js,jsx,css}", "src/**/*.{ts,tsx,js,jsx}", "stories/**/*.{ts,tsx}"]
|
|
82
|
+
},
|
|
83
|
+
"javascript": {
|
|
84
|
+
"formatter": {
|
|
85
|
+
"quoteStyle": "double",
|
|
86
|
+
"semicolons": "always",
|
|
87
|
+
"trailingCommas": "es5"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"overrides": [
|
|
91
|
+
{
|
|
92
|
+
"includes": ["**/*.{ts,tsx}"],
|
|
93
|
+
"linter": {
|
|
94
|
+
"rules": {
|
|
95
|
+
"suspicious": {
|
|
96
|
+
"noExplicitAny": "error"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"css": {
|
|
103
|
+
"parser": {
|
|
104
|
+
"tailwindDirectives": true
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jupiterjs/biome-config",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "The Biome configuration for Jupiter projects",
|
|
5
|
+
"main": "biome.json",
|
|
6
|
+
"files": [
|
|
7
|
+
"biome.json",
|
|
8
|
+
"README.md"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"publish:pre": "git checkout master && git merge dev -m 'chore: Merge branch ”dev“'",
|
|
12
|
+
"publish:post": "git push --follow-tags && node build-changelog.js && npm publish && git branch -D dev && git checkout -b dev",
|
|
13
|
+
"publish:postBeta": "git push --follow-tags && node build-changelog.js && npm publish --tag beta&& git branch -D dev && git checkout -b dev",
|
|
14
|
+
"publish:patch": "npm run publish:pre && npm version patch -m 'chore: Upgrade to %s for reasons' && npm run publish:post",
|
|
15
|
+
"publish:major": "npm run publish:pre && npm version major -m 'chore: Upgrade to %s for reasons' && npm run publish:post",
|
|
16
|
+
"publish:minor": "npm run publish:pre && npm version minor -m 'chore: Upgrade to %s for reasons' && npm run publish:post",
|
|
17
|
+
"publish:beta": "npm run publish:pre && npm version prerelease --preid=beta -m 'chore: Upgrade to %s for reasons' && npm run publish:postBeta"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"packageManager": "pnpm@10.25.0",
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@biomejs/biome": ">=1.9.0"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
}
|
|
29
|
+
}
|