@@ -86,7 +86,7 @@ function getTree(source, ast) {
8686 type : node . type ,
8787 text : source . slice ( node . range [ 0 ] , node . range [ 1 ] ) ,
8888 children : [ ] ,
89- } )
89+ } ) ,
9090 )
9191 } ,
9292 leaveNode ( ) {
@@ -127,7 +127,7 @@ function scopeToJSON(scopeManager) {
127127 reference . resolved &&
128128 reference . resolved . defs &&
129129 reference . resolved . defs [ 0 ] &&
130- reference . resolved . defs [ 0 ] . name
130+ reference . resolved . defs [ 0 ] . name ,
131131 ) ,
132132 init : reference . init || null ,
133133 }
@@ -225,17 +225,18 @@ for (const name of TARGETS) {
225225 const scopePath = path . join ( ROOT , `${ name } /scope.json` )
226226 const servicesPath = path . join ( ROOT , `${ name } /services.json` )
227227 const source = fs . readFileSync ( sourcePath , "utf8" )
228+ const parserOptions = fs . existsSync ( optionsPath )
229+ ? JSON . parse ( fs . readFileSync ( optionsPath , "utf8" ) )
230+ : { }
228231 const options = Object . assign (
229232 { filePath : sourcePath } ,
230233 PARSER_OPTIONS ,
231- fs . existsSync ( optionsPath )
232- ? JSON . parse ( fs . readFileSync ( optionsPath , "utf8" ) )
233- : { }
234+ parserOptions ,
234235 )
235236 // console.log("Start:", name)
236237 const actual = parser . parseForESLint ( source , options )
237238 const tokenRanges = getAllTokens ( actual . ast ) . map ( ( t ) =>
238- source . slice ( t . range [ 0 ] , t . range [ 1 ] )
239+ source . slice ( t . range [ 0 ] , t . range [ 1 ] ) ,
239240 )
240241 const tree = getTree ( source , actual . ast )
241242
@@ -247,13 +248,13 @@ for (const name of TARGETS) {
247248 if ( fs . existsSync ( scopePath ) ) {
248249 fs . writeFileSync (
249250 scopePath ,
250- scopeToJSON ( actual . scopeManager || analyze ( actual . ast , options ) )
251+ scopeToJSON ( actual . scopeManager || analyze ( actual . ast , options ) ) ,
251252 )
252253 }
253254 if ( fs . existsSync ( servicesPath ) ) {
254255 fs . writeFileSync (
255256 servicesPath ,
256- JSON . stringify ( Object . keys ( actual . services ) . sort ( ) , null , 4 )
257+ JSON . stringify ( Object . keys ( actual . services ) . sort ( ) , null , 4 ) ,
257258 )
258259 }
259260}
0 commit comments