问题描述
项目工程化配置一团糟:
next.config.mjs 里 TypeScript 和 lint 错误被全局禁用
package.json 的 lint 脚本报错(找不到 lint 目录)
- TypeScript 类型检查被关闭,导致满屏的类型错误没人管
- React StrictMode 被关闭
// next.config.mjs
typescript: {
ignoreBuildErrors: true, // 类型检查躺平
},
影响范围
- 所有类型错误都被吞掉了
- 新人不知道代码有多少问题
- 代码质量完全失控
建议方案
1. 修复 next.config.mjs
// next.config.mjs
const nextConfig = {
reactStrictMode: true, // 打开严格模式
// 删除 ignoreBuildErrors: true
};
2. 修复 package.json lint 脚本
{
"scripts": {
"lint": "next lint --dir src",
"typecheck": "tsc --noEmit"
}
}
3. 逐个修复 TypeScript 错误(可以新建一个表格追踪)
相关 Issue(建议关闭)
本 Issue 由 Memo Code 生成。
@hjx2289206 @AlkaidSTART