我有 CRA,我想安装自定义 eslint (airbnb),但安装后会触发错误
未找到规则“jsx-a11y/img-has-alt”的警告定义 jsx-a11y/img-has-alt
包.json
...
"eslint-config-airbnb": "^15.0.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-react": "^7.0.1",
创建应用程序反应 - 3.10.10
.eslintrc
"extends": [
"airbnb"
],
"plugins": [
"import",
"react",
"jsx-a11y"
],
"env": {
"browser": true,
"node": true,
"jest": true
},
"rules": {
"comma-dangle": ["error", "never"],
"jsx-a11y/img-has-alt": [0],
"jsx-quotes": ["error", "prefer-single"],
"no-confusing-arrow": [0],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/jsx-no-bind": [0],
"react/prop-types": [1],
"react/require-default-props": [0]
}
编辑:npm 说 eslint-config-airbnb 需要 jsx-a11y v5.0.1