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('');
- if (closeStart >= 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,