Tslint: Remove no-unused-variable rule in v5.0

Created on 9 Oct 2016  路  4Comments  路  Source: palantir/tslint

Follow-up from #1481.

API Won't Fix Breaking Change

Most helpful comment

@adidahiya we're using no-unused-variable in Angular and at Google. We're aware of the compiler errors, but we actually prefer the linter warning quite a bit, consistent with feedback in #1481. We universally run with --noEmitOnError (or an equivalent thereof), so not having compilation fail on unused variables, but rather having it has a lint error, is quite important to us.

Removing this would be quite annoying for our workflow - we'd probably actually backport the rule into our own code base. Given that, maybe it'd make sense to document on no-unused-variable that you can get a similar effect with the compiler options, but un-deprecate it and keep it around? The linter warning enables a very different workflow.

All 4 comments

@adidahiya we're using no-unused-variable in Angular and at Google. We're aware of the compiler errors, but we actually prefer the linter warning quite a bit, consistent with feedback in #1481. We universally run with --noEmitOnError (or an equivalent thereof), so not having compilation fail on unused variables, but rather having it has a lint error, is quite important to us.

Removing this would be quite annoying for our workflow - we'd probably actually backport the rule into our own code base. Given that, maybe it'd make sense to document on no-unused-variable that you can get a similar effect with the compiler options, but un-deprecate it and keep it around? The linter warning enables a very different workflow.

+1, because TypeScript doesn't have warnings, we have to use tslint for the checks that don't block the developer. IMO only issues that guarantee the program executes incorrectly should block developers (because you always benefit from catching these before you debug your tests or manually test)

I propose that we keep these rules in tslint (and we need to suppress the warning they print, since we will still use them), at least until TypeScript has a mechanism for warnings (which I also have a lot of ideas about :)

I agree with that! In react I sometimes want to comment a part of the JXS to isolate a problem and a lot of vars become unused. I just need a warning in that case.

Cool, looks like there's a lot of interest in keeping the rule around in the thread in #1481. Going to mark this as "won't fix" to signal that we're not deprecating the rule. It's still going to be opt-in though, and not enabled in the default configs.

Was this page helpful?
0 / 5 - 0 ratings