Skip to content

Instantly share code, notes, and snippets.

@gupta-ji6
Last active April 20, 2021 14:46
Show Gist options
  • Save gupta-ji6/f767eb7119d9432bff27cc60e17c314d to your computer and use it in GitHub Desktop.
Save gupta-ji6/f767eb7119d9432bff27cc60e17c314d to your computer and use it in GitHub Desktop.
ESLint Setup for React Native Projects
{
"env": {
"browser": true,
"es6": true,
"node": true,
"react-native/react-native": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"airbnb",
"airbnb/hooks"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["react", "react-native", "jsx-a11y"],
"rules": {
"quotes": 1,
"no-use-before-define": 0,
"react/jsx-filename-extension": [
2,
{
"extensions": [".js", ".jsx"]
}
],
"react/prop-types": 0,
"react-native/no-unused-styles": 2,
"react-native/split-platform-components": 2,
"react-native/no-inline-styles": 1,
"react-native/no-color-literals": 0,
"react-native/no-raw-text": 2,
"react-native/no-single-element-style-arrays": 2,
"comma-dangle": "off"
}
}
@gupta-ji6
Copy link
Author

gupta-ji6 commented Aug 13, 2020

devDependencies required are:

  1. babel-eslint
  2. eslint-config-airbnb
  3. eslint-plugin-import
  4. eslint-plugin-jsx-a11y
  5. eslint-plugin-react
  6. eslint-plugin-react-hooks
  7. eslint-plugin-react-native

Command to install them all:
npm i -D babel-eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-native

OR

yarn add --dev babel-eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-native

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