Cory Robinson
Cory Robinson

Reputation: 5262

WebStorm setup/configure eslint for React project

Using: WebStorm 2016.3

I'm getting all kinds of warnings from eslint after setting up a project using create-react-app.

The documentation is not clear on settings to use/ignore useful eslint warnings in my project.

Upvotes: 0

Views: 1466

Answers (1)

Cory Robinson
Cory Robinson

Reputation: 5262

First setup/install: npm i -D eslint babel-eslint in your project

Then go into Webstorm Preferences > Language & Frameworks > Javascript > Code Quality Tools > ESLint

  1. Set your ESLint package to point to either the current projects .../node_modules/eslint/ or some other directory where you have eslint installed via npm.
  2. Make sure "Automatic search" is checked, this will use the .eslintrc file in your project directory
  3. Create .eslintrc in your project directory root & add configuration:

{
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true,
      "modules": true
    }
  },
  "rules": {}
}

Upvotes: 1

Related Questions