biomejs/biome-vscode

✨ Consider adding husky for better development experience

Closed this issue · 1 comments

This is a feature request.

I think it would be a good idea to add husky to the project.
The pre-commit hook could then be used to format/lint automatically before committing.

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx biome format . --write
npx biome lint . --apply

This would prevent the biome ci from failing due to minor mistakes.
It can possibly also be combined with lint-staged to only run on staged files.

If this is something that the team would like implemented, please let me know and I'll gladly set up a pull request with it.

I love the idea, although I'd prefer if we used lefthook, which we've already used in setup-biome.

It could run biome check --apply {staged_files}, which does the same as running format and lint on staged files only.

Here {staged_files} is replaced by lefthook when the command is run.