diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a24f0341d..3d6c8e5240 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/rules/jsx-handler-names.js b/lib/rules/jsx-handler-names.js index c792bc040c..0d28c966e8 100644 --- a/lib/rules/jsx-handler-names.js +++ b/lib/rules/jsx-handler-names.js @@ -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: [{ diff --git a/tests/lib/rules/jsx-handler-names.js b/tests/lib/rules/jsx-handler-names.js index 03d2eb351f..da17432f3d 100644 --- a/tests/lib/rules/jsx-handler-names.js +++ b/tests/lib/rules/jsx-handler-names.js @@ -210,6 +210,11 @@ ruleTester.run('jsx-handler-names', rule, { options: [{ checkInlineFunction: true }] + }, { + code: '', + errors: [{ + message: 'Prop key for handleChange must begin with \'on\'' + }] }, { code: '', errors: [{