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.

Add support for diagnostic severities

See original GitHub issue

TypeScript has added compiler options for lint level checks like noUnusedParameters or noUnusedLocals in tsconfig.json (which is goodness). Today when such an option is enabled then the corresponding issues are reported by TypeScript in the same way as semantic or syntax errors. There is no notion of severity.

Background

We are using tslint to develop VS Code and we have used tslint rules to detect unused locals. TSLint rule failures are reported in VS code as warnings and we had the setup that lint style issue are shown as warnings and the typescript issues (syntax, semantic) are shown as errors. Now that typescript added more lint style checks we no longer get the distinction when developing between lint level warnings and semantic errors. The situation has become worse with tslint 4.0, there tslint has started to deprecate rules which are covered by TypeScript compiler options. This makes good sense, but it means we are now starting to see ‘unused locals’ reported as errors and no longer as warnings as we did before.

Suggestion

Support that the user can define in the tsconfig.json whether a check enabled by compiler option should be reported as error or warning.

eslint supports to configure the severity of an option. Here is an example the eslint documentation:

{
    "rules": {
        "eqeqeq": "off",
        "curly": "warn",
        "quotes": ["error", "double"]
    }
}

// CC @waderyan @mjbvz

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:108
  • Comments:39 (26 by maintainers)

github_iconTop GitHub Comments

20reactions
ffxsamcommented, Jan 10, 2018

As a newcomer to TypeScript, I find it rather confusing that there are two places to define similar rules:

tsconfig.json: noUnusedLocals tslint.json: no-unused-variables

In fact, in VS Code, the latter will not even check properly unless the former is defined. But if I set noUnusedLocals to true, there are no severity levels (everything is an error) and it causes my app to fail to load if I have an unused var. This isn’t a great developer experience.

15reactions
donaldpipowitchcommented, Feb 23, 2017

I’d love to see this feature in the roadmap. Could this become part of 2.3?

I personally need this for warnings for

  • noImplicitAny
  • noUnusedLocals
  • noUnusedParameters
Read more comments on GitHub >

github_iconTop Results From Across the Web

Diagnostic - Neovim docs
Nvim provides a framework for displaying errors or warnings from external tools, otherwise known as "diagnostics". These diagnostics can come from a variety ......
Read more >
About ADHD - Symptoms, Causes and Treatment - CHADD
As ADHD symptoms affect each person to varying degrees, the DSM-5 now requires professionals diagnosing ADHD to include the severity of the disorder....
Read more >
How to create an Azure support request - Microsoft Learn
Azure role-based access control · Go to Help + support from the global header · Go to Help + support from a resource...
Read more >
An Example with DSM-5 Alcohol Use Disorder - PMC - NCBI
Limits of Current Approaches to Diagnosis Severity Based on ... should help somewhat with both the diagnostic impostor and diagnostic orphan ...
Read more >
lsp_lines.nvim: Show diagnostics using virtual lines on top of ...
local highlight_groups = { [vim.diagnostic.severity. ... What API would indicate to plug-ins that you'd added a diagnostic?
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