File tree 2 files changed +37
-1
lines changed
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -448,7 +448,12 @@ const create = context => {
448
448
node : definition . name ,
449
449
} ;
450
450
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
+ ) {
452
457
const [ replacement ] = variableReplacements . samples ;
453
458
454
459
for ( const scope of scopes ) {
Original file line number Diff line number Diff line change @@ -2002,5 +2002,36 @@ test({
2002
2002
] ,
2003
2003
} ,
2004
2004
] ,
2005
+ } ) ;
2005
2006
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
+ ] ,
2006
2037
} ) ;
You can’t perform that action at this time.
0 commit comments