Skip to content

chore: fix lint-staged knip workspace path on Windows#20

Closed
reubenyap wants to merge 1 commit intorosen-bridge:devfrom
reubenyap:chore/lintstaged-windows-knip-path
Closed

chore: fix lint-staged knip workspace path on Windows#20
reubenyap wants to merge 1 commit intorosen-bridge:devfrom
reubenyap:chore/lintstaged-windows-knip-path

Conversation

@reubenyap
Copy link
Copy Markdown

Summary

getKnipCommand in .lintstagedrc.mjs calls path.posix.relative(process.cwd(), dir), but on Windows process.cwd() is a Windows-absolute path (e.g. C:\\path\\to\\repo). path.posix.relative treats its inputs as POSIX paths, so the mix produces a mangled relative that knip can't resolve to a workspace.

Use path.relative(...) (platform-aware) and then convert separators to / so knip gets a proper POSIX-style workspace path on every OS.

Split out of #19 per review — this is a Windows-only dev-tooling fix and has nothing to do with the Firo Bridge Expansion Kit.

Test plan

  • lint-staged runs cleanly on macOS / Linux (no behavior change: path.relative and path.posix.relative return the same string on POSIX).
  • On Windows, npm run lint-staged resolves the knip --workspace argument correctly for a package under packages/ or apps/.

`path.posix.relative` cannot produce a correct relative path from two
Windows-absolute paths, so `getKnipCommand` was emitting garbage like
`knip --dependencies --workspace ../E:\Github\rosen-ui\packages\X`,
which knip rejects as "Workspace is not a directory". This blocked
pre-commit hooks on Windows for any commit touching package sources.

Use the cross-platform `path.relative` and normalize separators to
forward slashes (matching the existing type-check line that already
uses `path.relative`).
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

@reubenyap is attempting to deploy a commit to the rosen-bridge Team on Vercel.

A member of the Team first needs to authorize it.

@reubenyap reubenyap closed this Apr 22, 2026
@reubenyap reubenyap deleted the chore/lintstaged-windows-knip-path branch April 22, 2026 09:29
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