git-hooks.nix
git-hooks.nix copied to clipboard
Prettier hook running 'Successfully' but nothing formatted
I'm having issues getting Prettier hook working.
I see the entry in .pre-commit-config.yaml
is
"/nix/store/6rq65zsjg4a07y0af936mqk7qjh7fdp7-node_prettier-2.2.1/bin/prettier --write --list-different --ignore-unknown"
For Prettier to actually do anything I would expect to specify the directory:
prettier --write --list-different --ignore-unknown .
I've attempted to specify this via the pre-commit-check
config in default.nix
, but this doesn't work
hooks = {
prettier.enable = true;
prettier.files = ".";
};
I've also tried this, but I admit I'm very bad at regex
hooks = {
prettier.enable = true;
prettier.files = "\\*$";
};
cc @macalinao
I have since moved to using the husky
nodejs tool, but I may have confused myself since this should only run on staged files. I don't believe I was using this with any unformatted staged files. Please ignore this issue if you see this working for staged files.