Enhancement/husky for auto lint on commit #26
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What issue is this solving?
Closes #15
Description
--fixwith ES Lint and--writewith Prettier to fix lint errors (if possible) and formatting, respectively.Notes
✔️ Run
npm ito install Husky and Lint-StagedLinting or formatting error messages may not be developer-friendly
Solution: Added
CONTRIBUTING.mdto describe how staged files are checked for linting and formatting errors, and to look for the errors if the commit is blocked.Here is how it appears to me using VS Code on Windows. I tested a commit with a lint error and get this popup:
Click "Open Git Log":
This may be a hurdle for some newbie devs. Since there may not be a one-size-fits-all solution, the documentation in CONTRIBUTING.md will help devs understand pre-commit checks.
Please make sure you've attempted to meet the following coding standards