From 8d50a7d82244d4912f3eab62a66c81c76c44a9da Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Thu, 26 Mar 2020 16:31:41 +0100 Subject: [PATCH] Fix: add end location to report in no-prototype-builtins (refs #12334) (#13087) --- lib/rules/no-prototype-builtins.js | 2 +- tests/lib/rules/no-prototype-builtins.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/rules/no-prototype-builtins.js b/lib/rules/no-prototype-builtins.js index 5bed2539a64..a00d3707204 100644 --- a/lib/rules/no-prototype-builtins.js +++ b/lib/rules/no-prototype-builtins.js @@ -47,7 +47,7 @@ module.exports = { if (DISALLOWED_PROPS.indexOf(propName) > -1) { context.report({ messageId: "prototypeBuildIn", - loc: node.callee.property.loc.start, + loc: node.callee.property.loc, data: { prop: propName }, node }); diff --git a/tests/lib/rules/no-prototype-builtins.js b/tests/lib/rules/no-prototype-builtins.js index b1493e45561..e4f0fa30f78 100644 --- a/tests/lib/rules/no-prototype-builtins.js +++ b/tests/lib/rules/no-prototype-builtins.js @@ -41,6 +41,8 @@ const invalid = [ errors: [{ line: 1, column: 5, + endLine: 1, + endColumn: 19, messageId: "prototypeBuildIn", data: { prop: "hasOwnProperty" }, type: "CallExpression" @@ -51,6 +53,8 @@ const invalid = [ errors: [{ line: 1, column: 5, + endLine: 1, + endColumn: 18, messageId: "prototypeBuildIn", data: { prop: "isPrototypeOf" }, type: "CallExpression" @@ -61,6 +65,8 @@ const invalid = [ errors: [{ line: 1, column: 5, + endLine: 1, + endColumn: 25, messageId: "prototypeBuildIn", data: { prop: "propertyIsEnumerable" } }] @@ -70,6 +76,8 @@ const invalid = [ errors: [{ line: 1, column: 9, + endLine: 1, + endColumn: 23, messageId: "prototypeBuildIn", data: { prop: "hasOwnProperty" }, type: "CallExpression" @@ -80,6 +88,8 @@ const invalid = [ errors: [{ line: 1, column: 13, + endLine: 1, + endColumn: 26, messageId: "prototypeBuildIn", data: { prop: "isPrototypeOf" }, type: "CallExpression"