fix: compile typed catches and reject event loop syntax
Quality / quality (ubuntu-latest) (push) Failing after 9m46s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-12 19:36:18 +05:30
parent d47c57a953
commit f68f79786f
8 changed files with 52 additions and 21 deletions
+12
View File
@@ -246,6 +246,18 @@ function astDiagnostics(ast: PageAst, options: DiagnoseOptions): WrnDiagnostic[]
const tag = node.tag.toLowerCase();
for (const attribute of node.attrs) {
if (attribute.event && (attribute.name === "for" || attribute.name === "key")) {
diagnostics.push({
code: "WRN-TEMPLATE-LOOP-DIRECTIVE",
severity: "error",
message: `@${attribute.name} is an event binding, not a loop directive.`,
hint:
attribute.name === "for"
? 'Use data-for="item in items".'
: 'Use data-key="item.id" alongside data-for.',
file: options.file,
});
}
if (attribute.event || attribute.boolean || !urlAttributes.has(attribute.name.toLowerCase()))
continue;
if (attribute.value.includes("{")) continue;