Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make the Visual Studio Code linter ignore a line?

For example this, at the top of a node.js source file:

#!/usr/bin/env node

...or unused local variables, etc.

like image 278
Shazron Avatar asked May 01 '15 00:05

Shazron


People also ask

How do I hide a line of code in Visual Studio?

The #Region directive enables you to collapse and hide sections of code in Visual Basic files. The #Region directive lets you specify a block of code that you can expand or collapse when using the Visual Studio code editor.

How do I ignore certain errors in VSCode?

Press Alt+Enter. From the pop-up menu, select Ignore All Errors in This File.

How do you ignore red lines in VSCode?

“how to remove red lines in vscode” Code Answer'sPress Ctrl + H (quick replace).


1 Answers

Late to the party but in VSCode you can write // @ts-ignore just before the line you want to ignore.

enter image description here enter image description here

It is important to notice that it will just ignore the line after the declaration.

enter image description here

There is more info about it in the official documentation.

like image 109
distante Avatar answered Oct 14 '22 03:10

distante