github-actions[bot] b64b26b71a
Create rule S5256 (#3886)
* Add javascript to rule S5256

* [JS-3] Add Rspec

---------

Co-authored-by: zglicz <zglicz@users.noreply.github.com>
Co-authored-by: Michal Zgliczynski <michal.zgliczynski@sonarsource.com>
2024-04-18 11:38:03 +02:00

52 lines
820 B
Plaintext

include::../why.adoc[]
This rule raises an issue whenever it detects a table that does not have a full row or column with `<th>` elements.
include::../exceptions.adoc[]
include::../how.adoc[]
=== Code examples
==== Noncompliant code example
[source,javascript,diff-id=1,diff-type=noncompliant]
----
<table> <!-- Noncompliant -->
<tr>
<td>Name</td>
<td>Age</td>
</tr>
<tr>
<td>John Doe</td>
<td>24</td>
</tr>
<tr>
<td>Alice Doe</td>
<td>54</td>
</tr>
</table>
----
==== Compliant solution
[source,javascript,diff-id=1,diff-type=compliant]
----
<table>
<tr>
<th scope="col">Name</th>
<th scope="col">Age</th>
</tr>
<tr>
<td>John Doe</td>
<td>24</td>
</tr>
<tr>
<td>Alice Doe</td>
<td>54</td>
</tr>
</table>
----
include::../resources.adoc[]