question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSCode not recognizing tslint-language-service

See original GitHub issue

I’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:open
  • Created 6 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
egammacommented, Jun 7, 2017

@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

1reaction
victornoelcommented, Jun 7, 2017

@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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found