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.

Allow ignoring certain TS suggestion-level diagnostic codes

See original GitHub issue

Related to what was discussed in https://github.com/Microsoft/vscode/issues/61326. Would provide more granularity to the settings introduced with https://github.com/Microsoft/vscode/pull/46590.

It might be useful to introduce a new setting to ignore certain suggestion diagnostic codes while still keeping suggestion diagnostics enabled, rather than having to disable them altogether.

What I’m proposing is to introduce 2 new settings, javascript.suggestionActions.ignoredCodes and typescript.suggestionActions.ignoredCodes. These would take a list of suggestion diagnostic codes that the user wants to ignore, given as a string of either comma- or space-separated code numbers.

Example:

{
  // ...

  "typescript.suggestionActions.enabled": true,
  "typescript.suggestionActions.ignoredCodes": "7043, 80006"

  // ...
}

This list would only be checked when a suggestion-level diagnostic is received, so including non-suggestion-level diagnostic codes in the list would have no effect (errors and messages would not be ignored).

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:72
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

34reactions
orassayagcommented, Dec 17, 2020

Is there any progress with this feature? I would like to remove some VSCode suggestions. I would like an option to remove this: Untitled

11reactions
jsayolcommented, Dec 3, 2018

@mjbvz That’s actually a better idea, adding those settings as compiler options instead.

The diagnostics setting could be extended to not only support a boolean, but to also accept an object with include and exclude arrays of codes. These 2 should be mutually exclusive, I don’t see any situation where it would make sense to have both.

So for example, instead of fully disabling diagnostics as it can be done now, the user could do the following to enable all diagnostics except for some of them:

{
  "compilerOptions": {
    "diagnostics": {
      "exclude": [7043, 80006]
    }
  }
}

Or, similarly, only enable some of the diagnostics:

{
  "compilerOptions": {
    "diagnostics": {
      "include": [80003]
    }
  }
}

If it’s decided to go that way, it might be worth assigning string identifiers to the diagnostic codes. Something like this would be much more readable:

{
  "compilerOptions": {
    "diagnostics": {
      "exclude": [
        "better-variable-type-may-be-inferred",
        "may-be-converted-to-async-function"
      ]
    }
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

how ignore typescript errors with @ts-ignore? - Stack Overflow
I recommend allowing @ts-ignore with an enforced description. This can be achieved by the following config ...
Read more >
Documentation - tsc CLI Options - TypeScript
Flag Type Default ‑‑allowJs boolean false ‑‑allowUmdGlobalAccess boolean false ‑‑allowUnreachableCode boolean
Read more >
Disable and suppress inspections | IntelliJ IDEA Documentation
In the Inspection Results tool window (after running code analysis), right-click the inspection you want to disable and select Disable ...
Read more >
Linting in TypeScript using ESLint and Prettier - LogRocket Blog
Integrate Prettier with ESLint to automate type-checking in your TypeScript code and ensure that the code has no bugs.
Read more >
Ignoring Code - Prettier
prettierignore to ignore (i.e. not reformat) certain files and folders completely. Use “prettier-ignore” comments to ignore parts of files. Ignoring Files: .
Read more >

github_iconTop Related Medium Post

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