fix(prefer-optional-chaining): various false positives discovered#732
Merged
camc314 merged 4 commits intooxc-project:mainfrom Feb 24, 2026
Merged
Conversation
Member
|
Have you compared the result to the original typescript-eslint rule? We generally defer to the original rule in terms of what behavior is considered correct. |
Contributor
Author
|
I had the rule enabled prior when using eslint and it didnt report the error. I did verify this by checking out a branch that still has this rule on for eslint. The oxlint rule actually reported a couple other cases that I considered correct and modified the code to resolve 🤷. This rule was definitely a big pain to try implement correctly when I first worked on it. |
connorshea
reviewed
Feb 22, 2026
internal/rules/prefer_optional_chain/prefer_optional_chain_test.go
Outdated
Show resolved
Hide resolved
Contributor
Author
connorshea
approved these changes
Feb 24, 2026
Member
connorshea
left a comment
There was a problem hiding this comment.
The tests make sense to me and all pass in the original rule. I can't speak to the logic changes themselves as I'm not especially familiar with Go, so I will defer to cam on that part.
camc314
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Trying get this rule going in my companies internal code base now that I have oxlint setup and found what I would consider false positives. Used AI to help come up with fixes and looked over the changes/verified they fix everything in my codebase.