Skip to content

Commit fd90b0e

Browse files
OleksiiKachanljharb
OleksiiKachan
authored andcommitted
[Fix] no-unknown-property: allow abbr on <th> and <td>
Fixes #3418.
1 parent 8aa023a commit fd90b0e

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1010
* [`no-unknown-property`]: add `noModule` on `script` ([#3414][] @ljharb)
1111
* [`no-unknown-property`]: allow `onLoad` on `<object>` ([#3415][] @OleksiiKachan)
1212
* [`no-multi-comp`]: do not detect a function property returning only null as a component ([#3412][] @ljharb)
13+
* [`no-unknown-property`]: allow `abbr` on `<th>` and `<td>` ([#3419][] @OleksiiKachan)
1314

1415
### Changed
1516

1617
* [Meta] npmignore markdownlint config ([#3413][] @jorrit)
1718

19+
[#3419]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3419
1820
[#3416]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3416
1921
[#3415]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3415
2022
[#3414]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3414

lib/rules/no-unknown-property.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const DOM_ATTRIBUTE_NAMES = {
2828
};
2929

3030
const ATTRIBUTE_TAGS_MAP = {
31+
abbr: ['th', 'td'],
3132
checked: ['input'],
3233
// image is required for SVG support, all other tags are HTML.
3334
crossOrigin: ['script', 'img', 'video', 'audio', 'link', 'image'],

tests/lib/rules/no-unknown-property.js

+15
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ ruleTester.run('no-unknown-property', rule, {
6969
{ code: '<object onLoad={bar} />' },
7070
{ code: '<div allowFullScreen webkitAllowFullScreen mozAllowFullScreen />' },
7171
{ code: '<table border="1" />' },
72+
{ code: '<th abbr="abbr" />' },
73+
{ code: '<td abbr="abbr" />' },
7274
{
7375
code: '<div allowTransparency="true" />',
7476
settings: {
@@ -549,5 +551,18 @@ ruleTester.run('no-unknown-property', rule, {
549551
},
550552
],
551553
},
554+
{
555+
code: '<div abbr="abbr" />',
556+
errors: [
557+
{
558+
messageId: 'invalidPropOnTag',
559+
data: {
560+
name: 'abbr',
561+
tagName: 'div',
562+
allowedTags: 'th, td',
563+
},
564+
},
565+
],
566+
},
552567
]),
553568
});

0 commit comments

Comments
 (0)