How to setup React Native project to use AirBnB's React rules via ESLint?

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"
}

Did it work?

Have an idea?

Let us transform your idea into a Scalable Product

Phone

424-388-1279

Address

1450 2nd St, Santa Monica, CA 90401