Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix: add end location to report in no-useless-concat (refs #12334) (#…
  • Loading branch information
mdjermanovic committed Apr 1, 2020
1 parent 0518ebb commit 988d842
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-useless-concat.js
Expand Up @@ -105,7 +105,7 @@ module.exports = {

context.report({
node,
loc: operatorToken.loc.start,
loc: operatorToken.loc,
messageId: "unexpectedConcat"
});
}
Expand Down
28 changes: 25 additions & 3 deletions tests/lib/rules/no-useless-concat.js
Expand Up @@ -42,7 +42,25 @@ ruleTester.run("no-useless-concat", rule, {
{
code: "'a' + 'b'",
errors: [
{ messageId: "unexpectedConcat" }
{
messageId: "unexpectedConcat",
line: 1,
column: 5,
endLine: 1,
endColumn: 6
}
]
},
{
code: "'a' +\n'b' + 'c'",
errors: [
{
messageId: "unexpectedConcat",
line: 2,
column: 5,
endLine: 2,
endColumn: 6
}
]
},
{
Expand All @@ -57,12 +75,16 @@ ruleTester.run("no-useless-concat", rule, {
{
messageId: "unexpectedConcat",
line: 1,
column: 5
column: 5,
endLine: 1,
endColumn: 6
},
{
messageId: "unexpectedConcat",
line: 1,
column: 11
column: 11,
endLine: 1,
endColumn: 12
}
]
},
Expand Down

0 comments on commit 988d842

Please sign in to comment.