chore(tooling): switch pre-commit hook to lint-staged#63
Merged
Conversation
Pre-commit was running `npm run format:fix` which calls
`prettier --write "src/**/*.ts"` on the entire src tree on every
commit — slow on a large repo and writes to files the user didn't
touch.
`lint-staged` was already in devDependencies but had no config and
wasn't invoked. This adds:
"lint-staged": {
"src/**/*.ts": ["prettier --write", "eslint --fix"]
}
…and switches `.husky/pre-commit` from `npm run format:fix` to
`npx lint-staged` so we only format/lint the staged subset and pick
up the eslint --fix step automatically.
Net effect: faster commits, narrower writes, no behavior loss.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No issues found. Tooling-only change with no runtime impact; diff is small and contained. |
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
Pre-commit was running `npm run format:fix` which calls `prettier --write "src/**/*.ts"` on the entire `src` tree on every commit — slow on a large repo and writes to files you didn't touch.
`lint-staged` was already in `devDependencies` (`^16.4.0`) but had no config and wasn't invoked. This wires it up.
What changed
```diff
// .husky/pre-commit
npx lint-staged
// package.json
"lint-staged": {
"src/**/*.ts": ["prettier --write", "eslint --fix"]
}
```
Net effect
Self-validation
When committing this PR, the new hook fired and correctly reported `→ lint-staged could not find any staged files matching configured tasks` (this commit only changes config + lockfile, no `.ts` files matched the glob).
Test plan
Note on prior PR
A version of this change was previously opened against `qwibitai/nanoclaw` (upstream) as PR nanocoai#2171 and closed. This PR targets `topcoder1/nanoclaw` (your fork) which is the right scope for tooling changes.
🤖 Generated with Claude Code