未找到针对import语句抛出规则'jsx-a11y / img-has-alt'的定义

时间:2017-05-11 19:15:14

标签: javascript node.js eslint

我正在使用eslint和airbnb代码样式,我刚刚升级了所有npm个包。现在我看到了错误

  

1:1错误未找到规则'jsx-a11y / img-has-alt'的定义jsx-a11y / img-has-alt

我所有JavaScript文件中的每个第一个import语句。这是我的package.json

{
  "name": "oembed",
  "version": "0.0.1",
  "description": "oEmbed API for embedding content at welt.de",
  "engines": {
    "node": "6.2.1",
    "npm": "3.9.3"
  },
  "main": "server.js",
  "scripts": {
    "dev-webpack": "webpack --progress --colors --watch --config webpack.config.dev.js",
    "dev-server": "NODE_ENV=development nodemon ./server/dist/server.dev.js",
    "dev": "concurrently --kill-others -r \"npm run dev-server\" \"npm run dev-webpack\"",
    "lint": "eslint server/src *.js",
    "build-webpack": "webpack --config webpack.config.prod.js",
    "build": "npm run lint && npm run test && npm run build-webpack",
    "test-watch": "NODE_ENV=test mocha --compilers js:babel-core/register --colors -w ./server/test/*.spec.js ./server/test/**/*.spec.js",
    "test": "NODE_ENV=test mocha --compilers js:babel-core/register --colors ./server/test/*.spec.js ./server/test/**/*.spec.js",
    "report-coverage": "NODE_ENV=test nyc --reporter=lcov --report-dir ./server/coverage npm test",
    "show-coverage": "open ./server/coverage/lcov-report/index.html",
    "coverage": "npm run report-coverage && npm run show-coverage",
    "prestart": "npm run build-webpack",
    "start": "NODE_ENV=production node ./server/dist/server.prod.js weltn24-oembed-service",
    "stop": "killall -SIGINT weltn24-oembed-service"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/WeltN24/oembed.git"
  },
  "keywords": [
    "oembed",
    "embed"
  ],
  "author": "Lukas Bombach",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/WeltN24/oembed/issues"
  },
  "homepage": "https://github.com/WeltN24/oembed#readme",
  "dependencies": {
    "aws-sdk": "^2.3.19",
    "compression": "^1.6.2",
    "cookie-parser": "^1.4.3",
    "cors": "^2.7.1",
    "debug": "^2.2.0",
    "es6-promisify": "^5.0.0",
    "express": "^4.13.4",
    "express-healthcheck": "^0.1.0",
    "express-winston": "^2.4.0",
    "html-minifier": "^3.4.4",
    "http-status": "^1.0.1",
    "i": "^0.3.5",
    "is-json": "^2.0.1",
    "joi": "^10.4.1",
    "json-promise": "^1.1.8",
    "lru-cache": "^4.0.1",
    "md5": "^2.1.0",
    "morgan": "^1.7.0",
    "mustache": "^2.2.1",
    "node-fetch": "^1.6.3",
    "npm": "^4.5.0",
    "regexp-clone": "0.0.1",
    "request": "^2.72.0",
    "winston": "^2.2.0",
    "winston-logentries": "^3.0.0",
    "xml2js": "^0.4.17",
    "xregexp": "^3.1.1",
    "xss": "^0.3.3"
  },
  "devDependencies": {
    "babel-core": "^6.9.1",
    "babel-eslint": "^7.2.3",
    "babel-loader": "^7.0.0",
    "babel-polyfill": "^6.9.1",
    "babel-preset-env": "^1.4.0",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-stage-0": "^6.5.0",
    "chai": "^3.5.0",
    "chai-as-promised": "^6.0.0",
    "chai-joi": "^1.1.0",
    "chai-json-schema": "^1.2.0",
    "chai-string": "^1.2.0",
    "concurrently": "^3.4.0",
    "cz-conventional-changelog": "^2.0.0",
    "eslint": "^3.19.0",
    "eslint-config-airbnb": "^14.1.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^5.0.1",
    "eslint-plugin-react": "^7.0.0",
    "ghooks": "^2.0.0",
    "istanbul": "^0.4.3",
    "mocha": "^3.3.0",
    "mocha-lcov-reporter": "^1.2.0",
    "nodemon": "^1.9.2",
    "nyc": "^10.3.2",
    "sinon": "^2.2.0",
    "sinon-chai": "^2.8.0",
    "supertest": "^3.0.0",
    "supertest-as-promised": "^4.0.2",
    "supertest-chai": "0.0.8",
    "webpack": "^2.5.1",
    "webpack-config": "^7.0.0",
    "webpack-node-externals": "^1.2.0"
  },
  "babel": {
    "presets": [
      [
        "env",
        {
          "targets": {
            "node": "current"
          }
        }
      ]
    ]
  },
  "eslintConfig": {
    "extends": "airbnb",
    "parser": "babel-eslint",
    "ecmaFeatures": {
      "classes": true
    },
    "rules": {
      "no-underscore-dangle": "off",
      "no-throw-literal": "off",
      "max-len": "off"
    },
    "plugins": [
      "jsx-a11y"
    ]
  }
}

1 个答案:

答案 0 :(得分:2)

@lukas这个问题已在github上讨论过:

这可能是找到这类问题的答案的最好方法是通过讨论项目的问题,除非你之前尝试过 enter image description here https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/232