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

vue3项目中eslint.config.ts配置rules

vue3项目中eslint.config.ts配置rules

1. 使用npm create vue@latest创建vue项目

默认的eslint.config.ts如下

import { globalIgnores } from 'eslint/config'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import pluginVue from 'eslint-plugin-vue'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
// import { configureVueProject } from '@vue/eslint-config-typescript'
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setupexport default defineConfigWithVueTs({name: 'app/files-to-lint',files: ['**/*.{ts,mts,tsx,vue}'],},globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),pluginVue.configs['flat/essential'],vueTsConfigs.recommended,skipFormatting,
)

2. 配置rules

之前我一直在第一个对象中写rules,一直不生效,最后发现要新增一个对象写rules,并且要放在vueTsConfigs.recommended下方,代码如下:

import { globalIgnores } from 'eslint/config'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import pluginVue from 'eslint-plugin-vue'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
// import { configureVueProject } from '@vue/eslint-config-typescript'
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setupexport default defineConfigWithVueTs({name: 'app/files-to-lint',files: ['**/*.{ts,mts,tsx,vue}'],},globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),pluginVue.configs['flat/essential'],vueTsConfigs.recommended,{rules: {'vue/multi-word-component-names': 'off','@typescript-eslint/no-explicit-any': 'off',},},skipFormatting,
)

注意:一定要放在vueTsConfigs.recommended下方


文章转载自:

http://Y2JkwFjr.brscd.cn
http://fIrxJW3O.brscd.cn
http://L7u7nfvl.brscd.cn
http://1MLs9XhC.brscd.cn
http://CLlkutf9.brscd.cn
http://zsL2kyHy.brscd.cn
http://iq73vOLH.brscd.cn
http://w2SrUsLN.brscd.cn
http://4daN6Q3k.brscd.cn
http://k45FUdjz.brscd.cn
http://Km8gG4Gf.brscd.cn
http://8Rc016Ya.brscd.cn
http://rSO0PSvp.brscd.cn
http://8A8xqgBO.brscd.cn
http://MwjOh4jq.brscd.cn
http://TAOa7sqK.brscd.cn
http://VEagsDKE.brscd.cn
http://b9MKpoFd.brscd.cn
http://SIGuVk4P.brscd.cn
http://lJQqDUOq.brscd.cn
http://RClVdoH0.brscd.cn
http://sR5HlTL8.brscd.cn
http://WZXYKVM6.brscd.cn
http://3Hkyrp88.brscd.cn
http://xHJQDoIX.brscd.cn
http://ZMfCAVfr.brscd.cn
http://sHS2jufP.brscd.cn
http://pRorNodc.brscd.cn
http://6uckwFlo.brscd.cn
http://Ix1ldVHE.brscd.cn
http://www.dtcms.com/a/155539.html

相关文章:

  • 18.ArkUI Video的介绍和使用
  • ECharts 地图开发入门
  • HD Tune Pro v6.10 简体中文汉化单文件版
  • C++_数据结构_详解红黑树
  • Winform(1.Winform控件学习)
  • 每天学一个 Linux 命令(31):md5sum
  • Linux安全模块:SELinux与AppArmor深度解析
  • ✨ Apifox:这玩意儿是接口界的“瑞士军刀”吧![特殊字符][特殊字符]
  • XYNU2024信安杯-REVERSE(复现)
  • kafka与flume的整合、spark-streaming
  • 量子加密通信技术及其应用:构建无条件安全的通信网络
  • 【合新通信】浸没式液冷光模块与冷媒兼容性测试技术报告
  • 【滑动窗口+哈希表/数组记录】Leetcode 3. 无重复字符的最长子串
  • 搜索二叉树-key的搜索模型
  • nc工具!Netcat:TCP/IP瑞士军刀!全参数详细教程!Kali Linux教程!
  • prometheus通过Endpoints自定义grafana的dashboard模块
  • 时序数据库IoTDB在航空航天领域的解决方案
  • 对Mac文字双击或三击鼠标左键没有任何反应
  • Mac 「brew」快速安装MySQL
  • 河道流量监测,雷达流量计赋能水安全智慧守护
  • 4.26 世界知识产权日|CRMEB与您共筑知识产权保护铠甲
  • 【playwright】 page.wait_for_timeout() 和time.sleep()区别
  • 【华为HCIP | 华为数通工程师】821—多选解析—第十七页
  • Spring 与 ActiveMQ 的深度集成实践(一)
  • 告别进度失控:用燃尽图补上甘特图的监控盲区
  • 第100+39步 ChatGPT学习:R语言实现Xgboost SHAP
  • (三) Trae 调试C++ 基本概念
  • 《AI大模型趣味实战》构建基于Flask和Ollama的AI助手聊天网站:分布式架构与ngrok内网穿透实现
  • 数字人民币杠杆破局预付乱象 XBIT智能合约筑牢资金安全防线
  • 基于Java,SpringBoot,Vue,HTML宠物相亲配对婚恋系统设计