-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(extract): detect 'type-only' with inline imports/exports #875
feat(extract): detect 'type-only' with inline imports/exports #875
Conversation
Unsure if this should be considered a new feature or a fix, a bit of a middle ground (opted for feature because it feels like adding functionality to detect more combinations). Also unsure if this should be considered a breaking change (opted for "yes" but I'd appreciate your perspective): I think it's possible that there's a rule out there that might start rejecting with this change, right? My thought process was: |
(I wonder why eslint didn't pick up on this as there's a rule for that 🤷)
Code Climate has analyzed commit ef18b2e and detected 0 issues on this pull request. View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alvaro-cuesta that was very quick! And a great PR
- good documentation,
- thorough unit tests,
- comments where it adds value to future maintainers and
- a refactor of the isTypeOnly function that makes it more readable
Thanks!
Agree.
Yep - it's the bane of maintaining a code analysis/ linting packages that improvements sometimes are breaking changes, even though the number of affected consumers might be close to zero. The other open PR (#867) has the same issue. |
Description
Detect dependencies extracted from TypeScript as
'type-only'
also when all of the inline imports/re-exports are qualified astype
.Motivation and Context
TypeScript 4.5 added inline type imports.
dependency-cruiser
has support for'type-only'
independencyTypesNot
, but this only works when using type import statements, and not when regular import statements have all their inline imports qualified astype
.This can be fixed by moving the individual type imports to a separate type import statement, but this is cumbersome for some of us since using ESLint's consistent-type-imports with
fixStyle: 'inline-type-imports'
will prefer addingtype
inline even when all imports aretype
.By extension this PR also implements the functionality for inline type re-exports.
Closes #873.
How Has This Been Tested?
Types of changes
Checklist
📖
⚖️