Skip to content

feat(ast-spec): support import attributes in TSImportType#10640

Merged
JoshuaKGoldberg merged 6 commits intotypescript-eslint:mainfrom
ronami:tsimporttype-import-attributes
Jan 20, 2025
Merged

feat(ast-spec): support import attributes in TSImportType#10640
JoshuaKGoldberg merged 6 commits intotypescript-eslint:mainfrom
ronami:tsimporttype-import-attributes

Conversation

@ronami
Copy link
Copy Markdown
Member

@ronami ronami commented Jan 12, 2025

PR Checklist

Overview

This PR addresses #10394 and adds import attributes to the TSImportType node.


Some thoughts:

I've named this attributes, similar to other nodes that use ImportAttribute[] (1, 2). This does mean the AST would be a bit different than Babel's, which uses the name options. Please let me know if this should be changed.

I didn't include any adjustments to the scope-manager, as to my understanding, ImportAttributes can't include any reference to variables (also other nodes don't currently do this).

I also didn't include any changes to visitor-keys since I didn't see other nodes with ImportAttributes do this.

Since this is currently auto-fixed incorrectly by Prettier (prettier/prettier#16072), I've added the fixture to .prettierignore. I've seen this done in similar cases (see here).

@typescript-eslint
Copy link
Copy Markdown
Contributor

Thanks for the PR, @ronami!

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.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jan 12, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 9dedfda
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/678e7479c1303d0008ff8e1b
😎 Deploy Preview https://deploy-preview-10640--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jan 12, 2025

View your CI Pipeline Execution ↗ for commit 9dedfda.

Command Status Duration Result
nx test eslint-plugin --coverage=false ✅ Succeeded 7m 24s View ↗
nx test eslint-plugin ✅ Succeeded 5m 55s View ↗
nx test type-utils ✅ Succeeded 17s View ↗
nx test visitor-keys ✅ Succeeded 2s View ↗
nx run types:build ✅ Succeeded <1s View ↗
nx run-many --target=build --exclude website --... ✅ Succeeded 59s View ↗
nx test visitor-keys --coverage=false ✅ Succeeded 3s View ↗
nx test typescript-estree ✅ Succeeded 58s View ↗
Additional runs (24) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-01-20 16:24:29 UTC

@ronami ronami marked this pull request as ready for review January 12, 2025 18:05
Copy link
Copy Markdown
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM! Just requesting the fixture be moved to a more proper directory.

Eventually someone will feel motivated to drive moving all those legacy fixtures into more proper dirs. That person is not me today. 😄

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Jan 19, 2025
@github-actions github-actions Bot removed the awaiting response Issues waiting for a reply from the OP or another party label Jan 20, 2025
Copy link
Copy Markdown
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I've named this attributes ...

Makes sense to me for the stated reasons. Since it's been a week, our weekly release will automatically start in 5-10 minutes, and this has a 👍 from @fisker too, I think we can go ahead and ship now.

@JoshuaKGoldberg JoshuaKGoldberg merged commit cde20d0 into typescript-eslint:main Jan 20, 2025
@ronami ronami deleted the tsimporttype-import-attributes branch January 20, 2025 17:09
@fisker
Copy link
Copy Markdown
Contributor

fisker commented Jan 21, 2025

Turns out the ast is not aligned with ImportExpression it should use .options instead.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jan 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: support import attributes in TS import type

3 participants