mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
A fix for the work done in: https://github.com/oxc-project/oxc/pull/2905 The existing code checks if _all_ import entries in a ModuleRecord are type-only, when determining if the ModuleRecord should be skipped when checking for cycles. This is incorrect. To demonstrate the problem: Running the `no-cycles` rule, with `ignoreTypes` enabled, on the following example code will cause a cycle to be reported between Module A and Module B ```typescript // Module A import type { Bar } from './b'; import { Baz } from './c' // Module B import type { Foo } from './a'; // Module C export const Baz = 'baz'; ``` The reason this is happening is because the import to Module C in Module A is causing the `was_imported_as_type` variable to evaluate to `false`, since the Module C import is not type-only. What we actually want to do is skip visiting Module B entirely, by checking if its import request from Module A is type-only. This PR fixes the logic so that only the import entries for the next ModuleRecord are considered when determining `was_imported_as_type`. |
||
|---|---|---|
| .. | ||
| es6 | ||
| external | ||
| ignore | ||
| typescript | ||
| depth-zero.js | ||
| external-depth-two.js | ||
| flow-typeof.js | ||
| flow-types-depth-one.js | ||
| flow-types-depth-two.js | ||
| flow-types-only-importing-multiple-types.js | ||
| flow-types-only-importing-type.js | ||
| flow-types-some-type-imports.js | ||
| flow-types.js | ||
| intermediate-ignore.js | ||