@@ -127,7 +127,9 @@ const preprocess = (data, text) => {
127127 ] ;
128128 return [ ] ;
129129 }
130- const { ast : { module : moduleJs , instance : instanceJs } , stats : { templateReferences, warnings } } = info ;
130+ const { ast : { module : moduleJs , instance : instanceJs } , stats : { vars, warnings } } = info ;
131+ const injectedVars = vars . filter ( v => v . injected ) ;
132+ const referencedVars = vars . filter ( v => v . referenced ) ;
131133
132134 // convert warnings to eslint messages
133135 data . messages = warnings . map ( ( { code, message, start, end } ) => ( {
@@ -140,8 +142,10 @@ const preprocess = (data, text) => {
140142 endColumn : end && end . column + 1 ,
141143 } ) ) ;
142144
143- // build a string that we can send along to ESLint
144- let str = '' ;
145+ // build a string that we can send along to ESLint to get the remaining messages
146+
147+ // include declarations of all injected identifiers
148+ let str = injectedVars . length ? `let ${ injectedVars . map ( v => v . name ) . join ( ',' ) } ; // eslint-disable-line\n` : '' ;
145149 data . moduleUnoffsets = getOffsets ( str ) ;
146150
147151 // include module script
@@ -162,8 +166,10 @@ const preprocess = (data, text) => {
162166 data . instanceDedent = offsets ;
163167 }
164168
165- // 'use' all of the properties referred to by the template
166- str += `\n{${ [ ...templateReferences ] . join ( ';' ) } } // eslint-disable-line` ;
169+ // create references to all identifiers referred to by the template
170+ if ( referencedVars . length ) {
171+ str += `\n{${ referencedVars . map ( v => v . reassigned ? v . name + '=0;' + v . name : v . name ) . join ( ';' ) } } // eslint-disable-line` ;
172+ }
167173
168174 // return processed string
169175 return [ str ] ;
0 commit comments