Skip to content

Instantly share code, notes, and snippets.

@radiovisual
Last active October 30, 2021 11:55
Show Gist options
  • Star 71 You must be signed in to star a gist
  • Fork 23 You must be signed in to fork a gist
  • Save radiovisual/7c27e5a1d0f7aa56e0e3922c98e19ffc to your computer and use it in GitHub Desktop.
Save radiovisual/7c27e5a1d0f7aa56e0e3922c98e19ffc to your computer and use it in GitHub Desktop.
React Native AirBnB ESLint Config
{
"parser": "babel-eslint",
"plugins": [
"react",
"react-native"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
}
},
"extends" : [
"eslint:recommended",
"plugin:react/recommended",
"airbnb-base"
],
"rules" : {
"arrow-body-style" : 'warn'
}
}
npm install --save-dev babel-eslint eslint-config-airbnb-base eslint-plugin-react eslint-plugin-react-native
@hansfpc
Copy link

hansfpc commented Dec 27, 2017

Thanks, but you've a typo in line 19: JSON standard does not allow single quoted strings 👍

@neiker
Copy link

neiker commented Dec 2, 2018

You also need to install eslint-plugin-import and eslint. I asume you forgot them because you have them installed globally, wich is a bat practice, so: npm i eslint-plugin-import eslint --save-dev.

Then can run npx eslint . or add this scripts to your package.json:

"lint": "eslint .",
"lint-fix": "eslint . --fix"

And then run npm run estlint or npm run eslint-fix if you want to autofix your code.

Also is cool to have a pre-commit hook with eslint, maybe using pre-git npm package and adding this to the package.json:

  "config": {
    "pre-git": {
      "pre-commit": [
        "npm run lint"
      ],
      "pre-push": [],
      "post-commit": [],
      "post-checkout": [],
      "post-merge": []
    }
  },

@brugnaro2022
Copy link

Thanks.

@mhdrezky
Copy link

Awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment