Skip to content
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(biome_js_parser): support defer attribute in import statements #4301

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

fireairforce
Copy link
Member

Summary

closes: #4215

Test Plan

@github-actions github-actions bot added A-Parser Area: parser A-Tooling Area: internal tools L-JavaScript Language: JavaScript and super languages labels Oct 15, 2024
@fireairforce fireairforce marked this pull request as ready for review October 15, 2024 08:03
@github-actions github-actions bot added A-Formatter Area: formatter A-Changelog Area: changelog labels Oct 15, 2024
Copy link

codspeed-hq bot commented Oct 15, 2024

CodSpeed Performance Report

Merging #4301 will improve performances by 6.06%

Comparing fireairforce:feat-4215 (2286c37) with main (561b54c)

Summary

⚡ 1 improvements
✅ 104 untouched benchmarks

Benchmarks breakdown

Benchmark main fireairforce:feat-4215 Change
db_17847247775464589309.json[cached] 14.1 ms 13.3 ms +6.06%

Copy link
Contributor

@ah-yu ah-yu left a comment

Choose a reason for hiding this comment

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

Thank you

@ah-yu ah-yu merged commit 27ff2a7 into biomejs:main Oct 15, 2024
13 checks passed
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

@fireairforce can you please follow up with another PR and address my comments? I think there are some cases that we need to cover

@@ -178,6 +178,16 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

### Parser

#### New features

- JS Parser support defer attribute in import statements ([#4215](https://github.com/biomejs/biome/issues/4215)).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- JS Parser support defer attribute in import statements ([#4215](https://github.com/biomejs/biome/issues/4215)).
- Add support for parsing the defer attribute in import statements ([#4215](https://github.com/biomejs/biome/issues/4215)).

Comment on lines 1254 to +1255
'type'?
'defer'?
Copy link
Member

Choose a reason for hiding this comment

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

Is this correct? Did you check if typescript will add the keyword defer after type? It would be nice if you could provide this information at least in the PR description

Copy link
Member Author

Choose a reason for hiding this comment

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

this is wrong, microsoft/TypeScript#59391, so maybe i need to support a new data structure like JsDeferImportNamespaceClause to support this case:

JsDeferImportNamespaceClause =
	'defer'?
	namespace_specifier: JsNamespaceImportSpecifier
	'from'
	source: AnyJsModuleSource
	assertion: JsImportAssertion?

What do you think?

Comment on lines +297 to +298
// test js import_defer_clause
// import defer * as yNamespace from "y";
Copy link
Member

Choose a reason for hiding this comment

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

import type defer * as yNamespace from "y"; is missing, we should add a test case for that

Copy link
Member Author

Choose a reason for hiding this comment

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

this case maybe need to be an error.

@fireairforce
Copy link
Member Author

ok, i will follow this later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Formatter Area: formatter A-Parser Area: parser A-Tooling Area: internal tools L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

📎 Add support for the defer attribute in import statements
3 participants