简体   繁体   English

ESLint 关闭分号规则

[英]ESLint turn off semicolon rule

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.当我搜索关闭分号时,我得到"semi": 0或类似的信息,我试图将其放入,但我的 linter 仍然将分号放在行上。

Below is my .eslintrc and I am perplexed which rule is putting semicolon.下面是我的 .eslintrc,我很困惑哪个规则放分号。

{
  "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" ]尝试添加此规则: "semi": [ "error", "never" ]

If still not fixed, the problem may be that prettier (if you installed) or editor is controlling it.如果仍未修复,则问题可能是更漂亮(如果您已安装)或编辑器正在控制它。

Go at vscode settings and add进入 vscode 设置并添加

"eslint.autoFixOnSave": true,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM