Kaa*_*lti 5 javascript eslint visual-studio-code eslint-config-airbnb eslintrc
如果 div 元素为空,Airbnb linting 规则会删除关闭的 div 标签,例如:
<div></div>
Run Code Online (Sandbox Code Playgroud)
被替换为
<div/>
Run Code Online (Sandbox Code Playgroud)
我的 .eslintrc 文件是这样的:
<div></div>
Run Code Online (Sandbox Code Playgroud)
将“react/self-close-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"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2700 次 |
| 最近记录: |