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:
Benjamin Woodruff
2015-06-04 10:44:47 -07:00
parent 9760e13f36
commit aecc48d877
2 changed files with 8 additions and 6 deletions
@@ -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',
},
],
},
+2 -2
View File
@@ -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,