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

[valid-typeof] @typescript-eslint/recommended disables valid-typeof but it shouldn't #3797

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issuebreaking changeThis change will require a new major version to be releasedpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginrecommended-rulesDiscussion about recommended rule sets
Milestone
@karoun

Description

@karoun
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I haveread the FAQ and my problem is not listed.

Repro

{"extends": ["plugin:@typescript-eslint/recommended"]}
typeofwindow===undefinedtypeofwindow===null

Expected Result

error  Typeof comparisons should be to string literals  valid-typeof

Actual Result

🦗

Additional Info

The@typescript-eslint/recommendedruleset disables thevalid-typeof ESLint rule onthe basis that it's covered by TypeScript's "This condition will always return 'false'" handling.

However, this is incorrect:TypeScript does not detect this incorrect condition in the case ofnull andundefined, and so thevalid-typeof rule should be re-enabled in therecommended preset.

Versions

packageversion
@typescript-eslint/eslint-plugin4.23.0
@typescript-eslint/parser4.23.0
TypeScript4.2.4
ESLint7.26.0
node12.13.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebreaking changeThis change will require a new major version to be releasedpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginrecommended-rulesDiscussion about recommended rule sets

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp