Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress warnings/errors in Visual Studio 2017 for certain file

Tags:

I have a project which is using TypeScript and some external libraries.

I'm searching a way to block all errors and warnings for all .js, .ts, .d.ts etc. files in node_modules folder and the folder with other libraries which relative path to the project root is assets/plugins . I've tried creating a .eslintignore file with the following content:

./node_modules/* ./assets/plugins/* 

and also

./node_modules/**/*.js ./node_modules/**/*.ts ./node_modules/**/*.d.ts ./assets/plugins/**/*.js ./assets/plugins/**/*.ts ./assets/plugins/**/*.d.ts 

but this didn't work.

Just to recap, I want to block errors and warnings for those files only and remain visible for all other files in the project.

P.S.: All those errors and warnings in .ts and .js files are visible only in Visual Studio 2017 when the project is opened in Visual Studio 2015 there are no errors and warnings.

like image 936
Nikola Nikolov Avatar asked Mar 21 '17 08:03

Nikola Nikolov


People also ask

How do I suppress SQL warnings in Visual Studio?

In Visual Studio, you have to set the warning(s) to ignore for each individual database object in the project. Select the file and add the warning(s) to ignore in the Suppress TSql Warnings entry in the File Properties window. Do this for each file.

How do I turn off error warnings?

You can make all warnings being treated as such using -Wno-error. You can make specific warnings being treated as such by using -Wno-error=<warning name> where <warning name> is the name of the warning you don't want treated as an error. If you want to entirely disable all warnings, use -w (not recommended).


2 Answers

Adding an .eslintignore to the root of the project, containing the following, and then restarting VS did the trick for me (for now at least)

**/*.d.ts **/node_modules/* 
like image 84
PelleLauritsen Avatar answered Oct 28 '22 21:10

PelleLauritsen


In order to suppress all warnings for node_modules (both ECMAScript and TypeScript) you should create an .eslintignore file with the following content:

**/*.d.ts **/node_modules/* **/assets/plugins/* 

and also create configuration for the typescript compiler (tsconfig.json file) in the project root containing the following:

{   "exclude": [      "node_modules/*",      "assets/plugins/*"   ] } 
like image 37
Nikola Nikolov Avatar answered Oct 28 '22 22:10

Nikola Nikolov