Skip to content
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

For JavaScript Projects, Mark Unreachable Code as a Warning Instead of an Error #15617

Closed
mjbvz opened this issue May 5, 2017 · 3 comments
Closed
Labels
Duplicate An existing issue was already created VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented May 5, 2017

From microsoft/vscode#26016

Feature Request
Using the TypeScript 2.3 checkJs feature, we've seen a few requests in VSCode to downgrade the unreachable code error's severity from error to warning

I'm not sure if we should downgrade this error specifically, but I do think we should allow users to configure this. I believe that #6802 and #13408 track this

@mjbvz
Copy link
Contributor Author

mjbvz commented May 5, 2017

There are currently no workarounds to mark this error as a warning but you can suppress the error entirely using // @ts-ignore:

function foo(){
    return 1;
    // @ts-ignore
    return 2;
    return 3;
}

or for an entire project by creating a jsconfig.json at the root of your workspace that sets allowUnreachableCode:

{
    "compilerOptions": {
        "checkJs": true,
        "allowUnreachableCode": true
    },
    "exclude": [
        "node_modules"
    ]
}

@mhegazy
Copy link
Contributor

mhegazy commented May 5, 2017

The overarching issue of treeing specific errors as warnings is tracked by #13408. For this unreachable code specifically, @mjbvz's comment provide remedies.

@mhegazy
Copy link
Contributor

mhegazy commented May 5, 2017

closing in favor of #13408.

@mhegazy mhegazy closed this as completed May 5, 2017
@mhegazy mhegazy added the Duplicate An existing issue was already created label May 5, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

2 participants