admin管理员组文章数量:1312658
Airbnb linting rules are removing the closing div tag if the div element is empty eg:
<div></div>
Is replaced by
<div/>
My .eslintrc file is this:
{
"extends": ["airbnb", "plugin:prettier/remended"],
"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-p": [
"error",
{
"ponent": true,
"html": false
}
]
}
}
Airbnb linting rules are removing the closing div tag if the div element is empty eg:
<div></div>
Is replaced by
<div/>
My .eslintrc file is this:
{
"extends": ["airbnb", "plugin:prettier/remended"],
"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-p": [
"error",
{
"ponent": true,
"html": false
}
]
}
}
Share
Improve this question
asked Oct 22, 2018 at 23:40
Kaan YaltiKaan Yalti
1232 silver badges9 bronze badges
4
-
have you tried
"react/self-closing-p": [0]
? – Julio Betta Commented Oct 23, 2018 at 0:07 - @JulioBetta Doesn't work unfortunately – Kaan Yalti Commented Oct 23, 2018 at 1:21
- I know that this is a dumb question, but have you tried to restart your code editor after editing .eslintrc.json? Sometimes I have to do that with VS Code to apply the changes... it's weird, but it happens =) – Julio Betta Commented Oct 23, 2018 at 1:26
- @JulioBetta I tried it, didn't make any difference – Kaan Yalti Commented Oct 23, 2018 at 1:59
2 Answers
Reset to default 4Set "react/self-closing-p" to "off".
{
"extends": ["airbnb", "plugin:prettier/remended"],
"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-p": "off"
}
}
I know this post is quiet old but for those who need, I have found a solution, which worked for me :
try :
module.exports = {
extends: [
'eslint:remended',
'plugin:vue/vue3-remended'
],
rules: {
'vue/no-unused-vars': 'error',
'vue/multi-word-ponent-names': 'off',
'vue/html-self-closing': 'off',
indent: 'off'
}
}
That's how my config file looks like with Vue3, maybe it can help.
本文标签:
版权声明:本文标题:javascript - Eslint airbnb gets enforces self closing div tag if the div is empy. How can I disable this rule? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741879364a2402654.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论