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
fix(eslint-plugin): [consistent-type-imports] crash when using both default and namespace in one import #2778
fix(eslint-plugin): [consistent-type-imports] crash when using both default and namespace in one import #2778
Conversation
Thanks for the PR, @ota-meshi! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
Codecov Report
@@ Coverage Diff @@
## master #2778 +/- ##
==========================================
+ Coverage 92.80% 92.81% +0.01%
==========================================
Files 300 300
Lines 9857 9871 +14
Branches 2769 2773 +4
==========================================
+ Hits 9148 9162 +14
Misses 332 332
Partials 377 377
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
thanks for hopping in to fix this!
// eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting | ||
output: noFormat` | ||
import type Default from 'module'; | ||
import * as Rest from 'module'; |
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.
Hard to notice, but this is being fixed with a double space: import\ \ *
.
We probably don't want to be doing that if we can avoid it.
// eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting | ||
output: noFormat` | ||
import type * as Rest from 'module'; | ||
import Default from 'module'; | ||
const a: Rest.A = ''; | ||
`, |
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.
I'd consider just dedenting the entire block to 0 (both code and output) so it matches instead of disabling the lint rule
// eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting | |
output: noFormat` | |
import type * as Rest from 'module'; | |
import Default from 'module'; | |
const a: Rest.A = ''; | |
`, | |
output: noFormat` | |
import type * as Rest from 'module'; | |
import Default from 'module'; | |
const a: Rest.A = ''; | |
`, |
// eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting | ||
output: noFormat` | ||
import type Default from 'module'; | ||
import * as Rest from 'module'; | ||
const a: Default = ''; | ||
`, |
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.
// eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting | |
output: noFormat` | |
import type Default from 'module'; | |
import * as Rest from 'module'; | |
const a: Default = ''; | |
`, | |
output: noFormat` | |
import type Default from 'module'; | |
import * as Rest from 'module'; | |
const a: Default = ''; | |
`, |
// eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting | ||
output: noFormat` | ||
import type * as Rest from 'module'; | ||
import type Default from 'module'; | ||
const a: Default = ''; | ||
const b: Rest.A = ''; | ||
`, |
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.
// eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting | |
output: noFormat` | |
import type * as Rest from 'module'; | |
import type Default from 'module'; | |
const a: Default = ''; | |
const b: Rest.A = ''; | |
`, | |
output: noFormat` | |
import type * as Rest from 'module'; | |
import type Default from 'module'; | |
const a: Default = ''; | |
const b: Rest.A = ''; | |
`, |
0d32de1
to
b1f2c7a
Compare
Thank you for checking! I changed this PR. I didn't know that 0 indentation would eliminate the format error. Thank you for telling me about this. I also fixed some related pre-existing test cases. |
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.
thanks for working on this!
Fixes #2775