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

使用 @antfu/eslint-config 配置 eslint (包含兼容uniapp方法)

  1. 安装 pnpm i -D eslint @antfu/eslint-config
  2. 创建 eslint.config.js 文件
// 如果没有在 page.json 配置 "type": "module" 
const antfu = require('@antfu/eslint-config').default
module.exports = antfu()// 配置了 "type": "module" 
import antfu from '@antfu/eslint-config'
export default antfu()
  1. 创建 .vscode/settings.json 文件 配置保存自动修复 (如果不需要可以跳过)
{// Enable the ESlint flat config support"eslint.experimental.useFlatConfig": true,// Disable the default formatter, use eslint instead"prettier.enable": false,"editor.formatOnSave": false,// Auto fix"editor.codeActionsOnSave": {"source.fixAll.eslint": "explicit","source.organizeImports": "never"},// Silent the stylistic rules in you IDE, but still auto fix them"eslint.rules.customizations": [{ "rule": "style/*", "severity": "off" },{ "rule": "*-indent", "severity": "off" },{ "rule": "*-spacing", "severity": "off" },{ "rule": "*-spaces", "severity": "off" },{ "rule": "*-order", "severity": "off" },{ "rule": "*-dangle", "severity": "off" },{ "rule": "*-newline", "severity": "off" },{ "rule": "*quotes", "severity": "off" },{ "rule": "*semi", "severity": "off" }],// Enable eslint for all supported languages"eslint.validate": ["javascript","javascriptreact","typescript","typescriptreact","vue","html","markdown","json","jsonc","yaml"]
}
  1. 修改规则(适用于uniapp)
module.exports = antfu({overrides: {vue: {'vue/component-name-in-template-casing': ['error', 'PascalCase' | 'kebab-case', { registeredComponentsOnly: false, ignores: [] }],},},
})

解释:

  • vue/component-name-in-template-casing 为了解决在uniapp 里面驼峰命名组件无效的问题
http://www.lryc.cn/news/210749.html

相关文章:

  • 我的架构复盘
  • LangChain+LLM实战---LangChain中的6大核心模块
  • 【Android】Android Framework系列---CarPower电源管理
  • io测试【FPGA】
  • vue项目中页面跳转传参的方法
  • 论文速递 TMC 2023 | RoSeFi: 一种利用商用WiFi设备进行稳健的久坐行为监测系统
  • Day 12 python学习笔记
  • DBA笔记(1)
  • C++设计模式_15_Proxy 代理模式
  • Go学习第十四章——Gin请求与响应
  • 【多线程面试题十】、说一说notify()、notifyAll()的区别
  • 【Element UI】解决 el-button 禁用状态下,el-tooltip 提示不生效问题
  • C++单元测试GoogleTest和GoogleMock十分钟快速上手(gtestgmock)
  • Starknet的去中心化路线图
  • python基础语法(十二)
  • 【开源】基于SpringBoot的农村物流配送系统的设计和实现
  • 【2024秋招】2023-9-16 贝壳后端开发一面
  • BI是什么?想要了解BI需要从哪些方面入手?
  • 软件测试---等价类划分(功能测试)
  • javascript原生态xhr上传多个图片,可预览和修改上传图片为固定尺寸比例,防恶意代码,加后端php处理图片
  • 【Java】Map集合中常用方法
  • 方太描画未来厨房的模样
  • ELASTICO-A Secure Sharding Protocol For Open Blockchains
  • 【数据结构】Map和Set
  • Python Flask
  • 时序预测 | Python实现ARIMA-LSTM差分自回归移动平均模型结合长短期记忆神经网络时间序列预测
  • Redis快速上手篇八(redission完善分布式锁)
  • Dataset文件下载以及使用,以nuswide为例
  • ZYNQ连载02-开发环境
  • 前端 :用HTML和css制作一个小米官网的静态页面