File tree 3 files changed +11
-15
lines changed
3 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 6
6
7
7
const fs = require ( "fs" )
8
8
const path = require ( "path" )
9
- const { CLIEngine } = require ( "eslint" )
9
+ const { ESLint } = require ( "eslint" )
10
10
const { browser : originalGlobals } = require ( "globals" )
11
11
12
12
const targetFile = path . resolve ( __dirname , "../lib/configs/_browser-globals.js" )
@@ -33,16 +33,14 @@ for (const key of Object.keys(originalGlobals).sort()) {
33
33
}
34
34
}
35
35
36
- const linter = new CLIEngine ( { fix : true } )
36
+ const linter = new ESLint ( { fix : true } )
37
37
const rawCode = `/**
38
38
* DON'T EDIT THIS FILE WHICH WAS GENERATED BY './scripts/generate-browser-globals.js'.
39
39
*/
40
40
"use strict"
41
41
42
42
module.exports = ${ JSON . stringify ( globals , null , 4 ) }
43
43
`
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 6
6
7
7
const fs = require ( "fs" )
8
8
const path = require ( "path" )
9
- const { CLIEngine } = require ( "eslint" )
9
+ const { ESLint } = require ( "eslint" )
10
10
11
11
const targetFile = path . resolve ( __dirname , "../lib/configs.js" )
12
12
28
28
`
29
29
)
30
30
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 6
6
7
7
const fs = require ( "fs" )
8
8
const path = require ( "path" )
9
- const { CLIEngine } = require ( "eslint" )
9
+ const { ESLint } = require ( "eslint" )
10
10
11
11
const targetFile = path . resolve ( __dirname , "../lib/rules.js" )
12
12
34
34
`
35
35
)
36
36
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