1
Sublime Text 3 eslinter顯示代碼第一行的錯誤消息,表示無法找到react/jsx-quotes的規則。下面是eslinter(.eslintrc)配置文件:eslint-plugin-react沒有找到規則
{
"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」),但沒有奏效。我錯過了什麼?
嘗試使用' 「JSX引號」:[2, 「喜歡雙」]'代替'「反應/ jsx-引號「:1,' – Andreyco
https://media.giphy.com/media/U1XhGr8CWqvVC/giphy.gif – boldnik
我根據我的評論添加了答案。請儘可能接受它。 – Andreyco