Skip to content

Conversation

reduckted
Copy link
Contributor

Closes #2349

This rule is similar to ESLint's no-empty and no-empty-function rules.

If a control flow block is empty, it's probably left over from some incomplete refactoring, or added by mistake.

This rule has does not have a fixer because removing the empty block is not necessarily the correct solution.

Examples of invalid code:

@if (condition) {
}

@for (item of items: track $index) {
}

@for (item of items: track $index) {
    {{ item }}
} @empty {
}
<!-- The above @empty block is unnecessary. -->

Copy link

nx-cloud bot commented Jul 20, 2025

View your CI Pipeline Execution ↗ for commit 64a35c8

Command Status Duration Result
nx run-many -t e2e-suite --parallel 1 ✅ Succeeded 25s View ↗
nx run-many -t test --codeCoverage ✅ Succeeded 41s View ↗
nx run-many -t build,typecheck,check-rule-docs,... ✅ Succeeded 48s View ↗
nx-cloud record -- pnpm nx sync:check ✅ Succeeded 2s View ↗
nx-cloud record -- pnpm format-check ✅ Succeeded 6s View ↗
nx run-many -t test ✅ Succeeded 31s View ↗
nx run-many -t build ✅ Succeeded 14s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-21 09:22:20 UTC

Copy link

codecov bot commented Jul 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.93%. Comparing base (813b8ce) to head (64a35c8).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2592      +/-   ##
==========================================
+ Coverage   92.89%   92.93%   +0.03%     
==========================================
  Files         207      209       +2     
  Lines        4378     4400      +22     
  Branches     1017     1023       +6     
==========================================
+ Hits         4067     4089      +22     
  Misses        241      241              
  Partials       70       70              
Flag Coverage Δ
unittest 92.93% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/eslint-plugin-template/src/index.ts 100.00% <100.00%> (ø)
...plugin-template/src/rules/no-empty-control-flow.ts 100.00% <100.00%> (ø)
...emplate/tests/rules/no-empty-control-flow/cases.ts 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks, just the one comment fix

@reduckted reduckted requested a review from JamesHenry July 21, 2025 09:20
@JamesHenry JamesHenry merged commit afe0b7d into angular-eslint:main Jul 21, 2025
11 checks passed
@reduckted reduckted deleted the feature/no-empty-control-flow branch July 21, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants