-
Notifications
You must be signed in to change notification settings - Fork 4.8k
替换 husky,eslint,添加 biome,nx #17390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
替换 husky,eslint,添加 biome,nx #17390
Conversation
修下冲突,看看效果 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17390 +/- ##
========================================
Coverage 57.70% 57.70%
========================================
Files 469 469
Lines 26551 26551
Branches 5722 5866 +144
========================================
Hits 15321 15321
+ Misses 9765 9596 -169
- Partials 1465 1634 +169
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
这个合并了我就着手引入nx |
除了nx,这个应该不阻塞功能贡献吧?这个个人觉得也需要Owner来拍板。 |
感觉Owner都好忙。 |
@tutuxxx 这是之前讨论过的改动,麻烦给个意见哈 |
晚一些细看哈,人力不足,只能优先看功能或bug修复类的改动 |
Walkthrough此次更改主要涉及配置和工作流的调整。删除了 ESLint、Prettier 及 Husky 相关的配置文件和钩子,移除了 CI 流程中的 lint 步骤。与此同时,引入了新的 Biome、Lefthook 及 Nx 配置文件,并对 package.json 中的脚本与依赖进行了更新。此外,还对部分测试文件中的字符串格式进行了统一调整,确保代码整体风格的一致性。 Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as 开发者
participant Git as Git
participant LH as Lefthook 钩子
participant BM as Biome 检查器
participant SL as Stylelint
participant CL as Commitlint
Dev->>Git: 执行 git commit
Git->>LH: 触发 pre-commit 钩子
LH->>BM: 检查代码格式
LH->>SL: 检查样式文件
BM-->>LH: 返回检测结果
SL-->>LH: 返回检测结果
LH->>Git: 决定是否允许提交
Dev->>Git: 提交 commit 消息
Git->>LH: 触发 commit-msg 钩子
LH->>CL: 验证 commit 消息格式
CL-->>LH: 返回验证结果
LH->>Git: 完成提交
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
package.json (1)
37-37
: 新增 Commit 脚本
添加了"commit": "git add -A && git commit --no-edit"
脚本,简化提交流程。不过建议确认此命令符合团队的提交实践,确保在需要时依然能手动书写详细的 commit message。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (16)
.eslintignore
(0 hunks).eslintrc.js
(0 hunks).github/workflows/nodejs.yml
(0 hunks).gitignore
(1 hunks).husky/commit-msg
(0 hunks).husky/pre-commit
(0 hunks).prettierignore
(0 hunks).prettierrc
(0 hunks)biome.json
(1 hunks)lefthook.yml
(1 hunks)nx.json
(1 hunks)package.json
(6 hunks)packages/babel-plugin-transform-solid-jsx/test/__unique_transform_fixtures__/aliasOrSameNameImport/output.js
(1 hunks)packages/babel-plugin-transform-solid-jsx/test/__unique_transform_fixtures__/simpleElements/output.js
(1 hunks)packages/babel-plugin-transform-solid-jsx/test/__unique_transform_fixtures__/unTransformElements/output.js
(1 hunks)packages/taro-components/package.json
(1 hunks)
💤 Files with no reviewable changes (7)
- .prettierrc
- .github/workflows/nodejs.yml
- .husky/commit-msg
- .prettierignore
- .husky/pre-commit
- .eslintignore
- .eslintrc.js
🧰 Additional context used
🧬 Code Definitions (1)
packages/babel-plugin-transform-solid-jsx/test/__unique_transform_fixtures__/unTransformElements/output.js (3)
packages/babel-plugin-transform-solid-jsx/test/__unique_transform_fixtures__/simpleElements/code.js (1)
Index
(3-18)packages/babel-plugin-transform-solid-jsx/test/__unique_transform_fixtures__/unTransformElements/code.js (1)
Index
(3-18)packages/taro-components-library-solid/src/component-lib/index.ts (4)
View
(17-17)Text
(23-23)Button
(26-26)Icon
(20-20)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build Rust Binding / stable - x86_64-pc-windows-msvc
- GitHub Check: Build Rust Binding / stable - x86_64-apple-darwin
🔇 Additional comments (28)
.gitignore (1)
87-88
: 新增 NX 相关目录的忽略项
这里添加了.nx/cache
和.nx/workspace-data
,确保 NX 生成的缓存及工作区数据不被版本控制跟踪。请确认这与团队的缓存管理策略一致。nx.json (1)
1-29
: 新增 Nx 配置文件,结构清晰
该配置文件正确定义了namedInputs
与targetDefaults
,并且利用 JSON schema 指定了 NX 配置标准。请检查"$schema": "./node_modules/nx/schemas/nx-schema.json"
路径是否与项目中的实际位置匹配,以及各项输入规则是否满足实际需求。biome.json (1)
1-51
: 新增 Biome 配置文件,配置全面
此文件详细定义了文件忽略规则、版本控制、lint 规则和格式化选项,整体配置非常全面。请确保这些配置与项目要求一致,同时通知团队成员新工具的使用方法。packages/babel-plugin-transform-solid-jsx/test/__unique_transform_fixtures__/aliasOrSameNameImport/output.js (1)
1-51
: 格式调整统一采用双引号
该文件主要对字符串定界符进行了统一调整,使用双引号替换单引号,从而与项目的新代码风格保持一致。代码逻辑无改变,建议保持统一的风格。packages/babel-plugin-transform-solid-jsx/test/__unique_transform_fixtures__/simpleElements/output.js (1)
1-32
: 统一代码风格,使用双引号
此处的修改将所有的字符串定界符统一为双引号,使代码风格标准化,不影响功能。此风格调整与其他变更保持一致,利于长期维护。packages/babel-plugin-transform-solid-jsx/test/__unique_transform_fixtures__/unTransformElements/output.js (8)
1-2
: 统一引入格式
将模块引入部分统一修改为双引号风格,保证项目内代码风格一致,无任何功能性影响。
5-5
: 组件属性格式统一
第5行将class
属性的值更改为双引号"index"
,确保 JSX 属性的字符串字面量格式与整体规范保持一致。
11-12
: 文本内容格式化
第11-12行将children
属性内容"Hello world! "
更改为使用双引号,与其他部分风格一致,无功能变更。
17-19
: 标准化子组件字符串
第18-19行中对Text
组件的children
字符串"Hello world2! "
进行了双引号标准化处理,格式统一且易于维护。
22-23
: 按钮组件文本更新
第23行将Button
组件的children
属性值更新为"set class"
,已改为双引号,保持了代码风格的一致性。
26-27
: 返回表达式格式调整
第27行的return Math.random();
细微调整了格式(确保语句以分号结束),有助于防止潜在的 ASI 问题,格式与语法均正确。
30-31
: 组件属性值修正
第31行中对Icon
组件的type
属性使用双引号"success"
进行传递,确保所有文本字面量均采用统一风格。
33-35
: 闭合与尾随逗号格式
第33和35行的格式调整有助于保持整体代码结构和对象闭合风格的一致性,不会对逻辑产生副作用。packages/taro-components/package.json (1)
10-11
: 配置数组格式调整
将sideEffects
与files
属性的数组格式从多行改为单行形式,有助于提高配置文件的紧凑性和可读性,且不影响运行逻辑。lefthook.yml (6)
1-3
: 基础配置验证
文件开头指定了 YAML LSP 的 schema 以及参考链接,为后续配置提供了良好的提示,有助于维护和自动补全。
4-19
: Pre-commit 钩子配置
在pre-commit
部分,通过配置并行任务分别调用biome
和stylelint
来进行代码检查和格式化,支持自动修复并对已修改的文件进行暂存。建议确保 glob 模式覆盖项目所有相关文件。
31-40
: Prepare-commit-msg 钩子设计
prepare-commit-msg
部分首先检测提交信息是否为空,然后通过pnpm git-cz --hook
以交互方式生成标准化的 commit 信息,该流程能够提升提交质量。
41-45
: Commit-msg 校验
在commit-msg
部分,根据传入的文件({1})运行commitlint
,验证提交信息格式是否符合规范,确保团队协作时提交记录整洁。
46-54
: Post-merge 钩子检查
post-merge
配置中检查pnpm-lock.yaml
是否发生变化,并提醒用户重新安装依赖,防止因依赖版本不一致而引起问题,逻辑清晰。
55-64
: Post-checkout 文件变更检测
post-checkout
钩子同样检查pnpm-lock.yaml
的变化,当切换分支时提醒执行安装操作,进一步保障依赖管理的一致性。package.json (8)
9-10
: 关键词字段更新
将"keywords"
字段更新为["taro"]
,使项目定位更准确,同时符合简洁化要求,无直接功能变更。
20-21
: Prepare 脚本更新
将原有的 husky 相关命令替换为先清除core.hookspath
(防止旧配置干扰),再执行lefthook install
。这一步骤清晰、健壮,符合迁移目标。
21-21
: 构建流程切换到 NX
将build
脚本更改为使用nx run-many -t prod
,表明构建流程将利用 NX 的优势进行多目标构建,提升效率。建议确保 NX 配置与各模块对应正确。
27-28
: Lint 脚本切换
更新lint
脚本为biome check --fix packages
,以及lint:style
脚本仅针对 SCSS 文件,这符合减少依赖和简化 linting 流程的目标。
29-29
: 测试脚本调整
test
脚本现改为nx run-many -t test:ci
,利用 NX 同步运行测试任务,有助于统一管理和加速测试流程。
31-31
: 快照更新脚本修改
updateSnapshot
脚本也调整为使用 NX 进行执行,确保在整个项目中快照的一致性更新。
67-68
: 开发依赖更新
在 devDependencies 中新增了@biomejs/biome
、lefthook
、nx
以及git-cz
,并移除或调整了 ESLint 相关依赖。这些变更与 PR 目标一致,请确认各新依赖的版本和兼容性问题。Also applies to: 70-71
136-137
: TypeScript 版本锁定
typescript
的版本已锁定为~5.4.5
,这能帮助确保在团队开发时的版本一致性。
这个 PR 做了什么? (简要描述所做更改)
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit