Skip to content

Commit

Permalink
[Fix] jsx-handler-names: properly substitute value into message
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored and ljharb committed Apr 25, 2021
1 parent 495a4cf commit cad79bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,10 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
### Added
* component detection: add componentWrapperFunctions setting ([#2713][] @@jzabala @LandonSchropp)

### Fixed
* [`jsx-handler-names`]: properly substitute value into message ([#2975][] @G-Rath)

[#2975]: https://github.com/yannickcr/eslint-plugin-react/pull/2975
[#2713]: https://github.com/yannickcr/eslint-plugin-react/pull/2713

## [7.23.2] - 2021.04.08
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-handler-names.js
Expand Up @@ -22,7 +22,7 @@ module.exports = {

messages: {
badHandlerName: 'Handler function for {{propKey}} prop key must be a camelCase name beginning with \'{{handlerPrefix}}\' only',
badPropKey: 'Prop key for {{propValue}} must begin with \'{{handlerPropPrefix}\''
badPropKey: 'Prop key for {{propValue}} must begin with \'{{handlerPropPrefix}}\''
},

schema: [{
Expand Down
5 changes: 5 additions & 0 deletions tests/lib/rules/jsx-handler-names.js
Expand Up @@ -210,6 +210,11 @@ ruleTester.run('jsx-handler-names', rule, {
options: [{
checkInlineFunction: true
}]
}, {
code: '<TestComponent only={this.handleChange} />',
errors: [{
message: 'Prop key for handleChange must begin with \'on\''
}]
}, {
code: '<TestComponent only={this.handleChange} />',
errors: [{
Expand Down

0 comments on commit cad79bb

Please sign in to comment.