Green-Software-Foundation / if-unofficial-plugins

Impact Framework unofficial models maintained by the community
MIT License
17 stars 19 forks source link

feat(package): use lint-staged for pre-commit hook #51

Closed alexzurbonsen closed 4 months ago

alexzurbonsen commented 6 months ago

Types of changes

A description of the changes proposed in the Pull Request

The current pre-commit hook is a bit could profit from these changes. 1) Safety: Currently, if the pre-commit hook takes into account unstaged changes as well. So technically you can have some unstaged linter fixes which will be not be commited, but the hook will pass anyways. 2) Efficiency: Currently, the entire test suite will be run. With these changes only tests relevant to staged files will be executed.

If this PR finds acceptance, I would add similar changes to the other if repos.

jmcook1186 commented 5 months ago

Hi @alexzurbonsen agree that having the unstaged changes included in the precommit hook is too frictionful - however, we probably do want to keep running all tests at the moment. We are doing a QA review this week though so this might change. We'd be happy to merge this if you can limit the scope to just updating the precommit hook to ignore unstaged changes.

alexzurbonsen commented 5 months ago

Hi @jmcook1186, I pulled the tests out of lint staged again. In my test it worked as expected.

jmcook1186 commented 4 months ago

Hi @narekhovhannisyan can you take another look at this and approve if you are happy. Thanks

narekhovhannisyan commented 4 months ago

@jmcook1186 tried locally, works as expected