File tree Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 66
77const fs = require ( "fs" )
88const path = require ( "path" )
9- const { CLIEngine } = require ( "eslint" )
9+ const { ESLint } = require ( "eslint" )
1010const { browser : originalGlobals } = require ( "globals" )
1111
1212const targetFile = path . resolve ( __dirname , "../lib/configs/_browser-globals.js" )
@@ -33,16 +33,14 @@ for (const key of Object.keys(originalGlobals).sort()) {
3333 }
3434}
3535
36- const linter = new CLIEngine ( { fix : true } )
36+ const linter = new ESLint ( { fix : true } )
3737const rawCode = `/**
3838* DON'T EDIT THIS FILE WHICH WAS GENERATED BY './scripts/generate-browser-globals.js'.
3939*/
4040"use strict"
4141
4242module.exports = ${ JSON . stringify ( globals , null , 4 ) }
4343`
44- const code =
45- linter . executeOnText ( rawCode , "_browser-globals.js" ) . results [ 0 ] . output ||
46- rawCode
47-
48- fs . writeFileSync ( targetFile , code )
44+ linter
45+ . lintText ( rawCode , { filePath : targetFile } )
46+ . then ( ( [ { output } ] ) => fs . writeFileSync ( targetFile , output || rawCode ) )
Original file line number Diff line number Diff line change 66
77const fs = require ( "fs" )
88const path = require ( "path" )
9- const { CLIEngine } = require ( "eslint" )
9+ const { ESLint } = require ( "eslint" )
1010
1111const targetFile = path . resolve ( __dirname , "../lib/configs.js" )
1212
2828`
2929)
3030
31- const linter = new CLIEngine ( { fix : true } )
32- const result = linter . executeOnFiles ( [ targetFile ] )
33- CLIEngine . outputFixes ( result )
31+ const linter = new ESLint ( { fix : true } )
32+ linter . lintFiles ( [ targetFile ] ) . then ( ( [ result ] ) => ESLint . outputFixes ( result ) )
Original file line number Diff line number Diff line change 66
77const fs = require ( "fs" )
88const path = require ( "path" )
9- const { CLIEngine } = require ( "eslint" )
9+ const { ESLint } = require ( "eslint" )
1010
1111const targetFile = path . resolve ( __dirname , "../lib/rules.js" )
1212
3434`
3535)
3636
37- const linter = new CLIEngine ( { fix : true } )
38- const result = linter . executeOnFiles ( [ targetFile ] )
39- CLIEngine . outputFixes ( result )
37+ const linter = new ESLint ( { fix : true } )
38+ linter . lintFiles ( [ targetFile ] ) . then ( ( [ result ] ) => ESLint . outputFixes ( result ) )
You can’t perform that action at this time.
0 commit comments