fix(lint/noUnassignedVariables): handle JSX ref attribute assignments#7000
Merged
ematipico merged 2 commits intobiomejs:mainfrom Jul 28, 2025
Merged
Conversation
🦋 Changeset detectedLatest commit: ed3684f The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
6766466 to
05c4ee5
Compare
This was referenced Jul 25, 2025
05c4ee5 to
cd7b464
Compare
cd7b464 to
ed3684f
Compare
Member
|
Hmm, I don't think this PR causes the test failure, it can be a flaky test. Let's ignore it for now. |
Contributor
Author
|
Thanks for confirming! I'll mark this as ready for review then. |
Merged
|
With the "fix", this now flags use of JSX refs under noParameterAssign |
|
@timtucker-dte can confirm, posted here #6795 (comment) |
harxki
added a commit
to harxki/biome
that referenced
this pull request
Aug 5, 2025
…ignments (biomejs#7000)" This reverts commit 4021165.
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.
Summary
Closes #6795
The
noUnassignedVariablesrule was incorrectly flagging variables used in JSXrefattributes asunassigned. This occurred because JSX ref attributes were not being recognized as write references in the
semantic analyzer.
This PR fixes the issue by adding proper detection for JSX ref attribute usage, ensuring that variables
assigned to
refprops are correctly tracked as write references.Test Plan
Added test cases in
crates/biome_js_analyze/tests/specs/nursery/noUnassignedVariables/valid.jsxto verifythat JSX ref attributes are correctly handled:
The snapshot test confirms that no diagnostic is generated for this valid usage pattern.
Docs
no-unassigned-variables