fix(nufmt): match .nu files instead of unrecognized type tag - #739
Open
Malix-Labs wants to merge 1 commit into
Open
fix(nufmt): match .nu files instead of unrecognized type tag#739Malix-Labs wants to merge 1 commit into
Malix-Labs wants to merge 1 commit into
Conversation
Commit b915811 added the nufmt hook with types = [ "nushell" ];. However, pre-commit (and its identify tag engine) does not recognize nushell as a valid type tag, causing pre-commit to fail with: An error has occurred: InvalidConfigError: ==> At key: types ===> Type tag 'nushell' is not recognized. Following the convention of other hooks without an identify tag (e.g. Dhall, Elm, OPAM), use files = "\\.nu$"; instead.
This was referenced Sep 6, 2026
Author
|
Alternatively: I opened pre-commit/identify#609, so if it is merged, we would just need to update our dependency to it to get support for nushell |
Author
|
Also I think some tests would be good for this repo maybe, such blatant bugs would be easily caught Update: created #740 for it |
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
nufmthook configuration so it can actually run underpre-commit.Context
In b915811 (#699 by @asakura), the
nufmthook was introduced withtypes = [ "nushell" ];.However,
pre-commitvalidates file type tags against the identify tag registry. Becauseidentifydoes not define anushelltag, enablingnufmtcurrently causespre-committo crash during configuration validation:Solution
Following the convention of other hooks in this repository for file formats not tracked by
identify(e.g. Elm, Dhall, OPAM, Typst), replacetypes = [ "nushell" ];with:(Since
typesdefaults to[ "file" ]inmodules/hook.nix, this properly restrictsnufmtto Nushell source files without triggeringidentifyvalidation errors).Verification
Tested with a consumer flake importing this modified
git-hooks.nixwithpre-commit.settings.hooks.nufmt.enable = true;. Pre-commit successfully invokednufmton.nufiles and passed all checks.