Repository: jsx-eslint/eslint-plugin-react
Pull request #3697 (2024-02-26 08:14:54)

[Fix] `no-unknown-property`: add `fetchPriority`
See:

- [HTML Standard](https://html.spec.whatwg.org/multipage/indices.html#attributes-3:~:text=Sets%20the%20priority%20for%20fetches%20initiated%20by%20the%20element)
- [mdn](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchpriority)
- DefinitelyTyped/DefinitelyTyped#68645


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d4d7360..9e897108 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
 * [`jsx-newline`]: prevent a crash when `allowMultilines ([#3633][] @ljharb)
 * [`no-unknown-property`]: use a better regex to avoid a crash ([#3666][] @ljharb @SCH227)
 * [`prop-types`]: handle nested forwardRef + memo ([#3679][] @developer-bandi)
+* [`no-unknown-property`]: add `fetchPriority` ([#3697][] @SevereCloud)
 
 ### Changed
 * [Refactor] `propTypes`: extract type params to var ([#3634][] @HenryBrown0)
@@ -37,6 +38,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
 * [Docs] [`iframe-missing-sandbox`]: fix link to iframe attribute on mdn ([#3690][] @nnmrts)
 * [Docs] [`hook-use-state`]: fix an undefined variable ([#3626][] @chentsulin)
 
+[#3697]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3697
 [#3690]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3690
 [#3680]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3680
 [#3679]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3679
diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js
index 2e77f289..ec913e1f 100644
--- a/lib/rules/no-unknown-property.js
+++ b/lib/rules/no-unknown-property.js
@@ -257,7 +257,7 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
   'onError', 'onFocus', 'onInput', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onLoad', 'onWheel', 'onDragOver',
   'onDragStart', 'onDrop', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver',
   'onMouseUp', 'onPaste', 'onScroll', 'onSelect', 'onSubmit', 'onToggle', 'onTransitionEnd', 'radioGroup', 'readOnly', 'referrerPolicy',
-  'rowSpan', 'srcDoc', 'srcLang', 'srcSet', 'useMap',
+  'rowSpan', 'srcDoc', 'srcLang', 'srcSet', 'useMap', 'fetchPriority',
   // SVG attributes
   // See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
   'crossOrigin', 'accentHeight', 'alignmentBaseline', 'arabicForm', 'attributeName',


Test patch:
diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js
index 3c20feeb..89624d54 100644
--- a/tests/lib/rules/no-unknown-property.js
+++ b/tests/lib/rules/no-unknown-property.js
@@ -46,7 +46,7 @@ ruleTester.run('no-unknown-property', rule, {
     { code: '<div onMouseDown={this._onMouseDown}></div>;' },
     { code: '<a href="someLink" download="foo">Read more</a>' },
     { code: '<area download="foo" />' },
-    { code: '<img src="cat_keyboard.jpeg" alt="A cat sleeping on a keyboard" align="top" />' },
+    { code: '<img src="cat_keyboard.jpeg" alt="A cat sleeping on a keyboard" align="top" fetchPriority="high" />' },
     { code: '<input type="password" required />' },
     { code: '<input ref={this.input} type="radio" />' },
     { code: '<input type="file" webkitdirectory="" />' },