VSCode not recognizing tslint-language-service
See original GitHub issueI’m not sure if I’ve configured something incorrectly or if vscode is just struggling but I can’t manage to get vscode to lint properly through the tslint-language-service.
tsconfig.json
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"module": "commonjs",
"types": ["mocha"],
"target": "es2015",
"jsx": "preserve",
"experimentalDecorators": true,
"plugins": [
{ "name": "tslint-language-service" }
]
},
"files": [
"./src/abstractions/index.d.ts",
"./node_modules/@types/webpack-env/index.d.ts",
"./src/index.tsx"
],
"exclude": [
"node_modules"
],
"include": [
"."
]
}
tslint.json
{
"rules": {
"no-unused-expression": true,
"no-duplicate-variable": true,
"no-duplicate-key": true,
"no-unnecessary-qualifier": true,
"class-name": true,
"interface-name": [true, "always-prefix"],
"no-unnecessary-callback-wrapper": true,
"object-literal-key-quotes": [true, "as-needed"],
"object-literal-shorthand": true,
"quotemark": [true, "single"],
"semicolon": [true, "always"],
"arrow-parens": [true, "ban-single-arg-parens"],
"prefer-const": [true, {"destructuring": "any"}],
"prefer-method-signature": true,
"indent": [true, "spaces"],
"use-isnan": true,
"switch-default": true,
"restrict-plus-operands": true,
"radix": true,
"no-var-keyword": true,
"no-use-before-declare": true,
"no-empty": true,
"no-duplicate-super": true,
"no-debugger": true,
"no-default-export": true,
"no-construct": true,
"no-conditional-assignment": true,
"no-string-throw": true,
"promise-function-async": true,
"prefer-for-of": true,
"adjacent-overload-signatures": true,
"typeof-compare": true,
"triple-equals": [true, "allow-null-check"]
}
}
server.ts (file I’m intentionally trying to break to catch errors)
var x = 2;
export function CreateThings(id){
x = '2';
var y = 2;
console.log("hello");
console.log('hello');
}
This should trip on multiple levels: no vars, single quotes, etc. Running TypeScript 2.3.3 Note: I can run tslint via the command line and it picks up on errors as expected.
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
TSLint - Visual Studio Marketplace
This extension works using VS Code's built-in version of TypeScript and a local or global install of tslint. You do not need to...
Read more >TSLint not working in VS Code - typescript - Stack Overflow
After installing, reload your VS Code window, and linting should work. How I found the problem: I copied your config file into a...
Read more >typescript-tslint-plugin - npm
TypeScript language service plugin for TSLint. To use the plugin: Install TSLint 5+ in your workspace or globally (if you are using a...
Read more >JavaScript and TypeScript in Visual Studio | Microsoft Learn
The option to restore to the legacy JavaScript language service is no longer available. Users have the new JavaScript language service ...
Read more >Write Your Own Debugger and Language Extensions with ...
For instance, you can't write cross-platform Xamarin mobile apps in Visual Studio Code (at least not at the time of this writing). You'd...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@victornoel I suggest you also try the vscode-tslint(vnext) extension. It bundles the tslint-language-service https://marketplace.visualstudio.com/items?itemName=eg2.ts-tslint
@jnarwold have you also forced the use of the project’s typescript install in vscode (by clicking on the version of typescript on the bottom right of the screen, next to the smiley and then selecting “use workspace version”).
@angelozerr I’ve noticed that if you don’t set
"typescript.tsdk": "./node_modules/typescript/lib"
in the workspace settings of vscode, it does not propose to use it…