Skip to content

Ignore specific errors from specific files. #78291

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

Closed
Dari-K opened this issue Jul 31, 2019 · 4 comments
Closed

Ignore specific errors from specific files. #78291

Dari-K opened this issue Jul 31, 2019 · 4 comments
Assignees
Labels
error-list Problems view *out-of-scope Posted issue is not in scope of VS Code typescript Typescript support issues

Comments

@Dari-K
Copy link
Contributor

Dari-K commented Jul 31, 2019

I think this request is distinct from a few other similar requests because filtering all the errors from a number of files isn't the goal, only specific errors, and also because it would be preferable to ignore these errors in the editor as well.

My specific use-case is turning on strictNullChecks in tsc, which for a large project is just not feasible given the number of errors thrown up. It would be nice to be able to enable strictNullChecks for all new files, while allowing old files to be slowly migrated over time. Ideally this would be done through tsconfig, but the Typescript team have cited various problems with doing this and have decided not to make this possible (related issues: microsoft/TypeScript#8405 microsoft/TypeScript#8855). Using a separate tsconfig for your IDE and for the build you can have the errors show up, but keep your project building, however it's not ideal to have so many errors in the problems pane. It makes it hard to notice actual problems and all of the red in your old files is very distracting when you're not trying to migrate them.

Some method of ignoring errors (not just filtering them from the problems pane, hiding them in the editor as well) would be useful.
Maybe a setting which looks something like:

ignoreDiagnostics: [
    {
        pattern: 'Error to be filtered',
        files: [ './old-folder/*', './old-file.ts']
    } 
]

If the vscode team isn't keen on a change like this, would it be possible for me to extend the built-in Typescript extension to filter out the errors I want to ignore from the tsserver responses? Any advice on how to go about that would be helpful. Cheers.

@cyraid
Copy link

cyraid commented Jul 31, 2019

I like this, because just using the filters text box to exclude files from files.exclude isn't really enough. Besides, I've noticed it still reports errors from file.exclude "SomeFolder/ThisFolder/" even though it's hidden from the explorer.. Only when you do "SomeFolder/ThisFolder/**" will it hide from both.

@sandy081 sandy081 assigned mjbvz and unassigned sandy081 Aug 2, 2019
@sandy081
Copy link
Member

sandy081 commented Aug 2, 2019

Moving this to Typescript extension as it is the right one to provide such configuration and ignore from generating errors.

@cyraid
Copy link

cyraid commented Aug 2, 2019

My errors come from a c# project. I have no typescript in my project at all.. Unless you mean that as an internal sense? (a comment to the internal developers)

@mjbvz
Copy link
Collaborator

mjbvz commented Aug 12, 2019

As noted by the OP, this has already been discussed for TypeScript/JavaScript. Right now I don't think it is something we will be investing given that it does add a lot of complexity without bringing significant user value (outside a few specific use cases like the one outlined here). You can use tasks to selectively run more strict checks on a subset of your code

@sandy081 Since I don't think there's anything we plan on doing specifically for TS for this, I'm closing this feature request as out of scope

@mjbvz mjbvz closed this as completed Aug 12, 2019
@mjbvz mjbvz added *out-of-scope Posted issue is not in scope of VS Code error-list Problems view typescript Typescript support issues labels Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error-list Problems view *out-of-scope Posted issue is not in scope of VS Code typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

4 participants