简体   繁体   中英

eslint-plugin-react does not find a rule

Sublime Text 3 eslinter shows error message for the first line of the code saying can't find a rule for react/jsx-quotes. Here is the config file for eslinter (.eslintrc):

{
  "ecmaFeatures": {
  "modules": true,
  "jsx": true
},
"env": {
        "browser": true,
        "node": true,
        "es6": true,
        "jasmine": true
      },
      "rules": {
        "strict": 0,
        "no-underscore-dangle": 0,
        "quotes": [2, "single"],
        "max-len": [1, 80, 4],
        "no-trailing-spaces": [2, { skipBlankLines: true }],
        "no-mixed-spaces-and-tabs": [2, "smart-tabs"],
        "no-unused-vars": [1, {"vars": "all", "args": "after-used"}],
        "semi": [1, "always"],
        "no-unused-expressions": 1,
        "no-shadow": 0,
        "no-redeclare": 0,
        "new-cap": 0,

        "react/display-name": 0,
        "react/jsx-boolean-value": 1,
        "react/jsx-no-undef": 1,
        "react/jsx-quotes": 1,
        "react/jsx-sort-prop-types": 1,
        "react/jsx-sort-props": 0,
        "react/jsx-uses-react": 1,
        "react/jsx-uses-vars": 1,
        "react/no-did-mount-set-state": 0,
        "react/no-did-update-set-state": 0,
        "react/no-multi-comp": 0,
        "react/no-unknown-property": 1,
        "react/prop-types": 0,
        "react/react-in-jsx-scope": 1,
        "react/self-closing-comp": 1,
        "react/sort-comp": 1,
        "react/wrap-multilines": 1,
      },
      "plugins": [
        "react"
      ]
    }

I have the eslint-plugin-react installed globally and locally and this .eslintrc is located in the root folder of the app. I followed several suggestions (like adding "parserOptions") but it did not work. What did I miss?

Instead of

"react/jsx-quotes": 1,

use this configuration

"jsx-quotes": [2, "prefer-double"]

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