oxc-project / oxc

⚓ A collection of JavaScript tools written in Rust.
https://oxc.rs
MIT License
12.43k stars 456 forks source link

linter: import/export with a typescript file only export type #7239

Open markEHVN opened 6 days ago

markEHVN commented 6 days ago

What version of Oxlint are you using?

0.11.1

What command did you run?

yarn oxlint -c .oxlint.json

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

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "categories": {
    "correctness": "allow"
  },
  "plugins": ["import"],
  "env": {
    "node": true
  },
  "globals": {},
  "settings": {},
  "rules": {
    "import/export": "error"
  }
}

What happened?

I caught an error when I try use import/export with an typescript only export type. ESLint plugin work well.

You can see source code at here

Screenshot 2024-11-12 at 00 12 25
pumano commented 5 days ago

I try to check it.

UPD: reason is:

if files contains only export type or export interface that marked as no named export. Continue digging...

looks like problem in ( I may be wrong):

https://github.com/oxc-project/oxc/blob/1282221e36a7b5be53ba81278507218abc90ed79/crates/oxc_semantic/src/module_record/builder.rs#L273-L281

Boshen commented 5 days ago

I try to check it.

UPD: reason is:

if files contains only export type or export interface that marked as no named export. Continue digging...

looks like problem in ( I may be wrong):

https://github.com/oxc-project/oxc/blob/1282221e36a7b5be53ba81278507218abc90ed79/crates/oxc_semantic/src/module_record/builder.rs#L273-L281

Thank you for the investigation, this is the problem. We need to add type information the ModuleRecord 😢