New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rules silently fail in VS 2017 due to typescript version conflict #58
Comments
To add a little to that - I can change a project's TypeScript tools version to a specific major and minor version, e.g. 2.6, but I can't choose 2.6.1 or 2.6.2 so it's hard to keep package.json and the language service in sync. I've also realised I can figure out what specific version I'll be using on my own machine by digging through the folders installed in |
tslint-language-service is just a simple TypeScript plugin. I don't know which fixes you wish to do? |
I was hoping either you might be able to tell me I'm doing it wrong, or that you would know where to start looking for a fix. The reason I've raised an issue here is that on its own tslint works fine for me, it's just an issue when it is passed source files from Visual Studio. It's a really useful plugin, but this makes it hard for me to use it on a shared project in VS. Two approaches I guess might work and are possible from the plugin are
I'm happy to try writing both since it's easy for me to repro the problem, but do you think either of these approaches are reasonable? |
For now I have used the code from the PR to create a second plugin locally that loads before // testing/tslint-language-service-versioner/index.js
"use strict";
function init(modules) {
// Force tslint to load with the language service's version of typescript. Must be loaded before tslint-language-service
require("mock-require")('typescript', modules.typescript);
function create(info) {
info.project.projectService.logger.info("tslint-language-service-versioner loaded");
return info.languageService;
}
return { create };
}
module.exports = init; and added it to tsconfig plugins as This seems to work around the problem until an official fix makes it into npm. |
…script version as the plugin. Fixes angelozerr#58
Short version
Rules either don't work or work badly when the version of typescript differs between tslint and VS. It is hard to notice when this has happened, and it's hard to stop it happening.
Long version
I am trying to get the language service set up in Vs 2017 and noticed certain rules (mainly
semicolon
) weren't producing linter errors. I tracked it down the issue to a difference in version between the typescript used by VS (and hence tslint-language-service) and the typescript used by tslint. TheSyntaxKind
enum has changed between 2.6.1 and 2.6.2, and the source file for tslint comes from the VS typescript version, but is walked using the tslint version.I can confirm that downgrading my tslint version of typescript (in package.json) to 2.6.1 to match VS fixes things, however:
I'm happy to have a go at fixing this but I'm not sure where to start:
Program
passed back from the language service?The text was updated successfully, but these errors were encountered: