fix(uncheck): reject paths outside cwd, take existing exclusions literally, skip linked folders - #20
Conversation
…rally, skip linked folders - A file, folder or glob above the working directory now fails with a clear error instead of reaching oxlint and oxfmt as a "../" path they reject. - An exclusion naming an existing path leaves out that path alone, so `![id].ts` no longer also drops i.ts and d.ts; backslash escapes now reach the glob matcher on POSIX. - Linked folders, which git lists as one file, are no longer handed to the tools, so their files are not reported twice or fixed outside the repo.
commit: |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Outside-cwd rejection. Each include whose resolved target is
..,../…, or absolute now fails fast with a clearCliError.UserErrorbefore reaching oxlint/oxfmt, including under--no-error-on-unmatched-pattern. - Backslash stays an escape.
relative()swaps.replaceAll('\\', '/')for.split(path.sep).join('/'), so\[id\].tsis a glob escape on POSIX while Windows separators are still normalized. - Exclusions take an existing path literally. A
!patternnaming an existing file/folder matches only that path (and its subtree); a non-existent one is still read as a glob, mirroring includes. - Linked folders and broken links are dropped. The final filter moved from
existsSyncto astatSync().isFile()helper, so git's single symlink entry for a linked folder is no longer passed through to the tools. Symlinks to files are still checked.
I verified the new tests are real regressions: reverting only packages/uncheck/src/files.ts to the base makes them fail (linked folder leaks into oxlint output, the escaped-glob include reports "No files match", and ../legacy.ts reaches oxlint instead of erroring). All five changed test files pass against the PR.
The documented behavior change — --only=tsc ../core/src/index.ts from a package now hits the outside-cwd error rather than building referencing projects — is a reasonable fail-fast tradeoff and the workspace-root run is still covered. One non-blocking note: the README's "Check only some files" section still frames unmatched patterns as the only failure mode, so it could mention that an out-of-cwd path errors regardless of --no-error-on-unmatched-pattern.
DeepSeek Flash (default — pick a model for stronger reviews) | 𝕏
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |

Fixes three path-resolution bugs in
uncheck <paths>. A path above the working directory now fails with a clear error instead of a tool error and a misleading "rerun with --fix" hint. Excluding a route file like[id].tsno longer dropsi.tsandd.tstoo. A linked folder in a git project is no longer checked through the link.Fixes
<path> is outside <cwd>, run from a folder that contains it or pass one with --cwd. This also applies with--no-error-on-unmatched-pattern. Before, a file reached oxlint and oxfmt as../..., which they reject, and a folder or glob gave "No files match".\[id\].tsescapes now work on Linux and macOS.--fixno longer edits through a link that points outside the repo, and git and non-git projects now resolve the same files. Linked files are still checked, and broken links are still dropped.Behavior change
Running
uncheck --only=tsc ../core/src/index.tsfrompackages/appused to build app through its project references. It now hits the outside-cwd error. In a default run it already failed, because oxlint and oxfmt reject the path. Running the same command from the workspace root still builds every dependent package and is still tested.Testing
../paths from a subfolder and via--cwd, glob-named and escaped exclusions, and a git project with linked folders inside and outside the repo, a linked file and a broken link.