当前位置: 首页 > news >正文

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

错误还原

  1. 搭建 Vite 项目
pnpm create vite my-vue-app --template vue-ts
  1. 安装 eslint-config-ali
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
{"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:

  • Change ESLint’s list of included files to not include this file
  • Change that TSConfig to include this file
  • Create a new TSConfig that includes this file and include it in your parserOptions.project
    See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run–however-that-tsconfig-does-not–none-of-those-tsconfigs-include-this-file

解决办法

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

{"extends": ["eslint-config-ali/typescript/vue"],"parserOptions": {"project": ["tsconfig.json", "tsconfig.node.json"]}
}
http://www.lryc.cn/news/182916.html

相关文章:

  • 蓝桥杯每日一题2023.10.5
  • PyTorch实例:简单线性回归的训练和反向传播解析
  • Arcgis提取玉米种植地分布,并以此为掩膜提取遥感影像
  • 软件工程与计算总结(四)项目管理基础
  • 【Python】datetime 库
  • 从0开始python学习-28.selenium 需要图片验证的登录
  • Nginx搭建Rtmp流媒体服务,并使用Ffmpeg推流
  • IDEA 将一个普通Java工程转化为maven工程
  • linux下的永久保存行号
  • 92岁高龄的创始人张忠谋谈台积电发展史
  • 【VIM】VIm初步使用
  • 教育类《中学政史地》收稿方向-投稿邮箱
  • 数据库的备份与恢复
  • string类的模拟实现(万字讲解超详细)
  • C 函数指针
  • zkVM设计性能分析
  • 调用gethostbyname实现域名解析(附源码)
  • 面向无线传感器网络WSN的增强型MODLEACH设计与仿真(Matlab代码实现)
  • 前端页面初步开发
  • 【赠书活动第3期】《构建新型网络形态下的网络空间安全体系》——用“价值”的视角来看安全
  • 基于SpringBoot的智能推荐的卫生健康系统
  • 几种开源协议的区别(Apache、MIT、BSD、MPL、GPL、LGPL)
  • 通过usb串口发送接收数据
  • Python3数据科学包系列(三):数据分析实战
  • UE4.27.2 自定义 PrimitiveComponent 出现的问题
  • 【docker】数据卷和数据卷容器
  • HTML——列表,表格,表单内容的讲解
  • Mongodb学习
  • 2024届计算机毕业生福利来啦!Python毕业设计选题分享Django毕设选题大全Flask毕设选题最易过题目
  • 网络爬虫指南