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 #19

Closed
svengreb opened this issue Jun 20, 2020 · 1 comment
Closed

Git Hook Manager & Runner: husky #19

svengreb opened this issue Jun 20, 2020 · 1 comment

Comments

@svengreb
Copy link
Owner

svengreb commented Jun 20, 2020

Git hooks made easy 🐶 woof!

In #17 lint-staged was added, a Git Hook runner that runs 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 will be used.

Just like other already added tools (Prettier, remark-lint, lint-staged), husky is (unfortunately) also written in JavaScript. Since NodeJS 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 like lefthook or quickhook, 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 will take 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 will be placed in the project root and includes the command to run for any supported Git hook. It will at least contain entries for the following hooks:

  • pre-commit - Runs lint-staged (Git Hook: lint-staged #17) before each commit to ensure all staged files are compliant to all style guides.
@svengreb svengreb added this to the 0.1.0 milestone Jun 20, 2020
@svengreb svengreb self-assigned this Jun 20, 2020
svengreb added a commit that referenced this issue Jun 20, 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

GH-19
svengreb added a commit that referenced this issue Jun 20, 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
Copy link
Owner Author

Resolves in 49d1fac.

@svengreb svengreb removed their assignment Jun 20, 2020
svengreb added a commit that referenced this issue 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 issue 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

No branches or pull requests

1 participant