-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [consistent-type-imports] import assertion checks added #7722
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] import assertion checks added #7722
Conversation
Thanks for the PR, @rielAsh24! 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. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
c7f375e
to
ed1119f
Compare
Added type assertion for json files
The linter checks for import assertions before suggesting fixes
ed1119f
to
81f63d6
Compare
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.
Added type assertion for json files
PR Checklist
import type
on import assertion #7527Overview
This PR addresses the issue where
typescript-eslint/eslint-plugin
throws an error when an import statement with type imports includes an import assertions.Reproduction Code:
Actual Behaviour
typescript-eslint
provides an invalid TypeScript code as a fix and hence had to be addressed by adding a rule that checks for such import type assertions.Expected Behaviour
Since typescript 4.5, import assertions are supported, so
No Error
orAll is Ok
is the expected output.Changes made:
consistent-type-imports.ts
for type only import. Now it checks for absence of assertions and only then suggests the fix.consistent-type-imports.ts
for type only imports. Now it checks for absence of import assertions and only then reports the error.consistent-type-imports.test.ts
which considers import assertion for json files as a valid rule.