From d1038918bb92307d62ed7edfbb6c9b3ed37e41cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Tue, 30 Jun 2026 20:49:04 -0700 Subject: [PATCH] fix(lint): catch visible markup comments (#1819) * fix(lint): catch visible markup comments * test(lint): cover visible comment exemptions * fix(lint): harden visible comment scan --- packages/lint/src/context.ts | 9 +++- packages/lint/src/rules/core.test.ts | 81 ++++++++++++++++++++++++++++ packages/lint/src/rules/core.ts | 69 ++++++++++++++++++++++++ 3 files changed, 158 insertions(+), 1 deletion(-) diff --git a/packages/lint/src/context.ts b/packages/lint/src/context.ts index 7ee0d7516..3e71b29a3 100644 --- a/packages/lint/src/context.ts +++ b/packages/lint/src/context.ts @@ -34,8 +34,15 @@ export function buildLintContext(html: string, options: HyperframeLinterOptions // hijack the boundary match below. Linear + fixpoint (see stripHtmlComments) to // stay ReDoS-free and catch markers that re-form when a comment is removed. let source = stripHtmlComments(rawSource); + const sourceWithoutTemplates = source.replace( + /]*>[\s\S]*?<\/template(?:\s[^>]*)?>/gi, + " ", + ); const templateMatch = source.match(/]*>([\s\S]*)<\/template>/i); - if (templateMatch?.[1]) source = templateMatch[1]; + // Some sub-composition files are HTML shells whose real root lives inside a + //