Skip to content

Add typos #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ use nix
## Spell checkers

- [hunspell](https://github.com/hunspell/hunspell)
- [typos](https://github.com/crate-ci/typos)

## Other Formatters

Expand Down
30 changes: 30 additions & 0 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,29 @@ in
default = "\\.js$";
};
};
typos =
{
write =
mkOption {
type = types.bool;
description = lib.mdDoc "Whether to write fixes out.";
default = false;
};

diff =
mkOption {
type = types.bool;
description = lib.mdDoc "Wheter to print a diff of what would change.";
default = false;
};

format =
mkOption {
type = types.enum [ "silent" "brief" "long" "json" ];
description = lib.mdDoc "Output format.";
default = "long";
};
};

revive =
{
Expand Down Expand Up @@ -529,6 +552,13 @@ in
entry = "${tools.hunspell}/bin/hunspell -l";
files = "\\.((txt)|(html)|(xml)|(md)|(rst)|(tex)|(odf)|\\d)$";
};
typos =
{
name = "typos";
description = "Source code spell checker";
entry = with settings.typos;
"${tools.typos}/bin/typos --format ${format} ${lib.optionalString write "-w"} ${lib.optionalString diff "--diff"}";
};
html-tidy =
{
name = "html-tidy";
Expand Down
3 changes: 2 additions & 1 deletion nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@
, stylish-haskell
, stylua
, texlive
, typos
, writeScript
, writeText
, go
, revive ? null
}:

{
inherit actionlint alejandra cabal-fmt cabal2nix cargo clang-tools clippy deadnix dhall hadolint hindent hlint hpack html-tidy nix-linter nixfmt nixpkgs-fmt ormolu rustfmt shellcheck shfmt statix stylish-haskell stylua go mdsh revive;
inherit actionlint alejandra cabal-fmt cabal2nix cargo clang-tools clippy deadnix dhall hadolint hindent hlint hpack html-tidy nix-linter nixfmt nixpkgs-fmt ormolu rustfmt shellcheck shfmt statix stylish-haskell stylua typos go mdsh revive;
inherit (elmPackages) elm-format elm-review elm-test;
# TODO: these two should be statically compiled
inherit (haskellPackages) brittany fourmolu;
Expand Down