You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TypeScript项目中ESLint无法找到plugin:@typescript-eslint/recommended-type-checked配置求助

1. 检查@typescript-eslint依赖版本

plugin:@typescript-eslint/recommended-type-checked这类类型化配置要求**@typescript-eslint/eslint-plugin和@typescript-eslint/parser版本≥v5.57.0**,且两个包版本必须完全一致。

先查看当前安装的版本:

npm list @typescript-eslint/eslint-plugin @typescript-eslint/parser

如果版本不匹配或过低,执行升级:

# npm 用户
npm update @typescript-eslint/eslint-plugin @typescript-eslint/parser

# yarn 用户
yarn upgrade @typescript-eslint/eslint-plugin @typescript-eslint/parser

# pnpm 用户
pnpm update @typescript-eslint/eslint-plugin @typescript-eslint/parser

2. 确保依赖安装完整

如果升级后仍报错,可能是依赖安装不完整,先删除现有依赖和锁文件后重新安装:

# 删除依赖目录和锁文件
rm -rf node_modules package-lock.json yarn.lock pnpm-lock.yaml

# 重新安装依赖
npm install # 或 yarn install / pnpm install

3. 清理ESLint缓存

ESLint的缓存可能残留旧配置,执行清理命令:

npx eslint --clear-cache

4. 验证tsconfig配置

类型化检查需要正确读取tsconfig文件,确保项目根目录存在tsconfig.json。你的.eslintrc.cjs中已设置project: true,这会自动查找根目录的tsconfig;如果你的tsconfig使用自定义名称(如tsconfig.eslint.json),需修改配置:

parserOptions: {
  sourceType: 'module',
  project: './tsconfig.eslint.json',
  tsconfigRootDir: __dirname,
},

5. 确认ESLint版本兼容性

你的ESLint版本为8.55.0,该版本与@typescript-eslint v5、v6版本均兼容,无需额外调整。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.04 06:33:26