Page MenuHomePhabricator

Reconsider using Husky in EntitySchema extension
Closed, ResolvedPublic

Description

Currently, the EntitySchema extension uses Husky to install a pre-commit hook that runs lint-staged. However, due to the way Husky works, this also disables the commit-msg hook that is used to generate the Change-Id for Gerrit. We should reconsider if this is worth it, and if we want to keep using Husky or not.

Event Timeline

We currently use Husky v1, which installs itself by generating a script for every possible Git hook in .git/hooks/, silently overwriting any already existing hook there. The latest version is v8, which works differently: it changes the core.hooksPath Git config to point to .husky (see this blog post for details), which turns the hook in .git/hooks/commit-msg into dead code.

IMHO, we should just get rid of Husky. We can instead add something like this to the README developer instructions:

Optionally, run the following command to fix JS linting errors automatically before committing:

ln -s ../../node_modules/.bin/lint-staged .git/hooks/pre-commit

Change 902117 had a related patch set uploaded (by Hoo man; author: Hoo man):

[mediawiki/extensions/EntitySchema@master] Remove husky, document alternative

https://gerrit.wikimedia.org/r/902117

hoo subscribed.

We currently use Husky v1, which installs itself by generating a script for every possible Git hook in .git/hooks/, silently overwriting any already existing hook there. The latest version is v8, which works differently: it changes the core.hooksPath Git config to point to .husky (see this blog post for details), which turns the hook in .git/hooks/commit-msg into dead code.

IMHO, we should just get rid of Husky. […]

Agreed. Being bold, I decided to remove husky.

Change 902117 merged by jenkins-bot:

[mediawiki/extensions/EntitySchema@master] Remove husky, document alternative

https://gerrit.wikimedia.org/r/902117