@@ -4,11 +4,54 @@ function! neomake#makers#ft#typescript#EnabledMakers()
4
4
return [' tsc' , ' tslint' ]
5
5
endfunction
6
6
7
+ let s: enabled_options = [
8
+ \ ' target' ,
9
+ \ ' emitDecoratorMetadata' ,
10
+ \ ' experimentalDecorators' ,
11
+ \ ' module' ,
12
+ \ ' noImplicitAny' ,
13
+ \ ' rootDir' ,
14
+ \ ' noEmit' ,
15
+ \ ' allowSyntheticDefaultImports' ,
16
+ \ ' noImplicitReturn' ,
17
+ \ ' allowUnreachableCode' ,
18
+ \ ' allowUnusedLabels'
19
+ \ ]
20
+
7
21
function ! neomake#makers#ft#typescript#tsc ()
22
+ let l: tsconfig = findfile (' tsconfig.json' , ' .;' )
23
+ if len (l: tsconfig )
24
+ let true = 1
25
+ let false = 0
26
+ let null = 0
27
+ " ugly shortcut
28
+ let l: jsonText = join (readfile (l: tsconfig , ' b' ), ' ' )
29
+ let l: json = eval (l: jsonText )
30
+ let l: option = get (l: json , ' compilerOptions' , {})
31
+ let l: option [' noEmit' ] = 1
32
+ let l: args = []
33
+ if ! len (get (l: option , ' rootDir' , ' ' ))
34
+ let l: option [' rootDir' ] = fnamemodify (l: tsconfig , ' :h' )
35
+ endif
36
+ for [key , value] in items (l: option )
37
+ if index (s: enabled_options , key ) == -1
38
+ continue
39
+ endif
40
+ if value == 1
41
+ call insert (l: args , ' --' .key )
42
+ elseif type (value) == type (' ' )
43
+ call insert (l: args , value)
44
+ call insert (l: args , ' --' .key )
45
+ endif
46
+ endfor
47
+ else
48
+ let l: args = [
49
+ \ ' -m' , ' commonjs' , ' --noEmit' , ' --rootDir' , ' .'
50
+ \ ]
51
+ endif
52
+
8
53
return {
9
- \ ' args' : [
10
- \ ' -m' , ' commonjs' , ' --noEmit'
11
- \ ],
54
+ \ ' args' : l: args ,
12
55
\ ' errorformat' :
13
56
\ ' %E%f %#(%l\,%c): error %m,' .
14
57
\ ' %E%f %#(%l\,%c): %m,' .
0 commit comments