Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Keep table rows inside valid thead/tbody/tfoot sections
Don't place a <thead> after a <tbody> or leave a <tr> directly under <table>; each row must live in a section, and a second header means a new <tbody> row or a separate table.
Bad example
| 1 | <table> |
| 2 | <thead><tr><th>A</th></tr></thead> |
| 3 | <tbody>{rows.map(...)}</tbody> |
| 4 | <tr><td colSpan={1} /></tr> {/* orphan row */} |
| 5 | <thead><tr><th>B</th></tr></thead> {/* thead after tbody */} |
| 6 | <tbody>{moreRows.map(...)}</tbody> |
| 7 | </table> |
Explanation (EN)
A second <thead> after a <tbody> and a bare <tr> under <table> are invalid; the browser reorders the sections, breaking the intended layout and semantics.
Objašnjenje (HR)
Drugi <thead> nakon <tbody> i goli <tr> ispod <table> nisu valjani; preglednik preraspodjeljuje sekcije, narusavajuci namjeravani izgled i semantiku.
Good example
| 1 | <table> |
| 2 | <thead><tr><th>A</th></tr></thead> |
| 3 | <tbody>{rows.map(...)}</tbody> |
| 4 | </table> |
| 5 | <table> |
| 6 | <thead><tr><th>B</th></tr></thead> |
| 7 | <tbody>{moreRows.map(...)}</tbody> |
| 8 | </table> |
Explanation (EN)
Each logical section becomes its own valid table with a single thead/tbody, so the markup renders predictably and stays accessible.
Objašnjenje (HR)
Svaka logicka sekcija postaje vlastita valjana tablica s jednim thead/tbody, pa se markup renderira predvidljivo i ostaje pristupacan.
Exceptions / Tradeoffs (EN)
A single table may legitimately contain multiple <tbody> sections; that is valid — the rule forbids multiple <thead> and orphan rows.
Iznimke / Tradeoffi (HR)
Jedna tablica smije legitimno sadrzavati vise <tbody> sekcija; to je valjano — pravilo zabranjuje vise <thead> i siroce retke.