Skip to content

Replace husky and lint-staged with simple-git-hooks and nano-staged - #680

Merged
infotexture merged 1 commit into
dita-ot:developfrom
infotexture:feature/nano-staged
Oct 31, 2026
Merged

infotexture merged 1 commit into
dita-ot:developfrom
infotexture:feature/nano-staged

Conversation

@infotexture

Copy link
Copy Markdown
Member

Description

Replaces husky with simple-git-hooks and lint-staged with nano-staged to reduce the number of npm dependencies.

The pre-commit commands are unchanged: Prettier still formats staged files, and Stylelint still lints staged stylesheets. All configuration lives in package.json.

Changes

  • Swap the dev dependencies and update prepare and the staged-files script and config in package.json.
  • Remove the obsolete .husky directory.
  • Update the README (tool descriptions, links, troubleshooting) to describe the new setup, including how to unset the core.hooksPath setting Husky left behind.

Installed packages in package-lock.json drop from 166 to 134 (−32); direct dev dependencies stay at 8.

Notes

  • nano-staged requires Node ^22 || >=24; .nvmrc already pins 22.
  • Contributors who installed dependencies under Husky need to run git config --unset core.hooksPath and then npm install, otherwise the new hook won't run (documented in the README).

Testing

  • Staged a CSS file with lint errors: Prettier ran, Stylelint failed, and nano-staged restored the original state.
  • npm run check passes.

Run the same Prettier and Stylelint pre-commit commands with lighter
tooling, configured in package.json. Remove the .husky directory and
document how to unset the leftover core.hooksPath in the README.

Signed-off-by: Roger Sheen <roger@infotexture.net>
@infotexture
infotexture merged commit 4288cf6 into dita-ot:develop Oct 31, 2026
4 checks passed
@infotexture
infotexture deleted the feature/nano-staged branch October 31, 2026 18:23
infotexture added a commit that referenced this pull request Oct 31, 2026
* develop:
  Bump prettier from 3.8.1 to 3.9.10 (#671)
  Replace husky and lint-staged with simple-git-hooks and nano-staged (#680)
  Pin website workflows to Ubuntu 24.04
  Update npm lockfile to fix dev dependency vulnerabilities
  Update link to DITA Bootstrap plug-in
  Update Dockerfile to use subcommand for installing plug-ins
  Update docs GitHub Actions for 4.4.1 (#675)
  Add 4.4.1 release date
infotexture added a commit that referenced this pull request Nov 14, 2026
* hotfix/4.4.2: (21 commits)
  Bump stylelint-config-recommended from 17.0.0 to 18.0.0
  Bump stylelint-config-sass-guidelines from 12.1.0 to 13.0.0
  Bump stylelint from 16.26.1 to 17.16.0
  Bump Node version to Active LTS v24
  Bump .github render actions to latest versions
  Bump actions/setup-java from 5 to 6 (#688)
  Bump actions/cache from 5 to 6 (#687)
  Bump actions/setup-node from 6 to 7 (#686)
  Bump actions/checkout from 6 to 7 (#682)
  Add details on recently merged PRs
  Draft 4.4.2 Release Notes stub
  Bump Docker image version to “4.4.2”
  Bump 'maintenance-version' key to “4.4.2”
  Bump prettier from 3.8.1 to 3.9.10 (#671)
  Replace husky and lint-staged with simple-git-hooks and nano-staged (#680)
  Pin website workflows to Ubuntu 24.04
  Update npm lockfile to fix dev dependency vulnerabilities
  Update link to DITA Bootstrap plug-in
  Update Dockerfile to use subcommand for installing plug-ins
  Update docs GitHub Actions for 4.4.1 (#675)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant