Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds LWC Parser to support unquoted interop attributes (#5800)
This pull requests adds a new parser option `lwc`. This is the same as the HTML parser, but it adds support for unquoted HTML attributes per the needs of LWC. See: #5627
- Loading branch information
Showing
19 changed files
with
239 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`attributes.html 1`] = ` | ||
====================================options===================================== | ||
parser: "lwc" | ||
parsers: ["lwc"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
<template> | ||
<div | ||
data-for={value} | ||
data-for={value[0]} | ||
data-for={value.toString()} | ||
data-for={value()} | ||
class="test" | ||
></div> | ||
</template> | ||
<template if:true={value.error}> | ||
<c-error-panel errors={value.error}></c-error-panel> | ||
</template> | ||
<a href="#" onclick={aFunction}> | ||
=====================================output===================================== | ||
<template> | ||
<div | ||
data-for={value} | ||
data-for={value[0]} | ||
data-for={value.toString()} | ||
data-for={value()} | ||
class="test" | ||
></div> | ||
</template> | ||
<template if:true={value.error}> | ||
<c-error-panel errors={value.error}></c-error-panel> | ||
</template> | ||
<a href="#" onclick={aFunction}></a> | ||
================================================================================ | ||
`; | ||
|
||
exports[`attributes.html 2`] = ` | ||
====================================options===================================== | ||
parser: "lwc" | ||
parsers: ["lwc"] | ||
printWidth: 80 | ||
trailingComma: "es5" | ||
| printWidth | ||
=====================================input====================================== | ||
<template> | ||
<div | ||
data-for={value} | ||
data-for={value[0]} | ||
data-for={value.toString()} | ||
data-for={value()} | ||
class="test" | ||
></div> | ||
</template> | ||
<template if:true={value.error}> | ||
<c-error-panel errors={value.error}></c-error-panel> | ||
</template> | ||
<a href="#" onclick={aFunction}> | ||
=====================================output===================================== | ||
<template> | ||
<div | ||
data-for={value} | ||
data-for={value[0]} | ||
data-for={value.toString()} | ||
data-for={value()} | ||
class="test" | ||
></div> | ||
</template> | ||
<template if:true={value.error}> | ||
<c-error-panel errors={value.error}></c-error-panel> | ||
</template> | ||
<a href="#" onclick={aFunction}></a> | ||
================================================================================ | ||
`; | ||
|
||
exports[`attributes.html 3`] = ` | ||
====================================options===================================== | ||
parser: "lwc" | ||
parsers: ["lwc"] | ||
printWidth: 80 | ||
semi: false | ||
| printWidth | ||
=====================================input====================================== | ||
<template> | ||
<div | ||
data-for={value} | ||
data-for={value[0]} | ||
data-for={value.toString()} | ||
data-for={value()} | ||
class="test" | ||
></div> | ||
</template> | ||
<template if:true={value.error}> | ||
<c-error-panel errors={value.error}></c-error-panel> | ||
</template> | ||
<a href="#" onclick={aFunction}> | ||
=====================================output===================================== | ||
<template> | ||
<div | ||
data-for={value} | ||
data-for={value[0]} | ||
data-for={value.toString()} | ||
data-for={value()} | ||
class="test" | ||
></div> | ||
</template> | ||
<template if:true={value.error}> | ||
<c-error-panel errors={value.error}></c-error-panel> | ||
</template> | ||
<a href="#" onclick={aFunction}></a> | ||
================================================================================ | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<template> | ||
<div | ||
data-for={value} | ||
data-for={value[0]} | ||
data-for={value.toString()} | ||
data-for={value()} | ||
class="test" | ||
></div> | ||
</template> | ||
<template if:true={value.error}> | ||
<c-error-panel errors={value.error}></c-error-panel> | ||
</template> | ||
<a href="#" onclick={aFunction}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
run_spec(__dirname, ["lwc"], { parser: "lwc" }); | ||
run_spec(__dirname, ["lwc"], { parser: "lwc", trailingComma: "es5" }); | ||
run_spec(__dirname, ["lwc"], { parser: "lwc", semi: false }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.