Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

CdnPreconnect misses `href="https://cdn.shopify.com"` without a trailing path

未关闭 适合新手
#1,365 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@RaphaelFakhri 已经在做这个了。

开始于 2026年10月22日。

  • #1366 来自 @RaphaelFakhri —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
testing-qa

调研方向

找到 CdnPreconnect 检查及其测试,然后查看它如何匹配 href 值,以及如何断言预期的违规情况。添加裸 CDN 主机和协议相对 URL 的用例,再添加不应匹配的 example.com 路径用例;运行针对该检查的测试。完成标准是前两个标签会被报告,第三个不会。

由索引模型根据 Issue 内容生成。

描述

CdnPreconnect matches the href with the pattern .+cdn.shopify.com.+, wrapped in whitespace anchors. The pattern requires at least one character after cdn.shopify.com, so the most common form of the tag is never reported:

<link rel="preconnect" href="https://cdn.shopify.com" crossorigin>
<link rel="preconnect" href="//cdn.shopify.com">

Because the dots are unescaped and the host is not anchored, the pattern also reports links to other hosts that only contain the text in their path:

<link rel="preconnect" href="https://example.com/cdn.shopify.com.html">

The Ruby theme-check version of this check reported any href that contains cdn.shopify.com, so the first case is a regression from the port.

Expected behavior

The first two tags are reported. The third tag is not reported.

Actual behavior

The first two tags produce no offense. The third tag is reported.

Steps to reproduce

  1. Add <link rel="preconnect" href="https://cdn.shopify.com" crossorigin> to layout/theme.liquid.
  2. Run shopify theme check.
  3. No CdnPreconnect offense appears. Changing the href to https://cdn.shopify.com/ reports the offense.
主要语言
TypeScript
星标
240
派生
106
平均合并
1 天 2 小时
30 天内合并 PR
23

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Shopify/theme-tools 的其他 Issue

查看 Shopify/theme-tools 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。