oxc icon indicating copy to clipboard operation
oxc copied to clipboard

linter: import/no-cycle with TypeScript + ESM

Open Boshen opened this issue 1 year ago • 2 comments

Discussed in https://github.com/oxc-project/oxc/discussions/6906

Originally posted by LukeNotable October 26, 2024 Trying out oxlint for the first time in the hope that it can at least give us a fast check on import/no-cycle. I have a TypeScript project using ESM, thus files like:

// foo.ts
import { Bar } from './bar.js';

// bar.ts
import { Foo } from './foo.js';

However, the rule fails to flag this as a problem. But if I remove the .js extension, the rule behaves correctly. However, the .js extension is required under ESM.

I recall a similar issue with the original eslint-plugin-import, which required eslint-import-resolver-typescript, and I see there's an oxc-resolver, so I wonder if I just need to do some additional configuration to use it.

Boshen avatar Oct 26 '24 05:10 Boshen

context: https://www.typescriptlang.org/docs/handbook/modules/reference.html#common-features-and-processes

Boshen avatar Oct 26 '24 05:10 Boshen

Sounds like we need to modify the resolver?

DonIsaac avatar Oct 27 '24 12:10 DonIsaac

@Boshen is this fix already available in v 0.15 of linter?

Smrtnyk avatar Dec 12 '24 12:12 Smrtnyk