Reputation: 309
EDIT2: Now it works. Had to remove all local eslint packages. All is good!
EDIT: Okay, after installing the specific version it was complaining about(^1.16.0) it now works in command line again. But that did sadly not help for within Sublime. Are there any settings that might be wrong here?
I had this working before but after installing the same packages again by mistake, it broke. Ultimately I'm trying to get ESLINT to work with Sublime. And I think everything in Sublime is correct since I haven't changed anything there. It's just that Eslint doesn't work anymore which 'eslint app.jsx' etc shows (see below).
I get this error of unmet peer dependencies on eslint-plugin-import.
aa:myResolutions Andreas$ sudo npm install -g eslint eslint-plugin-import
Password:
/usr/local/bin/eslint -> /usr/local/lib/node_modules/eslint/bin/eslint.js
/usr/local/lib
├── [email protected]
└── [email protected]
aa:myResolutions Andreas$ sudo npm install -g eslint eslint-plugin-import
eslint-config-airbnb eslint-plugin-react eslint-plugin-jsx-a11y
/usr/local/bin/eslint -> /usr/local/lib/node_modules/eslint/bin/eslint.js
/usr/local/lib
├── [email protected]
├─┬ [email protected]
│ └── UNMET PEER DEPENDENCY eslint-plugin-import@^1.16.0
├── UNMET PEER DEPENDENCY [email protected]
├── [email protected]
└── [email protected]
npm WARN [email protected] requires a peer of eslint-plugin-
import@^1.16.0 but none was installed.
npm WARN [email protected] requires a peer of eslint-plugin-
import@^1.16.0 but none was installed.
aa:myResolutions Andreas$ eslint App.jsx
Oops! Something went wrong! :(
ESLint couldn't find the plugin "eslint-plugin-import". This can happen for a
couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-import 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-import@latest --save-dev
I don't get it. I first installed it. But then it's not installed anymore? Or at least it can't be found by some other packages?
Been scratching my head on this for over a day now. All plugins are installed globally so that shouldn't be the issue, and it was like that before it broke as well. And I've completely reinstalled node/npm but nothing seems to help.
Anyone have any idea as how to solve this?
Upvotes: 2
Views: 9354
Reputation: 11
After uninstalling eslint-plugin-import
, eslint-plugin-jsx-a11y
, eslint-plugin-jsx-a11y
, and eslint-plugin-react
, you can install eslint-config-airbnb
along with its peer dependencies:
For npm 5+:
npx install-peerdeps --dev eslint-config-airbnb
For npm < 5:
(
export PKG=eslint-config-airbnb;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)
Upvotes: 0
Reputation: 61
Notice that on the AirBnB config package, they state some additional information before installing.
First remove all the packages that were installed, which should be the following:
npm uninstall eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-import
Next, terminal run:
export PKG=eslint-config-airbnb;
npm info "$PKG" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG"
This will produce the correct dependencies eg:
npm install --save-dev eslint-config-airbnb eslint@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-react@^#.#.#
Upvotes: 6