Suppress warnings/errors in Visual Studio 2017 for certain file

11,357

Solution 1

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/*"
  ]
}

Solution 2

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/*
Share:
11,357

Related videos on Youtube

Nikola Nikolov
Author by

Nikola Nikolov

Front-end developer

Updated on October 15, 2022

Comments

  • Nikola Nikolov
    Nikola Nikolov about 1 year

    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.