Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac WebStorm Error: Cannot find module 'eslint-config-airbnb'

I'm on a ReactNative project and prefer to use airbnb. I have npm install airbnb global:

  1. npm install -g airbnb (and also dependencies)
  2. Made .eslintrc file with config "extends": eslint-config-airbnb
  3. WebStorm enabled ESLint and use above .eslintrc

Got error below:

Error: Cannot find module 'eslint-config-airbnb'

Other info:

  • MacOS
  • WebStorm 2017.1.2
like image 383
Flame Avatar asked May 06 '17 03:05

Flame


People also ask

How do I fix ESLint errors in Webstorm?

Fix problems automatically on saveOpen the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Languages & Frameworks | JavaScript | Code Quality Tools | ESLint, and select the Run eslint --fix on save checkbox.

What is Airbnb ESLint?

ESLint is a tool for “linting” your code. It can analyze your code and warn you of potential errors. In order for it to work, you need to configure it with specific rules. Luckily, Airbnb — as part of their style guide — provides an ESLint configuration that anyone can use.

How do I set path to ESLint package?

You can't run eslint-config-standard directly. You need installing eslint ( npm install eslint --save-dev ) in your project and specify path/to/project/node_modules/eslint as ESLint package: value. my paths may be set up different so do this in conjunction with "Daydream Nation" answer you should get it working.


1 Answers

Plugin and eslint needs to be installed at the same location ie if eslint s global then plugin need to be global and if its local then both need to be local.

With that Webstorm uses local version of eslint and not global (thats how at least work on windows). So make sure you install eslint and plugin locally using npm install.

I hope this helps.

like image 122
Gyandeep Avatar answered Oct 15 '22 02:10

Gyandeep