[英]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. Sublime Text 3 eslinter显示代码第一行的错误消息,指出无法找到react / jsx-quotes的规则。 Here is the config file for eslinter (.eslintrc): 这是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. 我在全局和本地安装了eslint-plugin-react
,这个.eslintrc
位于应用程序的根文件夹中。 I followed several suggestions (like adding "parserOptions") but it did not work. 我遵循了几个建议(比如添加“parserOptions”),但它没有用。 What did I miss? 我错过了什么?
Instead of 代替
"react/jsx-quotes": 1,
use this configuration 使用此配置
"jsx-quotes": [2, "prefer-double"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.