Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

commented Dec 27, 2017

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

@neiker

This comment has been minimized.

Copy link

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": []
    }
  },
@brugnaro

This comment has been minimized.

Copy link

commented Jan 29, 2019

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.