Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.04 KB

pr-8173.md

File metadata and controls

30 lines (25 loc) · 1.04 KB

Support legacy HTML-like comments script blocks (#8173 by @fisker, #8394 by @fisker)

Previously we parse html <script> blocks as "module"(ECMAScript Module grammar), this is why we can't parse comments starts with <!--(aka HTML-like comments), now we parse <script> blocks as "script", unless this <script>

  1. type="module"
  2. type="text/babel" and data-type="module", will be introduced in babel@v7.10.0
<!-- Input -->
<SCRIPT>
<!--
alert("hello" +    ' world!')
//--></SCRIPT>

<!-- Prettier stable -->
SyntaxError: Unexpected token (2:1)
  1 |
> 2 | <!--
    | ^
  3 | alert("hello" +    ' world!')
  4 | //-->

<!-- Prettier master -->
<script>
  <!--
  alert("hello" + " world!");
  //-->
</script>