Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typecheck linter for typescript #170

Merged
merged 2 commits into from
Nov 10, 2016
Merged

Add typecheck linter for typescript #170

merged 2 commits into from
Nov 10, 2016

Conversation

mkusher
Copy link
Contributor

@mkusher mkusher commented Nov 10, 2016

Solves #20

It uses my simple wrapper around typescript compiler . npm i -g ts-type-checker would be enough.
typecheck.vim is almost a copy of tslint.vim.

call ale#linter#Define('typescript', {
\ 'name': 'typecheck',
\ 'executable': 'typecheck',
\ 'command': 'typecheck %s',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will be running the command on the file as it is on disk, not the text you are editing as you type. You'll either need to use an option to use stdin data for the file, or use the stdin_wrapper file, probably with an argument to include the directory you are editing the file in or something similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, typecheck uses stdin by default

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it still use stdin if a filename is given? The '%s' here will be replaced with the filename.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, typecheck needs file name to find tsconfig.json, but it will read file contents from stdin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sounds good to me, then. Sounds similar to the --stdin-filename option for eslint, but as a positional argument.

for l:line in a:lines
let l:match = matchlist(l:line, l:pattern)
echom len(l:match)
echom join(l:match, ", ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You left some echo lines here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, my fault

@w0rp w0rp added the new tool Support for new linters, fixers, etc. label Nov 10, 2016
@w0rp
Copy link
Member

w0rp commented Nov 10, 2016

I think this is good. I'll let Travis CI look at this. We might find that it could be a bit slow, but it's certainly better than nothing. If it delays other checks, you can always turn it off. If someone can implement something using HTTP and the test server, I'd also accept that.

@w0rp w0rp merged commit 7669550 into dense-analysis:master Nov 10, 2016
@mkusher mkusher deleted the typescript_typecheck_linter branch November 10, 2016 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new tool Support for new linters, fixers, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants