Skip to content

Commit d01e1cb

Browse files
chore(root): add commitlint as a husky commit-msg hook
Add a commit-msg husky hook that runs `yarn check-commits` to validate commit messages locally. This ensures conventional commit format is enforced before commits are pushed, for all developers regardless of their shell setup. Reverts the nix-specific pre-commit-hooks approach in favor of the simpler husky-based hook which works universally after `yarn install`. WAL-565
1 parent bf7cd0e commit d01e1cb

3 files changed

Lines changed: 7 additions & 87 deletions

File tree

.husky/commit-msg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
rootDir=$(pwd)
4+
cd "$rootDir"
5+
6+
yarn check-commits

flake.lock

Lines changed: 1 addition & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22
inputs = {
33
nixpkgs.url = "github:nixos/nixpkgs";
44
nixpkgs-nodejs.url = "github:nixos/nixpkgs/6ad174a6dc07c7742fc64005265addf87ad08615"; # Node.js 22.14.0
5-
pre-commit-hooks = {
6-
url = "github:cachix/pre-commit-hooks.nix";
7-
# Avoids pulling in a second version of `nixpkgs`
8-
inputs = {
9-
nixpkgs.follows = "nixpkgs";
10-
};
11-
};
125
};
136

147
outputs = {
158
self,
169
nixpkgs,
1710
nixpkgs-nodejs,
18-
pre-commit-hooks,
1911
}: let
2012
forEachSystem = nixpkgs.lib.genAttrs [
2113
"aarch64-darwin"
@@ -24,24 +16,8 @@
2416
"x86_64-linux"
2517
];
2618
in {
27-
checks = forEachSystem (system: {
28-
pre-commit-check = pre-commit-hooks.lib.${system}.run {
29-
src = ./.;
30-
hooks = {
31-
commitlint = {
32-
enable = true;
33-
name = "commitlint";
34-
entry = "npx --no -- commitlint --edit";
35-
language = "system";
36-
stages = ["commit-msg"];
37-
};
38-
};
39-
};
40-
});
41-
4219
devShells = forEachSystem (system: let
4320
pkgs = nixpkgs.legacyPackages.${system};
44-
pre-commit-check = self.checks.${system}.pre-commit-check;
4521
in {
4622
default = pkgs.mkShell {
4723
packages = with nixpkgs-nodejs.legacyPackages.${system}; [
@@ -51,8 +27,6 @@
5127

5228
shellHook = ''
5329
export PATH="$(pwd)/node_modules/.bin:$PATH"
54-
${pre-commit-check.shellHook}
55-
pre-commit install --hook-type commit-msg
5630
'';
5731
};
5832
});

0 commit comments

Comments
 (0)