You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(prefer-primordials): allow private identifier in in expression - #1308
I suggested banning the in operator to enforce proper use of Reflect.has and Object.hasOwn, but in most cases Object.hasOwn was not used in Deno internal. It might be better to simply allow the in operator for DX and performance 🙇
Thanks — this looks correct. I reproduced the false positive on main: prefer-primordials flags #x in o and suggests ObjectHasOwn/ReflectHas, but neither can express a private-field brand check, so #x in o is the only valid form. Since this rule runs on internal runtime code, the fix matters. Could you rebase on latest main so we can get CI green, and confirm the test covers the #field in obj case? Then this should be good to merge.
Verdict: LGTM — correct fix. Recommend a maintainer merge (rule-behavior change + merge state is BLOCKED, so not auto-merging).
Correctness — good
The fix correctly exempts the ergonomic brand-check syntax #brand in obj from the in→ReflectHas suggestion. When the LHS of in is a PrivateName, the expression is not rewritable with a primordial (ReflectHas(obj, #brand) is invalid syntax), so suppressing the diagnostic is right.
BinaryOp::In if !bin_expr.left.is::<PrivateName>() is the correct guard — #x in y is the only construct where a PrivateName appears as a binary LHS, so there's no risk of over-suppressing legitimate in uses. instanceof handling is unchanged.
The if/else→match refactor is clean and equivalent.
Test coverage — good
Adds both a valid case (the static is() brand check) and an invalid case (a in A) confirming ordinary in is still flagged. Solid.
Performance: none — same single bin_expr visit, one extra is::<PrivateName>() type check.
Housekeeping
mergeable: MERGEABLE but mergeStateStatus: BLOCKED — likely just awaiting a required review/approval rather than a code problem. A maintainer should confirm CI is green and approve; the change itself is ready.
No changes requested. Good to merge once a maintainer approves.
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
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.
No description provided.