7
7
// Requirements
8
8
//------------------------------------------------------------------------------
9
9
10
- import { Linter as TSLintLinter , RuleSeverity , Configuration } from 'tslint' ;
10
+ import { RuleSeverity , Configuration } from 'tslint' ;
11
11
import * as ts from 'typescript' ;
12
12
import { Rule } from 'eslint' ;
13
- import { createService } from 'typescript-service' ;
13
+ import { typescriptService } from './typescript-service' ;
14
+ import { CustomLinter } from './custom-linter' ;
15
+
14
16
15
17
//------------------------------------------------------------------------------
16
18
// Plugin Definition
@@ -35,8 +37,6 @@ interface TSLintPluginOptions {
35
37
rules ?: RawRulesConfig ;
36
38
}
37
39
38
- let languageService : ReturnType < typeof createService > ;
39
-
40
40
export const rules = {
41
41
/**
42
42
* Expose a single rule called "config", which will be accessed in the user's eslint config files
@@ -110,16 +110,14 @@ export const rules = {
110
110
let program : ts . Program | undefined = undefined ;
111
111
112
112
if ( fileName !== '<input>' && configFile ) {
113
- if ( ! languageService ) {
114
- languageService = createService ( { configFile, compilerOptions } ) ;
115
- }
116
- program = languageService . getProgram ( ) ;
113
+ const service = typescriptService ( { configFile, compilerOptions } ) ;
114
+ program = service . getProgram ( ) ;
117
115
}
118
116
119
117
/**
120
118
* Create an instance of TSLint
121
119
*/
122
- const tslint = new TSLintLinter ( tslintOptions , program ) ;
120
+ const tslint = new CustomLinter ( tslintOptions , program ) ;
123
121
124
122
/**
125
123
* Lint the source code using the configured TSLint instance, and the rules which have been
0 commit comments