Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] jsx-handler-names: Skip inline handlers when checkInlineFunction=false. Fixes #2832 #2833

Merged
merged 1 commit into from Oct 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,7 +7,9 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel

### Fixed
* [`jsx-indent-props`]: Apply indentation when using brackets ([#2826][] @Moong0122)
* [`jsx-handler-names`]: Skip inline handlers when checkInlineFunction=false ([#2833][] @onigoetz)

[#2833]: https://github.com/yannickcr/eslint-plugin-react/issues/2833
[#2826]: https://github.com/yannickcr/eslint-plugin-react/issues/2826

## [7.21.4] - 2020.10.09
Expand Down
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