Skip to content

Commit 3385caa

Browse files
committed
[Tests] button-has-type: ensure no mistakenly allowed identifiers named button/submit/reset
See #1846 (comment)
1 parent aecff62 commit 3385caa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/lib/rules/button-has-type.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ ruleTester.run('button-has-type', rule, {
118118
pragma: 'Foo'
119119
}
120120
}
121+
},
122+
{
123+
code: 'function Button({ type, ...extraProps }) { const button = type; return <button type={button} {...extraProps} />; }',
124+
errors: [{
125+
message: 'The button type attribute must be specified by a static string'
126+
}]
121127
}
122128
]
123129
});

0 commit comments

Comments
 (0)