From 92a5cf4e3851710dcc1b01a02271bd21de902997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20R=C3=B8ed?= Date: Mon, 13 Apr 2026 14:33:36 +0200 Subject: [PATCH] Fix template-table-groups: align with upstream's table semantics Match upstream's scope-union reduce for sibling control-flow branches (was producing false positives on legitimate table layouts). Remove the port-only empty-table synthetic check, which over-flagged
beyond upstream's scope. --- lib/rules/template-table-groups.js | 16 +++------------- tests/lib/rules/template-table-groups.js | 7 ++----- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/lib/rules/template-table-groups.js b/lib/rules/template-table-groups.js index 5b02c65fb5..617a94c9ea 100644 --- a/lib/rules/template-table-groups.js +++ b/lib/rules/template-table-groups.js @@ -178,18 +178,6 @@ module.exports = { return; } - // Truly empty table (no content at all between tags) must have table groups - if (!node.children || node.children.length === 0) { - const sourceCode = context.sourceCode; - const text = sourceCode.getText(node); - const openEnd = text.indexOf('>') + 1; - const closeStart = text.lastIndexOf('= 0 && closeStart <= openEnd) { - context.report({ node, messageId: 'missing' }); - return; - } - } - const children = getEffectiveChildren(node.children); let currentAllowedMinimumIndices = new Set([0]); @@ -198,7 +186,9 @@ module.exports = { for (const child of children) { if (child === CONTROL_FLOW_START_MARK) { scopedIndices.push(currentAllowedMinimumIndices); - currentAllowedMinimumIndices = new Set(currentAllowedMinimumIndices); + currentAllowedMinimumIndices = new Set( + scopedIndices.reduce((acc, indices) => [...acc, ...indices]) + ); continue; } if (child === CONTROL_FLOW_END_MARK) { diff --git a/tests/lib/rules/template-table-groups.js b/tests/lib/rules/template-table-groups.js index 4e3799b4e8..1a377d4f30 100644 --- a/tests/lib/rules/template-table-groups.js +++ b/tests/lib/rules/template-table-groups.js @@ -145,6 +145,8 @@ ruleTester.run('template-table-groups', rule, { '', '', '', + // Empty
matches upstream (ember-template-lint) behavior of not flagging. + '', '', '', '', @@ -310,11 +312,6 @@ ruleTester.run('template-table-groups', rule, { output: null, errors: [{ messageId: 'missing' }], }, - { - code: '', - output: null, - errors: [{ messageId: 'missing' }], - }, { code: '', output: null,