Skip to content

Commit 35f6403

Browse files
committed
[Fix] no-unknown-property: add inert attribute
Fixes #3484
1 parent 6e41392 commit 35f6403

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1515
* configs: avoid legacy config system error ([#3461][] @ljharb)
1616
* [`jsx-no-target-blank`]: allow ternaries with literals ([#3464][] @akulsr0)
1717
* [`sort-prop-types`]: restore autofixing ([#2574][] @ROSSROSALES)
18+
* [`no-unknown-property`]: add `inert` attribute ([#3484][] @ljharb)
1819

1920
### Changed
2021
* [Perf] component detection: improve performance by avoiding traversing parents unnecessarily ([#3459][] @golopot)
2122
* [Docs] `forbid-component-props`: inclusive language w/ allowlist ([#3473][] @AndersDJohnson)
2223
* [Docs] automate doc generation with `eslint-doc-generator` ([#3469][] @bmish)
2324

25+
[#3484]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3484
2426
[#3473]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3473
2527
[#3469]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3469
2628
[#3464]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3464

lib/rules/no-unknown-property.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const SVGDOM_ATTRIBUTE_NAMES = {
202202
const DOM_PROPERTY_NAMES_ONE_WORD = [
203203
// Global attributes - can be used on any HTML/DOM element
204204
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
205-
'dir', 'draggable', 'hidden', 'id', 'lang', 'nonce', 'part', 'slot', 'style', 'title', 'translate',
205+
'dir', 'draggable', 'hidden', 'id', 'lang', 'nonce', 'part', 'slot', 'style', 'title', 'translate', 'inert',
206206
// Element specific attributes
207207
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes (includes global attributes too)
208208
// To be considered if these should be added also to ATTRIBUTE_TAGS_MAP

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ruleTester.run('no-unknown-property', rule, {
5151
{ code: '<input ref={this.input} type="radio" />' },
5252
{ code: '<input type="file" webkitdirectory="" />' },
5353
{ code: '<input type="file" webkitDirectory="" />' },
54-
{ code: '<div children="anything" />' },
54+
{ code: '<div inert children="anything" />' },
5555
{ code: '<iframe scrolling="?" onLoad={a} onError={b} align="top" />' },
5656
{ code: '<input key="bar" type="radio" />' },
5757
{ code: '<button disabled>You cannot click me</button>;' },
@@ -62,7 +62,7 @@ ruleTester.run('no-unknown-property', rule, {
6262
{ code: '<input type="checkbox" checked={checked} disabled={disabled} id={id} onChange={onChange} />' },
6363
{ code: '<video playsInline />' },
6464
{ code: '<img onError={foo} onLoad={bar} />' },
65-
{ code: '<picture onError={foo} onLoad={bar} />' },
65+
{ code: '<picture inert={false} onError={foo} onLoad={bar} />' },
6666
{ code: '<iframe onError={foo} onLoad={bar} />' },
6767
{ code: '<script onLoad={bar} onError={foo} />' },
6868
{ code: '<source onError={foo} />' },

0 commit comments

Comments
 (0)