简体   繁体   中英

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.

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.

Go at vscode settings and add

"eslint.autoFixOnSave": true,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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