How to setup ESLint to use AirBnB’s React rules with a React Native project ?

Setting up ESLint can seem daunting but luckily the following ‘dox’ can help
 

Step 1 : Add the required dependencies

yarn add -D eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-react eslint-plugin-jsx-a11y babel-eslint

Step 2 : Configure ESLint

eslint --init

You’ll see a few options that ESLint offers

  1. Select ‘Use a popular style guide’
  2. Select Airbnb
  3. Select JSON
  4. Note: allow it to update newer versions and/or install packages if it asks
Step 3 : Restart your IDE

Step 4 : Paste the following in you .eslintrc.json that ‘eslint –init’ just generated

{
    "env": {
        "node": true, 
        "es6": true 
    },
    "parser": "babel-eslint", 
    "extends": "airbnb"
}
We hope that works, if you find something that works for you better. we’d love to know about it.

CZ Consultants

As we are helping startups and enterprises deliver robust, scalable, secure and quality projects quicker than anyone else, we learn a few tricks along the way from engineers world wide.

Share the ❤️