Repository: jsx-eslint/eslint-plugin-react (js)

Issue:
react/no-unknown-property: allow abbr on th
The `react/no-unknown-property` rule reports the `abbr` tag on `th` elements as invalid, which seems incorrect: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-abbr

Pull request description:
[Fix] `no-unknown-property`: allow `abbr` on `<th>` and `<td>`
Fixes #3418

[https://www.w3resource.com/html/attributes/html-abbr-attribute.php]()

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c5c9253d..1d5324d1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,11 +10,13 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
 * [`no-unknown-property`]: add `noModule` on `script` ([#3414][] @ljharb)
 * [`no-unknown-property`]: allow `onLoad` on `<object>` ([#3415][] @OleksiiKachan)
 * [`no-multi-comp`]: do not detect a function property returning only null as a component ([#3412][] @ljharb)
+* [`no-unknown-property`]: allow `abbr` on `<th>` and `<td>` ([#3419][] @OleksiiKachan)
 
 ### Changed
 
 * [Meta] npmignore markdownlint config ([#3413][] @jorrit)
 
+[#3419]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3419
 [#3416]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3416
 [#3415]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3415
 [#3414]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3414
diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js
index 26e39fd2..92f0257f 100644
--- a/lib/rules/no-unknown-property.js
+++ b/lib/rules/no-unknown-property.js
@@ -28,6 +28,7 @@ const DOM_ATTRIBUTE_NAMES = {
 };
 
 const ATTRIBUTE_TAGS_MAP = {
+  abbr: ['th', 'td'],
   checked: ['input'],
   // image is required for SVG support, all other tags are HTML.
   crossOrigin: ['script', 'img', 'video', 'audio', 'link', 'image'],


Test patch:
diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js
index 911d2817..00060413 100644
--- a/tests/lib/rules/no-unknown-property.js
+++ b/tests/lib/rules/no-unknown-property.js
@@ -69,6 +69,8 @@ ruleTester.run('no-unknown-property', rule, {
     { code: '<object onLoad={bar} />' },
     { code: '<div allowFullScreen webkitAllowFullScreen mozAllowFullScreen />' },
     { code: '<table border="1" />' },
+    { code: '<th abbr="abbr" />' },
+    { code: '<td abbr="abbr" />' },
     {
       code: '<div allowTransparency="true" />',
       settings: {
@@ -549,5 +551,18 @@ ruleTester.run('no-unknown-property', rule, {
         },
       ],
     },
+    {
+      code: '<div abbr="abbr" />',
+      errors: [
+        {
+          messageId: 'invalidPropOnTag',
+          data: {
+            name: 'abbr',
+            tagName: 'div',
+            allowedTags: 'th, td',
+          },
+        },
+      ],
+    },
   ]),
 });