Skip to content

Instantly share code, notes, and snippets.

@gupta-ji6
Last active February 21, 2021 22:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gupta-ji6/6d28603c7befb4801d4150876ef8952d to your computer and use it in GitHub Desktop.
Save gupta-ji6/6d28603c7befb4801d4150876ef8952d to your computer and use it in GitHub Desktop.
ESLint + Prettier Setup for React Project
{
"env": {
"browser": true,
"es2020": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
// "plugin:prettier/recommended",
"plugin:jsx-a11y/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"airbnb",
"airbnb/hooks"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": ["react", "import", "jsx-a11y"],
"rules": {
"no-console": "warn",
"no-use-before-define": "error",
"quotes": "warn",
"jsx-quotes": "off",
"object-curly-newline": "warn",
"comma-dangle": "off",
"arrow-body-style": "off",
"no-unused-vars": "warn",
"operator-linebreak": "off",
"import/prefer-default-export": "warn",
"react/jsx-fragments": "off",
"react/prop-types": "off",
"react/no-array-index-key": "warn",
"react/jsx-filename-extension": [
2,
{
"extensions": [".js", ".jsx"]
}
]
}
}
{
"printWidth": 85,
"arrowParens": "always",
"semi": true,
"trailingComma": "es5",
"tabWidth": 2,
"singleQuote": true,
"jsxSingleQuote": true
}
@gupta-ji6
Copy link
Author

Init Command - eslint --init

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

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

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