Skip to content

Commit

Permalink
[Fix] jsx-handler-names: Skip inline handlers when checkInlineFunct…
Browse files Browse the repository at this point in the history
…ion=false. Fixes #2832
  • Loading branch information
onigoetz committed Oct 16, 2020
1 parent aeff5ea commit 42e2b0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rules/jsx-handler-names.js
Expand Up @@ -106,6 +106,7 @@ module.exports = {
if (
!node.value
|| !node.value.expression
|| (!checkInlineFunction && isInlineHandler(node))
|| (
!checkLocal
&& (isInlineHandler(node)
Expand Down
5 changes: 5 additions & 0 deletions tests/lib/rules/jsx-handler-names.js
Expand Up @@ -59,6 +59,11 @@ ruleTester.run('jsx-handler-names', rule, {
options: [{
checkLocalVariables: false
}]
}, {
code: '<TestComponent onChange={event => window.alert(event.target.value)} />',
options: [{
checkInlineFunction: false
}]
}, {
code: '<TestComponent onChange={() => handleChange()} />',
options: [{
Expand Down

0 comments on commit 42e2b0e

Please sign in to comment.