fix(prefer-export-from): type-import removed when using namespace import#2771
Conversation
prefer-export-from): type-import removed when using namespace import
59b7962 to
deda324
Compare
deda324 to
4345915
Compare
| `␊ | ||
| 1 |␊ | ||
| 2 |␊ | ||
| 3 | export * as X from 'foo';␊ |
There was a problem hiding this comment.
I think this also change the behavior, it only expose type before, now it expose values. Maybe we can export type but not remove the import.
There was a problem hiding this comment.
done, this also affects one existing test case
4345915 to
8d6b1da
Compare
| ␊ | ||
| Output:␊ | ||
| 1 |␊ | ||
| 1 | import { foo } from 'foo';␊ |
There was a problem hiding this comment.
We can't remove this (unless it's type import).
There was a problem hiding this comment.
removeSpecifier can control whether the declaration should be removed if the specifier is the only one. https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/rules/fix/remove-specifier.js#L12
There was a problem hiding this comment.
sorry, what do you mean by we can't remove this? the diff here is adding the import, not removing it
|
Bump :) |
Currently, this code:
is autofixed to this:
which is missing the
typemodifier.This PR fixes the issue. First commit adds a test case, second commit fixes the bug