[no-unreachable] and [no-unused-label] are handled inconsistently #4819
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
documentation
Documentation ("docs") that needs adding/updating
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Repro
Expected Result
The unreachable code and the unused label should both be handled by either TypeScript or by the
eslint:recommended
rules.Actual Result
With default settings, the unused label is flagged as invalid both by VSCode (dims the text and provides the reason: "Unused label.ts(7028)") and when linting ("'Label:' is defined but never used.eslint(no-unused-labels)"). The unreachable code is only flagged as invalid by VSCode (dims the text and provides the reason: "Unreachable code detected.ts(7027)").
Additional Info
Based upon my understanding of the eslint-recommended, any rule that is handled by the TypeScript compiler by default should be disabled by this config. I'm curious if this stance holds even for the rules above that are not considered errors in TypeScript by default.
It might be good to document that stance a bit better. That seems like the decision from #1041, though it seems that nothing was ever done to enhance the documentation.
Documentation aside, I think that it at least makes sense to be as consistent as possible with how the eslint-recommended config handles rules that overlap with TypeScript.
Versions
It's worth pointing out along with these versions that as of
v5.19.0
, the rules in question still have the same settings as in my local versions@typescript-eslint/eslint-plugin
4.3.0
@typescript-eslint/parser
4.3.0
TypeScript
4.0.5
ESLint
7.31.0
node
14.19.0
The text was updated successfully, but these errors were encountered: