惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
WordPress大学
WordPress大学
U
Unit 42
I
InfoQ
A
About on SuperTechFans
宝玉的分享
宝玉的分享
J
Java Code Geeks
博客园 - 司徒正美
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
G
Google Developers Blog
人人都是产品经理
人人都是产品经理
小众软件
小众软件
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
腾讯CDC
Recent Announcements
Recent Announcements

博客园 - 草率的龙果果

window 11 Ultra5‑125H,Arrow Lake 卡顿解决办法 npm配置内网,git配置内网 jenkins打包完镜像更新页面没有变化 vue2 element ui dialog拖拽功能实现。 AI整理提示词 数字转换为中文数字 前端数据导出excel工具函数 自动监测数据有效传输率统计算法说明 echarts官方扩展vue组件vue-echarts实现链接两个charts实现联动 OPPO商店签名认领应用 iframe跨域通信(postMessage) 博文阅读密码验证 - 博客园 项目常用工具函数获取url参数和hash参数 Copilot键怎么改成Ctrl键? plus.downloader.createDownload 发送 POST 请求并携带 token vue2,vue3中在template中使用component组件is属性绑定jsx的vnode vue3 vite idea中control+鼠标单击不能跳转到文件定义的解决办法 Vue2项目解决van-calendar 显示白色空白,需滑动一下屏幕,才可正常显示 Windows Terminal/Powershell 设置自动补全, 智能提示 【类似于mac的iterm2功能】 vue中使用axios获取不到响应头Content-Disposition的解决办法 ES7 新增方法:Array.prototype.some、Array.prototype.every 博文阅读密码验证 - 博客园 vue2使用openlayers10.3.0版本组包 javascript跨域问题排查
vue/html-self-closing
草率的龙果果 · 2025-02-20 · via 博客园 - 草率的龙果果

安装依赖

pnpm i eslint-plugin-vue --save-dev
pnpm install eslint-plugin-react --save-dev

 eslint

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    "plugin:vue/essential",
    "plugin:vue/recommended",
    "eslint:recommended",
    "@vue/prettier",
  ],
  parserOptions: {
    parser: "@babel/eslint-parser",
  },
  rules: {
    "vue/html-self-closing": [
      "error",
      {
        html: {
          void: "any",
          normal: "always",
          component: "always",
        },
        svg: "always",
        math: "always",
      },
    ],
    "react/self-closing-comp": [
      "error",
      {
        // 使用这个规则来处理 JSX 自闭合
        component: true,
        html: true,
      },
    ],
    "vue/component-name-in-template-casing": [
      "error",
      "kebab-case",
      {
        registeredComponentsOnly: false,
        ignores: ["currentPage", "pageSize"],
      },
    ],
    // "vue/name-property-casing": ["error", "kebab-case"],
    "vue/order-in-components": [
      "error",
      {
        order: [
          "name",
          "components",
          "props",
          "data",
          "computed",
          "watch",
          "methods",
          "beforeCreate",
          "created",
          "beforeMount",
          "mounted",
          "beforeUpdate",
          "updated",
          "beforeDestroy",
          "destroyed",
          "activated",
          "deactivated",
          "errorCaptured",
          "filters",
          "directives",
          "provide",
          "inject",
        ],
      },
    ],
    "vue/attributes-order": [
      "error",
      {
        order: [
          // ["id"],
          // ["class"],
          // "name",
          // "data-*",
          // "src",
          // "href",
          // "alt",
          // "title",
          // "style",
          // "v-*",
          // "on*",
          // "bind*",
          // "directives*",
          // "slot",
          // "key"
        ],
      },
    ],
    "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
    "no-unused-vars": "off",
    eqeqeq: "error",
    "prettier/prettier": [
      "error",
      {
        semi: false,
        singleQuote: true,
        printWidth: 80,
        endOfLine: "auto",
        trailingComma: "none",
        proseWrap: "never",
        arrowParens: "avoid",
      },
    ],
    "vue/no-unused-components": 0,
  },
  globals: {
    T: true,
  },
  overrides: [
    {
      files: [
        "**/__tests__/*.{j,t}s?(x)",
        "**/tests/unit/**/*.spec.{j,t}s?(x)",
      ],
      env: {
        mocha: true,
      },
    },
  ],
  plugins: [
    "react", // 添加这一行
  ],
};