Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6e22d51

Browse filesBrowse files
authored
fix(no-ref-as-operand): do not report in tagged template expression (#2726)
1 parent 527081f commit 6e22d51
Copy full SHA for 6e22d51

File tree

2 files changed

+18
-2
lines changed
Filter options

2 files changed

+18
-2
lines changed

‎lib/rules/no-ref-as-operand.js

Copy file name to clipboardExpand all lines: lib/rules/no-ref-as-operand.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ module.exports = {
233233
},
234234
// `${refValue}`
235235
/** @param {Identifier} node */
236-
'TemplateLiteral>Identifier'(node) {
236+
':not(TaggedTemplateExpression)>TemplateLiteral>Identifier'(node) {
237237
reportIfRefWrapped(node)
238238
},
239239
// refValue.x

‎tests/lib/rules/no-ref-as-operand.js

Copy file name to clipboardExpand all lines: tests/lib/rules/no-ref-as-operand.js
+17-1Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,22 @@ tester.run('no-ref-as-operand', rule, {
168168
}
169169
</script>
170170
`,
171+
`
172+
<script>
173+
import { ref } from 'vue'
174+
const foo = ref(0)
175+
func(foo)
176+
function func(foo) {}
177+
</script>
178+
`,
179+
`
180+
<script>
181+
import { ref } from 'vue'
182+
const foo = ref(0)
183+
tag\`\${foo}\`
184+
function tag(arr, ...args) {}
185+
</script>
186+
`,
171187
`
172188
<script setup>
173189
const model = defineModel();
@@ -196,7 +212,7 @@ tester.run('no-ref-as-operand', rule, {
196212
<script setup>
197213
const emit = defineEmits(['test'])
198214
const [model, mod] = defineModel();
199-
215+
200216
function update() {
201217
emit('test', model.value)
202218
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.