eslint: 'eslint --init' installs wrong versions of depencies for AirBnB

Tell us about your environment Windows 10

  • ESLint Version: 3.7.1
  • Node Version: 5.3.0
  • npm Version: 3.3.12

What parser (default, Babel-ESLint, etc.) are you using? N/A Please show your full configuration: AirBnB style guide What did you do? Please include the actual source code causing the issue.

npm init
Use a popular style guide
Airbnb
JSON

What did you expect to happen? I expected the node modules to install correctly. What actually happened? Please include the actual, raw output from ESLint. Eslint failed to correctly install dependencies as seen at the bottom of this output:

C:\SWDev\job-frontend>eslint --init                                                                                                                                                          
? How would you like to configure ESLint? Use a popular style guide                                                                                                                          
? Which style guide do you want to follow? Airbnb                                                                                                                                            
? What format do you want your config file to be in? JSON                                                                                                                                    
Installing eslint-plugin-react, eslint-plugin-jsx-a11y, eslint-plugin-import, eslint-config-airbnb                                                                                           
npm WARN install Couldn't install optional dependency: Unsupported                                                                                                                           
job-frontend@0.0.0 C:\SWDev\job-frontend                                                                                                                                                     
├─┬ eslint@3.7.1                                                                                                                                                                             
│ └── doctrine@1.3.0                                                                                                                                                                         
├─┬ eslint-config-airbnb@12.0.0                                                                                                                                                              
│ ├── eslint-config-airbnb-base@8.0.0                                                                                                                                                        
│ └── UNMET PEER DEPENDENCY eslint-plugin-import@^1.16.0                                                                                                                                     
├─┬ UNMET PEER DEPENDENCY eslint-plugin-import@2.0.0                                                                                                                                         
│ ├── contains-path@0.1.0                                                                                                                                                                    
│ ├── eslint-import-resolver-node@0.2.3   
│ ├─┬ eslint-module-utils@1.0.0                                                                                                                                                              
│ │ └── pkg-dir@1.0.0                                                                                                                                                                        
│ ├── lodash.cond@4.5.2                                                                                                                                                                      
│ └── pkg-up@1.0.0                                                                                                                                                                           
├─┬ eslint-plugin-jsx-a11y@2.2.3                                                                                                                                                             
│ └── damerau-levenshtein@1.0.3                                                                                                                                                              
└── eslint-plugin-react@6.4.1                                                                                                                                                                

npm WARN EPEERINVALID eslint-config-airbnb@12.0.0 requires a peer of eslint-plugin-import@^1.16.0 but none was installed.                                                                    
npm WARN EPEERINVALID eslint-config-airbnb-base@8.0.0 requires a peer of eslint-plugin-import@^1.16.0 but none was installed.                                                                
npm WARN EPACKAGEJSON job-frontend@0.0.0 No license field.

Workaround The AirBnB style guide for standard javascript is actually eslint-config-airbnb-base, the one used by the wizard is for react. So I swapped out that package and chose the versions of the decencies that would work (with either react or standard AirBnB).

Initialized package.json:

    "eslint-config-airbnb": "^12.0.0",
    "eslint-plugin-import": "^2.0.0",
    "eslint-plugin-jsx-a11y": "^2.2.3",

Updated package.json:

    "eslint-config-airbnb-base": "^8.0.0",
    "eslint-plugin-import": "^1.16.0",
    "eslint-plugin-jsx-a11y": "^2.2.2",

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 16 (12 by maintainers)

Commits related to this issue

Most upvoted comments

This is so broken it’s not even funny.

This has been broken for soo long now, are there any other close match standards that just works? Eslint seemed nice but it’s split out in so many packages that this really is becoming a pain to setup.

Please use the bash command in the readme of eslint-config-airbnb to install all the proper peer deps - reproduced here (i’m pretty sure i mentioned it in another issue as well):

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

I highly recommend reusing that command for anything you install that might have peer deps.

Ok, I have no objections to doing it the way @vitorbal showed. To answer your question, yes, we should assume that npm executable is present.