Skip to content

Commit aecc48d

Browse files
committed
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.
1 parent 9760e13 commit aecc48d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

eslint-rules/__tests__/warning-and-invariant-args-test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,19 @@ eslintTester.addRuleTest('eslint-rules/warning-and-invariant-args', {
5151
code: "warning(true, 'expected %s, got %s');",
5252
errors: [
5353
{
54-
message: 'Expected 4 arguments in call to warning, but got 2 ' +
55-
'based on the number of "%s" substitutions',
54+
message:
55+
'Expected 4 arguments in call to warning based on the number of ' +
56+
'"%s" substitutions, but got 2',
5657
},
5758
],
5859
},
5960
{
6061
code: "warning(true, 'foobar', 'junk argument');",
6162
errors: [
6263
{
63-
message: 'Expected 2 arguments in call to warning, but got 3 ' +
64-
'based on the number of "%s" substitutions',
64+
message:
65+
'Expected 2 arguments in call to warning based on the number of ' +
66+
'"%s" substitutions, but got 3',
6567
},
6668
],
6769
},

eslint-rules/warning-and-invariant-args.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ module.exports = function(context) {
6363
if (node.arguments.length !== expectedNArgs) {
6464
context.report(
6565
node,
66-
'Expected {{expectedNArgs}} arguments in call to {{name}}, but ' +
67-
'got {{length}} based on the number of "%s" substitutions',
66+
'Expected {{expectedNArgs}} arguments in call to {{name}} based on ' +
67+
'the number of "%s" substitutions, but got {{length}}',
6868
{
6969
expectedNArgs: expectedNArgs,
7070
name: node.callee.name,

0 commit comments

Comments
 (0)