Commit 726fbd5
committed
fix(useVueValidVBind): trim trivia when checking modifier-token text
`find_invalid_modifiers` compared `modifier_token().text()` directly,
which includes trailing trivia. When a modifier was followed by `=value`
the trivia was empty so this happened to work; with the Vue 3.4+
same-name shorthand the modifier can now be followed by whitespace and
the self-closing `/>` instead, in which case `text()` returned e.g.
`"prop "` (with the trailing space) and the valid modifier was
mis-flagged as invalid.
Switch to `text_trimmed()`, matching how the sibling rule
`no_vue_v_on_number_values` already compares modifier names. Add test
cases covering shorthand + modifier and shorthand inside a v-for.1 parent 29c8ffa commit 726fbd5
3 files changed
Lines changed: 15 additions & 1 deletion
File tree
- crates/biome_html_analyze
- src/lint/correctness
- tests/specs/correctness/useVueValidVBind
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
17 | 24 | | |
18 | 25 | | |
19 | 26 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
0 commit comments