hk 2.7.1 fixes the global pre-commit hook adding unstaged changes to commits. It also fixes spurious failures in the Vite+, oxfmt and standard_rb builtins, and makes hk init write a valid identifier for editorconfig-checker.
Fixed
- Global pre-commit hook now stashes unstaged changes (#1715, @jdx). The hook installed by
hk install --globalrunshk run pre-commit --from-hook --staged. Because--stagedalways turned stashing off, the hook ignored itsstashsetting, including the defaultstash = "git". If you staged part of a file withgit add -pand a fixer then changed that file, the unstaged hunks ended up in the commit. When--stagedis used together with--from-hook, hk now follows the hook'sstashsetting.HK_STASHis ignored in that case, so a globalHK_STASHcan't override a repository'sstash = "none". Runninghk run pre-commit --stagedyourself still doesn't stash. vp_check,vp_fmtandvp_lintpass when no files match (#1716, @jdx). These Vite+ builtins now pass--no-error-on-unmatched-pattern, as theoxfmtbuiltin already does. Steps no longer fail when the Vite+ config ignores every staged file, and you don't need customcheck/fixoverrides for this.oxfmtskips lockfiles (#1717, @jdx). Commits that stagedpnpm-lock.yamlorpackage-lock.jsonused to printoxfmt failed/Unsupported file type for stdin-filepath. The builtin now excludes both lockfiles fromcheck,check_diffandfix.standard_rbrespects.standard.ymlexclusions (#1719, @beauraF). Standard ignores exclusions for paths passed to it directly, so hk could report offenses in excluded files. The builtin's check and fix commands now pass--force-exclusion, as the RuboCop builtin already does.hk initwrites a valid editorconfig-checker step (#1726, @jdx).hk init --interactiveused to writeBuiltins.editorconfig-checker, which Pkl can't resolve. It now writes["editorconfig_checker"] = Builtins.editorconfig_checker. The picker now shows this builtin's category and description.hk builtinslists it aseditorconfig_checker, the name you use inhk.pkl.
Full Changelog: v2.7.0...v2.7.1
💚 Sponsor hk
hk is built and maintained by @jdx, an open source developer at entire.io, the title sponsor of his open source work.
If hk speeds up your pre-commit loop or makes linting less painful, please consider becoming an individual or company sponsor. Your support funds ongoing development and helps keep hk fast, free, and independent.