eslint-plugin-react 找不到规则
eslint-plugin-react does not find a rule
Sublime Text 3 eslinter 显示代码第一行的错误消息说找不到 react/jsx-quotes 的规则。这是 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"
]
}
我在全局和本地安装了 eslint-plugin-react
,这个 .eslintrc
位于应用程序的根文件夹中。我遵循了几个建议(比如添加 "parserOptions"),但没有用。我错过了什么?
而不是
"react/jsx-quotes": 1,
使用此配置
"jsx-quotes": [2, "prefer-double"]
Sublime Text 3 eslinter 显示代码第一行的错误消息说找不到 react/jsx-quotes 的规则。这是 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"
]
}
我在全局和本地安装了 eslint-plugin-react
,这个 .eslintrc
位于应用程序的根文件夹中。我遵循了几个建议(比如添加 "parserOptions"),但没有用。我错过了什么?
而不是
"react/jsx-quotes": 1,
使用此配置
"jsx-quotes": [2, "prefer-double"]