2017-01-31 40 views
0

我有一個react-native項目,並希望使用eslint進行樣式檢查。下面無法安裝eslint與反應原生項目

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 [email protected] --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" 
    } 

...我已經尋找這個問題的人說一下同行的依賴,但運行eslint app/命令時,我得到了下面的錯誤。而我嘗試了不同的版本組合仍然不起作用。

回答

0

1-在您的項目中本地安裝ESLint和您的插件。全局或在包配置中安裝插件都是一種破解。

2-

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

如果不工作,然後嘗試在這裏看,這可能會幫助你https://github.com/AtomLinter/linter-eslint/issues/422

相關問題