1- import ESLint from 'eslint' ;
1+ import { CLIEngine , Linter } from 'eslint' ;
22import requireRelative from 'require-relative' ;
33import { runInNewContext } from 'vm' ;
44
@@ -32,25 +32,25 @@ const relativeRequire = (name: string): unknown =>
3232relativeRequire . resolve = ( name : string ) : string =>
3333 requireRelative . resolve ( name , process . cwd ( ) ) ;
3434
35- const compileConfigCodeCache = new Map < string , ESLint . Linter . Config > ( ) ;
35+ const compileConfigCodeCache = new Map < string , Linter . Config > ( ) ;
3636
37- const compileConfigCode = ( fileCode : string ) : ESLint . Linter . Config => {
37+ const compileConfigCode = ( fileCode : string ) : Linter . Config => {
3838 return getsertCache (
3939 compileConfigCodeCache ,
4040 fileCode ,
4141 ( ) =>
4242 ( runInNewContext ( fileCode , {
4343 module : { exports : { } } ,
4444 require : relativeRequire
45- } ) ?? { } ) as ESLint . Linter . Config ,
45+ } ) ?? { } ) as Linter . Config ,
4646 'compileConfigCode'
4747 ) ;
4848} ;
4949
50- const createCliEngineCache = new Map < string , ESLint . CLIEngine > ( ) ;
50+ const createCliEngineCache = new Map < string , CLIEngine > ( ) ;
5151
52- const createCLIEngine = ( config : ESLint . Linter . Config ) : ESLint . CLIEngine => {
53- const extraConfig : ESLint . Linter . Config = {
52+ const createCLIEngine = ( config : Linter . Config ) : CLIEngine => {
53+ const extraConfig : Linter . Config = {
5454 parserOptions : {
5555 ...config . parserOptions ,
5656 project : require . resolve ( '../../tsconfig.fake.json' ) ,
@@ -72,7 +72,7 @@ const createCLIEngine = (config: ESLint.Linter.Config): ESLint.CLIEngine => {
7272 createCliEngineCache ,
7373 JSON . stringify ( config ) ,
7474 ( ) =>
75- new ESLint . CLIEngine ( {
75+ new CLIEngine ( {
7676 useEslintrc : false ,
7777 ignorePath : pathToBlankFile ,
7878 ignorePattern : [ '!node_modules/*' ] ,
@@ -88,7 +88,7 @@ const createCLIEngine = (config: ESLint.Linter.Config): ESLint.CLIEngine => {
8888} ;
8989
9090interface ConfigInfo {
91- deprecatedRules : ESLint . CLIEngine . DeprecatedRuleUse [ ] ;
91+ deprecatedRules : CLIEngine . DeprecatedRuleUse [ ] ;
9292 unknownRules : string [ ] ;
9393 errors : ESLintError [ ] ;
9494}
@@ -107,10 +107,7 @@ const ensureArray = <T>(v: T | T[] = []): T[] => (Array.isArray(v) ? v : [v]);
107107 * Merging is done at the top level only, and based on explicit named properties,
108108 * so any additional properties on either config will be lost.
109109 */
110- const mergeConfigs = (
111- a : ESLint . Linter . Config ,
112- b : ESLint . Linter . Config
113- ) : ESLint . Linter . Config => ( {
110+ const mergeConfigs = ( a : Linter . Config , b : Linter . Config ) : Linter . Config => ( {
114111 parser : b . parser ?? a . parser ,
115112 parserOptions : { ...a . parserOptions , ...b . parserOptions } ,
116113 processor : b . processor ?? a . processor ,
@@ -126,9 +123,7 @@ const mergeConfigs = (
126123 rules : { ...a . rules , ...b . rules }
127124} ) ;
128125
129- const extractRelevantConfigs = (
130- config : ESLint . Linter . Config
131- ) : ESLint . Linter . Config [ ] => [
126+ const extractRelevantConfigs = ( config : Linter . Config ) : Linter . Config [ ] => [
132127 { ...config , overrides : [ ] } ,
133128 ...( config . overrides ?? [ ] )
134129 . map ( override =>
@@ -279,9 +274,9 @@ const parseESLintError = (error: Error): ESLintError => {
279274} ;
280275
281276const followErrorPathToConfig = (
282- config : ESLint . Linter . Config ,
277+ config : Linter . Config ,
283278 error : ESLintError
284- ) : ESLint . Linter . Config => {
279+ ) : Linter . Config => {
285280 if ( ! error . path || ! config . overrides ) {
286281 return config ;
287282 }
@@ -296,7 +291,7 @@ const followErrorPathToConfig = (
296291} ;
297292
298293const tryRemoveErrorPointFromConfig = (
299- config : ESLint . Linter . Config ,
294+ config : Linter . Config ,
300295 error : ESLintError
301296) : boolean => {
302297 const configToDeleteFrom = followErrorPathToConfig ( config , error ) ;
@@ -350,9 +345,7 @@ const tryRemoveErrorPointFromConfig = (
350345 return false ;
351346} ;
352347
353- const collectConfigInfoFromESLint = (
354- config : ESLint . Linter . Config
355- ) : ConfigInfo => {
348+ const collectConfigInfoFromESLint = ( config : Linter . Config ) : ConfigInfo => {
356349 const theConfig = { rules : { } , ...config } ;
357350 const errors : ESLintError [ ] = [ ] ;
358351 let counter = 0 ;
@@ -406,7 +399,7 @@ const collectConfigInfoCache = new Map<string, ConfigInfo>();
406399 * Info about any `overrides` the `config` might have will be collected and
407400 * merged into the returned info object.
408401 */
409- const collectConfigInfo = ( config : ESLint . Linter . Config ) : ConfigInfo => {
402+ const collectConfigInfo = ( config : Linter . Config ) : ConfigInfo => {
410403 return getsertCache (
411404 collectConfigInfoCache ,
412405 JSON . stringify ( config ) ,
0 commit comments