[英]Eslint airbnb gets enforces self closing div tag if the div is empy. How can I disable this rule?
Airbnb linting rules are removing the closing div tag if the div element is empty eg: 如果div元素为空,则Airbnb的掉毛规则将删除结束div标签,例如:
<div></div>
Is replaced by 被替换为
<div/>
My .eslintrc file is this: 我的.eslintrc文件是这样的:
{ "extends": ["airbnb", "plugin:prettier/recommended"], "parser": "babel-eslint", "parserOptions": { "ecmaVersion": 9, "ecmaFeatures": { "impliedStrict": true, "jsx": true } }, "env": { "node": true, "es6": true }, "plugins": ["react"], "rules": { "react/jsx-filename-extension": ["off"], "react/prefer-stateless-function": ["off"], "arrow-body-style": ["error", "always"], "react/self-closing-comp": [ "error", { "component": true, "html": false } ] } }
Set "react/self-closing-comp" to "off". 将“ react / self-closing-comp”设置为“ off”。
{
"extends": ["airbnb", "plugin:prettier/recommended"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 9,
"ecmaFeatures": {
"impliedStrict": true,
"jsx": true
}
},
"env": {
"node": true,
"es6": true
},
"plugins": ["react"],
"rules": {
"react/jsx-filename-extension": ["off"],
"react/prefer-stateless-function": ["off"],
"arrow-body-style": ["error", "always"],
"react/self-closing-comp": "off"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.