Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

typescript (tsc) syntax checker defaults to earlier-than-ES5 #1807

Closed
cookiengineer opened this issue Jul 5, 2016 · 7 comments
Closed

typescript (tsc) syntax checker defaults to earlier-than-ES5 #1807

cookiengineer opened this issue Jul 5, 2016 · 7 comments

Comments

@cookiengineer
Copy link

cookiengineer commented Jul 5, 2016

The problem I've had using the typescript syntax checker involve the arguments flags that are passed to the typescript compiler (tsc binary).

The tsc binary does not have tsconfig.json support if any flag was passed to it, so I recommend that at least the default behaviour should be configurable by end-users.

Currently, this line is the problem: tsc.vim#L43

As there's no target give, people will always get the annoying legacy errors like:

error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

These flags should be configurable, so I would suggest these two variables in order to influence the behaviour:

let g:syntastic_typescript_module = 'commonjs';
let g:syntastic_typescript_target = 'es2015';

What do you think about that suggestion? Good/Bad?

If the suggestion would get accepted by @scrooloose or @jb55, I would love to implement it and create a pull request for it. Not sure where it's necessary to document this, though.

@lcd047
Copy link
Collaborator

lcd047 commented Jul 5, 2016

These flags should be configurable

They are, and the manual is supposed to tell you how: :h syntastic-config-makeprg. If that isn't clear, I'll consider patches to the manual.

@cookiengineer
Copy link
Author

I figured out that the problem in my setup is a mix from my personal config vs. the project config. The syntastic makerpg flags worked and I have it working now.

But I think the conceptual problem is a bit different, as the project has a tsconfig.json file that differs from my personal setup. Is there any way to use auto-generated flags by the project's tsconfig.json and its compiler options?

@lcd047
Copy link
Collaborator

lcd047 commented Jul 5, 2016

No, but you can adapt this trick to look upwards for a tsconfig.json and use it. Please note the b: in front of the variable.

@lcd047 lcd047 closed this as completed Jul 7, 2016
@nomaed
Copy link

nomaed commented Jul 11, 2016

Had troubles with TypeScript as well.
The solution was, eventually: https://github.com/Quramy/tsuquyomi
This plugin is a dedicated TypeScript syntax checker and it works well with tsconfig.json and integrates well with syntastic. Now everything works well.

@lcd047
Copy link
Collaborator

lcd047 commented Jul 11, 2016

@nomaed You're the second person to recommend it. I suppose this makes it a good time to retire the tsc checker from syntastic. The more checkers maintained externally by people who actually care about them, the better.

@nomaed
Copy link

nomaed commented Jul 11, 2016

I suppose you're right.
The downside is that people who are using syntastic's tsc support successfully (for basic needs) might miss it.

I am not familiar with vim scripting, so I can't say for sure, but is it possible to set the default behavior to detect whether tsuquyomi is usable and if so - use it, and only if it's not available fall back to tsc?

@lcd047
Copy link
Collaborator

lcd047 commented Jul 11, 2016

@nomad External checkers have a well-defined API. They are identical to internal checkers for all intents and purposes, except for being maintained externally.

Anyway, please see #1811.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants