HTML: RSPEC-1102 demands either id or scope on each th element

RSPEC-1102 erroneously demands that each th element has either an id or a scope attribute, even in simple tables. The table below is quoted from the HTML5 specification (but with end tags added where the spec omits the optional end tags):

<table>
  <caption>Characteristics with positive and negative sides</caption>
  <thead>
   <tr>
    <th>Characteristic</th>
    <th>Negative</th>
    <th>Positive</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <th>Mood</th>
    <td>Sad</td>
    <td>Happy</td>
   </tr>
   <tr>
    <th>Grade</th>
    <td>Failing</td>
    <td>Passing</td>
  </tr>
 </tbody>
</table>

For each of the th elements, SonarLint in VS Code says, “Add either an id or a scope attribute to this <th> tag”.
Since this is a simple table, this is not necessary. Screen readers can make perfect sense of this table with adding scope attributes or without adding id attributes to the th elements with headers attributes on the td elements that reference the th IDs.

For example, if you add scope=row to the th elements for “Mood” and “Grade”, this makes absolutely no difference when reading this table with NVDA or Narrator in Edge.

For an example of a table that has the scope attribute only on row header cells and not on column header cells (an no id attributes anywhere), see WCAG 2.1 Technique H51: Using table markup to present tabular information at the W3C.

The attributes scope and id make sense in complex tables but are redundant in simple tables such as the above. SonarLint should first check whether the table is a complex table, and prompt for the addition of either scope or id if it concludes that the table is complex.

The following statement in RSPEC-1102 is also erroneous:

Tables are considered as such when the headers are either all in the first row, or all in the first column. The two conditions must not apply together.

In reality, it is perfectly acceptable to have both row headers and column headers.

The above comments are also relevant to RSPEC-5260.