Deno: Enable noUnusedLocals and noUnusedParameters In Default Config

Created on 12 Mar 2020  路  4Comments  路  Source: denoland/deno

Is there any reason these two options were not enabled in the default config? Can we have them enabled since i believe majority of users would prefer clean code and this would cause a need to create and use a custom tsconfig.

Most helpful comment

I've always felt that this is a linting issue (I argued that at the time they were introduced into TypeScript). I would rather support deno lint (#1880 ) than change these as a default compile option in Deno.

All 4 comments

For reference - Go does not allow unused locals and imports either, but it does allow unused parameters. Go has the _ = myvar syntax to suppress this error, TS does not.

@lucacasonato You can add a _ in front of the parameter and TS will ignore that error.

image

image

I've always felt that this is a linting issue (I argued that at the time they were introduced into TypeScript). I would rather support deno lint (#1880 ) than change these as a default compile option in Deno.

I agree with @kitsonk.

There are good reasons to disable these configurations - the intention is not to be maximally strict - when you're in the middle of development warnings like these can defeat the purpose of using a dynamic language in the first place. The great benefit of TypeScript, in my view, is that you can start programming very fast and sloppy without any types and as the code moves from prototype to production crank up the safety guarantees.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

justjavac picture justjavac  路  3Comments

xueqingxiao picture xueqingxiao  路  3Comments

ry picture ry  路  3Comments

ry picture ry  路  3Comments

ry picture ry  路  3Comments