From aecc48d8772bce610dd1dd50fc0258e29b2fdfa2 Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Thu, 4 Jun 2015 10:44:47 -0700 Subject: [PATCH] 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. --- .../__tests__/warning-and-invariant-args-test.js | 10 ++++++---- eslint-rules/warning-and-invariant-args.js | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/eslint-rules/__tests__/warning-and-invariant-args-test.js b/eslint-rules/__tests__/warning-and-invariant-args-test.js index be460f6cfb..bca79f8b75 100644 --- a/eslint-rules/__tests__/warning-and-invariant-args-test.js +++ b/eslint-rules/__tests__/warning-and-invariant-args-test.js @@ -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', }, ], }, diff --git a/eslint-rules/warning-and-invariant-args.js b/eslint-rules/warning-and-invariant-args.js index 332262ed8b..e120810dda 100644 --- a/eslint-rules/warning-and-invariant-args.js +++ b/eslint-rules/warning-and-invariant-args.js @@ -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,