Skip to content

Instantly share code, notes, and snippets.

@vinothpandian
Created January 5, 2020 00:09
Show Gist options
  • Save vinothpandian/fb8b72a9d6ea817f1e8317b1e8a156cb to your computer and use it in GitHub Desktop.
Save vinothpandian/fb8b72a9d6ea817f1e8317b1e8a156cb to your computer and use it in GitHub Desktop.
Add eslint airbnb guidelines to create-react-app
yarn add -D eslint-config-airbnb eslint-config-prettier prettier eslint-plugin-{jsx-a11y,prettier,react,react-hooks}
cat <<EOF >./.eslintrc
{
"env": {
"browser": true
},
"extends": [
"react-app",
"airbnb",
"plugin:jsx-a11y/recommended",
"prettier",
"prettier/react"
],
"plugins": ["jsx-a11y", "react-hooks", "prettier"],
"rules": {
// Allow single Named-export
"import/prefer-default-export": "off",
// Set react-hooks lint as error
"react-hooks/rules-of-hooks": "error"
}
}
EOF
cat <<EOF >./.eslintignore
src/serviceWorker.js
EOF
@vinothpandian
Copy link
Author

To install directly run the following command inside the app folder created using create-react-app

curl https://gist.githubusercontent.com/vinothpandian/fb8b72a9d6ea817f1e8317b1e8a156cb/raw/6dbe3afd1c70bfec16ed002ca22ef7efad66f89a/add-react-airbnb-eslint.sh | bash

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