Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quick-hands-show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@biomejs/biome": patch
---

Fixed [#9250](https://github.com/biomejs/biome/issues/9250): `noVueDuplicateKeys` will no longer flag keys under `watch`, preventing false positives.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ impl Rule for NoVueDuplicateKeys {
let mut key_declarations: FxHashMap<String, Vec<VueDeclaration>> = FxHashMap::default();

// Collect all declarations across all Vue component sections
for declaration in component.declarations(VueDeclarationCollectionFilter::all()) {
for declaration in component.declarations(
VueDeclarationCollectionFilter::all() ^ VueDeclarationCollectionFilter::Watcher,
) {
if let Some(name) = declaration.declaration_name() {
// Handle cases like `const { foo } = defineProps(...);`.
if let VueDeclaration::Setup(ref setup_decl) = declaration
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<div>This is valid because this is how you declare watchers in Vue. The child keys of `watch` define which properties/variables to watch, and they are not declarations.</div>
</template>

<script>
export default {
name: 'QFormContainer',
props: {
formData: {
type: Object,
default: () => ({}),
validator: (val) => true
},
},
watch: {
formData: {
handler(newValue)
{
//do things
},
deep: true
}
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
source: crates/biome_js_analyze/tests/spec_tests.rs
expression: valid-watch.vue
---
# Input
```ts
export default {
name: 'QFormContainer',
props: {
formData: {
type: Object,
default: () => ({}),
validator: (val) => true
},
},
watch: {
formData: {
handler(newValue)
{
//do things
},
deep: true
}
}
}

```