Skip to content

Commit 5f4d343

Browse files
authored
Merge pull request #460 from tricoder42/issue/459
Ignore spread props when checking attributes
2 parents 8fa7d4a + 42b385c commit 5f4d343

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

__tests__/src/rules/no-noninteractive-element-interactions-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const alwaysValid = [
116116
{ code: '<html onClick={() => {}} />;' },
117117
{ code: '<i onClick={() => {}} />;' },
118118
{ code: '<iframe onLoad={() => {}} />;' },
119-
{ code: '<img onError={() => {}} />;' },
119+
{ code: '<img {...props} onError={() => {}} />;' },
120120
{ code: '<img onLoad={() => {}} />;' },
121121
{ code: '<ins onClick={() => {}} />;' },
122122
{ code: '<kbd onClick={() => {}} />;' },

src/rules/no-noninteractive-element-interactions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module.exports = {
6060
const interactiveProps = config.handlers || defaultInteractiveProps;
6161
// Allow overrides from rule configuration for specific elements and roles.
6262
if (has(config, type)) {
63-
attributes = attributes.filter(attr => !includes(config[type], propName(attr)));
63+
attributes = attributes.filter(attr => attr.type !== 'JSXSpreadAttribute' && !includes(config[type], propName(attr)));
6464
}
6565

6666
const hasInteractiveProps = interactiveProps

0 commit comments

Comments
 (0)