码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 【已解决】在 Vite 项目中使用 eslint-config-ali 时遇到的解析错误


    重现错误

    1. 搭建 Vite 项目
    pnpm create vite my-vue-app --template vue
    
    • 1
    1. 安装
    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
    1. 配置 .eslintrc
    {
      "extends": ["eslint-config-ali/typescript/vue"]
    }
    
    • 1
    • 2
    • 3

    错误信息

    在 vite.config.ts 首行开始处位置:

    Parsing error: ESLint was configured to run on /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

    错误原因

    ESLint 识别包含在 include 属性中的内容,默认是从 tsconfig.json 中读取的,而 vite.config.ts 包含在 tsconfig.node.json 的 include 属性中,通过 references 属性引用到 tsconfig.json 中,造成了 ESLint 识别不到该文件。

    解决错误

    修改 .eslintrc 的 parserOptions.project 配置,增加 tsconfig.node.json,如下:

    {
      "extends": ["eslint-config-ali/typescript/vue"],
      "parserOptions": {
        "project": ["tsconfig.json", "tsconfig.node.json"]
      }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    🎉 搞定!

  • 相关阅读:
    国标GB28181协议客户端开发(一)整体流程和技术选型
    【生产力++】脚本自动化提取待复习内容 极大提高复习效率(下)
    [Linux]多线程编程
    flask 和fastdeploy 快速部署 yolov3
    找不到实时聊天软件?给你推荐电商企业都在用的!
    C# SolidWorks 二次开发 API-Solidworks文件关系与打开文件的方式
    JSP EL表达式的基本语法及运算符(超详细)
    java计算机毕业设计家电售后管理系统源码+mysql数据库+系统+lw文档+部署
    【Leetcode】剑指Offer10:斐波那契数列
    长尾预测效果不好怎么办?试试这两种思路
  • 原文地址:https://blog.csdn.net/zhengh513/article/details/133550915
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号