web icon indicating copy to clipboard operation
web copied to clipboard

Husky pre post commit hooks

Open dmnisson opened this issue 5 years ago • 1 comments

Links

  • Issue: https://github.com/UPchieve/web/issues/338

Description

  • Scripts are added to pre-commit and post-commit hooks to ensure that automatic changes made by the linter are staged for the commit.
  • A stash is used to ensure that unstaged changes are kept in the working tree, and only staged files are linted before they are committed.
  • It's possible someone could stage some changes, run git commit meaning to commit the originally staged changes, then make further changes while the linter is still running. If the commit fails, then this setup will overwrite the original changes with the new changes. We should address this edge case at some point, but for now most people will probably not want to bring back lint errors that have been auto fixed.

Developer self-review checklist

  • [x] Potentially confusing code has been explained with comments
  • [x] No warnings or errors have been introduced; all known error cases have been handled
  • [ ] Any appropriate documentation (within the code, README.md, docs, etc) has been updated
  • [ ] All edge cases have been addressed

dmnisson avatar Mar 04 '20 21:03 dmnisson

Hmm, would it be possible to edit a file and not have it come back to the working tree as "Modified"? I'm still coming across that problem that we talked about earlier where the file before it was committed and linted pops back on as "Modified"

Screen Shot 2020-04-14 at 1 29 28 AM Screen Shot 2020-04-14 at 1 29 45 AM

treystevens avatar Apr 14 '20 05:04 treystevens