Skip to content

Commit

Permalink
fix: prevent parsing of json script tags (#211)
Browse files Browse the repository at this point in the history
* fix: prevent parsing of json script tags

* Create tall-waves-hug.md

* chore: fix linting issues

---------

Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
  • Loading branch information
SudoCat and ota-meshi committed May 25, 2023
1 parent 541a9ba commit 639d010
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tall-waves-hug.md
@@ -0,0 +1,5 @@
---
"eslint-plugin-astro": patch
---

fix: prevent parsing of json script tags
6 changes: 5 additions & 1 deletion src/processor/index.ts
Expand Up @@ -20,7 +20,11 @@ export const processor: Linter.Processor = {
if (
node.type === "element" &&
node.name === "script" &&
node.children.length
node.children.length &&
!node.attributes.some(
({ name, value }) =>
name === "type" && /json$|importmap/i.test(value),
)
) {
shared.addClientScript(code, node, parsed)
}
Expand Down

0 comments on commit 639d010

Please sign in to comment.