mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix wording of warning-and-invariant-args linter
The wording for an incorrect number of arguments based on counting %s substitutions. The previous wording was backwards and a bit yoda-like leading to possible ambiguity.
This commit is contained in:
@@ -51,8 +51,9 @@ eslintTester.addRuleTest('eslint-rules/warning-and-invariant-args', {
|
||||
code: "warning(true, 'expected %s, got %s');",
|
||||
errors: [
|
||||
{
|
||||
message: 'Expected 4 arguments in call to warning, but got 2 ' +
|
||||
'based on the number of "%s" substitutions',
|
||||
message:
|
||||
'Expected 4 arguments in call to warning based on the number of ' +
|
||||
'"%s" substitutions, but got 2',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -60,8 +61,9 @@ eslintTester.addRuleTest('eslint-rules/warning-and-invariant-args', {
|
||||
code: "warning(true, 'foobar', 'junk argument');",
|
||||
errors: [
|
||||
{
|
||||
message: 'Expected 2 arguments in call to warning, but got 3 ' +
|
||||
'based on the number of "%s" substitutions',
|
||||
message:
|
||||
'Expected 2 arguments in call to warning based on the number of ' +
|
||||
'"%s" substitutions, but got 3',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -63,8 +63,8 @@ module.exports = function(context) {
|
||||
if (node.arguments.length !== expectedNArgs) {
|
||||
context.report(
|
||||
node,
|
||||
'Expected {{expectedNArgs}} arguments in call to {{name}}, but ' +
|
||||
'got {{length}} based on the number of "%s" substitutions',
|
||||
'Expected {{expectedNArgs}} arguments in call to {{name}} based on ' +
|
||||
'the number of "%s" substitutions, but got {{length}}',
|
||||
{
|
||||
expectedNArgs: expectedNArgs,
|
||||
name: node.callee.name,
|
||||
|
||||
Reference in New Issue
Block a user