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
189 stars 34 forks source link

No linting errors displayed #114

Closed ko-vasilev closed 5 years ago

ko-vasilev commented 5 years ago

The plugin doesn't seem to show any errors for me while the deprecated one is working just fine (https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin). Here's the terse log:

Info 0    [15:32:33.57] Host information vscode
Info 1    [15:32:33.63] Search path: e:/Projects/Test/Client/common/src/services
Info 2    [15:32:33.65] Config file name: e:/Projects/Test/Client/tsconfig.json
Info 3    [15:32:33.937] Loading global plugin typescript-tslint-plugin
Info 4    [15:32:33.937] Enabling plugin typescript-tslint-plugin from candidate paths: e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js/../../..,C:\Users\Konstantin Vasilev\.vscode\extensions\ms-vscode.vscode-typescript-tslint-plugin-1.2.2
Info 5    [15:32:33.938] Loading typescript-tslint-plugin from e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js/../../.. (resolved to e:/Projects/Test/Client/node_modules/node_modules)
Info 6    [15:32:33.981] Failed to load module 'typescript-tslint-plugin': Error: Could not resolve JS module 'typescript-tslint-plugin' starting at 'e:/Projects/Test/Client/node_modules/node_modules'. Looked in: e:/Projects/Test/Client/node_modules/typescript-tslint-plugin/package.json, e:/Projects/Test/Client/node_modules/typescript-tslint-plugin.js, e:/Projects/Test/Client/node_modules/typescript-tslint-plugin.jsx, e:/Projects/Test/Client/node_modules/typescript-tslint-plugin/index.js, e:/Projects/Test/Client/node_modules/typescript-tslint-plugin/index.jsx, e:/Projects/Test/node_modules/typescript-tslint-plugin/package.json, e:/Projects/Test/node_modules/typescript-tslint-plugin.js, e:/Projects/Test/node_modules/typescript-tslint-plugin.jsx, e:/Projects/Test/node_modules/typescript-tslint-plugin/index.js, e:/Projects/Test/node_modules/typescript-tslint-plugin/index.jsx, e:/Projects/node_modules/typescript-tslint-plugin/package.json, e:/Projects/node_modules/typescript-tslint-plugin.js, e:/Projects/node_modules/typescript-tslint-plugin.jsx, e:/Projects/node_modules/typescript-tslint-plugin/index.js, e:/Projects/node_modules/typescript-tslint-plugin/index.jsx, e:/node_modules/typescript-tslint-plugin/package.json, e:/node_modules/typescript-tslint-plugin.js, e:/node_modules/typescript-tslint-plugin.jsx, e:/node_modules/typescript-tslint-plugin/index.js, e:/node_modules/typescript-tslint-plugin/index.jsx
    at Object.resolveJavaScriptModule (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:5020:19)
    at Object.sys.require (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:84178:45)
    at Function.Project.resolveModule (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:78972:35)
    at ConfiguredProject.enablePlugin (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:79632:50)
    at _loop_10 (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:79615:32)
    at ConfiguredProject.enablePlugins (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:79620:25)
    at new ConfiguredProject (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:79583:23)
    at ProjectService.createAndAddConfiguredProject (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:80560:31)
    at ProjectService.openConfigFile (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:80602:36)
    at ProjectService.openOrUpdateConfiguredProjectForFile (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:80372:35)
    at ProjectService.openClientFileWithNormalizedPath (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:80881:32)
    at IOSession.Session.openClientFile (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:82188:46)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:81419:31)
    at e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:82799:88
    at IOSession.Session.executeWithRequestId (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:82790:28)
    at IOSession.Session.executeCommand (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:82799:33)
    at IOSession.Session.onMessage (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:82819:35)
    at Interface.<anonymous> (e:\Projects\Test\Client\node_modules\typescript\lib\tsserver.js:83945:27)
    at Interface.emit (events.js:182:13)
    at Interface._onLine (readline.js:290:10)
    at Interface._normalWrite (readline.js:433:12)
    at Socket.ondata (readline.js:149:10)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Info 7    [15:32:33.981] Loading typescript-tslint-plugin from C:\Users\Konstantin Vasilev\.vscode\extensions\ms-vscode.vscode-typescript-tslint-plugin-1.2.2 (resolved to C:/Users/Konstantin Vasilev/.vscode/extensions/ms-vscode.vscode-typescript-tslint-plugin-1.2.2/node_modules)
Info 8    [15:32:34.79] [typescript-tslint-plugin] "Create"
Info 9    [15:32:34.79] [typescript-tslint-plugin] "ConfigurationManager: Found configured project: e:/Projects/Test/Client/tsconfig.json"
Info 10   [15:32:34.80] Plugin activation failed: TypeError: project.getCurrentDirectory is not a function
Info 11   [15:33:8.563] Add recursive watcher for: e:/Projects/Test/Client
Info 12   [15:33:8.777] Add type root watcher for: e:/Projects/Test/Client/node_modules/@types
Info 13   [15:33:8.782] Opened configuration file e:/Projects/Test/Client/tsconfig.json
Info 14   [15:33:8.952] Host configuration update for file e:/Projects/Test/Client/common/src/services/external-auth.service.ts
mjbvz commented 5 years ago

The error seems to be:

Info 10   [15:32:34.80] Plugin activation failed: TypeError: project.getCurrentDirectory is not a function
ko-vasilev commented 5 years ago

Typescript 2.5.3 Windows 10 - version 1903 (OS Build 18362.295) if that matters VS Code about text:

Version: 1.37.1 (user setup)
Commit: f06011ac164ae4dc8e753a3fe7f9549844d15e35
Date: 2019-08-15T16:17:55.855Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362
tihuan commented 5 years ago

https://github.com/microsoft/vscode-typescript-tslint-plugin/issues/61#issuecomment-494823720

Ah if I change VS Code's TS version to 3.X+, then it will work again! I see you're using 2.5.3, which could be why it's not working!

ko-vasilev commented 5 years ago

That's nice to know, but I can't upgrade from 2.5.3 at the moment.

mjbvz commented 5 years ago

Yes, this plugin requires TS 3.0+

ko-vasilev commented 5 years ago

Can we have some kind of warning about that on extension main page saying that if you are using typescript <3.0 switch to TSLint (deprecated) extension? Thanks.

tihuan commented 5 years ago

@ko-vasilev Not sure if this helps, but my project is not using 3+ as well (2.8), and I just npm installed TS3+ for VS Code to use, and project linters and ts compiler will still stick with project's TS version in package.json!

ko-vasilev commented 5 years ago

@tihuan I have 3+ installed for VSCode, but I have 2.4.3 enabled for my project. I don't think it's a good idea to use typescript version drastically different from the version used in the project because it could potentially allow you to use the typescript features your project doesn't support.

tihuan commented 5 years ago

@ko-vasilev ahh I see your point!

Just out of curiosity, for "potentially using TS3 features in TS2 projects", My project is set up to throw compilation error when TS is unhappy (instead warnings), so if I accidentally use a TS3 feature, the app won't compile.

Perhaps your project setup is different?

ko-vasilev commented 5 years ago

@tihuan there are just no benefits of using TS version different from the one configured for the project with possibility of loosing some time during development.

tihuan commented 5 years ago

@ko-vasilev Ah got it, that makes sense 👌!