-
-
Notifications
You must be signed in to change notification settings - Fork 791
fix: noSyncScripts type="module" #8149
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
Conversation
🦋 Changeset detectedLatest commit: c4c53c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
c6741e6 to
ff17ff3
Compare
.changeset/pretty-pumas-float.md
Outdated
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Improve noSyncScripts, ignore script tags with `type="module"` |
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.
Link the issue that this is fixing
ff17ff3 to
341bd21
Compare
CodSpeed Performance ReportMerging #8149 will not alter performanceComparing Summary
Footnotes
|
ematipico
left a comment
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.
Nice!!
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.
The fix looks alright, but I think we may need to be a bit more careful with the implementation.
| attribute.initializer().is_some_and(|initializer| { | ||
| initializer.value().ok().is_some_and(|value| { | ||
| value.as_html_string().is_some_and(|html_string| { | ||
| html_string.inner_string_text().unwrap().text() == "module" |
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.
Is this unwrap() safe?
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 a check
| } | ||
|
|
||
| /// Create a new string literal token with no attached trivia | ||
| pub fn html_string_literal(text: &str) -> HtmlSyntaxToken { |
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.
Does this get used anywhere in the PR?
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.
It's used in the example of inner_string_text. The CI seemed to fail on that implementation missing even tho it's it's only in the docs
| /// .with_leading_trivia(vec![(TriviaPieceKind::Whitespace, " ")])); | ||
| /// assert_eq!(string.inner_string_text().unwrap().text(), "button"); | ||
| /// ``` | ||
| pub fn inner_string_text(&self) -> SyntaxResult<TokenText> { |
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.
What is the purpose of this wrapper function?
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.
To make it easier to access the inner string text; js, json, css also have such wrapper function
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.
How much easier is it if we already have one?
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.
The css, json, css wrapper functions are not available on the HtmlString
inner_string_text(html_string.value_token()?).ok()?.text() vs
html_string.inner_string_text?.text()
basically continued the pattern that was already in place, to make inner_string_text a function of a syntax String, but missing for HtmlString
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.
Mhm thoughts? @ematipico @dyc3
| attribute.initializer().is_some_and(|initializer| { | ||
| initializer.value().ok().is_some_and(|value| { | ||
| value.as_jsx_string().is_some_and(|jsx_string| { | ||
| jsx_string.inner_string_text().unwrap().text() == "module" |
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.
Also mind this unwrap() please.
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 a check
Summary
script tags with
type="module"are non-blocking; https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script#blockingCloses #8144
Test Plan
Docs