Repository: jsx-eslint/eslint-plugin-react
Pull request #3415 (2022-09-06 14:23:30)

[Fix] `no-unknown-property`: allow `onLoad` on `<object>`

codecov[bot]: # [Codecov](https://codecov.io/gh/jsx-eslint/eslint-plugin-react/pull/3415?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jsx-eslint) Report
> Merging [#3415](https://codecov.io/gh/jsx-eslint/eslint-plugin-react/pull/3415?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jsx-eslint) (bf21d8d) into [master](https://codecov.io/gh/jsx-eslint/eslint-plugin-react/commit/22c569bedc650f8eb0912441c48c63f1489b4276?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jsx-eslint) (22c569b) will **decrease** coverage by `0.17%`.
> The diff coverage is `n/a`.

> :exclamation: Current head bf21d8d differs from pull request most recent head 350bfcd. Consider uploading reports for the commit 350bfcd to get more accurate results

```diff
@@            Coverage Diff             @@
##           master    #3415      +/-   ##
==========================================
- Coverage   97.58%   97.40%   -0.18%     
==========================================
  Files         123      123              
  Lines        8957     8957              
  Branches     3271     3271              
==========================================
- Hits         8741     8725      -16     
- Misses        216      232      +16     
```


| [Impacted Files](https://codecov.io/gh/jsx-eslint/eslint-plugin-react/pull/3415?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jsx-eslint) | Coverage Δ | |
|---|---|---|
| [lib/rules/no-unknown-property.js](https://codecov.io/gh/jsx-eslint/eslint-plugin-react/pull/3415/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jsx-eslint#diff-bGliL3J1bGVzL25vLXVua25vd24tcHJvcGVydHkuanM=) | `98.82% <ø> (ø)` | |
| [lib/rules/no-unused-state.js](https://codecov.io/gh/jsx-eslint/eslint-plugin-react/pull/3415/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jsx-eslint#diff-bGliL3J1bGVzL25vLXVudXNlZC1zdGF0ZS5qcw==) | `93.51% <0.00%> (-5.73%)` | :arrow_down: |
| [lib/rules/jsx-props-no-spreading.js](https://codecov.io/gh/jsx-eslint/eslint-plugin-react/pull/3415/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jsx-eslint#diff-bGliL3J1bGVzL2pzeC1wcm9wcy1uby1zcHJlYWRpbmcuanM=) | `95.65% <0.00%> (-2.18%)` | :arrow_down: |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jsx-eslint). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=jsx-eslint)


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3359afac..54cb112a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,12 +8,14 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
 ### Fixed
 * [`no-unknown-property`]: add `viewBox` on `marker` ([#3416][] @ljharb)
 * [`no-unknown-property`]: add `noModule` on `script` ([#3414][] @ljharb)
+* [`no-unknown-property`]: allow `onLoad` on `<object>` ([#3415][] @OleksiiKachan)
 
 ### Changed
 
 * [Meta] npmignore markdownlint config ([#3413][] @jorrit)
 
 [#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
 [#3413]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3413
 
diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js
index 2f1a4fc6..26e39fd2 100644
--- a/lib/rules/no-unknown-property.js
+++ b/lib/rules/no-unknown-property.js
@@ -75,7 +75,7 @@ const ATTRIBUTE_TAGS_MAP = {
   onEncrypted: ['audio', 'video'],
   onEnded: ['audio', 'video'],
   onError: ['audio', 'video', 'img', 'link', 'source', 'script', 'picture', 'iframe'],
-  onLoad: ['script', 'img', 'link', 'picture', 'iframe'],
+  onLoad: ['script', 'img', 'link', 'picture', 'iframe', 'object'],
   onLoadedData: ['audio', 'video'],
   onLoadedMetadata: ['audio', 'video'],
   onLoadStart: ['audio', 'video'],


Test patch:
diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js
index d58c6e21..911d2817 100644
--- a/tests/lib/rules/no-unknown-property.js
+++ b/tests/lib/rules/no-unknown-property.js
@@ -66,6 +66,7 @@ ruleTester.run('no-unknown-property', rule, {
     { code: '<source onError={foo} />' },
     { code: '<link onLoad={bar} onError={foo} />' },
     { code: '<link rel="preload" as="image" href="someHref" imageSrcSet="someImageSrcSet" imageSizes="someImageSizes" />' },
+    { code: '<object onLoad={bar} />' },
     { code: '<div allowFullScreen webkitAllowFullScreen mozAllowFullScreen />' },
     { code: '<table border="1" />' },
     {
@@ -443,7 +444,7 @@ ruleTester.run('no-unknown-property', rule, {
           data: {
             name: 'onLoad',
             tagName: 'div',
-            allowedTags: 'script, img, link, picture, iframe',
+            allowedTags: 'script, img, link, picture, iframe, object',
           },
         },
       ],