Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Eslint with airbnb does not load when using .eslint.json

I’m trying to setup linting for a node project. I wish to use the airbnb style guide.

These are my dev dependencies in package.json:

  "devDependencies": {
    "eslint": "^8.2.0",
    "eslint-config-airbnb-base": "^15.0.0",
    "eslint-plugin-import": "^2.25.2"
  }

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This is my .eslintrc.json file:
  {
    "env": {
      "es2021": true,
      "node": true
    },    
    "parserOptions": {
      "ecmaVersion": "latest",
      "sourceType": "module"
    },
    "extends": "airbnb",
    "rules": { /* ... */ }
  }

I keep getting this error (in the VSCode Output terminal):

[Info  - 9:24:00] Failed to load config "airbnb" to extend from. Referenced from: C:\GitWorkspace\lorand.eu\backend\.eslintrc.json

Note that eslint works just fine whenever using .yml or .js files as configuration.

How could I solve this error in the json config file?

P.S While this is a minimal reproducible error, the setup process that yielded the error came by following the instructions in this video:
https://www.youtube.com/watch?v=SydnKbGc7W8&t=1111s

>Solution :

When you use the eslint-config-airbnb-base package via the command below…

  $ npm install --save-dev eslint-config-airbnb-base

…you have to add "airbnb-base" the following to your .eslintrc.json file’s extends field, as seen below:

"extends": "airbnb-base"


The package eslint-config-airbnb that is installed via the command…

npm install –save-dev eslint-config-airbnb

…is the package that you use "extends": "airbnb" to your .eslintrc
file


The difference is that the latter, the airbnb supports react, where the airbnb-base does not.

Obviously, you don’t want to add the unnecessary rules for a framework you’re not using.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading