Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
15 changes: 15 additions & 0 deletions tests/lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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',
},
},
],
},
]),
});