Skip to content

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.

@graphite-app
Copy link
Contributor

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
Member

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
@Sysix
Copy link
Member

Sysix commented Apr 11, 2025

@Boshen what was the reason of marking it as a draft?

@Sysix Sysix requested a review from Boshen April 22, 2025 20:25
@Boshen Boshen self-assigned this Apr 23, 2025
@Boshen Boshen force-pushed the fix-current-dir-arg branch from ba7ec72 to 7bd5c00 Compare April 24, 2025 03:21
@Boshen Boshen merged commit 9a02066 into oxc-project:main Apr 24, 2025
13 checks passed
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