-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(typescript-estree): support Import Assertions #4074
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(typescript-estree): support Import Assertions #4074
Conversation
Thanks for the PR, @sosukesuzuki! 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. |
83489a0
to
58ba775
Compare
✔️ Deploy Preview for typescript-eslint ready! 🔨 Explore the source changes: d78acb4 🔍 Inspect the deploy log: https://app.netlify.com/sites/typescript-eslint/deploys/618cda2f3084e10008d093a2 😎 Browse the preview: https://deploy-preview-4074--typescript-eslint.netlify.app |
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.
as part of this could you please also add a method to the scope-manager Referencer
?
It should just be an empty method with a comment explaining like "import assertions are module metadata and thus have no variables to reference"
For example this is a similar method for PrivateIdentifier
:
typescript-eslint/packages/scope-manager/src/referencer/Referencer.ts
Lines 554 to 556 in 0eefe5e
protected PrivateIdentifier(): void { | |
// private identifiers are members on classes and thus have no variables to to reference | |
} |
This will ensure that we don't create a variable for the identifier or create any references
@@ -16,6 +16,9 @@ type AdditionalKeys = { | |||
}; | |||
|
|||
const additionalKeys: AdditionalKeys = { | |||
// Stage 3 Import Assertions | |||
ImportAttribute: [], |
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.
You will need to declare this so that ESLint will traverse these nodes
ImportAttribute: [], | |
ImportAttribute: ['key', 'value'], |
Codecov Report
@@ Coverage Diff @@
## master #4074 +/- ##
==========================================
+ Coverage 92.71% 93.13% +0.41%
==========================================
Files 209 174 -35
Lines 9985 9628 -357
Branches 3042 3008 -34
==========================================
- Hits 9258 8967 -291
+ Misses 311 248 -63
+ Partials 416 413 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@bradzacher Thank you for your review, I've addressed your comments! |
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.
LGTM - thanks for this!
PR Checklist
Overview
Adds support for Import Assertions syntax.
Based on #4073