Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to output the list of problems that vscode shows when opening a JS file, by using only the terminal:?

What is the default jsconfig.json or tslint.json that vscode are using to show me errors and warnings?


I would like to get all the problem in my JavaScript project. I do not have jsconfig.json or tsconfig.json files. I'm just using some files the //@ts-check.

Everytime I'm open a file js file, I see list of warnings in the problems panel. I would like to get the problems in all the files in the projects. No just the opened files. VS Studio doesn't support it, so I'm looking to do if from the CLI.

I want to get the list using a CLI. So it can be part of CI process. I have tryied to using tslint and typescript CLI with my custom tsconfig.json and tslint.json but I never got exactly the same issues and warning as the vscode show me. I believe vscode have a default tsconfig and tslint that they use for showing the information.

I didn't find this on the GitHub of the typescript language server and the repository of vscode.

In other words: I'm searching for a command that I can launch from the terminal that will give me list of all problems that vscode will show me if I will open the same file in vscode.

enter image description here How to get this output using a terminal without having tsconfig or jsconfig files.

like image 641
Aminadav Glickshtein Avatar asked Jun 06 '19 07:06

Aminadav Glickshtein


People also ask

How do I display JavaScript output code in Visual Studio?

Open the JavaScript code file in Text Editor, then use shortcut Control + Alt + N (or ⌃ Control + ⌥ Option + N on macOS), or press F1 and then select/type Run Code , the code will run and the output will be shown in the Output Window.

How do I create a JavaScript file using Visual Studio code?

With your project open in Visual Studio, right-click on a folder or your project node in Solution Explorer (right pane), and choose Add > New Item. In the New File dialog box, under the General category, choose the file type that you want to add, such as JavaScript File, and then choose Open.


1 Answers

The screenshot you provided showing that you are using the built-in Typescript comes with vscode, outputs with the ts(<code>) abbr.

I think, (Not sure for 100%) that the config for that Built-In Typescript is composed out of many configuration options you will see when you open settings and search for: "typescript" or expand the "Extensions > TypeScript" at the left side tree menu. I think, again: not sure, that the configurations are gathered and compiled at run time, never outputs to a file that you can capture...

The usual workflow though, is to get the official tslint extension:
https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin
Which is not the same thing as the built in one, and to get a basic tslint.js file, matching your team taste, which you can re-use at each one of your projects, then the tsc ... command will become part of your CI process, consuming the project's tslint.js config file.

The new extension will also output the problems to the problems section (outputs tslint(<code>))

I understand that it's not exactly what you meant for, but I think it's the correct answer.

like image 114
Nati Mask Avatar answered Oct 21 '22 01:10

Nati Mask