@@ -86,7 +86,7 @@ function getTree(source, ast) {
86
86
type : node . type ,
87
87
text : source . slice ( node . range [ 0 ] , node . range [ 1 ] ) ,
88
88
children : [ ] ,
89
- } )
89
+ } ) ,
90
90
)
91
91
} ,
92
92
leaveNode ( ) {
@@ -127,7 +127,7 @@ function scopeToJSON(scopeManager) {
127
127
reference . resolved &&
128
128
reference . resolved . defs &&
129
129
reference . resolved . defs [ 0 ] &&
130
- reference . resolved . defs [ 0 ] . name
130
+ reference . resolved . defs [ 0 ] . name ,
131
131
) ,
132
132
init : reference . init || null ,
133
133
}
@@ -225,17 +225,18 @@ for (const name of TARGETS) {
225
225
const scopePath = path . join ( ROOT , `${ name } /scope.json` )
226
226
const servicesPath = path . join ( ROOT , `${ name } /services.json` )
227
227
const source = fs . readFileSync ( sourcePath , "utf8" )
228
+ const parserOptions = fs . existsSync ( optionsPath )
229
+ ? JSON . parse ( fs . readFileSync ( optionsPath , "utf8" ) )
230
+ : { }
228
231
const options = Object . assign (
229
232
{ filePath : sourcePath } ,
230
233
PARSER_OPTIONS ,
231
- fs . existsSync ( optionsPath )
232
- ? JSON . parse ( fs . readFileSync ( optionsPath , "utf8" ) )
233
- : { }
234
+ parserOptions ,
234
235
)
235
236
// console.log("Start:", name)
236
237
const actual = parser . parseForESLint ( source , options )
237
238
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 ] ) ,
239
240
)
240
241
const tree = getTree ( source , actual . ast )
241
242
@@ -247,13 +248,13 @@ for (const name of TARGETS) {
247
248
if ( fs . existsSync ( scopePath ) ) {
248
249
fs . writeFileSync (
249
250
scopePath ,
250
- scopeToJSON ( actual . scopeManager || analyze ( actual . ast , options ) )
251
+ scopeToJSON ( actual . scopeManager || analyze ( actual . ast , options ) ) ,
251
252
)
252
253
}
253
254
if ( fs . existsSync ( servicesPath ) ) {
254
255
fs . writeFileSync (
255
256
servicesPath ,
256
- JSON . stringify ( Object . keys ( actual . services ) . sort ( ) , null , 4 )
257
+ JSON . stringify ( Object . keys ( actual . services ) . sort ( ) , null , 4 ) ,
257
258
)
258
259
}
259
260
}
0 commit comments