1
- var Linter = require ( "tslint" ) ;
1
+ var tslint = require ( "tslint" ) ;
2
2
var fs = require ( "fs" ) ;
3
3
4
4
function getLinterOptions ( ) {
5
5
return {
6
- configuration : require ( "../tslint.json" ) ,
7
6
formatter : "prose" ,
8
7
formattersDirectory : undefined ,
9
8
rulesDirectory : "built/local/tslint"
10
9
} ;
11
10
}
11
+ function getLinterConfiguration ( ) {
12
+ return require ( "../tslint.json" ) ;
13
+ }
12
14
13
- function lintFileContents ( options , path , contents ) {
14
- var ll = new Linter ( path , contents , options ) ;
15
- return ll . lint ( ) ;
15
+ function lintFileContents ( options , configuration , path , contents ) {
16
+ var ll = new tslint . Linter ( options ) ;
17
+ ll . lint ( path , contents , configuration ) ;
18
+ return ll . getResult ( ) ;
16
19
}
17
20
18
- function lintFileAsync ( options , path , cb ) {
21
+ function lintFileAsync ( options , configuration , path , cb ) {
19
22
fs . readFile ( path , "utf8" , function ( err , contents ) {
20
23
if ( err ) {
21
24
return cb ( err ) ;
22
25
}
23
- var result = lintFileContents ( options , path , contents ) ;
26
+ var result = lintFileContents ( options , configuration , path , contents ) ;
24
27
cb ( undefined , result ) ;
25
28
} ) ;
26
29
}
@@ -30,7 +33,8 @@ process.on("message", function (data) {
30
33
case "file" :
31
34
var target = data . name ;
32
35
var lintOptions = getLinterOptions ( ) ;
33
- lintFileAsync ( lintOptions , target , function ( err , result ) {
36
+ var lintConfiguration = getLinterConfiguration ( ) ;
37
+ lintFileAsync ( lintOptions , lintConfiguration , target , function ( err , result ) {
34
38
if ( err ) {
35
39
process . send ( { kind : "error" , error : err . toString ( ) } ) ;
36
40
return ;
0 commit comments