fix(ast-spec): replace attributes with options property in TSImportType#10691
fix(ast-spec): replace attributes with options property in TSImportType#10691JoshuaKGoldberg merged 14 commits intotypescript-eslint:mainfrom
attributes with options property in TSImportType#10691Conversation
|
Thanks for the PR, @fisker! 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. |
|
View your CI Pipeline Execution ↗ for commit 9d8e54f.
☁️ Nx Cloud last updated this comment at |
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #10691 +/- ##
==========================================
- Coverage 87.17% 87.12% -0.05%
==========================================
Files 448 450 +2
Lines 15598 15633 +35
Branches 4555 4566 +11
==========================================
+ Hits 13597 13621 +24
- Misses 1645 1655 +10
- Partials 356 357 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
TSImportType.options instead of TSImportType.attributesTSImportType.options instead of TSImportType.attributes
TSImportType.options instead of TSImportType.attributesTSImportType.options instead of TSImportType.attributes
TSImportType.options instead of TSImportType.attributesTSImportType.options instead of .attributes
TSImportType.options instead of .attributesattributes with options property in TSImportType
|
@fisker can you say more, why should it use |
I'm fine to accept if you have a better AST shape to suggest, but I still hope it contains the location information of |
|
Since |
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
Gotcha, thanks - this makes sense. I see why you'd want to align them to the options from ImportExpression.
Since we only just released support yesterday for this relatively-uncommon AST usage I think it's fine to treat this as a non-breaking-change fix.
cc @ronami as I might have (again) missed something.
There was a problem hiding this comment.
Oh, I missed this one too, I didn't consider it not having the location information on the entire second "argument" 🙈
+1 from me to treat this as non-breaking; I didn't even know this was correct TypeScript syntax until a few days ago 😁
Some thoughts:
It seems TypeScript's AST uses ts.ImportAttributes over ts.Expression for this (see here), which is also used in ts.ImportDeclaration and ts.ExportDeclaration.
To my understanding, typescript-eslint's AST coverts these to ImportAttribute[] (e.g. 1, 2), so this would be the first time a ts.ImportAttributes node is converted into something other than ImportAttribute[].
Still, I think the change is correct, as the existing AST doesn't include location information for the second "argument", making it rather hard to use 👍
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
Noting #10649: is there more work to be done here?
9d8e54f
|
Updated vistorKeys. |
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
LGTM, thanks. I don't want to keep delaying on this - it's a good change and the longer we wait the more likely an issue will pop up. Merging now to get in today's release.

PR Checklist
Overview
The AST should align with
ImportExpressionwhich contains.optionswithProperty#10640 (comment)