Skip to content

linter: oxc/const-comparisons does not catch const comparison #21064

@TheRealDevKat

Description

@TheRealDevKat

What version of Oxlint are you using?

1.58.0

What command did you run?

oxlint -c .oxlintrc.json

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "categories": {
    "correctness": "error"
  },
  "rules": {
    "oxc/const-comparisons": "error",
  },
  "ignorePatterns": ["node_modules/**"],
}

What happened?

having this in a test.ts file:

const a = 2 as const;

if (a !== a) {
  console.log("This will never be logged");
}

should trigger the oxc/const-comparisons for the if, because a is always identical to itself, but oxlint finished without errors.

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