Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linter: no-redeclare false positives when variable and type have same name #8237

Open
EYHN opened this issue Jan 3, 2025 · 1 comment
Open
Labels
A-linter Area - Linter C-bug Category - Bug

Comments

@EYHN
Copy link
Contributor

EYHN commented Jan 3, 2025

What version of Oxlint are you using?

0.15.5

What command did you run?

oxlint -c oxlint.json

What does your .oxlint.json config file look like?

{
  "rules": {
    "no-redeclare": "error"
  }
}

What happened?

with code

export const a = {
  hello: "world",
};

export type a = typeof a;

oxlint shows error

  × eslint(no-redeclare): 'a' is already defined.
   ╭─[src\bad.ts:1:14]
 1 │ export const a = {
   ·              ┬
   ·              ╰── 'a' is already defined.
 2 │   hello: "world",
   ╰────
   ╭─[src\bad.ts:5:13]
 4 │
 5 │ export type a = typeof a;
   ·             ┬
   ·             ╰── It can not be redeclare here.
   ╰────

Having both type and variable with same name is allowed in typescript and eslint not show this error, so I think it is a bug

@EYHN EYHN added A-linter Area - Linter C-bug Category - Bug labels Jan 3, 2025
@Sysix
Copy link
Collaborator

Sysix commented Jan 3, 2025

info in general:
we are (currently) supporting only the eslint version:

pub struct NoRedeclare {
built_in_globals: bool,
}

The ts rules has a extra option which defaults to true:
https://typescript-eslint.io/rules/no-redeclare/#options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

No branches or pull requests

2 participants