microsoft / vscode-typescript-tslint-plugin

VS Code extension that provides TSLint support using the typescript-tslint-plugin
https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin
MIT License
188 stars 34 forks source link

error message in node_modules #18

Closed JounQin closed 5 years ago

JounQin commented 5 years ago
[tslint]
Failed to load the TSLint library for the document /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.generator.d.ts
To use TSLint for single file install tslint globally using 'npm install -g tslint'.
TSLint has a peer dependency on `typescript`, make sure that `typescript` is installed as well.
You need to reopen VS Code after installing tslint.

My tsconfig.json:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "lib": ["esnext"],
    "module": "commonjs",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "strictNullChecks": true,
    "target": "esnext"
  }
}

And I've uninstalled vscode-tslint plugin and tried to install typescript and tslint globally, but it still emits errors.

justingrant commented 5 years ago

@JounQin - I think this error message is not fully accurate. I got the same error in my project, and I fixed it via npm install -D tslint in my project folder (not globally) and the error went away.

mjbvz commented 5 years ago

Duplicate of #26

JounQin commented 5 years ago

@mjbvz Are you sure? I'm facing a lot of warnings from .d.ts in node_modules directory...

image

mjbvz commented 5 years ago

Different error, it should not lint d.ts files by default: https://github.com/Microsoft/typescript-tslint-plugin/issues/41

JounQin commented 5 years ago

What about .ts source codes in node_modules? It should only not lint all .ts files in node_modules. And also user customed .d.ts files should also be linted.

Beside, why not read it from exclude of tsconfig.json or linterOptions.exclude of tslint.json?

glen-84 commented 5 years ago

@JounQin I've just opened #40.