Adding quotes around output markup with `| json` is not a safe formatting operation
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- tooling
调研方向
使用报告中的 Liquid 和 HTML 示例,通过 Prettier 3.0.0 和 @shopify/prettier-plugin-liquid 1.2.1 重现格式变化。跟踪格式化程序对包含 json 过滤器的输出标记的行为,然后验证格式化会保留不带引号的形式,并且不会向生成的数据集值添加转义引号。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
Formatting the document causes quotation marks to be added around output markup that contains | json, which is not a safe formatting operation if the value being piped to the json filter is a string.
Unformatted source
No quotes around the tag:
<div
data-something={{ someStringVar | json }}
></div>
Expected output
(no change)
<div
data-something={{ someStringVar | json }}
></div>
Actual output
Adds quotes around tag:
<div
data-something='{{ someStringVar | json }}'
></div>
Which gets evaluated as:
<div
data-something=""someValue""
></div>
(Or maybe that's just the way Chrome renders it on the 'Elements' tab. When I copy the outerHTML to a clipboard it looks like ""someValue"")
And then the element's dataset gets changed from:
{
something: 'someValue'
}
to:
{
something: '\"someValue\"'
}
Debugging information
- Ubuntu 20.04
- Prettier version 3.0.0
- @shopify/prettier-plugin-liquid version 1.2.1
- 主要语言
- TypeScript
- 星标
- 245
- 派生
- 108
- 平均合并
- 2 天 8 小时
- 30 天内合并 PR
- 24
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Shopify/theme-tools 的其他 Issue
-
ThemeCheck incorrectly reports error when `with` is used in snippet可能已有人在做 @efegokdemir 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
Shopify/theme-tools#1408 ·
维护者通常 2 天内回复
-
CdnPreconnect misses `href="https://cdn.shopify.com"` without a trailing path可能已有人在做 @RaphaelFakhri 于 33 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
Shopify/theme-tools#1365 ·
维护者通常 2 天内回复
-
theme-graph CLI never calls getWebComponentMap, so custom-element references are never resolved可能已有人在做 @reginaldalfret 于 51 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
Shopify/theme-tools#1291 · 1 条评论 ·
维护者通常 2 天内回复
-
JSONMissingBlock false positive for app block when section supports both @app and @theme可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
Shopify/theme-tools#1144 · 2 条评论 · 8 个 reaction ·
维护者通常 2 天内回复
-
theme-language-server: creating or deleting a folder leaves stale readDirectory/stat cache可能已有人在做 @efegokdemir 于 14 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
Shopify/theme-tools#1386 ·
维护者通常 2 天内回复
查看 Shopify/theme-tools 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
-
bug triage:in-progress
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
e2e-failure ready-to-code
难度 2/5 1-3 小时 新手友好度 72/100
redhat-developer/rhdh-plugin-export-overlays#4845 · 1 条评论 ·
维护者通常 1 天内回复
-
chore kaizen ui-rewrite
难度 2/5 1-3 小时 新手友好度 64/100
IBM/mcp-context-forge#7681 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
cloudflare/workers-sdk#17159 ·
维护者通常 1 天内回复