Skip to content

Commit 44e2394

Browse files
committed
chore: add failing test cases
1 parent eb97068 commit 44e2394

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

test/prefer-export-from.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,22 @@ test.snapshot({
474474
export {foo};
475475
export {bar} from './foo.json' assert { type: 'unknown' };
476476
`,
477+
outdent`
478+
import type * as X from 'foo';
479+
export { X };
480+
`,
481+
outdent`
482+
import * as X from 'foo';
483+
export type { X };
484+
`,
485+
outdent`
486+
import type * as X from 'foo';
487+
export type { X };
488+
`,
489+
outdent`
490+
import * as X from 'foo';
491+
export { X };
492+
`,
477493
],
478494
});
479495

test/snapshots/prefer-export-from.js.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,6 +2227,106 @@ Generated by [AVA](https://avajs.dev).
22272227
3 | export {bar} from './foo.json' assert { type: 'unknown' };␊
22282228
`
22292229

2230+
## invalid(26): import type * as X from 'foo'; export { X };
2231+
2232+
> Input
2233+
2234+
`␊
2235+
1 | import type * as X from 'foo';␊
2236+
2 | export { X };␊
2237+
`
2238+
2239+
> Output
2240+
2241+
`␊
2242+
1 |␊
2243+
2 |␊
2244+
3 | export * as X from 'foo';␊
2245+
`
2246+
2247+
> Error 1/1
2248+
2249+
`␊
2250+
1 | import type * as X from 'foo';␊
2251+
> 2 | export { X };␊
2252+
| ^ Use \`export…from\` to re-export \`X\`.␊
2253+
`
2254+
2255+
## invalid(27): import * as X from 'foo'; export type { X };
2256+
2257+
> Input
2258+
2259+
`␊
2260+
1 | import * as X from 'foo';␊
2261+
2 | export type { X };␊
2262+
`
2263+
2264+
> Output
2265+
2266+
`␊
2267+
1 |␊
2268+
2 |␊
2269+
3 | export * as X from 'foo';␊
2270+
`
2271+
2272+
> Error 1/1
2273+
2274+
`␊
2275+
1 | import * as X from 'foo';␊
2276+
> 2 | export type { X };␊
2277+
| ^ Use \`export…from\` to re-export \`X\`.␊
2278+
`
2279+
2280+
## invalid(28): import type * as X from 'foo'; export type { X };
2281+
2282+
> Input
2283+
2284+
`␊
2285+
1 | import type * as X from 'foo';␊
2286+
2 | export type { X };␊
2287+
`
2288+
2289+
> Output
2290+
2291+
`␊
2292+
1 |␊
2293+
2 |␊
2294+
3 | export * as X from 'foo';␊
2295+
`
2296+
2297+
> Error 1/1
2298+
2299+
`␊
2300+
1 | import type * as X from 'foo';␊
2301+
> 2 | export type { X };␊
2302+
| ^ Use \`export…from\` to re-export \`X\`.␊
2303+
`
2304+
2305+
## invalid(29): import * as X from 'foo'; export { X };
2306+
2307+
> Input
2308+
2309+
`␊
2310+
1 | import * as X from 'foo';␊
2311+
2 | export { X };␊
2312+
`
2313+
2314+
> Output
2315+
2316+
`␊
2317+
1 |␊
2318+
2 |␊
2319+
3 | export * as X from 'foo';␊
2320+
`
2321+
2322+
> Error 1/1
2323+
2324+
`␊
2325+
1 | import * as X from 'foo';␊
2326+
> 2 | export { X };␊
2327+
| ^ Use \`export…from\` to re-export \`X\`.␊
2328+
`
2329+
22302330
## invalid(1): import json from './foo.json' with { type: 'json' }; export default json;
22312331

22322332
> Input
141 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)