The default makers for typescript are ['tsc', 'tslint']. The tsc maker runs fine and shows error signs as expected, but the tslint maker doesn't.
The errors do appear in :lopen, but no signs are placed in the gutter.
When you hit 'enter' on a tslint error in the location list, you're taken to a new file.
I think this is due to the errorformat specified in the tslint maker no longer matching output from tslint 5.0.
You're taken to a new file on hitting enter since the filename in the error message seems to be "ERROR /path/to/file.ts" (ie. file name is thought to include "ERROR " as well
I downgraded my tslint to 4.x and things work - with signs being placed properly.
Can you provide some example output, please?
Here is a sample .ts file.
I use the default tslint.config from tslint v 5.1.
In my tsconfig.json, I have noUnusedParameters: true.
function dummy(unusedParam: number) {
var v = 2;
return v;
}
When the makers run, I see the following errors in :lopen.
Only one sign is placed in the gutter - for the error returned by tsc.
||
ERROR: /tmp/ts/omg.ts|2 col 3 error| Forbidden 'var' keyword, use 'let' or 'const' instead
ERROR: /tmp/ts/omg.ts|2 col 7 error| Identifier 'v' is never reassigned; use 'const' instead of 'var'.
omg.ts|1 col 16 error| TS6133: 'unusedParam' is declared but never used.
When I hit 'enter' on any of the lint errors, I'm taken to a new file.
The status line at the bottom says: "ERROR: /tmp/ts/omg.ts" [New DIRECTORY]
Of note is the Placing sign... line, with buffer=2.
02:55:05 [D ] [1.-:-] Nothing to make: no enabled file mode makers (filetype=).
02:55:10 [D +4.46] [2.-:1] Running makers: tsc (auto), tslint (auto)
02:55:10 [V ] [2.-:1] Starting async job: ['tsc', '--project', '/tmp/ts/tsconfig.json', '--noEmit']
02:55:10 [V ] [2.-:1] Starting async job: ['tslint', '/tmp/ts/omg.ts', '--format verbose', '/tmp/ts/omg.ts']
02:55:10 [D +0.38] [2.2:1] stdout: tslint: ['', 'ERROR: /tmp/ts/omg.ts[2, 3]: Forbidden ''var'' keyword, use ''let'' or ''const'' instead', 'ERROR: /tmp/ts/omg.ts[2, 7]: Identifier ''v'' isnever reassigned; use ''const'' instead of ''var''.', '']
02:55:10 [D ] [2.2:1] exit: tslint: 2
02:55:10 [D ] [2.2:1] tslint: processing 3 lines of output.
02:55:10 [D ] Placing sign: sign place 5000 line=2 name=neomake_err buffer=2
02:55:10 [D ] Placing sign: sign place 5000 name=neomake_err buffer=2
02:55:10 [D ] Skipping User autocmd NeomakeCountsChanged: no hooks.
02:55:10 [D ] [2.2:1] tslint: completed with exit code 2.
02:55:10 [D ] [2.2:1] Cleaning jobinfo
02:55:10 [D ] Skipping User autocmd NeomakeJobFinished: no hooks.
02:55:11 [D +0.49] [2.1:1] stdout: tsc: ['omg.ts(1,16): error TS6133: ''unusedParam'' is declared but never used.', '']
02:55:11 [D ] [2.1:1] exit: tsc: 1
02:55:11 [D ] [2.1:1] tsc: processing 1 lines of output.
02:55:11 [D ] File-level errors cleaned in buffer 1
02:55:11 [D ] Placing sign: sign place 5000 line=1 name=neomake_err buffer=1
02:55:11 [D ] Skipping User autocmd NeomakeCountsChanged: no hooks.
02:55:11 [D ] [2.1:1] tsc: completed with exit code 1.
02:55:11 [D ] [2.1:1] Cleaning jobinfo
02:55:11 [D ] Skipping User autocmd NeomakeJobFinished: no hooks.
02:55:11 [D ] Skipping User autocmd NeomakeFinished: no hooks.
Looks like there is now a ERROR: prefix, which should be captured/ignored by the errorformat.
I've tried the following tsconfig.json with tslint 5.0, but it does not work at all:
% tslint -c tsconfig.json t.ts
Could not find implementations for the following rules specified in the configuration:
noUnusedParameters
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.
No valid rules have been specified
According to https://github.com/palantir/tslint/releases it's not a new rule in 5.1, so I might be missing something else?!
You might want to try let g:neomake_typescript_tslint_errorformat = ''%EERROR: %f[%l\, %c]: %m', and/or change it for the maker itself (https://github.com/neomake/neomake/blob/b043a841bd198d6e7a9ced5b91d9fa692e1e30cb/autoload/neomake/makers/ft/typescript.vim#L25).
Thanks! The new format you provided makes it work now.
Some clarification about your comment about tslint -c tsconfig.json t.ts:
tslint reads linting rules from tslint.json (not tsconfig.json).
The -c switch accepts a tslint.json.
noUnusedParameters is an option for tsc in tsconfig.json. I just included it to demonstrate that tsc was working properly, when tslint was not.
Thanks again.
Ok, so we would have to fix the errorformat then.
Are there only lines prefixed with ERROR:? Should we use another output format maybe? (it seems to also provide JSON)
See #1204 about the WIP fix for this.
I think this can be closed.
Most helpful comment
See #1204 about the WIP fix for this.