What does 'extends: ["airbnb"]' actually do in a React's eslintrc file?

kyw

Say for a React app, I have eslint-config-airbnb and its usual bunch of peer dependencies, and eslint-config-prettier and eslint-plugin-prettier. Is this eslintrc.js as basic as it gets?:

module.exports = {
  parser: 'babel-eslint',
  extends: ['airbnb', 'plugin:prettier/recommended'],
  env: {
    browser: true,
    es6: true
  }
};

I mean I learned from the doc that extending the plugin:prettier/recommended would do things I would have had to do with the eslint-config-prettier alone. So I'm wondering the same thing with extends: "airbnb", like do I need some of the stuffs here like

"parserOptions": {
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  },

I can't seem to find this documented in the eslint-config-airbnb doc..

tungd

It does exactly what it says: extending the AirBnB ESLint config. By extending I mean it will copy/merge the AirBnB config to yours. Overall your understanding is correct.

If you want to know exactly what the AirBnB config does, you can look at their rule file here:

https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/rules/react.js

The JSX snippet is already there, so no, you don't have to add it to your config anymore.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related