【已解决】在 Vite 项目中使用 eslint-config-ali 时遇到的解析错误

错误还原

  1. 搭建 Vite 项目
bash 复制代码
pnpm create vite my-vue-app --template vue-ts
  1. 安装 eslint-config-ali
bash 复制代码
pnpm i -D eslint-config-ali @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-import eslint-import-resolver-typescript vue-eslint-parser eslint-plugin-vue
  1. 配置 .eslintrc
json 复制代码
{
  "extends": ["eslint-config-ali/typescript/vue"]
}
  1. 安装并启用 VSCode 插件 ESLint

报错信息

查看 vite.config.ts 发现出错了,在第 1 行开始处的位置:

Parsing error: ESLint was configured to run on <tsconfigRootDir>/vite.config.ts using parserOptions.project: /tsconfig.json

However, that TSConfig does not include this file. Either:

解决办法

修改 .eslintrcparserOptions.project 配置,增加 tsconfig.node.json

json 复制代码
{
  "extends": ["eslint-config-ali/typescript/vue"],
  "parserOptions": {
    "project": ["tsconfig.json", "tsconfig.node.json"]
  }
}
相关推荐
持续前行几秒前
通过 npm 下载node_modules 某个依赖 ;例如 下载 @rollup/rollup-linux-arm64-gnu
前端·javascript·vue.js
Embrace92424 分钟前
React Native + Realm 离线方案处理
javascript·react native·react.js·realm
chenyingjian34 分钟前
鸿蒙|能力特性-统一文件预览
前端·harmonyos
毛骗导演35 分钟前
OpenClaw 沙箱执行系统深度解析:一条 exec 命令背后的安全长城
前端·架构
天才聪41 分钟前
鸿蒙开发vs前端开发1-父子组件传值
前端
卡尔特斯43 分钟前
Android Studio 代理配置指南
android·前端·android studio
李剑一1 小时前
同样做缩略图,为什么别人又快又稳?踩过无数坑后,我总结出前端缩略图实战指南
前端·vue.js
Jolyne_1 小时前
Taro样式重构记录
前端
恋猫de小郭1 小时前
Google 开源大模型 Gemma4 怎么选,本地跑的话需要什么条件?
前端·人工智能·ai编程
文心快码BaiduComate1 小时前
Comate搭载GLM-5.1:长程8H,对齐Opus 4.6
前端·后端·架构