diff --git a/lib/rules/no-mixed-operators.js b/lib/rules/no-mixed-operators.js index 9e4cbd6e238..80fac79affd 100644 --- a/lib/rules/no-mixed-operators.js +++ b/lib/rules/no-mixed-operators.js @@ -197,13 +197,13 @@ module.exports = { context.report({ node: left, - loc: getOperatorToken(left).loc.start, + loc: getOperatorToken(left).loc, message, data }); context.report({ node: right, - loc: getOperatorToken(right).loc.start, + loc: getOperatorToken(right).loc, message, data }); diff --git a/tests/lib/rules/no-mixed-operators.js b/tests/lib/rules/no-mixed-operators.js index 4e822181f53..efc93bf793a 100644 --- a/tests/lib/rules/no-mixed-operators.js +++ b/tests/lib/rules/no-mixed-operators.js @@ -64,8 +64,8 @@ ruleTester.run("no-mixed-operators", rule, { { code: "a && b || c", errors: [ - { column: 3, message: "Unexpected mix of '&&' and '||'." }, - { column: 8, message: "Unexpected mix of '&&' and '||'." } + { column: 3, endColumn: 5, message: "Unexpected mix of '&&' and '||'." }, + { column: 8, endColumn: 10, message: "Unexpected mix of '&&' and '||'." } ] }, { @@ -110,48 +110,48 @@ ruleTester.run("no-mixed-operators", rule, { code: "a + b - c", options: [{ allowSamePrecedence: false }], errors: [ - { column: 3, message: "Unexpected mix of '+' and '-'." }, - { column: 7, message: "Unexpected mix of '+' and '-'." } + { column: 3, endColumn: 4, message: "Unexpected mix of '+' and '-'." }, + { column: 7, endColumn: 8, message: "Unexpected mix of '+' and '-'." } ] }, { code: "a * b / c", options: [{ allowSamePrecedence: false }], errors: [ - { column: 3, message: "Unexpected mix of '*' and '/'." }, - { column: 7, message: "Unexpected mix of '*' and '/'." } + { column: 3, endColumn: 4, message: "Unexpected mix of '*' and '/'." }, + { column: 7, endColumn: 8, message: "Unexpected mix of '*' and '/'." } ] }, { code: "a || b ? c : d", options: [{ groups: [["&&", "||", "?:"]] }], errors: [ - { column: 3, message: "Unexpected mix of '||' and '?:'." }, - { column: 8, message: "Unexpected mix of '||' and '?:'." } + { column: 3, endColumn: 5, message: "Unexpected mix of '||' and '?:'." }, + { column: 8, endColumn: 9, message: "Unexpected mix of '||' and '?:'." } ] }, { code: "a && b ? 1 : 2", options: [{ groups: [["&&", "||", "?:"]] }], errors: [ - { column: 3, message: "Unexpected mix of '&&' and '?:'." }, - { column: 8, message: "Unexpected mix of '&&' and '?:'." } + { column: 3, endColumn: 5, message: "Unexpected mix of '&&' and '?:'." }, + { column: 8, endColumn: 9, message: "Unexpected mix of '&&' and '?:'." } ] }, { code: "x ? a && b : 0", options: [{ groups: [["&&", "||", "?:"]] }], errors: [ - { column: 3, message: "Unexpected mix of '?:' and '&&'." }, - { column: 7, message: "Unexpected mix of '?:' and '&&'." } + { column: 3, endColumn: 4, message: "Unexpected mix of '?:' and '&&'." }, + { column: 7, endColumn: 9, message: "Unexpected mix of '?:' and '&&'." } ] }, { code: "x ? 0 : a && b", options: [{ groups: [["&&", "||", "?:"]] }], errors: [ - { column: 3, message: "Unexpected mix of '?:' and '&&'." }, - { column: 11, message: "Unexpected mix of '?:' and '&&'." } + { column: 3, endColumn: 4, message: "Unexpected mix of '?:' and '&&'." }, + { column: 11, endColumn: 13, message: "Unexpected mix of '?:' and '&&'." } ] } ]