diff --git a/packages/lint/src/rules/core.test.ts b/packages/lint/src/rules/core.test.ts index 15341e0f76..d3f1832d37 100644 --- a/packages/lint/src/rules/core.test.ts +++ b/packages/lint/src/rules/core.test.ts @@ -143,6 +143,29 @@ describe("core rules", () => { expect(result.findings.find((f) => f.code === "root_missing_dimensions")).toBeUndefined(); }); + it("does not mistake a -shaped CSS comment inside + + + + +`; + const result = await lintHyperframeHtml(html); + expect(result.findings.find((f) => f.code === "root_missing_composition_id")).toBeUndefined(); + expect(result.findings.find((f) => f.code === "root_missing_dimensions")).toBeUndefined(); + expect(result.findings.find((f) => f.code === "head_leaked_text")).toBeUndefined(); + }); + it("reports error when timeline registry is missing", async () => { const html = ` diff --git a/packages/lint/src/utils.ts b/packages/lint/src/utils.ts index 4b2b2c7c4d..4de1c2c82f 100644 --- a/packages/lint/src/utils.ts +++ b/packages/lint/src/utils.ts @@ -51,13 +51,34 @@ const TIMELINE_REGISTRY_OBJECT_BODY_PATTERN = /window\.__timelines\s*=\s*\{([\s\ const TIMELINE_REGISTRY_OBJECT_ENTRY_PATTERN = /(?:["']([^"']+)["']|([A-Za-z_$][\w$]*))\s*:\s*[A-Za-z_$][\w$]*/g; +//