简体   繁体   English

Eslint - 找不到 eslint-config-airbnb

[英]Eslint - eslint-config-airbnb not find

I'm getting some errors module eslint-config-airbnb not found , when run command eslint **/*.jsx .当运行命令eslint **/*.jsx时,我收到一些错误module eslint-config-airbnb not found

package.json file package.json 文件

{
  "name": "reactapp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "precommit": "npm test",
    "start": "webpack-dev-server --hot"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "husky": "^0.14.3",
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "webpack": "^3.5.5",
    "webpack-dev-server": "^2.7.1"
  },
  "devDependencies": {
    "eslint-config-airbnb": "^15.1.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.3.0"
  }
}

eslintrc file eslintrc 文件

{ "extends": "airbnb" } {“扩展”:“airbnb”}

Check to see if your eslint has been installed / installed correctly.检查您的 eslint 是否已正确安装/安装。 Also reinstall your node_modules folder as well, if eslint has been configured.如果 eslint 已配置,还要重新安装您的 node_modules 文件夹。

Since eslint isn't in your devDependencies, I assumed you've got it set up globally?由于 eslint 不在您的 devDependencies 中,我假设您已经在全球范围内设置了它?

I've copied your package.json set up, but tested it with a local eslint and it's working for me.我已经复制了您的 package.json 设置,但使用本地 eslint 对其进行了测试,它对我有用。

"scripts": 
{
    "precommit": "npm test",
    "start": "webpack-dev-server --hot",
    "lint": "eslint **/*.jsx --fix"
}

...

"devDependencies": 
{
    "eslint": "^4.5.0",
    "eslint-config-airbnb": "^15.1.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.3.0" 
}
npm install -D rimraf prettier babel-eslint eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-import eslint-config-prettier eslint-config-airbnb eslint-plugin-react-hooks
npm run build

Try running this, worked for me.尝试运行它,对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM