Skip to content

[Bug]: no-constant-binary-expression reports valid short-circuit checks #552

@chenjiahan

Description

@chenjiahan

System Info

0.3.1

Details

no-constant-binary-expression appears to report many false positives on normal TypeScript boolean/nullish guard patterns.

After enabling the no-constant-binary-expression rule in Rsbuild repo, Rslint reports many errors, but the flagged expressions are ordinary short-circuit checks and do not look like constant binary expressions.

  no-constant-binary-expression  — [error] Unexpected constant || on the left-hand side of a `||` expression.
  ╭─┴──────────( packages/core/src/plugins/rsdoctor.ts:71:11 )─────
  │ 70 │
  │ 71 │  if (!module || !module[pluginName]) {
  │ 72 │    return;
  ╰────────────────────────────────

Reproduce link

https://github.com/web-infra-dev/rsbuild

Reproduce Steps

  1. enable no-constant-binary-expression in rslint.config.ts
  2. pnpm lint

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions