Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Husky for auto formatting on pre commit #854 #859

Closed
wants to merge 8 commits into from

Conversation

MuntazirHaider
Copy link
Contributor

Description

For husky setup I take following steps -:

  1. Run npm install husky --save-dev and npx husky-init && npm install
  2. These commands make a directory named husky in root directory. In .husky/pre-commit file replace npm test to npm run lint
    npm run format
  3. Modify package.json, In script add lint and format. Add husky configuration in package.json.
  4. In eslintrc.cjs file replace ecmaVersion to 2017

Related Issue

Fixes #856

Motivation and Context

There have been multiple issues while reviewing due to issues with conflicting formats.
Adding Husky to your project to enforce code formatting and linting before commits is a great way to maintain code quality.

How Has This Been Tested?

For Testing husky setup Suppose we have a formatting or linting issue try to commit if Husky blocks the commit due to ESLint issues, review the ESLint output and address the reported issues in your code. Once the issues are resolved, you can attempt the commit again if Husky doesn't block the commit this time and the commit goes through, it means its working fine.

Screenshots or GIF (In case of UI changes):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant