Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[no-unreachable] Recommended rule disabled with default TS compiler options #1041

Closed
Labels
documentationDocumentation ("docs") that needs adding/updatingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@OliverSieweke

Description

@OliverSieweke

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

packageversion
@typescript-eslint/eslint-plugin2.3.0
@typescript-eslint/parser2.3.0
TypeScript3.6.3
ESLint6.4.0
node10.16.3
npm6.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationDocumentation ("docs") that needs adding/updatingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp