【已解决】在 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"]
  }
}
相关推荐
Fairy要carry2 分钟前
项目01-手搓Agent之loop
前端·javascript·python
亲亲小宝宝鸭7 分钟前
Ctrl ACV工程师的提效之路:删掉项目中的冗余
前端
kyriewen10 分钟前
DOM树与节点操作:用JS给网页“动手术”
前端·javascript·面试
米饭同学i14 分钟前
基于腾讯云COS的小程序素材上传功能实现
前端·javascript·react.js
cxxcode14 分钟前
前端性能指标接入 Prometheus 技术方案
前端
辣椒炒代码14 分钟前
🚀 AI Agent 入门实战:基于 LangChain + MCP 构建智能导游助手
前端
ruanCat19 分钟前
前端工程化工具链从零配置:simple-git-hooks + lint-staged + commitlint
前端·git·代码规范
光影少年21 分钟前
如何开发一个CLI工具?
javascript·测试工具·前端框架·node.js
哈__31 分钟前
ReactNative项目OpenHarmony三方库集成实战:react-native-fingerprint-scanner
javascript·react native·react.js
晴栀ay35 分钟前
Generator + RxJS 重构 LLM 流式输出的“丝滑”架构
javascript·后端·llm