-
Notifications
You must be signed in to change notification settings - Fork 10
Steve/v3-next #4652
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
Steve/v3-next #4652
Conversation
chore(deps): Update babel monorepo (next)
chore(deps): Update dependency postcss to ^8.5.2 (next)
chore(deps): Update dependency prettier to ^3.5.0 (next)
…packages chore(deps): Update cypress packages to v14 (next) (major)
chore(deps): Update babel monorepo to ^7.26.9 (next)
chore(deps): Update cypress packages to ^14.0.3 (next)
chore(deps): Update dependency concurrently to ^9.1.2 (next)
chore(deps): Update dependency chokidar to ^4.0.3 (next)
chore(deps): Update dependency webpack to ^5.98.0 (next)
chore(deps): Update dependency postcss to ^8.5.3 (next)
chore(deps): Update dependency express to ^4.21.2 (next)
…react-7.x chore(deps): Update dependency eslint-plugin-react to v7.37.4 (next)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…-env-10.x chore(deps): Update dependency postcss-preset-env to ^10.1.5 (next)
chore(deps): Update dependency less to ^4.2.2 (next)
chore(deps): Update dependency prettier to ^3.5.3 (next)
…v-action-5.x chore(deps): Update codecov/codecov-action action to v5 (next)
chore(deps): Update cypress packages to ^14.1.0 (next)
…r-5.x chore(deps): Update dependency fast-xml-parser to v5 (next)
…4641) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
chore(deps): Update dependency rimraf to v6 (next)
…prettier-10.x chore(deps): Update dependency eslint-config-prettier to ^10.1.1 (next)
BREAKING CHANGE: migrate eslint config for v9
…pt-eslint-monorepo chore(deps): Update typescript-eslint monorepo to v8 (next) (major)
Walkthrough本次变更主要涉及对 ESLint 配置和相关工具的调整,包括删除旧的 ESLint 配置文件并引入新款 ES 模块化配置。与此同时,CI 工作流、lint-staged 以及 Docker Compose 的配置得到更新。多个 package.json 文件中依赖版本也进行了升级,涵盖 Babel、Cypress、ESLint、TypeScript 等。部分代码中用于抑制 ESLint 警告的注释被移除,同时对 ESLint 配置包进行了重构,采用 ES 模块导出并优化配置结构。 Changes
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (7)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🪧 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 (
|
next-core
|
Project |
next-core
|
Branch Review |
steve/v3-next
|
Run status |
|
Run duration | 00m 22s |
Commit |
|
Committer | Shenwei Wang |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
16
|
View all changes introduced in this branch ↗︎ |
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)
packages/eslint-config-next/deepFreeze.js (1)
1-21
: 新增工具函数:深度冻结对象新增的
deepFreeze
函数实现了对对象的递归冻结,使对象及其所有嵌套属性变为不可变。此实现有几点值得注意:
- 使用了 JSDoc 范型注解,保证了类型安全
- 对象属性的获取使用了
Object.getOwnPropertyNames
,确保能处理所有自身属性- 递归处理了嵌套对象,确保深度冻结
代码逻辑正确,但有一个潜在的优化点:当处理循环引用的对象时,可能会导致无限递归。考虑添加一个已访问对象的集合来防止这种情况。
- export default function deepFreeze(object) { + export default function deepFreeze(object, visited = new WeakSet()) { + // 处理 null 或已访问的对象 + if (object === null || visited.has(object)) { + return object; + } + + // 标记当前对象为已访问 + visited.add(object); // Retrieve the property names defined on object const propNames = Object.getOwnPropertyNames(object); // Freeze properties before freezing self for (const name of propNames) { const value = object[name]; if (value && typeof value === "object") { - deepFreeze(value); + deepFreeze(value, visited); } } return Object.freeze(object); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (26)
.eslintignore
(0 hunks).eslintrc
(0 hunks).github/workflows/ci.yml
(1 hunks).lintstagedrc
(1 hunks)docker-compose.yml
(1 hunks)eslint.config.mjs
(1 hunks)package.json
(2 hunks)packages/babel-preset-next/package.json
(1 hunks)packages/brick-container/package.json
(2 hunks)packages/brick-playground/package.json
(1 hunks)packages/build-next-bricks/package.json
(1 hunks)packages/build-next-libs/package.json
(1 hunks)packages/cook/package.json
(1 hunks)packages/create-api-sdk/package.json
(1 hunks)packages/doc-helpers/package.json
(1 hunks)packages/eslint-config-next/deepFreeze.js
(1 hunks)packages/eslint-config-next/index.js
(1 hunks)packages/eslint-config-next/node.js
(1 hunks)packages/eslint-config-next/package.json
(1 hunks)packages/http/src/http.ts
(0 hunks)packages/runtime/package.json
(1 hunks)packages/runtime/src/internal/Renderer.ts
(0 hunks)packages/runtime/src/internal/compute/WidgetFunctions.ts
(0 hunks)packages/runtime/src/internal/secret_internals.ts
(0 hunks)packages/test-next/package.json
(1 hunks)packages/webpack/package.json
(1 hunks)
💤 Files with no reviewable changes (6)
- .eslintignore
- packages/runtime/src/internal/compute/WidgetFunctions.ts
- packages/http/src/http.ts
- .eslintrc
- packages/runtime/src/internal/Renderer.ts
- packages/runtime/src/internal/secret_internals.ts
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build (20.x)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (57)
packages/runtime/package.json (1)
64-64
: 更新 API Extractor 依赖版本将
@microsoft/api-extractor
的版本从^7.47.11
更新到^7.51.1
,这是一个次要版本升级,可能包含了功能改进和错误修复。packages/create-api-sdk/package.json (1)
52-53
: 依赖版本更新将
prettier
从^3.4.2
更新到^3.5.3
,将semver
从^7.6.3
更新到^7.7.1
。这些更新包含了最新的功能改进和错误修复,有助于保持项目依赖的最新状态。packages/cook/package.json (1)
52-52
: 更新 Babel 解析器版本将
@babel/parser
从^7.26.5
更新到^7.26.9
,这是补丁版本更新,通常包含错误修复和安全性改进。docker-compose.yml (1)
4-4
:❓ Verification inconclusive
升级 Cypress Docker 镜像版本
将 Cypress 镜像从
cypress/included:13.15.2
更新到cypress/included:14.1.0
,这是一个主要版本升级,可能包含重要的功能变更和改进。建议在更新后验证所有端到端测试是否仍然正常工作,因为主要版本升级可能引入不兼容的变更。可通过运行以下命令检查 Cypress 14.x 的主要变更:
🌐 Web query:
Cypress 14 主要变更和迁移指南
💡 Result:
Cypress 14 引入了多项重要更新和破坏性变更,旨在提升测试体验并适配最新技术栈。以下是主要变更及迁移指南:
主要变更
环境支持调整
- Node.js 18+ 强制要求:安装 Cypress 14 需 Node.js 18 或更高版本,旧版 Node.js(如 16、21)不再支持[1][14]。
- Linux 兼容性限制:不再支持基于 glibc
<2.28
的发行版(如 Ubuntu 18、CentOS 7),需升级系统[1][14]。- 浏览器支持策略:仅官方维护 Chrome、Firefox 和 Edge 的最新 3 个主版本[14]。
核心功能改进
- 组件测试增强:支持 React、Angular、Next.js 等最新框架版本,优化执行性能[1]。
- Chrome 兼容性修复:自动处理
document.domain
弃用问题,需使用cy.origin()
处理跨子域导航[1][2]。- Electron 升级:内置 Chromium 130,提升稳定性和性能[1]。
移除旧版依赖
- 停止对旧版组件测试框架、开发服务器及第三方工具链的支持,聚焦现代技术栈[1]。
迁移指南
环境检查与升级
- 升级 Node.js 至 18+,并确保 CI/CD 环境同步更新[1][14]。
- 验证 Linux 发行版兼容性,必要时升级系统[14]。
测试代码适配
- 跨域处理:使用
cy.origin()
替代旧的跨域导航方法,避免因document.domain
弃用导致的错误[1][6]。// 旧方式(不再适用) cy.visit('http://sub.domain.com'); // 新方式 cy.origin('http://sub.domain.com', () => { cy.visit('/'); });
- 组件测试配置:若使用自定义样式或 CDN 资源,改为通过独立 CSS 文件导入而非
mount
参数[14]。- 断言重试逻辑:确认因自动重试机制优化导致的测试行为变化,必要时调整断言顺序[17]。
工具链调整
- IDE 支持:JetBrains Aqua 提供增强的 Cypress 测试可见性、代码洞察及元素检查功能[3][5]。
- 迁移辅助:参考官方迁移指南,逐步修正废弃 API 的使用[14][6]。
验证与回退
- 运行
cypress run --runner-ui
确保测试回放功能正常[14]。- 若遇插件兼容性问题,暂时锁定版本或联系维护者更新适配。
常见问题
- 错误链接引用:旧版文档中可能存在失效链接(如
on.cypress.com
),应替换为https://on.cypress.io/migration-guide
[6]。- 依赖冲突:使用
npm install cypress@latest --force
强制更新依赖树[2][8]。升级后若遇异常,可通过
DEBUG=cypress:*
输出详细日志排查[14]。建议结合官方示例项目逐步迁移[1][14]。Citations:
- 1: https://www.cypress.io/blog/cypress-14-is-here-see-whats-new
- 2: https://www.youtube.com/watch?v=KdTmZ9LkAt4
- 3: https://blog.jetbrains.com/zh-hans/qa/2023/06/cypress-jetbrains-aqua/
- 4: https://docs.xenserver.com/zh-cn/xenserver/7-0/downloads/wlb-admin-guide.pdf
- 5: https://www.cnblogs.com/surpassme/p/16790145.html
- 6: Cypress configuration error leads to non existing page cypress-io/cypress#30951
- 7: https://www.infineon.com/dgdl/Infineon-001-13251_ADCINC-Software%20Module%20Datasheets-v01_02-CN.pdf?fileId=8ac78c8c7d0d8da4017d0f9ea5c20de7
- 8: https://juejin.cn/post/7174749663323488312
- 9: https://blog.csdn.net/dawei_yang000000/article/details/110004314
- 10: https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration
- 11: https://openedx.org/zh-CN/blog/announcing-cypress-latest-open-edx-release/
- 12: https://cloud.tencent.com.cn/developer/article/2090257
- 13: https://www.infineon.com/dgdl/Infineon-001-13253_ADCINC14-Software%20Module%20Datasheets-v01_04-CN.pdf?fileId=8ac78c8c7d0d8da4017d0fa7545b176a
- 14: https://docs.cypress.io/app/references/migration-guide
- 15: https://www.dilatoit.com/zh/2023/04/14/cypresszidonghuaceshidegaojiyutazhanjiaocheng.html
- 16: https://www.glo.texas.gov/sites/default/files/20241018/5b-sap-amend16-chinese.pdf
- 17: https://www.cnblogs.com/surpassme/p/16663683.html
- 18: https://docs.aws.amazon.com/zh_cn/freertos/latest/userguide/getting_started_cypress_psoc64.html
- 19: https://openedx.org/zh-CN/hosting-provider/open-edx-cypress-virtual-machine-images-now-available-thanks-bitnami/
- 20: https://blog.csdn.net/gitblog_00035/article/details/138243133
请验证 Cypress 升级后的端到端测试环境
当前的修改将
docker-compose.yml
中的 Cypress 镜像从cypress/included:13.15.2
升级到了cypress/included:14.1.0
。Cypress 14 相较于之前的版本引入了以下几项重要变更,请注意:
环境要求调整
- Cypress 14 强制要求 Node.js 18+,请确认本地开发及 CI/CD 环境已同步升级。
- 对部分 Linux 发行版存在兼容性要求(例如 glibc 需 ≥2.28),确保系统版本满足需求。
核心功能更新
- 可能需要对测试代码做少量调整,比如跨域场景应使用
cy.origin()
替代旧方式。- 其他 API 或插件的变动也可能影响测试行为,请结合官方迁移指南进行全面核查。
建议在镜像升级后,完整运行端到端测试,确认所有测试用例均正常通过,再将此次变更合入主分支。
image: cypress/included:14.1.0
.lintstagedrc (1)
2-2
: 添加对 .mjs 文件的 lint 支持更新文件匹配模式,将
.mjs
文件添加到 lint-staged 的处理范围中。这与 PR 中引入 ES 模块化 ESLint 配置的方向一致,确保新增的.mjs
文件也能被正确地进行代码检查和格式化。packages/doc-helpers/package.json (2)
33-33
: 依赖升级:prettierprettier 从 ^3.4.2 升级到 ^3.5.3,这是一个次要版本升级,一般不会引起兼容性问题。此更新可获得最新的格式化功能和修复。
31-31
:❓ Verification inconclusive
依赖升级:fast-xml-parser
fast-xml-parser 从 ^4.5.0 升级到 ^5.0.8,这是一个主版本升级,可能包含破坏性变更。请确认应用代码已适配新版本的 API 变化。
🏁 Script executed:
#!/bin/bash # 检查项目中使用 fast-xml-parser 的地方是否需要适配新版本 rg "fast-xml-parser" --type js --type ts -A 3 -B 3Length of output: 324
验证 fast-xml-parser 新版本 API 兼容性
目前升级到 ^5.0.8 是一次主版本更新,可能引入 API 变化。根据脚本结果,目前项目仅在
packages/doc-helpers/src/htmlToYaml.js
中有对XMLParser
的直接引用。建议开发者:
- 检查
XMLParser
的实例化及后续方法调用是否符合 fast-xml-parser v5 新版的 API 要求;- 对比官方升级指南,确认是否需要对用法进行必要的调整。
packages/test-next/package.json (3)
35-35
: 依赖升级:@babel/core@babel/core 从 ^7.26.0 升级到 ^7.26.9,是补丁版本更新,一般不会引入兼容性问题,可以获得最新的修复和性能改进。
38-38
: 依赖升级:@testing-library/react@testing-library/react 从 ^16.1.0 升级到 ^16.2.0,此次版本更新增加了新功能和修复,属于安全升级。
45-45
: 依赖升级:typescripttypescript 从 ^5.7.3 升级到 ^5.8.2,此次升级可能带来新的类型检查特性和性能改进。确保构建过程中没有出现新的类型错误。
packages/build-next-libs/package.json (2)
23-23
: 依赖升级:@babel/core@babel/core 从 ^7.26.0 升级到 ^7.26.9,是补丁版本更新,不会引入兼容性问题,可以获得最新的修复和改进。
26-26
:❓ Verification inconclusive
依赖升级:rimraf
rimraf 从 ^5.0.10 升级到 ^6.0.1,这是一个主版本升级,可能包含 API 变更。请确认所有使用 rimraf 的代码是否需要适配。
🏁 Script executed:
#!/bin/bash # 检查项目中使用 rimraf 的地方是否需要适配新版本 rg "rimraf" --type js --type ts -A 3 -B 3Length of output: 863
确认 rimraf 升级后导入方式兼容性
在升级 rimraf 从 ^5.0.10 到 ^6.0.1 后,由于这是一次主版本更新,可能会引入模块导出机制上的变化。目前在项目中,文件
packages/build-next-libs/src/index.js
采用了解构赋值的方式引入 rimraf:
const { rimraf } = require("rimraf");这种写法在 rimraf 旧版本中可能正常工作,因为模块既作为函数导出,又在对象中存在同名属性,但新版是否依然支持此形式值得谨慎确认。请开发人员检查新版 rimraf 的导出方式,确认以下两点:
- 若新版 rimraf 改为仅导出默认函数,则应修改为:
const rimraf = require("rimraf");- 确保所有对 rimraf 的调用(例如链式调用 Promise 的部分)在新版 API 下依然正常。
请验证相关代码不会因导入方式不匹配而出现异常。
eslint.config.mjs (1)
1-49
: 很好的 ESLint 配置迁移这个新的 ESLint 配置文件使用了现代的 flat config 格式,采用 ES 模块语法,替代了之前的
.eslintrc
和.eslintignore
文件。配置结构清晰,针对不同类型的文件设置了合适的规则,并正确处理了测试框架的全局变量。这种迁移符合 ESLint 的最新实践,简化了配置管理,也使规则应用更加精确。
.github/workflows/ci.yml (1)
143-143
:❓ Verification inconclusive
codecov-action 版本更新
将 Codecov GitHub Action 从 v4 更新到 v5 是个好的做法,可以获取最新的功能和安全性改进。
请确认 v5 版本的 API 与 v4 完全兼容,以避免 CI 流程中出现意外问题。
🌐 Web query:
codecov action v4 vs v5 compatibility
💡 Result:
The transition from Codecov GitHub Action v4 to v5 introduces several compatibility considerations and breaking changes. Here's a detailed comparison:
Core Changes
- v4 uses the Codecov CLI for uploads, while v5 employs the Codecov Wrapper for faster updates[1][9]
- v5 introduces tokenless upload support for public repositories through global upload tokens in Codecov settings[1]
- Both versions require explicit token handling for Dependabot PRs via GitHub Secrets[2][8]
Deprecated/Changed Arguments (v4 → v5)
Feature v4 Status v5 Status Replacement file
Supported Deprecated files
plugin
Supported Deprecated plugins
Tokenless Limited support Expanded Global upload token[1] OIDC Support Unavailable Added use_oidc
flag[1]New arguments introduced in v5:
gcov_args
,gcov_include
,gcov_ignore
report_type
,binary
,skip_validation
swift_project
[1][4]Migration Requirements
- Update runner prerequisites:
# Both versions require: - actions/checkout@v3+ - curl/git/gpg installed- Token handling changes:
# v4 requires explicit token - uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} # v5 supports OIDC alternative - uses: codecov/codecov-action@v5 with: use_oidc: true- Argument updates for multi-file handling:
# v4 syntax file: coverage.xml # v5 syntax files: coverage1.xml,coverage2.xmlCompatibility Notes
- Token Requirements: v5 reduces token dependency for public repos through global upload tokens[1]
- Security: Both versions require careful secret management, but v5 adds OIDC authentication as a safer alternative[1][5]
- System Requirements: v5 has stricter requirements for runner tools (curl 7.79.0+, git 2.36.0+, gpg)[1]
Developers should carefully test their CI pipelines when upgrading, particularly verifying coverage file paths and authentication methods. The v5 wrapper architecture enables faster updates but may introduce different error handling patterns compared to v4's CLI-based approach[1][9].
Citations:
- 1: https://github.com/codecov/codecov-action
- 2: https://discourse.julialang.org/t/psa-new-version-of-codecov-action-requires-additional-setup/109857
- 3: https://hynek.me/articles/ditch-codecov-python/
- 4: https://about.codecov.io/blog/how-to-set-up-codecov-with-c-and-github-actions/
- 5: https://www.usenix.org/system/files/sec22_slides-koishybayev.pdf
- 6: http://lsstdesc.org/desc-continuous-integration/desc/ci/github_actions.html
- 7: https://about.codecov.io/blog/discovering-the-most-popular-and-most-used-github-actions/
- 8: https://about.codecov.io/tool/github-actions/
- 9: v4 Migration Guide codecov/codecov-action#1248
- 10: https://docs.codecov.com/docs/test-analytics
- 11: https://docs.codecov.com/docs/codecov-tokens
升级至 v5 后注意 API 变化
- 当前工作流使用了
uses: codecov/codecov-action@v5
,升级策略对安全性和新功能均有提升。- 请注意 v5 与 v4 存在不向后兼容的变化:
- 参数名称改动:例如
file
已被替换为files
,plugin
替换为plugins
等。- 令牌处理机制发生了变更:部分场景下 v5 采用了 tokenless 上传及 OIDC 支持,需确认依赖配置与新要求一致。
- 建议检查 CI 配置中所有 Codecov 相关的参数传值,确保在参数和认证方式上不存在因版本更新而导致的问题,并在测试环境下验证上传是否正常工作。
packages/eslint-config-next/node.js (1)
1-18
: 成功迁移至 ES 模块格式将 Node.js ESLint 配置从 CommonJS 格式转换为 ES 模块格式是个很好的改进。主要变化点:
- 使用
import
替代require
- 使用
export default
替代module.exports
- 从
env: { node: true }
转换为更现代的languageOptions: { globals: { ...globals.node } }
- 规则从
@typescript-eslint/no-var-requires
更新为@typescript-eslint/no-require-imports
- 使用
deepFreeze
确保配置对象的不可变性这些更改与整个项目向 ES 模块迁移的方向一致,提高了代码的一致性和可维护性。
packages/brick-container/package.json (3)
41-44
: 依赖项更新将以下依赖更新到最新的次要版本:
- chokidar: ^4.0.1 → ^4.0.3
- compression: ^1.7.5 → ^1.8.0
- express: ^4.21.1 → ^4.21.2
这些更新合理,应该包含了一些bug修复和小的功能改进。
50-50
: 依赖项更新: ws将 ws 依赖从 ^8.18.0 更新到 ^8.18.1,这是一个小的补丁版本更新,可能包含一些bug修复。
67-71
:❓ Verification inconclusive
开发依赖更新
将以下开发依赖更新到最新版本:
- copy-webpack-plugin: ^12.0.2 → ^13.0.0 (主版本升级)
- core-js: ^3.40.0 → ^3.41.0
- webpack-dev-server: ^5.1.0 → ^5.2.0
请注意,copy-webpack-plugin 进行了主版本更新,可能会有破坏性变更。请确保应用程序构建过程在此更新后仍然正常工作。
🌐 Web query:
copy-webpack-plugin 13.0.0 breaking changes
💡 Result:
The primary breaking change in
copy-webpack-plugin
v13.0.0 is the replacement ofglobby
/fast-glob
withtinyglobby
for handling file patterns. This change impacts how glob patterns are processed, potentially requiring adjustments to existing configurations if they relied on features specific to the previous libraries[15].Key Details:
- Glob Pattern Handling: The switch to
tinyglobby
may affect complex glob patterns or edge-case scenarios supported byglobby
/fast-glob
but not in the new implementation. Users should test pattern behavior after upgrading[15].- Performance Focus:
tinyglobby
is lighter and faster but has fewer features. For example, it lacks support for some advanced glob syntax like(?...)
(regular expression groups) and!(...)
(negation patterns)[15].Example of Affected Use Case:
If your configuration used patterns like:
{ from: "src/**/*.{png,jpg}", to: "images/" }Verify these patterns still match files correctly after upgrading.
Migration Steps:
- Audit Patterns: Review existing glob patterns for compatibility with
tinyglobby
.- Update Dependencies: Ensure no other tools rely on
globby
/fast-glob
in your build chain.- Test Thoroughly: Run build processes with
--watch
and--no-cache
flags to catch pattern mismatches.For most users, this change improves performance without configuration adjustments, but projects with complex file-matching logic should validate their setup[15].
Citations:
- 1: https://www.npmjs.com/package/copy-webpack-plugin
- 2: https://www.npmjs.com/package/copy-webpack-plugin/v/6.3.1
- 3: https://github.com/webpack-contrib/copy-webpack-plugin/blob/master/CHANGELOG.md
- 4: https://webpack.js.org/plugins/terser-webpack-plugin/
- 5: https://www.npmjs.com/package/copy-webpack-plugin/v/6.0.0
- 6: https://docs.cypress.io/app/references/changelog
- 7: https://www.gitclear.com/open_repos/angular/angular-cli/release/13.0.0-next.0
- 8: https://github.com/webpack-contrib/copy-webpack-plugin/blob/master/package.json
- 9: https://docs.cypress.io/app/references/migration-guide
- 10: https://security.snyk.io/package/npm/copy-webpack-plugin
- 11: https://classic.yarnpkg.com/en/package/webpack-atoms
- 12: https://secure.software/npm/packages/copy-webpack-plugin/10.2.4
- 13: Updating CopyWebpackPlugin (> 6.0.0) breaking changes aurelia/cli#1185
- 14: https://newreleases.io/latest?start=gxce160
- 15: https://newreleases.io/project/github/webpack-contrib/copy-webpack-plugin/release/v13.0.0
- 16: https://gerrit.avm99963.com/c/translateselectedtext/+/5653?usp=search
开发依赖更新:注意 copy-webpack-plugin v13 升级可能带来的 glob 模式差异
在
packages/brick-container/package.json
(行 67-71) 中更新了以下依赖:
- copy-webpack-plugin: 从
^12.0.2
升级到^13.0.0
(主版本升级)- core-js: 从
^3.40.0
升级到^3.41.0
- webpack-dev-server: 从
^5.1.0
升级到^5.2.0
根据目前获取的信息,copy-webpack-plugin 13.0.0 已将文件 glob 模式的处理工具由
globby
/fast-glob
替换为tinyglobby
,这可能会对原先依赖复杂 glob 模式(如使用正则或否定模式)的配置产生影响。请在更新后:
- 仔细测试 应用程序的构建流程,确保所有文件匹配配置仍然正常工作;
- 核查 glob 模式配置(如
{ from: "src/**/*.{png,jpg}", to: "images/" }
),确认是否需要微调以兼容新版tinyglobby
的行为。packages/webpack/package.json (3)
19-19
: 更新 copy-webpack-plugin 版本
将 copy-webpack-plugin 从旧版本升级至 "^13.0.0",请确认新版与 webpack 及相关插件的兼容性。
22-22
: 更新 webpack 版本(devDependencies)
将 webpack 更新至 "^5.98.0",建议检查新版本对构建流程及插件的影响。
25-25
: 更新 webpack 版本(peerDependencies)
在 peerDependencies 中同步升级 webpack 至 "^5.98.0",请确保下游项目可正常使用该版本。packages/babel-preset-next/package.json (3)
15-15
: 升级 @babel/plugin-transform-runtime
已更新该依赖版本至 "^7.26.9",请验证与其他 Babel 插件之间的兼容性。
16-16
: 升级 @babel/preset-env
版本已提升至 "^7.26.9",建议测试编译输出是否符合预期。
19-19
: 升级 @babel/runtime
更新至 "^7.26.9",确保运行时行为与新版 Babel 配置一致。packages/brick-playground/package.json (3)
37-37
: 升级 copy-webpack-plugin
在 devDependencies 中将 copy-webpack-plugin 升级到 "^13.0.0",确保与 webpack 配置匹配。
41-41
: 升级 webpack-dev-server
将 webpack-dev-server 更新至 "^5.2.0",建议检查开发服务器的启动与热更新功能。
28-29
:❓ Verification inconclusive
升级 compression 与 express
"compression" 更新至 "^1.8.0" 且 "express" 更新至 "^4.21.2",请测试 API 响应及安全性是否无异常。
请验证 API 响应及安全性测试
在文件
packages/brick-playground/package.json
第 28-29 行,已将"compression"
升级为"^1.8.0"
;同时将"express"
升级为"^4.21.2"
。请对升级后的版本进行全面的 API 响应和安全性测试,确保没有引入任何异常问题,以免影响生产环境的稳定性。package.json (11)
40-41
: 升级 Babel 核心依赖
将 "@babel/core" 与 "@babel/types" 均升级至 "^7.26.9",建议验证构建流程及代码转换后行为正常。
57-57
: 升级 concurrently
版本更新为 "^9.1.2",请确认多进程任务管理功能没有出现异常。
59-59
: 升级 Cypress
将 Cypress 更新至 "^14.1.0",请确保所有端到端测试用例在新版本下均能通过。
60-60
: 升级 ESLint
ESLint 升级至 "^9.12.0",与新 ESLint 配置保持一致,注意检查是否有遗留的 ESLint 注释问题。
61-61
: 升级 Husky
更新 Husky 至 "^9.1.7",建议在不同平台下测试 Git 钩子功能。
66-66
: 升级 lint-staged
lint-staged 版本更新至 "^15.4.3",请确认文件匹配规则正常工作。
67-67
: 升级 Prettier
Prettier 升级至 "^3.5.3",确保代码格式化统一且符合团队规范。
68-68
: 升级 rimraf
将 rimraf 更新至 "^6.0.1",该版本修复了部分安全与兼容性问题,建议验证清理任务。
70-70
: 升级 TypeScript
TypeScript 升级至 "^5.8.2",请检查项目类型声明和编译步骤是否均无问题。
77-77
: 更新 resolutions 中的 @babel/parser
将 "@babel/parser" 更新至 "^7.26.9",确保解析器版本与 Babel 核心依赖一致。
78-78
: 更新 resolutions 中的 @babel/runtime
更新至 "^7.26.9",保证所有 Babel 相关依赖同步升级。packages/build-next-bricks/package.json (9)
37-37
: 升级 @babel/parser
将版本更新至 "^7.26.9",确保与 babel 其它依赖保持一致。
38-38
: 升级 @babel/traverse
更新至 "^7.26.9",请验证代码遍历逻辑在新版本下依然正常。
41-41
: 升级 babel-loader
将 babel-loader 升级至 "^10.0.0",建议检查 webpack 构建流程中的 loader 配置。
46-46
: 升级 less
更新 less 至 "^4.2.2",请测试样式预处理是否无异常。
50-50
: 升级 postcss
更新 postcss 至 "^8.5.3",确认新的版本能正确处理 CSS 转换任务。
52-52
: 升级 postcss-preset-env
将版本升级至 "^10.1.5",建议测试 CSS 输出以避免兼容性问题。
53-53
: 升级 Prettier
Prettier 更新至 "^3.5.3",保持与整体版本同步,确保代码格式化效果一致。
55-55
: 升级 TypeScript
将 TypeScript 版本更新至 "^5.8.2",请确保所有类型检查在升级后正常运行。
56-56
: 升级 webpack
升级 webpack 至 "^5.98.0",确保构建工具链利用最新性能优化和 bug 修复。packages/eslint-config-next/index.js (7)
1-8
: 很好的模块化导入设置你使用了现代ES模块语法导入所有必要的ESLint配置和插件。引入
globals
、@eslint/js
和typescript-eslint
等依赖非常合理,它们是构建新型ESLint扁平配置的基础组件。
9-14
: 配置转换为扁平格式的ESM模块成功地将ESLint配置从CommonJS格式转换为使用
tseslint.config
函数的现代ES模块格式。使用eslint.configs.recommended
、tseslint.configs.recommended
等标准配置作为基础是很好的做法,这样可以确保项目遵循社区最佳实践。
15-26
: 全局配置和React设置合理语言选项中正确配置了浏览器和ES2025环境的全局变量,React版本设置为"detect"可以自动适配项目中React的实际版本。
27-62
: TypeScript规则配置全面TypeScript相关规则的配置全面且合理。将
@typescript-eslint/no-explicit-any
设为警告而非错误是个平衡的选择,no-use-before-define
和parameter-properties
的配置考虑了实际开发情况。特别注意到
@typescript-eslint/no-unused-vars
规则的配置从"all"变更为"after-used",这样更符合实际开发中的使用场景,减少了不必要的警告。
62-71
: 新增规则配置合理新增的
@typescript-eslint/no-unsafe-function-type
设置为"off"以及对@typescript-eslint/no-unused-expressions
的详细配置都是合理的。
73-94
: 测试文件的覆盖配置完善为Jest测试文件配置了适当的规则覆盖,包括允许带说明的
ts-ignore
注释以及关闭一些在测试中可能过于严格的规则,如no-require-imports
和no-explicit-any
。
95-109
: 构建和配置文件的特殊处理对构建配置文件、脚本和bin文件的特殊处理是合理的,特别是引入了适用于Node环境的配置。对于特定配置文件强制使用
@typescript-eslint/no-require-imports
规则,有助于保持代码的一致性和模块化。packages/eslint-config-next/package.json (3)
12-16
: 模块类型和导出配置的现代化改进添加
"type": "module"
标记使包明确为ES模块,符合现代JavaScript开发趋势。exports
字段的定义清晰地暴露了包的入口点,包括根路径和node.js专用配置,使导入更加明确和可预测。
17-19
: 简化的对等依赖将ESLint的对等依赖更新为
">= 9"
是合理的,因为新的配置格式需要ESLint 9或更高版本。移除了之前对特定版本TypeScript和React插件的要求,让依赖管理更加灵活。
20-27
:❓ Verification inconclusive
依赖更新和调整
依赖项的更新反映了向新的ESLint配置系统的过渡:
- 添加
@eslint/js
支持新的配置格式- 引入
globals
用于环境全局变量定义- 更新React相关插件到最新版本
- 使用统一的
typescript-eslint
包替代分散的@typescript-eslint子包所有的版本选择都是最新的且相互兼容的。
不过,请确认以下事项:
🌐 Web query:
ESLint 9兼容性和typescript-eslint 8.x版本的稳定性
💡 Result:
ESLint 9 的兼容性和
typescript-eslint
8.x 的稳定性问题需要从配置迁移、依赖管理和规则调整三个方面综合分析:
一、ESLint 9 的兼容性挑战
配置文件迁移
ESLint 9 弃用了传统的.eslintrc
配置,改用 扁平化配置系统(eslint.config.js
),需重写配置文件[1][3][7][19]。例如:import js from '@eslint/js'; import ts from 'typescript-eslint'; export default [ js.configs.recommended, ...ts.configs.recommended, { rules: { '@typescript-eslint/no-unused-vars': 'error' } } ];旧配置中的
extends
和plugins
需通过显式导入实现[3][7]。依赖调整
- 需安装新包:
@eslint/js
(核心规则)、@stylistic/eslint-plugin
(原内置样式规则拆分)[1][4][9]- 移除旧包:如
@typescript-eslint/parser
(由typescript-eslint
统一管理)[4][5]- Node.js 要求 ≥ v18.18.0,不再支持 v19[3][7][19]
工具支持
使用官方迁移工具简化配置转换:npx @eslint/migrate-config .eslintrc.yml并配合
eslint-config-inspector
验证规则有效性[1][3][4]。
二、typescript-eslint 8.x 的稳定性
版本兼容性
typescript-eslint
v8.0.0+ 已全面适配 ESLint 9,需确保安装最新版本[5][11]- 需匹配 TypeScript 版本:≥4.7.4 且 <5.4.0[6][16],否则会触发警告
- 常见错误解决:
# 升级 TypeScript 至兼容版本 npm install typescript@^4.7.4
规则迁移
- 部分规则(如
comma-dangle
)需改为@stylistic
插件实现[1][2]- 示例配置调整:
- "comma-dangle": ["error", "never"] + "@stylistic/comma-dangle": ["error", "always"]编辑器集成
VS Code 需升级 ESLint 扩展至 v3.0+ 以支持扁平配置[12],避免出现Could not find config file
错误[10][20]。
三、关键实践建议
问题类型 解决方案 Prettier 冲突 禁用 eslint-plugin-prettier
,改用独立格式化命令[3][4][9]React Hooks 兼容 安装 eslint-plugin-react-hooks@^5.1.0-rc.0
[4][18]遗留规则告警 通过 @eslint/compat
包过渡性支持旧配置[9][17]TypeScript 泛型错误 检查 ecmaVersion
是否设置为latest
[1][4]
四、稳定性验证
通过以下命令验证环境:
# 检查 ESLint 版本 npx eslint --version # 检查 TypeScript 兼容性 npx tsc --version # 全面扫描项目 npx eslint . --ext .ts,.tsx若出现规则失效,优先使用
@eslint/eslintrc
包进行规则转换[7][13]。
ESLint 9 的迁移成本主要集中于配置重构和依赖更新,而
typescript-eslint
8.x 在版本对齐后表现稳定。建议通过渐进式迁移(如隔离测试项目)降低风险[1][3][9]。Citations:
- 1: https://www.imooc.com/article/363349
- 2: https://zh-hans.eslint.org/docs/latest/use/migrate-to-8.0.0
- 3: https://tduyng.com/blog/migrating-to-eslint9x/
- 4: https://www.cnblogs.com/jsonq/p/18357943
- 5: https://www.npmjs.com/package/@typescript-eslint/eslint-plugin
- 6: https://blog.csdn.net/Anislandwhale/article/details/136610772
- 7: https://juejin.cn/post/7354298118236864566
- 8: https://blog.csdn.net/yorkhunter/article/details/144656392
- 9: https://blog.linotte.dev/eslint-9-next-js-935c2b6d0371
- 10: https://www.cnblogs.com/dudu/p/18622271
- 11: ESLint v9 Support typescript-eslint/typescript-eslint#8211
- 12: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
- 13: https://blog.csdn.net/y_ang_1/article/details/137510680
- 14: https://typescript-eslint.nodejs.cn/linting/typed-linting
- 15: https://juejin.cn/post/7355096015583920128
- 16: https://wenku.csdn.net/doc/6dpd7yzk90
- 17: https://ksh7.com/posts/eslint-update-9/
- 18: Release version based on typescript-eslint 8.0.0 beta eslint-stylistic/eslint-stylistic#414
- 19: https://eslint.org/docs/latest/use/migrate-to-9.0.0
- 20: https://blog.csdn.net/qelen/article/details/144010440
依赖升级调整与迁移提醒
依赖项的更新已反映出向 ESLint 9 及其全新扁平化配置系统迁移的意图,当前依赖版本(包括新增的
@eslint/js
、globals
、更新的 React 插件以及统一的typescript-eslint
包)看似都是最新且互相兼容的。但请注意以下关键要点,以确保整体升级平稳且稳定:
配置文件迁移
请确认项目已从传统的.eslintrc
配置文件切换到扁平化配置(例如使用eslint.config.js
),因为 ESLint 9 弃用了旧配置方式。依赖调整
检查是否已移除旧的解析器包(如@typescript-eslint/parser
),并保持统一使用typescript-eslint
包,同时确保所有新增依赖已正确安装并配置。版本兼容性
确保 TypeScript 的版本满足typescript-eslint
8.x 的要求(建议在 ≥4.7.4 且 <5.4.0 范围内),以避免潜在的兼容性问题。React 插件检查
验证 React 相关插件(例如eslint-plugin-react
与eslint-plugin-react-hooks
)与 ESLint 9 及新配置模式之间的兼容性,必要时调整对应规则。更新依赖示例如下:
{ "dependencies": { "@eslint/js": "^9.22.0", "globals": "^16.0.0", "eslint-plugin-react": "^7.37.4", "eslint-plugin-react-hooks": "^5.2.0", "eslint-config-prettier": "^10.1.1", "typescript-eslint": "^8.26.1" } }建议在完成配置迁移后,通过如下命令验证整体环境稳定性:
# 检查 ESLint 版本(确保为 ESLint 9+) npx eslint --version # 执行全面 lint 检查(确认规则与配置工作正常) npx eslint . --ext .ts,.tsx综合网络资料,依赖更新本身没有问题,但在整体升级过程中,请逐项确认上述配置及版本要求,确保项目平滑过渡到 ESLint 9 及
typescript-eslint
8.x 版本环境。
chore(deps): Update babel monorepo to ^7.26.10 (next)
…4649) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
next-core
|
Project |
next-core
|
Branch Review |
next
|
Run status |
|
Run duration | 00m 26s |
Commit |
|
Committer | renovate[bot] |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
16
|
View all changes introduced in this branch ↗︎ |
Summary by CodeRabbit
Tests
Refactor
Chores