Skip to content

build: run the pre-commit hook without a global prettier-standard - #26

Merged
Kikobeats merged 1 commit into
masterfrom
Kikobeats/fix-pre-commit-hook
Oct 28, 2026
Merged

Kikobeats merged 1 commit into
masterfrom
Kikobeats/fix-pre-commit-hook

Conversation

@Kikobeats

@Kikobeats Kikobeats commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Problem

  • The *.js task in nano-staged called prettier-standard, which isn't a dependency, so the pre-commit hook failed on every .js commit unless it was installed globally.
  • Every task group also ran git add. With .js and .md files staged together, the groups raced: fatal: Unable to create '.git/index.lock': File exists.

Fix

The same config simple-wappalyzer uses: npx @kikobeats/prettier-standard + standard --fix for *.js, standard-markdown for *.md, finepack for package.json. No git add; nano-staged re-stages task output itself ("Applying modifications from tasks").

How it was tested

  • With prettier-standard not on PATH: I staged .js + .md + package.json together and ran npx nano-staged 5 times. Exit 0 every time, no index.lock errors.
  • A misformatted staged line (const probe = { a:1 }) came out staged as const probe = { a: 1 }.
  • This commit itself went through the hook.
  • npm test: 63 passed.

🤖 Generated with Claude Code


Note

Low Risk
Only pre-commit tooling in package.json changed; no runtime or library behavior is affected.

Overview
Updates nano-staged pre-commit tasks so JS formatting no longer depends on a globally installed prettier-standard. Staged *.js files now run npx @kikobeats/prettier-standard followed by standard --fix, matching the approach used in simple-wappalyzer.

Removes git add from every task group (*.js, *.md, package.json). nano-staged re-stages formatter output on its own, which avoids parallel task groups fighting over .git/index.lock when multiple file types are staged at once.

Reviewed by Cursor Bugbot for commit 4d956ff. Bugbot is set up for automated code reviews on this repo. Configure here.

The *.js task called prettier-standard, which is not a dependency, so the
hook failed unless it was installed by hand. Every task group also ran
`git add`, and with .js and .md files staged together the groups raced on
.git/index.lock. Use `npx @kikobeats/prettier-standard` as
simple-wappalyzer does and drop the `git add` steps; nano-staged re-stages
task output itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f19c618b-ca1f-4ded-b91a-c43c93501d58
Commits

Reviewing files that changed from the base of the PR and between 59fcf01 and 4d956ff.

Files selected for processing: 1
  • package.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

html-scripts

Details
Benchmark suite Current: 4d956ff Previous: 59fcf01 Ratio
getScripts 1MB page 53.6 ms (51.9-55.7) 54.5 ms (53.7-55) 0.98
getScripts 20KB page 69.4 ms (65.9-70.7) 70 ms (67.9-71.4) 0.99

This comment was automatically generated by workflow using github-action-benchmark.

@Kikobeats
Kikobeats merged commit 90c8ef6 into master Oct 28, 2026
5 checks passed
@Kikobeats
Kikobeats deleted the Kikobeats/fix-pre-commit-hook branch October 28, 2026 11:58
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