Extend your eslint with airbnb config

In case you are trying to extend your eslint with eslint-config-airbnb and for some reason you are getting unknown errors, that’s most probably due to conflict between locally and globally installed packages.

To make it globally accessible and to be able to extend each new project with this configuration, simply install the following packages globally on your machine.

Open your local terminal and paste the following command:

sudo npm i eslint eslint-plugin-jsx-a11y eslint-config-airbnb eslint-plugin-react eslint-plugin-import -g

If you on on Windows, using Git bash or cmd, omit the “sudo” keyword.

Keep in mind that we are installing all the packages globally. This means that everything will perfectly work on our computer but be warned, if you push your code to some CI server and do some automatic linting, you will need to have those packages saved locally and listed in your package.json file. Reason for this is that your continuous integration server will need to pre-install all the packages from your package.json before it actually runs all the tests etc. so you want to make sure to have them locally installed.

In your project, create a file called .eslintrc.json and paste the following json into it:

{
    "extends": "airbnb"
}

There you go, Eslint is ready to help you write even awesomer code!