Disallow self-closing on HTML void elements

环境:

vue cli 3.0初始化带有eslint项目

触发位置:

avatar

解决:

报错内容是:不允许对HTML void元素进行自动关闭

方法一:

avatar

方法二:

修改文件.eslintrc.js

...
rules: {
...
	"vue/html-self-closing": ["error", {
      "html": {
        "void": "always",
        "normal": "never",
        "component": "always"
      },
      "svg": "always",
      "math": "always"
    }],
...
}
...

详情:参考链接

配置1:

{
  "vue/html-self-closing": ["error", {
    "html": {
      "void": "never",
      "normal": "always",
      "component": "always"
    },
    "svg": "always",
    "math": "always"
  }]
}

示例1:


配置2:

{
  "vue/html-self-closing": ["error", {
    "html": {
      "void": "always",
      "normal": "never",
      "component": "always"
    },
    "svg": "always",
    "math": "always"
  }]
}

示例2:


你可能感兴趣的:(vue,html,vue.js,html)