Skip to content

linter: no-unnecessary-condition not respecting disable comment #19575

@camc314

Description

@camc314

Bug 2: eslint-disable-next-line doesn't suppress no-unnecessary-condition

function g(x: number) {
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  if (x != null) return x
  return 0
}

The disable comment is ignored. Other tsgolint rules like no-unsafe-return respect it fine.

Taken from oxc-project/tsgolint#699 (comment)

Metadata

Metadata

Assignees

Labels

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions