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

vue3+TS+eslint9配置

记录eslint升级到9.x的版本之后遇到的坑

  1. 在 ESLint 9 中,配置方式发生了变化。Flat Config 格式(eslint.config.js 或 .ts)不再支持 extensions 选项。所以vscode编辑器中的 extensions 需要注释掉,要不然保存的时候不会格式化。

在这里插入图片描述
2. eslint9 只支持eslint.config.js/eslint.config.ts的写法,使用vite默认生成的项目模板不能格式化

import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginVue from 'eslint-plugin-vue'
import pluginPrettierRecommendedConfigs from 'eslint-plugin-prettier/recommended'
import parserVue from 'vue-eslint-parser';
export default [// eslint 默认推荐规则pluginJs.configs.recommended,// ts 默认推荐规则...tseslint.configs.recommended,// vue3 基础推荐规则...pluginVue.configs['flat/recommended'],// prettier 默认推荐规则pluginPrettierRecommendedConfigs,{languageOptions: {globals: {...globals.browser,...globals.es2020,...globals.node,},ecmaVersion: 2020,parser: parserVue,parserOptions: {parser: tseslint.parser,},},rules: {// 覆盖 TypeScript 严格规则,允许显式 any'@typescript-eslint/no-explicit-any': 'off','vue/multi-word-component-names': 'off','vue/require-default-prop': 'off','@typescript-eslint/no-unused-vars': 'off',},},
]
  1. eslint依赖项
    在这里插入图片描述
  2. eslint 调试方式
    在这里插入图片描述
    查看报错信息依次处理
http://www.xdnf.cn/news/12614.html

相关文章:

  • 《强连通分量》题集
  • 如何在Windows本机安装Python并确保与Python.NET兼容
  • day46python打卡
  • 1.4 编译库:静态库、动态库
  • Java并发包中的管程:Lock和Condition
  • 基于STM32语音识别柔光台灯
  • 基于深度学习的无人机轨迹预测
  • 《ERP原理与应用教程》第3版习题和答案
  • VSCode - VSCode 放大与缩小代码
  • 嵌入式开发之STM32学习笔记day22
  • 深入解析:为什么 Redis 比 MySQL 快
  • 如何轻松、安全地管理密码(新手指南)
  • 创客匠人:如何通过精准定位实现创始人IP打造与知识变现
  • [C语言实战]C语言操作MySQL数据库(八)
  • Ubuntu18.6 学习QT问题记录以及虚拟机安装Ubuntu后的设置
  • 下载和安装Visual Studio(开发ASP.NET MVC应用)
  • 华为仓颉语言初识:并发编程之同步机制(上)
  • TensorFlow安装全攻略:快速搭建AI开发环境
  • 图像识别预处理(配合pytesseract使用)
  • 基于最大相邻夹角的边缘点提取(matlab)
  • 华为大规模——重塑生产力
  • 软信天成:数据驱动型背后的人工智能,基于机器学习的数据管理
  • FPGA定点和浮点数学运算-实例对比
  • opencv2/opencv.hpp里面有哪些常用的函数
  • 从混乱到秩序:探索管理系统如何彻底改变工作流程
  • Spring 团队详解:AOT 缓存实践、JSpecify 空指针安全与支持策略升级
  • Python 构建法律DeepSeek RAG
  • 35.成功解决编写关于“江协科技”编写技巧第二期标志位积累的问题
  • PostgreSQL 的扩展pg_freespacemap
  • Webhook 配置备忘