Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(oxlint): current dir as arg #9382

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BenShelton
Copy link
Contributor

closes #9023

When passing . as an arg it would result in a path like {cwd}/., which when being used to resolve other paths obviously caused issues. This canonicalizes any path args before doing anything else.

Adds test to verify this based on original issue. This also caused another snapshot to change for an invalid file extension, changing from LintSucceeded to LintNoFilesFound, which I believe is actually correct? If you only pass files that do not exist it would make more sense to return an error to me so I'm viewing this as a side effect fix.

Copy link

graphite-app bot commented Feb 26, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-cli Area - CLI C-bug Category - Bug labels Feb 26, 2025
@Sysix
Copy link
Collaborator

Sysix commented Feb 27, 2025

my windows setup is broken.
I expect that some other bugs will be introduces with canonicalize under windows.
canonicalize will generate a \\?\ prefix, which caused other ignore bugs. See the PR for more info:

#8214

@Boshen
Copy link
Member

Boshen commented Feb 28, 2025

canonicalize is a very slow sys call, we should avoid calling it on all paths.

@BenShelton BenShelton changed the title fix(oxlint): canonicalize paths provided as args fix(oxlint): current dir as arg Feb 28, 2025
@BenShelton
Copy link
Contributor Author

Ok so using canonicalize is a no then, trying instead absolute which seems to be the only std way to resolve the path without accessing the filesystem. This reverts the failing "bad extension" test to a success which is a shame but perhaps that was desired anyway.

If that's still problematic I think we'd have to use a crate like normalize_path instead. Or manually handle each edge case.

@Boshen Boshen marked this pull request as draft March 1, 2025 01:12
@BenShelton BenShelton marked this pull request as ready for review March 8, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Area - CLI C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linter: "ignorePatterns" not causing files to be ignored when . is passed in to CLI
4 participants