You need to enable JavaScript to run this app. 升级到ESLint时执行schematics:convert-tslint-to-eslint出现angular.json相关错误
优惠活动
大模型
产品
解决方案
定价
更多

升级到ESLint时执行schematics:convert-tslint-to-eslint出现angular.json相关错误

TSLint迁移ESLint时angular.json相关报错的可能诱因

  • @angular-eslint版本与Angular版本不兼容:Angular 12仅适配v4.x版本的@angular-eslint套件,若执行ng add @angular-eslint/schematics时未指定版本默认安装了更高版本的包,高版本脚本读取angular.json的逻辑与Angular12的配置结构不匹配,就会触发报错。
  • angular.json结构不符合迁移脚本预期:如果项目的angular.json中存在自定义的配置节点、多子项目/共享库的层级结构偏离标准Angular项目规范,或者配置中对应项目的lint字段下的tslintConfig属性缺失、路径被修改,脚本无法定位到目标配置就会报错。
  • Angular版本升级遗留的配置问题:刚从Angular11升级到12的过程中,如果ng update流程未完全执行完毕,或者手动调整过angular.json的配置,导致配置字段还残留Angular11的旧规范,迁移脚本解析时会出现结构识别错误。
  • 项目名称参数不匹配:执行ng g @angular-eslint/schematics:convert-tslint-to-eslint your_project_name时,参数your_project_name需要和angular.json中projects节点下的项目键名完全一致(大小写敏感),填错名称会导致脚本找不到对应项目的配置节点,抛出angular.json相关异常。
  • TSLint配置关联异常:如果angular.json中绑定的tslint配置文件不存在,或者配置中存在自定义的extends规则路径无法被解析,迁移脚本读取关联配置时也会触发报错。

内容的提问来源于stack exchange,提问作者Martin Hochmair

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.18 02:27:03