How to install eslint-config-airbnb correctly? `INDEPENDENT INDEPENDENCE

➜ beslint git:(master) ✗ eslint -v v3.15.0 ➜ beslint git:(master) ✗ npm install -g eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react /Users/next/.nvm/versions/node/v7.5.0/lib ├── UNMET PEER DEPENDENCY eslint@ ^3.15.0 ├─┬ eslint-config-airbnb@14.1.0 │ └── UNMET PEER DEPENDENCY eslint@ ^3.15.0 ├── eslint-plugin-import@2.2.0 ├── eslint-plugin-jsx-a11y@4.0.0 └── eslint-plugin-react@6.10.0 npm WARN eslint-config-airbnb@14.1.0 requires a peer of eslint@ ^3.15.0 but none was installed. npm WARN eslint-config-airbnb-base@11.1.0 requires a peer of eslint@ ^3.15.0 but none was installed. npm WARN eslint-plugin-import@2.2.0 requires a peer of eslint@2.x - 3.x but none was installed. npm WARN eslint-plugin-jsx-a11y@4.0.0 requires a peer of eslint@ ^2.10.2 || 3.x but none was installed. npm WARN eslint-plugin-react@6.10.0 requires a peer of eslint@ ^2.0.0 || ^3.0.0 but none was installed. ➜ beslint git:(master) ✗ 
  • I'm tired of installing globally
  • I use nvm to install node 7.5.0 and installed eslint globally.
  • when i try to install eslint-config-airbnb globally.
  • He said UNMET PEER DEPENDENCY
+6
source share
4 answers

I ran into a similar problem, but found a solution to this problem. I thought it was worth sharing.

To install the correct versions of each eslint configuration associated with a package, you can run the following command:

 npm info " eslint-config-airbnb@latest " peerDependencies 

You can get an exact dependency on peers that are listed when executing the command:

for example, on exits (with a response date) will cause the following:

 { eslint: '^3.19.0 || ^4.3.0', 'eslint-plugin-jsx-a11y': '^5.1.1', 'eslint-plugin-import': '^2.7.0', 'eslint-plugin-react': '^7.1.0' } 

From the above, you can find out exactly what dependencies to install for the current one (last build).

If you want to install all the dependencies at once (only for Linux / OSX users) Use the command below:

 ( export PKG=eslint-config-airbnb; npm info " $PKG@latest " peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev " $PKG@latest " ) 

More details here .

+2
source

Removing node modules ( rm -rf node_modules/ ) and restarting npm install worked for me !!

0
source

You can install eslint-config-airbnb-bundle . This is the unchanged configuration of the Airbnb style guide bundled with ESLint in one package to solve some installation inconvenience (for example, unsatisfied peer error warnings). You can also install it globally:

 npm i -g eslint-config-airbnb-bundle 

Airbnb only: https://www.npmjs.com/package/eslint-config-airbnb-bundle

Airbnb + Standard: https://www.npmjs.com/package/eslint-config-airbnb-standard

0
source

I do not think that you should establish everything global. Try the following:

npm install --save-dev eslint eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react

-one
source

Source: https://habr.com/ru/post/1015053/


All Articles