Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
Recommended ESLint rules that are already handled by TypeScript are turned off inplugin:@typescript-eslint/recommended
.
Theno-unreachable
rule is one of the disabled rules because it is covered by the TypeScript compiler errorTS7027
. However this TS error issuppressed by default since2.9.1
.
This means that when using the recommended rules without explicitly turning off theallowUnreachableCode
flag, no ESLint or TS errors will alert the developer of the presence of unreachable code.
I am not sure what the best approach to this is, but it may be worth considering not disablingno-unreachable
in the recommended rules or adding a note in the docs...
Repro
{"extends": ["eslint:recommended","plugin:@typescript-eslint/eslint-recommended","plugin:@typescript-eslint/recommended" ]}
From the ESLintdocs:
functionfn(){x=1;returnx;x=3;// this will never execute}
Expected Result
To be alerted of the unreachable code.
Actual Result
No error reported with the default TypeScript compiler options.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 2.3.0 |
@typescript-eslint/parser | 2.3.0 |
TypeScript | 3.6.3 |
ESLint | 6.4.0 |
node | 10.16.3 |
npm | 6.9.0 |