File tree Expand file tree Collapse file tree 1 file changed +8
-16
lines changed
packages/eslint-plugin-svelte/src/rules Expand file tree Collapse file tree 1 file changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -12,32 +12,24 @@ function findVariableForName(
1212 expectedName : string
1313) : { hasConflict : boolean ; variable : Variable | null } {
1414 const scope = getScope ( context , node ) ;
15- let hasConflict = false ;
1615 let variable : Variable | null = null ;
1716
1817 for ( const ref of scope . references ) {
1918 if ( ref . identifier . name === expectedName ) {
20- hasConflict = true ;
21- break ;
19+ return { hasConflict : true , variable : null } ;
2220 }
2321 }
2422
25- if ( ! hasConflict ) {
26- for ( const v of scope . variables ) {
27- if ( hasConflict && variable ) {
28- break ;
29- }
30- if ( v . name === expectedName ) {
31- hasConflict = true ;
32- continue ;
33- }
34- if ( v . name === name ) {
35- variable = v ;
36- }
23+ for ( const v of scope . variables ) {
24+ if ( v . name === expectedName ) {
25+ return { hasConflict : true , variable : null } ;
26+ }
27+ if ( v . name === name ) {
28+ variable = v ;
3729 }
3830 }
3931
40- return { hasConflict, variable } ;
32+ return { hasConflict : false , variable } ;
4133}
4234
4335function createFixer ( node : TSESTree . Node , variable : Variable | null , name : string ) {
You can’t perform that action at this time.
0 commit comments