Skip to content

feat(lint/vue): automatically ignore noAssignInExpressions for vue v-on directives#9164

Merged
dyc3 merged 2 commits intomainfrom
dyc3/ignore-no-assignment-in-expresions-vue-v-on
Feb 20, 2026
Merged

feat(lint/vue): automatically ignore noAssignInExpressions for vue v-on directives#9164
dyc3 merged 2 commits intomainfrom
dyc3/ignore-no-assignment-in-expresions-vue-v-on

Conversation

@dyc3
Copy link
Copy Markdown
Contributor

@dyc3 dyc3 commented Feb 20, 2026

Summary

@click="open = true" is a pretty common pattern in vue, and is considered idiomatic. This makes it so noAssignInExpressions gets ignored in these scenarios.

closes #9161

Test Plan

added some cli tests

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: 1192e83

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

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

Copy link
Copy Markdown
Contributor Author

dyc3 commented Feb 20, 2026

@github-actions github-actions Bot added A-CLI Area: CLI A-Project Area: project A-Linter Area: linter A-Parser Area: parser L-JavaScript Language: JavaScript and super languages labels Feb 20, 2026
@dyc3 dyc3 marked this pull request as ready for review February 20, 2026 19:45
Base automatically changed from dyc3/parse-attrs-w-colon-in-vue to main February 20, 2026 20:04
@dyc3 dyc3 force-pushed the dyc3/ignore-no-assignment-in-expresions-vue-v-on branch from ce07ac0 to 65403f1 Compare February 20, 2026 20:05
@github-actions
Copy link
Copy Markdown
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 52912 52912 0
Passed 51692 51692 0
Failed 1178 1178 0
Panics 42 42 0
Coverage 97.69% 97.69% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 38 38 0
Passed 37 37 0
Failed 1 1 0
Panics 0 0 0
Coverage 97.37% 97.37% 0.00%

markdown/commonmark

Test result main count This PR count Difference
Total 652 652 0
Passed 652 652 0
Failed 0 0 0
Panics 0 0 0
Coverage 100.00% 100.00% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 5464 5464 0
Passed 1915 1915 0
Failed 3549 3549 0
Panics 0 0 0
Coverage 35.05% 35.05% 0.00%

ts/babel

Test result main count This PR count Difference
Total 629 629 0
Passed 563 563 0
Failed 66 66 0
Panics 0 0 0
Coverage 89.51% 89.51% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18871 18871 0
Passed 13012 13012 0
Failed 5858 5858 0
Panics 1 1 0
Coverage 68.95% 68.95% 0.00%

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

The PR fixes the noAssignInExpressions rule to no longer flag assignments within Vue v-on event handlers. Changes include adding an event_handler field to track Vue embeddings corresponding to event handlers, updating the embedding construction in directive handlers to set this flag appropriately, modifying the rule to skip processing when in a Vue event handler context, and adding tests to verify correct behaviour in both v-on directives and template interpolations.

Possibly related PRs

  • #8700 — Both PRs adjust lint rule behaviour based on Vue embedding context by modifying file_handlers/html.rs.
  • #9053 — Both PRs modify Vue directive embedding and parsing to handle v-on/directive expression contexts differently.
  • #9074 — Both PRs add Vue-specific guards to JavaScript lint rules via JsFileSource checks to prevent false positives.

Suggested labels

D-Vue

Suggested reviewers

  • ematipico
  • arendjr
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses the noAssignInExpressions false positive in Vue v-on directives [#9161], but does not address the parse error for static attributes with spaces. This PR only resolves the noAssignInExpressions rule suppression for v-on directives. Address the parse error for static Vue template attributes separately, as specified in #9161.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change: making noAssignInExpressions ignore Vue v-on directives, which is the primary objective of this PR.
Description check ✅ Passed The description explains the motivation, provides context for the common Vue pattern, links the related issue (#9161), and mentions test coverage.
Out of Scope Changes check ✅ Passed All changes directly support the v-on event handler detection infrastructure and are scoped to Vue event handlers without weakening the rule for JS/JSX contexts.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/ignore-no-assignment-in-expresions-vue-v-on

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 20, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 156 skipped benchmarks1


Comparing dyc3/ignore-no-assignment-in-expresions-vue-v-on (1192e83) with main (7f1e060)

Open in CodSpeed

Footnotes

  1. 156 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@dyc3 dyc3 merged commit 458211b into main Feb 20, 2026
21 checks passed
@dyc3 dyc3 deleted the dyc3/ignore-no-assignment-in-expresions-vue-v-on branch February 20, 2026 20:44
@github-actions github-actions Bot mentioned this pull request Feb 20, 2026
jiwon79 added a commit to jiwon79/biome that referenced this pull request Apr 23, 2026
Extend `EmbeddingKind::Svelte` with a `const_block` flag that marks
embeds originating from a `{@const name = value}` block. The rule now
returns early for those embeds, since the assignment is a declaration
scoped to the enclosing block rather than an accidental use of `=`.

Follows the pattern used for Vue `v-on` event handlers in biomejs#9164.

Fixes biomejs#10082.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Linter Area: linter A-Parser Area: parser A-Project Area: project L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Vue: False positive parse and noAssignInExpressions errors in <template> starting from 2.4.0

2 participants