All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 Save g:ale_typescript_tslint_ignore_empty_files
4 unlet! g:ale_typescript_tslint_ignore_empty_files
5 unlet! b:ale_typescript_tslint_ignore_empty_files
7 runtime ale_linters/typescript/tslint.vim
9 call ale#test#SetDirectory('/testplugin/test/handler')
14 unlet! b:ale_typescript_tslint_ignore_empty_files
15 unlet! b:relative_to_root
16 unlet! b:tempname_suffix
17 unlet! b:relative_tempname
19 call ale#test#RestoreDirectory()
20 call ale#linter#Reset()
22 Execute(The tslint handler should parse lines correctly):
23 call ale#test#SetFilename('app/test.ts')
30 \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'),
34 \ 'text': 'Missing semicolon',
35 \ 'code': 'semicolon',
40 \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'),
44 \ 'text': 'Something else',
49 \ 'filename': ale#path#Simplify(expand('%:p:h') . '/something-else.ts'),
53 \ 'text': 'Something else',
54 \ 'code': 'something',
59 \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'),
63 \ 'text': 'Calls to console.log are not allowed.',
64 \ 'code': 'no-console',
67 \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([
74 \ 'failure': 'Missing semicolon',
81 \ 'ruleName': 'semicolon',
82 \ 'ruleSeverity': 'ERROR',
95 \ 'failure': 'Something else',
102 \ 'ruleSeverity': 'WARNING',
115 \ 'failure': 'Something else',
121 \ 'name': 'something-else.ts',
122 \ 'ruleName': 'something',
123 \ 'ruleSeverity': 'WARNING',
136 \ "failure": "Calls to console.log are not allowed.",
138 \ "ruleName": "no-console",
147 Execute(The tslint handler should handle empty output):
150 \ ale_linters#typescript#tslint#Handle(bufnr(''), [])
152 Execute(The tslint handler report errors for empty files by default):
153 call ale#test#SetFilename('app/test.ts')
160 \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'),
164 \ 'text': 'Consecutive blank lines are forbidden',
165 \ 'code': 'no-consecutive-blank-lines',
168 \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([{
174 \ 'failure': 'Consecutive blank lines are forbidden',
181 \ 'ruleName': 'no-consecutive-blank-lines',
182 \ 'ruleSeverity': 'ERROR',
190 Execute(The tslint handler should not report errors for empty files when the ignore option is on):
191 let b:ale_typescript_tslint_ignore_empty_files = 1
192 call ale#test#SetFilename('app/test.ts')
197 \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([{
203 \ 'failure': 'Consecutive blank lines are forbidden',
210 \ 'ruleName': 'no-consecutive-blank-lines',
211 \ 'ruleSeverity': 'ERROR',
219 Given typescript(A file with extra blank lines):
225 Execute(The tslint handler should report errors when the ignore option is on, but the file is not empty):
226 let b:ale_typescript_tslint_ignore_empty_files = 1
227 call ale#test#SetFilename('app/test.ts')
234 \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.ts'),
238 \ 'text': 'Consecutive blank lines are forbidden',
239 \ 'code': 'no-consecutive-blank-lines',
242 \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([{
248 \ 'failure': 'Consecutive blank lines are forbidden',
255 \ 'ruleName': 'no-consecutive-blank-lines',
256 \ 'ruleSeverity': 'ERROR',
264 Execute(The tslint handler should not report no-implicit-dependencies errors):
265 call ale#test#SetFilename('app/test.ts')
270 \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([{
276 \ 'failure': 'this is ignored',
278 \ 'ruleName': 'no-implicit-dependencies',
279 \ 'ruleSeverity': 'ERROR',
287 Execute(The tslint handler should set filename keys for temporary files):
288 " The temporary filename below is hacked into being a relative path so we can
289 " test that we resolve the temporary filename first.
290 let b:relative_to_root = substitute(expand('%:p'), '\v[^/\\]*([/\\])[^/\\]*', '../', 'g')
291 let b:tempname_suffix = substitute(tempname(), '^\v([A-Z]:)?[/\\]', '', '')
292 let b:relative_tempname = substitute(b:relative_to_root . b:tempname_suffix, '\\', '/', 'g')
296 \ {'lnum': 47, 'col': 1, 'code': 'curly', 'end_lnum': 47, 'type': 'E', 'end_col': 26, 'text': 'if statements must be braced'},
298 \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([
305 \ 'failure': 'if statements must be braced',
306 \ 'name': b:relative_tempname,
307 \ 'ruleName': 'curly',
308 \ 'ruleSeverity':'ERROR',