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: import/named throwing error on named typescript enum import into javascript #9601

Open
MichaelGoff opened this issue Mar 8, 2025 · 0 comments
Labels
A-linter Area - Linter C-bug Category - Bug

Comments

@MichaelGoff
Copy link

What version of Oxlint are you using?

0.15.13

What command did you run?

oxlint

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

{
  "env": {
    "browser": true
  },
  "ignorePatterns" : ["node_modules"],
  "categories": {
    "correctness": "error"
  },
  "plugins": [
    "import",
    "typescript"
  ],
  "rules": {
    "import/named": "error"
  }
}

What happened?

Oxlint reports an error from import/named when importing a ts enum into a .js file. eslint-plugin-import does not report this as an issue.

Given enums.ts

export enum Events {
    Christmas = 'Christmas',
    NewYears = 'NewYears',
}

and jsFile.js

import {Events} from "./enums";

console.log(Events.NewYears);

Oxlint will report the following false positive error:

  × eslint-plugin-import(named): named import "Events" not found
   ╭─[jsFile.js:1:9]
 1 │ import {Events} from "./enums";
   ·         ──────
 2 │
   ╰────
  help: does "./enums" have the export "Events"?

It does not report such an error when importing an enum into a .ts file.

See reproduction Repo: https://github.com/MichaelGoff/oxlint-named-enum-js-bug

@MichaelGoff MichaelGoff added A-linter Area - Linter C-bug Category - Bug labels Mar 8, 2025
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

1 participant