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

Git Hook Manager & Runner: husky #20

Merged
merged 1 commit into from
Jun 20, 2020

Conversation

svengreb
Copy link
Owner

Resolves #19

In GH-17 lint-staged [1] was added, a Git Hook [2] run linters against
staged files before each commit.
To automatically run this and other hooks that might be added later on,
the hook manager and runner husky [3] is used.

Like the already added tools Prettier [4], remark-lint [5] and
lint-staged [6] it is (unfortunately) also written in JavaScript again
Since NodeJS [7] is therefore already a development dependency it
doesn't really matter that husky is another NPM package too.
Unlike these previous tools there are indeed alternatives written in
Go [8] like lefthook [9] or quickhook [10], but it requires time to test
and evaluate them before actually replacing husky. Also a long as there
are no comparable alternatives to the already used tools listed above,
this template would be more complex by requiring both Node and Go as
development dependency. Therefore husky takes over the part as hook
manager & runner since it is a stable, production-proven and advanced
project that I already use in almost any other project setup.

>>> Configuration

The `.huskyrc.js` configuration file is placed in the project root and
includes the command to run for any supported Git hook [11].
Initially it contains entries for the following hooks:

- `pre-commit` - Runs lint-staged (GH-17) before each commit to ensure
  all staged files are compliant to all style guides.

[1]: https://github.com/okonet/lint-staged
[2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
[3]: https://github.com/typicode/husky
[4]: #13
[5]: #15
[6]: #17
[7]: https://nodejs.org
[8]: https://go.dev
[9]: https://github.com/Arkweid/lefthook
[10]: https://github.com/dirk/quickhook
[11]: https://github.com/typicode/husky/blob/master/DOCS.md#supported-hooks

GH-19
@svengreb svengreb added this to the 0.1.0 milestone Jun 20, 2020
@svengreb svengreb self-assigned this Jun 20, 2020
@svengreb svengreb merged commit 49d1fac into base Jun 20, 2020
@svengreb svengreb deleted the feature/gh-19-git-hook-manager-runner-husky branch June 20, 2020 07:42
@svengreb svengreb removed their assignment Jun 20, 2020
svengreb added a commit that referenced this pull request Aug 22, 2020
In GH-17 lint-staged [1] was added, a Git Hook [2] run linters against
staged files before each commit.
To automatically run this and other hooks that might be added later on,
the hook manager and runner husky [3] is used.

Like the already added tools Prettier [4], remark-lint [5] and
lint-staged [6] it is (unfortunately) also written in JavaScript again
Since NodeJS [7] is therefore already a development dependency it
doesn't really matter that husky is another NPM package too.
Unlike these previous tools there are indeed alternatives written in
Go [8] like lefthook [9] or quickhook [10], but it requires time to test
and evaluate them before actually replacing husky. Also a long as there
are no comparable alternatives to the already used tools listed above,
this template would be more complex by requiring both Node and Go as
development dependency. Therefore husky takes over the part as hook
manager & runner since it is a stable, production-proven and advanced
project that I already use in almost any other project setup.

>>> Configuration

The `.huskyrc.js` configuration file is placed in the project root and
includes the command to run for any supported Git hook [11].
Initially it contains entries for the following hooks:

- `pre-commit` - Runs lint-staged (GH-17) before each commit to ensure
  all staged files are compliant to all style guides.

[1]: https://github.com/okonet/lint-staged
[2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
[3]: https://github.com/typicode/husky
[4]: #13
[5]: #15
[6]: #17
[7]: https://nodejs.org
[8]: https://go.dev
[9]: https://github.com/Arkweid/lefthook
[10]: https://github.com/dirk/quickhook
[11]: https://github.com/typicode/husky/blob/master/DOCS.md#supported-hooks

Resolves GH-19
svengreb added a commit that referenced this pull request Aug 22, 2020
In GH-17 lint-staged [1] was added, a Git Hook [2] run linters against
staged files before each commit.
To automatically run this and other hooks that might be added later on,
the hook manager and runner husky [3] is used.

Like the already added tools Prettier [4], remark-lint [5] and
lint-staged [6] it is (unfortunately) also written in JavaScript again
Since NodeJS [7] is therefore already a development dependency it
doesn't really matter that husky is another NPM package too.
Unlike these previous tools there are indeed alternatives written in
Go [8] like lefthook [9] or quickhook [10], but it requires time to test
and evaluate them before actually replacing husky. Also a long as there
are no comparable alternatives to the already used tools listed above,
this template would be more complex by requiring both Node and Go as
development dependency. Therefore husky takes over the part as hook
manager & runner since it is a stable, production-proven and advanced
project that I already use in almost any other project setup.

>>> Configuration

The `.huskyrc.js` configuration file is placed in the project root and
includes the command to run for any supported Git hook [11].
Initially it contains entries for the following hooks:

- `pre-commit` - Runs lint-staged (GH-17) before each commit to ensure
  all staged files are compliant to all style guides.

[1]: https://github.com/okonet/lint-staged
[2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
[3]: https://github.com/typicode/husky
[4]: #13
[5]: #15
[6]: #17
[7]: https://nodejs.org
[8]: https://go.dev
[9]: https://github.com/Arkweid/lefthook
[10]: https://github.com/dirk/quickhook
[11]: https://github.com/typicode/husky/blob/master/DOCS.md#supported-hooks

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

Successfully merging this pull request may close these issues.

1 participant