-
Notifications
You must be signed in to change notification settings - Fork 0
升级 ESLint 至 v9 并采用 Flat Config #15
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
Conversation
引入 ESLint v9 的 Flat Configuration 系统,替换旧版配置。 更新 ESLint 和 TypeScript ESLint 插件至最新主要版本,以获得最新功能和性能优化。 为 TypeScript 和 Node.js 项目配置推荐规则,并启用类型检查。 调整测试文件中的 `require` 导入规则,以避免不必要的 linting 错误。
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.
Pull request overview
This PR upgrades the project's ESLint infrastructure from v8 to v9, adopting the new Flat Config format. The change modernizes the linting setup with updated TypeScript ESLint plugins (from v6 to v8), introduces a new eslint.config.cjs configuration file, and updates related dependencies. However, there's a concerning TypeScript version downgrade that should be addressed.
Key Changes
- ESLint upgraded from ^8.47.0 to ^9.39.1
- TypeScript ESLint plugin/parser upgraded from ^6.4.1 to ^8.48.1
- New Flat Config format implemented in
eslint.config.cjs
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| package.json | Dependency version updates with a problematic TypeScript downgrade |
| package-lock.json | Lock file updates reflecting new dependency versions and their transitive dependencies |
| eslint.config.cjs | New ESLint v9 Flat Config implementation with TypeScript support and test file rule adjustments |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| sourceType: 'module', | ||
| tsconfigRootDir: __dirname, | ||
| // 若启用需要类型信息的规则,请保留 project。若不需要,可注释掉以提升性能。 | ||
| project: ['./tsconfig.json'] |
Copilot
AI
Dec 2, 2025
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.
The comment claims "若启用需要类型信息的规则,请保留 project。若不需要,可注释掉以提升性能。" (If enabling rules requiring type information, keep project. If not needed, comment out to improve performance), but the project configuration is uncommented. This creates ambiguity. Either enable type-checking rules (line 54) or remove the project configuration for better linting performance, as mentioned in the comment itself.
| project: ['./tsconfig.json'] | |
| // project: ['./tsconfig.json'] |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
在 ESLint 配置中启用 'recommended-requiring-type-checking' 规则,以强制执行更严格的 TypeScript 类型检查。 为有意不处理的异步函数调用添加 'void' 操作符,以符合新的 ESLint 规则(例如,避免未处理的 Promise 警告)。 重构了工具函数 (getAllFileExtensions, directoryHasMatchingFiles),移除了同步操作中不必要的 Promise.all,简化了代码并提高了效率。
|
@copilot 再检查一下 |
[WIP] Upgrade ESLint to v9 and adopt Flat Config
引入 ESLint v9 的 Flat Configuration 系统,替换旧版配置。
更新 ESLint 和 TypeScript ESLint 插件至最新主要版本,以获得最新功能和性能优化。
为 TypeScript 和 Node.js 项目配置推荐规则,并启用类型检查。
调整测试文件中的
require导入规则,以避免不必要的 linting 错误。