From e8356addc90562348afbfbd3f03df8256eadfdc1 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 5 Sep 2022 11:39:58 -0700 Subject: [PATCH] [Fix] `no-unknown-property`: add `border`; `focusable` on `` Fixes #3404. Fixes #3405. --- CHANGELOG.md | 3 +++ lib/rules/no-unknown-property.js | 3 ++- tests/lib/rules/no-unknown-property.js | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 595fb3f2f3..4496cf9df8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,9 +14,12 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange * [`no-unknown-property`]: Add more one word properties found in DefinitelyTyped's react/index.d.ts ([#3402][] @sjarva) * [`no-unknown-property`]: Mark onLoad/onError as supported on iframes ([#3398][] @maiis, [#3406][] @akx) * [`no-unknown-property`]: allow `imageSrcSet` and `imageSizes` attributes on `` ([#3407][] @terrymun) +* [`no-unknown-property`]: add `border`; `focusable` on `` ([#3404][] [#3404][] @ljharb) [#3407]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3407 [#3406]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3406 +[#3405]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3405 +[#3404]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3404 [#3402]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3402 [#3398]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3398 [#3397]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3397 diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js index 64f0f87445..f353fceca5 100644 --- a/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js @@ -57,6 +57,7 @@ const ATTRIBUTE_TAGS_MAP = { 'animateTransform', 'set', ], + focusable: ['svg'], imageSizes: ['link'], imageSrcSet: ['link'], property: ['meta'], @@ -230,7 +231,7 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [ // Element specific attributes // See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes (includes global attributes too) // To be considered if these should be added also to ATTRIBUTE_TAGS_MAP - 'acceptCharset', 'autoComplete', 'autoPlay', 'cellPadding', 'cellSpacing', 'classID', 'codeBase', + 'acceptCharset', 'autoComplete', 'autoPlay', 'border', 'cellPadding', 'cellSpacing', 'classID', 'codeBase', 'colSpan', 'contextMenu', 'dateTime', 'encType', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'frameBorder', 'hrefLang', 'httpEquiv', 'imageSizes', 'imageSrcSet', 'isMap', 'keyParams', 'keyType', 'marginHeight', 'marginWidth', 'maxLength', 'mediaGroup', 'minLength', 'noValidate', 'onAnimationEnd', 'onAnimationIteration', 'onAnimationStart', diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js index 2cd111c137..03feec6130 100644 --- a/tests/lib/rules/no-unknown-property.js +++ b/tests/lib/rules/no-unknown-property.js @@ -67,6 +67,7 @@ ruleTester.run('no-unknown-property', rule, { { code: '' }, { code: '' }, { code: '
' }, + { code: '' }, { code: '
', settings: { @@ -110,7 +111,7 @@ ruleTester.run('no-unknown-property', rule, { // Attributes on allowed elements should work { code: '