简体   繁体   中英

How to get proper linting from commandline for vscode?

Have searched far and wide and found numerous articles, videos etc. tangent to what I look for, but never a perfect solution.

My main question is how to get proper linting (like the one that's inbuilt and enabled by default in vscode)?

The reason is to be able to enforce this in a continuous integration setting, for example a github action rule for pull requests.

Example when using vscode default tslint:

export class Foo {
readonly bar: string;

constructor(bar : string) {
  this.bar123 = bar; <-- Property 'bar123 ' does not exist on type 'Foo'. Did you mean 'bar'?ts(2551)
}

This is excellent. Exactly what I want to include as a linting rule in the project? So I take control by disabling vscode tslint (which is deprecated now anyway,) and replace it with eslint with all the proper packages, parser options. extends and other settings.

Now it's silent. No notification about unused properties. And several other problems too are silent.

Eslint is however working and can also easily be enabled to auto-format code on save. So I am halfway there, but how to get the same quality linting? Found it strange that none of the tutorials and articles even touched on this topic.

Answer is 'tsc', the compiler gives these errors and accessible from command line too. Thanks to Tobias S leading me on the right track.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM