refactor(linter/plugins): cwd set per file#18701
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
Refactors the oxlint JS plugin context setup so cwd can be set per file by passing it into setupFileContext, paving the way for workspace isolation work (see #17809).
Changes:
- Update
setupFileContextto accept(filePath, cwd)and clearcwdinresetFileContext. - Update the linter entrypoint (
lintFileImpl) to pass a cwd value intosetupFileContext. - Update affected tests to provide both an absolute file path and a cwd.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/oxlint/test/tokens.test.ts | Updates test setup to pass absolute path and cwd into setupFileContext. |
| apps/oxlint/test/isSpaceBetween.test.ts | Updates parse helper to derive path from cwd + filename and pass cwd into setupFileContext. |
| apps/oxlint/src-js/plugins/lint.ts | Passes cwd into setupFileContext (currently via a module-level constant). |
| apps/oxlint/src-js/plugins/context.ts | Changes setupFileContext signature to accept per-file cwd and updates cwd getters/reset logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
Pass `cwd` into `setupFileContext`, so it can be set per file, rather than being a global setting. This is preamble to #17809. This PR is some of the changes from that one split off, so the diff on #17809 is focused just on that one change. This PR does nothing in itself, as currently `process.cwd()` is always passed to `setupFileContext`.
24a259b to
3818486
Compare

Pass
cwdintosetupFileContext, so it can be set per file, rather than being a global setting.This is preamble to #17809. This PR is some of the changes from that one split off, so the diff on #17809 is focused just on that one change.
This PR does nothing in itself, as currently
process.cwd()is always passed tosetupFileContext.