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-unsafe-negation] Duplicates TypeScript's TS2358, TS2360, and TS2365 errors (?) #1146

Closed
Labels
breaking changeThis change will require a new major version to be releasedpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginrecommended-rulesDiscussion about recommended rule sets
@glen-84

Description

@glen-84

Repro

{"rules": {"no-unsafe-negation": ["error", {"enforceForOrderingRelations":true }],  }}
consta=1;constb=2;letfoo;if(!a<b){/**/}while(!a>b){/**/}foo=!a<=b;foo=!a>=b;constmyObject={};constkey="";constCtor=Function;if(!keyinmyObject){// operator precedence makes it equivalent to (!key) in object// and type conversion makes it equivalent to (key ? "false" : "true") in object}if(!myObjectinstanceofCtor){// operator precedence makes it equivalent to (!obj) instanceof Ctor// and it equivalent to always false since boolean values are not objects.}

Expected Result

TS errors only.

Actual Result

TS and ESLint errors.

image

Additional Info

enforceForOrderingRelations is actually off by default, so technicallyTS2365 is probably not being duplicated.

Versions

packageversion
@typescript-eslint/eslint-plugin2.5.0
@typescript-eslint/parser2.5.0
TypeScript3.5.3
ESLint6.6.0
node12.13.0
npm6.12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking 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

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp