Skip to content

Commit 2917b24

Browse files
committed
[chore]: add spread prop check
1 parent fe44166 commit 2917b24

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/getSettingsAttributes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type { ESLintSettings } from '../../flow/eslint';
2525
* <Link foo="path/to/page" /> // will be checked as if <a href="path/to/page" />
2626
*/
2727
const getSettingsAttributes = (node: JSXOpeningElement, settings: ESLintSettings): Node[] => {
28-
const { attributes: rawAttributes } = node;
28+
const { attributes: rawAttributes = [] } = node;
2929
const { components } = settings?.['jsx-a11y'] || {};
3030

3131
if (!components || typeof components !== 'object') return rawAttributes;
@@ -60,7 +60,7 @@ const getSettingsAttributes = (node: JSXOpeningElement, settings: ESLintSettings
6060
});
6161

6262
// raw attributes that don't have mappings
63-
const unmappedAttributes = rawAttributes.filter((attr) => !mappedRawAttrNames.has(propName(attr)));
63+
const unmappedAttributes = rawAttributes.filter((attr) => attr.type !== 'JSXSpreadAttribute' && !mappedRawAttrNames.has(propName(attr)));
6464

6565
return [...unmappedAttributes, ...mappedAttributes];
6666
};

0 commit comments

Comments
 (0)