Skip to content

Instantly share code, notes, and snippets.

@gayanvirajith
Last active June 5, 2021 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gayanvirajith/ffd89ac957965fceeb5d3eae289af17d to your computer and use it in GitHub Desktop.
Save gayanvirajith/ffd89ac957965fceeb5d3eae289af17d to your computer and use it in GitHub Desktop.
React formatters and git hooks

React formatters and git hooks

Note: On visual studio code you should installed Eslint and Prettier plugins

Install dev dependencies.

npm i prettier eslint-config-prettier eslint-plugin-prettier --save-dev

Create .eslintrc file with below contents.

{
    "extends": ["react-app", "plugin:prettier/recommended"]
}

Configure auto formatting with Git hooks

npm i husky lint-staged -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment