ESLint关闭分号规则 [英] ESLint turn off semicolon rule
本文介绍了ESLint关闭分号规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我搜索关闭分号时,得到"semi":0
或类似的字词我试着放它,但我的短绒棉仍然把分号放在行上.
When I search for turning off semicolon, I get "semi": 0
or similar
I tried to putting it, but still my linter puts semicolon on lines.
下面是我的.eslintrc,我感到困惑的是哪个规则放在了分号上.
Below is my .eslintrc and I am perplexed which rule is putting semicolon.
{
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"jsx-quotes": ["error", "prefer-single"],
"react/jsx-boolean-value": "error",
"react/jsx-curly-spacing": ["error", "never"],
"react/jsx-equals-spacing": ["error", "never"],
"react/jsx-indent": ["error", 2],
"react/jsx-indent-props": ["error", 2],
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-undef": "error",
"react/jsx-tag-spacing": ["error", { "beforeSelfClosing": "always" }],
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/self-closing-comp": "error",
"no-console": 0,
"semi": 0
}
}
推荐答案
尝试添加以下规则:半":[错误",绝不"]
Try to add this rule: "semi": [ "error", "never" ]
如果仍未解决,则问题可能出在更漂亮(如果已安装)或编辑器对其进行控制.
If still not fixed, the problem may be that prettier(if you installed) or editor is controlling it.
进入vscode设置并添加
Go at vscode settings and add
"eslint.autoFixOnSave": true,
这篇关于ESLint关闭分号规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文