繁体   English   中英

无法使用本机项目安装eslint

[英]Failed to install eslint with react-native project

我有一个本机反应项目,想使用eslint进行样式检查。 但是运行eslint app/命令时出现以下错误:

ESLint couldn't find the plugin "eslint-plugin-jsx-a11y". This can happen for a couple different reasons:

1. If ESLint is installed globally, then make sure eslint-plugin-jsx-a11y is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.

2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm i eslint-plugin-jsx-a11y@latest --save-dev

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

以下是我的package.json文件:

"dependencies": {
    "react": "15.4.2",
    "react-native": "0.40.0",
    "react-redux": "^5.0.2",
    "redux": "^3.6.0",
    "redux-actions": "^1.2.1",
    "redux-thunk": "^2.2.0"
  },
  "devDependencies": {
    "babel-jest": "18.0.0",
    "babel-preset-react-native": "1.9.1",
    "eslint": "^3.14.1",
    "eslint-config-airbnb": "^14.0.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^3.0.2",
    "eslint-plugin-react": "^6.9.0",
    "jest": "18.1.0",
    "react-test-renderer": "15.4.2"
  },
  "jest": {
    "preset": "react-native"
  }

我已经搜索了有人对同伴依赖性说的这个问题。 而且我尝试了不同的版本组合仍然无法正常工作。

1-在您的项目中本地安装ESLint和您的插件。 在全球范围内或在软件包配置中安装插件有点麻烦。

2-

cd ~/.atom/packages/linter-eslint/
    npm install eslint-plugin-react

如果这不起作用,请尝试在此处查看,这可能会对您有所帮助https://github.com/AtomLinter/linter-eslint/issues/422

暂无
暂无

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

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