How can I show unused imports/locals in green (warning) in vscode, rather than red (error)?

Viewed 8071

When I'm writing TypeScript code in vscode, unused imports are shown as an error, with a red squiggly underline:

lodash import with a red squiggly underline

The same is true of unused local variables. I'm happy to have these marked as errors when I run tsc as part of my continuous integration tests, but I'd rather have them rendered as green warnings in vscode. It's more likely that I just haven't used the import/local yet, and the red error makes me think there's a more serious problem, e.g. that I'm importing a symbol that doesn't exist.

Back when unused imports/locals were implemented by tslint, this worked great. But now that they're part of the compiler, it's harder to distinguish them.

Is it possible to make just these two compiler errors get rendered as warnings?

My tsconfig.json includes:

{
  "compilerOptions": {
    "noUnusedLocals": true
  }
}
1 Answers
Related