eslint-plugin-react
eslint-plugin-react copied to clipboard
[FIX] jsx-boolean-value error message makes clear
As mentioned in #3675, jsx-boolean-value error message is not clear.
in current code, after setting never or always in the second option, if the modification is made not only to the first option but also to the second option, an error message containing the properties of the second option is displayed as shown below.
{
code: '<App foo={true} bar={true} baz />;',
output: '<App foo bar baz={true} />;',
options: ['always', { never: ['foo', 'bar'] }],
errors: [
{
messageId: 'omitBoolean',
data: { exceptionsMessage: ' for the following props: `foo`, `bar`' },
},
{
messageId: 'omitBoolean',
data: { exceptionsMessage: ' for the following props: `foo`, `bar`' },
},
{
messageId: 'setBoolean',
data: { exceptionsMessage: ' for the following props: `foo`, `bar`' },
// setBoolean attribute is not foo or bar but baz
}
],
},
i think this is not make sense, so change the error message include single prop that has error. so fixed test case is it
{
code: '<App foo={true} bar={true} baz />;',
output: '<App foo bar baz={true} />;',
options: ['always', { never: ['foo', 'bar'] }],
errors: [
{
messageId: 'omitBoolean',
data: { exceptionsMessage: ' for the following props: `foo`' },
},
{
messageId: 'omitBoolean',
data: { exceptionsMessage: ' for the following props: `bar`' },
},
{
messageId: 'setBoolean',
data: { exceptionsMessage: ' for the following props: `baz`' },
},
],
},
other test case change is because of message format change
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 97.75%. Comparing base (
2124d13) to head (4d83242).
:exclamation: Current head 4d83242 differs from pull request most recent head 6cb0f00. Consider uploading reports for the commit 6cb0f00 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #3691 +/- ##
==========================================
- Coverage 97.76% 97.75% -0.01%
==========================================
Files 133 133
Lines 9471 9462 -9
Branches 3472 3465 -7
==========================================
- Hits 9259 9250 -9
Misses 212 212
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.