Skip to content

Commit 3e7d791

Browse files
committed
bugfix: remove before/after options from config json file
A recent commit to add ordering priority to the hooks introduced new keys into the pre-commit JSON config file. These keys should not be there are they are not keys pre-commit is aware of and produce warning messages. e.g.: ``` [WARNING] Unexpected key(s) present on local => treefmt: after, before ``` This commit fixes it by filter out all keys with names `before` or `after`, in Nix, before writing the configuration to file. Fixes #112
1 parent c2b3567 commit 3e7d791

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

modules/pre-commit.nix

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ let
99
mapAttrsToList
1010
mkOption
1111
types
12+
removeAttrs
1213
remove
1314
;
1415

@@ -43,8 +44,15 @@ let
4344
)
4445
enabledHooks
4546
);
47+
cleanedHooks = builtins.map (
48+
hook:
49+
removeAttrs hook [
50+
"before"
51+
"after"
52+
]
53+
) sortedHooks.result;
4654
in
47-
sortedHooks.result;
55+
cleanedHooks;
4856

4957
configFile =
5058
performAssertions (

0 commit comments

Comments
 (0)