File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -448,7 +448,12 @@ const create = context => {
448448 node : definition . name ,
449449 } ;
450450
451- if ( variableReplacements . total === 1 && shouldFix ( variable ) && variableReplacements . samples [ 0 ] ) {
451+ if (
452+ variableReplacements . total === 1
453+ && shouldFix ( variable )
454+ && variableReplacements . samples [ 0 ]
455+ && ! variable . references . some ( reference => reference . vueUsedInTemplate )
456+ ) {
452457 const [ replacement ] = variableReplacements . samples ;
453458
454459 for ( const scope of scopes ) {
Original file line number Diff line number Diff line change @@ -2002,5 +2002,36 @@ test({
20022002 ] ,
20032003 } ,
20042004 ] ,
2005+ } ) ;
20052006
2007+ test . vue ( {
2008+ valid : [ ] ,
2009+ invalid : [
2010+ {
2011+ code : outdent `
2012+ <template>
2013+ <button @click="goToPrev"/>
2014+ </template>
2015+ <script setup>
2016+ const goToPrev = () => {}
2017+ </script>
2018+ ` ,
2019+ errors : 1 ,
2020+ } ,
2021+ {
2022+ code : outdent `
2023+ <template><button/></template>
2024+ <script setup>
2025+ const goToPrev = () => {}
2026+ </script>
2027+ ` ,
2028+ output : outdent `
2029+ <template><button/></template>
2030+ <script setup>
2031+ const goToPrevious = () => {}
2032+ </script>
2033+ ` ,
2034+ errors : 1 ,
2035+ } ,
2036+ ] ,
20062037} ) ;
You can’t perform that action at this time.
0 commit comments