Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

[React/Redux template] Turn on noUnusedLocals & noUnusedParameters rules in tsconfig.json #1373

Closed
thangchung opened this issue Nov 4, 2017 · 2 comments

Comments

@thangchung
Copy link

Hi all,
Because I want to turn on the noUnusedLocals & noUnusedParameters rules in tsconfig.json to make my code neat and succinct. But if I turn it on, then the line at https://github.com/aspnet/templating/blob/dev/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/store/Counter.ts#L42 violated the rules. I have searched around on Google, but could not end up with the solution. I notice that maybe Typescript doesn't support it, the issue at microsoft/TypeScript#12913. Do we have any solution there?

@PFAR
Copy link

PFAR commented Nov 5, 2017

Since code in the default switch can in practice also be considered 'Unused', you can just as well add code on Line 43 that references the const exhaustiveCheck, which should not affect the overall behavior:
if (typeof exhaustiveCheck != 'undefined') break;

@SteveSandersonMS
Copy link
Member

Thanks for the answer, @PFAR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants