-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ignoring certain TS suggestion-level diagnostic codes #28825
Comments
(Experimental duplicate detection) |
@DanielRosenwasser We can implement the filtering on the VS Code side but should consider if we want a consistent story for TS. |
@mjbvz That's actually a better idea, adding those settings as compiler options instead. The 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"
]
}
}
} |
I still agree with this sentiment~ |
may be we can add there a file exclusion for gradual migration (to e.g. strict mode) too? exclude those rules for a certain globbing pattern only. |
want this feature too, mention that awesome-typescript-loader support this feature with the config item |
Please provide a way to set these per file (or at least per file type). Some of the suggestions are great in TS files where they will be transpiled away, but should not be suggested for JS files which still need to run directly in older environments. |
Input from the extension ecosystem: this would help with implementing features where a TypeScript language service plugin wants to allow configuration of ignoring certain errors: |
What is the status? |
Something like this would be great: |
Still a valid point. Any progress here? |
Some of these diagnostics appear to impair functionality of VSCode (and presumably other IDEs using ts server) when not using specific libraries. For example, diagnostic
disables the normal VSCode import suggestions and removes both This diagnostic code is making the assumption that global types are being injected by a test framework, which is not the case by default on Vitest, and is not actually available when running Jest under ESM or when using the inbuilt Node test runner. This means IDE import actions are partially broken for these cases due to this diagnostic. |
I'm don't know enough about the code base to take this through the process of adding a compiler option, which presumably touches protocols, command line, etc. There would also need to be tests to submit it, but the code to actually make this work is extremely short. Here is an implementation: |
Any status? How can I get rid of |
any progress? god? |
For TypeScript diagnostic errors you can use Disable TS Errors extension. Works well for me, for example ( {
"editor.formatOnSave": true,
"disableTsErrors.customizations": [
{
"code": [
2304,
2322,
2339
],
"severity": "off"
}
]
} |
Related to what was discussed in microsoft/vscode#61326.
Would provide more granularity to the settings introduced with microsoft/vscode#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
andtypescript.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:
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).
The text was updated successfully, but these errors were encountered: