Skip to content

Commit 471c7f1

Browse files
authored
Merge pull request #201 from loicreynier/feat-prettier-write-option
Add Prettier output option
2 parents 8d476c5 + 5c36747 commit 471c7f1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

modules/hooks.nix

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ in
134134
"''${tools.prettier}/bin/prettier"
135135
'';
136136
};
137+
138+
write =
139+
mkOption {
140+
type = types.bool;
141+
description = lib.mdDoc "Whether to edit files inplace.";
142+
default = true;
143+
};
144+
145+
output =
146+
mkOption {
147+
description = lib.mdDoc "Output format.";
148+
types = types.nullOr types.enum [ "check" "list-diffrent" ];
149+
default = "list-different";
150+
};
137151
};
138152
eslint =
139153
{
@@ -542,7 +556,8 @@ in
542556
{
543557
name = "prettier";
544558
description = "Opinionated multi-language code formatter.";
545-
entry = "${settings.prettier.binPath} --write --list-different --ignore-unknown";
559+
entry = with settings.prettier;
560+
"${binPath} ${lib.optionalString write "--write"} ${lib.optionalString (output != null) "--${output}"} --ignore-unknown";
546561
types = [ "text" ];
547562
};
548563
hunspell =

0 commit comments

Comments
 (0)