Repository: eslint/eslint
Pull request #12795 (2020-01-16 04:57:26)

Fix: improve report location for computed-property-spacing
<!--
    ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
-->

**What is the purpose of this pull request? (put an "X" next to item)**

[X] Other, please explain:

Changes `computed-property-spacing` report locations.

<!--
    If the item you've checked above has a template, please paste the template questions below and answer them. (If this pull request is addressing an issue, you can just paste a link to the issue here instead.)
-->

<!--
    Please ensure your pull request is ready:

    - Read the pull request guide (https://eslint.org/docs/developer-guide/contributing/pull-requests)
    - Include tests for this change
    - Update documentation for this change (if appropriate)
-->

<!--
    The following is required for all pull requests:
-->

**What changes did you make? (Give an overview)**

* For missing spaces the rule will now report `loc` instead of just `loc.start`.
* For disallowed spaces the rule will now report the location of spaces (the range that should be removed) instead of the location of the brackets.

before this change:

![image](https://user-images.githubusercontent.com/44349756/72494512-63a5a680-3824-11ea-810f-0291b0b00fe5.png)

after this change:

![image](https://user-images.githubusercontent.com/44349756/72494580-95b70880-3824-11ea-9742-3515a3fea988.png)


**Is there anything you'd like reviewers to focus on?**





Patch:
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index ca5e285ec..1e8eb304a 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,8 +1,15 @@
 <!--
+    Thank you for contributing!
+
     ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
 -->
 
-**What is the purpose of this pull request? (put an "X" next to item)**
+#### Prerequisites checklist
+
+- [ ] I have read the [contributing guidelines](https://github.com/eslint/eslint/blob/master/CONTRIBUTING.md).
+- [ ] The team has reached consensus on the changes proposed in this pull request. If not, I understand that the evaluation process will begin with this pull request and won't be merged until the team has reached consensus.
+
+#### What is the purpose of this pull request? (put an "X" next to item)
 
 [ ] Documentation update
 [ ] Bug fix ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/bug-report.md))
@@ -29,9 +36,7 @@
     The following is required for all pull requests:
 -->
 
-**What changes did you make? (Give an overview)**
-
-
-**Is there anything you'd like reviewers to focus on?**
+#### What changes did you make? (Give an overview)
 
 
+#### Is there anything you'd like reviewers to focus on?
diff --git a/lib/rules/computed-property-spacing.js b/lib/rules/computed-property-spacing.js
index a0bd7f48c..48bea6a6f 100644
--- a/lib/rules/computed-property-spacing.js
+++ b/lib/rules/computed-property-spacing.js
@@ -67,7 +67,7 @@ module.exports = {
         function reportNoBeginningSpace(node, token, tokenAfter) {
             context.report({
                 node,
-                loc: token.loc.start,
+                loc: { start: token.loc.end, end: tokenAfter.loc.start },
                 messageId: "unexpectedSpaceAfter",
                 data: {
                     tokenValue: token.value
@@ -88,7 +88,7 @@ module.exports = {
         function reportNoEndingSpace(node, token, tokenBefore) {
             context.report({
                 node,
-                loc: token.loc.start,
+                loc: { start: tokenBefore.loc.end, end: token.loc.start },
                 messageId: "unexpectedSpaceBefore",
                 data: {
                     tokenValue: token.value
@@ -108,7 +108,7 @@ module.exports = {
         function reportRequiredBeginningSpace(node, token) {
             context.report({
                 node,
-                loc: token.loc.start,
+                loc: token.loc,
                 messageId: "missingSpaceAfter",
                 data: {
                     tokenValue: token.value
@@ -128,7 +128,7 @@ module.exports = {
         function reportRequiredEndingSpace(node, token) {
             context.report({
                 node,
-                loc: token.loc.start,
+                loc: token.loc,
                 messageId: "missingSpaceBefore",
                 data: {
                     tokenValue: token.value
diff --git a/lib/rules/id-blacklist.js b/lib/rules/id-blacklist.js
index 53be62e68..e5dcdc630 100644
--- a/lib/rules/id-blacklist.js
+++ b/lib/rules/id-blacklist.js
@@ -61,9 +61,12 @@ module.exports = {
          * @returns {boolean} whether an error should be reported or not
          */
         function shouldReport(effectiveParent, name) {
-            return effectiveParent.type !== "CallExpression" &&
+            return (
+                effectiveParent.type !== "CallExpression" &&
                 effectiveParent.type !== "NewExpression" &&
-                isInvalid(name);
+                effectiveParent.parent.type !== "ObjectPattern" &&
+                isInvalid(name)
+            );
         }
 
         /**
@@ -98,11 +101,11 @@ module.exports = {
                             report(node);
                         }
 
-                        // Report AssignmentExpressions only if they are the left side of the assignment
+                    // Report AssignmentExpressions only if they are the left side of the assignment
                     } else if (effectiveParent.type === "AssignmentExpression" &&
                         (effectiveParent.right.type !== "MemberExpression" ||
-                        effectiveParent.left.type === "MemberExpression" &&
-                        effectiveParent.left.property.name === node.name)) {
+                            effectiveParent.left.type === "MemberExpression" &&
+                            effectiveParent.left.property.name === node.name)) {
                         if (isInvalid(name)) {
                             report(node);
                         }
@@ -115,7 +118,7 @@ module.exports = {
                         report(node);
                     }
 
-                // Report anything that is a match and not a CallExpression
+                    // Report anything that is a match and not a CallExpression
                 } else if (shouldReport(effectiveParent, name)) {
                     report(node);
                 }


Test patch:
diff --git a/lib/rule-tester/rule-tester.js b/lib/rule-tester/rule-tester.js
index 4b8c38692..2ac26534f 100644
--- a/lib/rule-tester/rule-tester.js
+++ b/lib/rule-tester/rule-tester.js
@@ -174,7 +174,7 @@ function freezeDeeply(x) {
  */
 function sanitize(text) {
     return text.replace(
-        /[\u0000-\u0009|\u000b-\u001a]/gu, // eslint-disable-line no-control-regex
+        /[\u0000-\u0009\u000b-\u001a]/gu, // eslint-disable-line no-control-regex
         c => `\\u${c.codePointAt(0).toString(16).padStart(4, "0")}`
     );
 }
diff --git a/tests/lib/rule-tester/rule-tester.js b/tests/lib/rule-tester/rule-tester.js
index 4abb053ab..7f2b6de67 100644
--- a/tests/lib/rule-tester/rule-tester.js
+++ b/tests/lib/rule-tester/rule-tester.js
@@ -1281,6 +1281,20 @@ describe("RuleTester", () => {
             });
             sinon.assert.calledWith(spyRuleTesterIt, "\\u0000");
         });
+        it("should present the pipe character correctly", () => {
+            const code = "var foo = bar || baz;";
+
+            ruleTester.run("no-var", require("../../fixtures/testers/rule-tester/no-var"), {
+                valid: [],
+                invalid: [
+                    {
+                        code,
+                        errors: [/^Bad var/u]
+                    }
+                ]
+            });
+            sinon.assert.calledWith(spyRuleTesterIt, code);
+        });
 
     });
 });
diff --git a/tests/lib/rules/computed-property-spacing.js b/tests/lib/rules/computed-property-spacing.js
index 3a0bd9e0e..3f656ff55 100644
--- a/tests/lib/rules/computed-property-spacing.js
+++ b/tests/lib/rules/computed-property-spacing.js
@@ -184,6 +184,8 @@ ruleTester.run("computed-property-spacing", rule, {
             options: ["always", { enforceForClassMembers: true }],
             parserOptions: { ecmaVersion: 6 }
         },
+
+        // handling of parens and comments
         {
             code: [
                 "const foo = {",
@@ -277,8 +279,11 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MemberExpression",
+                    line: 1,
                     column: 17,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 18
+
                 }
             ]
         },
@@ -291,8 +296,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MemberExpression",
+                    line: 1,
                     column: 14,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 15
                 }
             ]
         },
@@ -305,8 +312,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MemberExpression",
-                    column: 14,
-                    line: 1
+                    line: 1,
+                    column: 15,
+                    endLine: 1,
+                    endColumn: 16
                 }
             ]
         },
@@ -318,7 +327,11 @@ ruleTester.run("computed-property-spacing", rule, {
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
-                    type: "MemberExpression"
+                    type: "MemberExpression",
+                    line: 1,
+                    column: 16,
+                    endLine: 1,
+                    endColumn: 17
                 }
             ]
         },
@@ -331,15 +344,19 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MemberExpression",
-                    column: 4,
-                    line: 1
+                    line: 1,
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 6
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MemberExpression",
-                    column: 10,
-                    line: 1
+                    line: 1,
+                    column: 9,
+                    endLine: 1,
+                    endColumn: 10
                 }
             ]
         },
@@ -352,8 +369,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MemberExpression",
-                    column: 9,
-                    line: 1
+                    line: 1,
+                    column: 8,
+                    endLine: 1,
+                    endColumn: 9
                 }
             ]
         },
@@ -366,8 +385,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MemberExpression",
-                    column: 4,
-                    line: 1
+                    line: 1,
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 6
                 }
             ]
         },
@@ -380,15 +401,128 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MemberExpression",
+                    line: 1,
                     column: 14,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 15
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MemberExpression",
+                    line: 1,
                     column: 16,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 17
+                }
+            ]
+        },
+
+        // multiple spaces
+        {
+            code: "obj[    foo]",
+            output: "obj[foo]",
+            options: ["never"],
+            errors: [
+                {
+                    messageId: "unexpectedSpaceAfter",
+                    data: { tokenValue: "[" },
+                    type: "MemberExpression",
+                    line: 1,
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 9
+                }
+            ]
+        },
+        {
+            code: "obj[  foo  ]",
+            output: "obj[foo]",
+            options: ["never"],
+            errors: [
+                {
+                    messageId: "unexpectedSpaceAfter",
+                    data: { tokenValue: "[" },
+                    type: "MemberExpression",
+                    line: 1,
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 7
+                },
+                {
+                    messageId: "unexpectedSpaceBefore",
+                    data: { tokenValue: "]" },
+                    type: "MemberExpression",
+                    line: 1,
+                    column: 10,
+                    endLine: 1,
+                    endColumn: 12
+                }
+            ]
+        },
+        {
+            code: "obj[   foo ]",
+            output: "obj[foo]",
+            options: ["never"],
+            errors: [
+                {
+                    messageId: "unexpectedSpaceAfter",
+                    data: { tokenValue: "[" },
+                    type: "MemberExpression",
+                    line: 1,
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 8
+                },
+                {
+                    messageId: "unexpectedSpaceBefore",
+                    data: { tokenValue: "]" },
+                    type: "MemberExpression",
+                    line: 1,
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
+                }
+            ]
+        },
+        {
+            code: "obj[ foo + \n  bar   ]",
+            output: "obj[foo + \n  bar]",
+            options: ["never"],
+            errors: [
+                {
+                    messageId: "unexpectedSpaceAfter",
+                    data: { tokenValue: "[" },
+                    type: "MemberExpression",
+                    line: 1,
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 6
+                },
+                {
+                    messageId: "unexpectedSpaceBefore",
+                    data: { tokenValue: "]" },
+                    type: "MemberExpression",
+                    line: 2,
+                    column: 6,
+                    endLine: 2,
+                    endColumn: 9
+                }
+            ]
+        },
+        {
+            code: "obj[\n foo  ]",
+            output: "obj[\n foo]",
+            options: ["never"],
+            errors: [
+                {
+                    messageId: "unexpectedSpaceBefore",
+                    data: { tokenValue: "]" },
+                    type: "MemberExpression",
+                    line: 2,
+                    column: 5,
+                    endLine: 2,
+                    endColumn: 7
                 }
             ]
         },
@@ -404,15 +538,19 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
+                    line: 1,
                     column: 10,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 11
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
+                    line: 1,
                     column: 12,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 13
                 }
             ]
         },
@@ -426,8 +564,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
+                    line: 1,
                     column: 10,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 11
                 }
             ]
         },
@@ -441,8 +581,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
+                    line: 1,
                     column: 13,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 14
                 }
             ]
         },
@@ -458,15 +600,19 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
-                    column: 10,
-                    line: 1
+                    line: 1,
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
-                    column: 14,
-                    line: 1
+                    line: 1,
+                    column: 13,
+                    endLine: 1,
+                    endColumn: 14
                 }
             ]
         },
@@ -480,8 +626,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
-                    column: 13,
-                    line: 1
+                    line: 1,
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 13
                 }
             ]
         },
@@ -495,8 +643,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
-                    column: 10,
-                    line: 1
+                    line: 1,
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
@@ -510,17 +660,15 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
-                    column: 10,
-                    line: 1
+                    line: 1,
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
 
-        //------------------------------------------------------------------------------
-        // Classes
-        //------------------------------------------------------------------------------
-
-        // never
+        // never - classes
         {
             code: "class A { [ a](){} }",
             output: "class A { [a](){} }",
@@ -531,8 +679,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
-                    column: 11,
-                    line: 1
+                    line: 1,
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 13
                 }
             ]
         },
@@ -546,8 +696,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
-                    column: 37,
-                    line: 1
+                    line: 1,
+                    column: 36,
+                    endLine: 1,
+                    endColumn: 37
                 }
             ]
         },
@@ -561,29 +713,37 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
-                    column: 18,
-                    line: 1
+                    line: 1,
+                    column: 17,
+                    endLine: 1,
+                    endColumn: 18
                 },
                 {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
-                    column: 28,
-                    line: 1
+                    line: 1,
+                    column: 29,
+                    endLine: 1,
+                    endColumn: 30
                 },
                 {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
-                    column: 81,
-                    line: 1
+                    line: 1,
+                    column: 82,
+                    endLine: 1,
+                    endColumn: 83
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
-                    column: 104,
-                    line: 1
+                    line: 1,
+                    column: 103,
+                    endLine: 1,
+                    endColumn: 104
                 }
             ]
         },
@@ -597,90 +757,114 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
-                    column: 13,
-                    line: 1
+                    line: 1,
+                    column: 14,
+                    endLine: 1,
+                    endColumn: 15
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
-                    column: 17,
-                    line: 1
+                    line: 1,
+                    column: 16,
+                    endLine: 1,
+                    endColumn: 17
                 },
                 {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
-                    column: 27,
-                    line: 1
+                    line: 1,
+                    column: 28,
+                    endLine: 1,
+                    endColumn: 29
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
-                    column: 31,
-                    line: 1
+                    line: 1,
+                    column: 30,
+                    endLine: 1,
+                    endColumn: 31
                 },
                 {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
-                    column: 41,
-                    line: 1
+                    line: 1,
+                    column: 42,
+                    endLine: 1,
+                    endColumn: 43
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
-                    column: 45,
-                    line: 1
+                    line: 1,
+                    column: 44,
+                    endLine: 1,
+                    endColumn: 45
                 },
                 {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
-                    column: 61,
-                    line: 1
+                    line: 1,
+                    column: 62,
+                    endLine: 1,
+                    endColumn: 63
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
-                    column: 65,
-                    line: 1
+                    line: 1,
+                    column: 64,
+                    endLine: 1,
+                    endColumn: 65
                 },
                 {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
-                    column: 82,
-                    line: 1
+                    line: 1,
+                    column: 83,
+                    endLine: 1,
+                    endColumn: 84
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
-                    column: 86,
-                    line: 1
+                    line: 1,
+                    column: 85,
+                    endLine: 1,
+                    endColumn: 86
                 },
                 {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
-                    column: 103,
-                    line: 1
+                    line: 1,
+                    column: 104,
+                    endLine: 1,
+                    endColumn: 105
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
-                    column: 107,
-                    line: 1
+                    line: 1,
+                    column: 106,
+                    endLine: 1,
+                    endColumn: 107
                 }
             ]
         },
 
-        // always
+        // always - classes
         {
             code: "class A { [ a](){} }",
             output: "class A { [ a ](){} }",
@@ -691,8 +875,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 14,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 15
                 }
             ]
         },
@@ -706,8 +892,10 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 36,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 37
                 }
             ]
         },
@@ -721,29 +909,37 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 15,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 16
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 31,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 32
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 84,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 85
                 },
                 {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 101,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 102
                 }
             ]
         },
@@ -757,88 +953,114 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 13,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 14
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 15,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 16
                 },
                 {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 25,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 26
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 27,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 28
                 },
                 {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 37,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 38
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 39,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 40
                 },
                 {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 55,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 56
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 57,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 58
                 },
                 {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 74,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 75
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 76,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 77
                 },
                 {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 93,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 94
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MethodDefinition",
+                    line: 1,
                     column: 95,
-                    line: 1
+                    endLine: 1,
+                    endColumn: 96
                 }
             ]
         },
+
+        // handling of parens and comments
         {
             code: [
                 "const foo = {",
@@ -857,15 +1079,19 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
+                    line: 2,
                     column: 3,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 4
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
+                    line: 2,
                     column: 7,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 8
                 }
             ]
         },
@@ -887,15 +1113,19 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
+                    line: 2,
                     column: 3,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 4
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
+                    line: 2,
                     column: 9,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 10
                 }
             ]
         },
@@ -917,15 +1147,19 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
-                    column: 3,
-                    line: 2
+                    line: 2,
+                    column: 4,
+                    endLine: 2,
+                    endColumn: 5
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
-                    column: 11,
-                    line: 2
+                    line: 2,
+                    column: 10,
+                    endLine: 2,
+                    endColumn: 11
                 }
             ]
         },
@@ -947,15 +1181,19 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
+                    line: 2,
                     column: 3,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 4
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
+                    line: 2,
                     column: 15,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 16
                 }
             ]
         },
@@ -977,15 +1215,19 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
-                    column: 3,
-                    line: 2
+                    line: 2,
+                    column: 4,
+                    endLine: 2,
+                    endColumn: 5
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
-                    column: 17,
-                    line: 2
+                    line: 2,
+                    column: 16,
+                    endLine: 2,
+                    endColumn: 17
                 }
             ]
         },
@@ -1007,29 +1249,37 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
+                    line: 2,
                     column: 3,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 4
                 },
                 {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MemberExpression",
+                    line: 2,
                     column: 5,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 6
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MemberExpression",
+                    line: 2,
                     column: 7,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 8
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
+                    line: 2,
                     column: 8,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 9
                 }
             ]
         },
@@ -1051,29 +1301,37 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
-                    column: 3,
-                    line: 2
+                    line: 2,
+                    column: 4,
+                    endLine: 2,
+                    endColumn: 5
                 },
                 {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MemberExpression",
-                    column: 6,
-                    line: 2
+                    line: 2,
+                    column: 7,
+                    endLine: 2,
+                    endColumn: 8
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MemberExpression",
-                    column: 10,
-                    line: 2
+                    line: 2,
+                    column: 9,
+                    endLine: 2,
+                    endColumn: 10
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
-                    column: 12,
-                    line: 2
+                    line: 2,
+                    column: 11,
+                    endLine: 2,
+                    endColumn: 12
                 }
             ]
         },
@@ -1095,22 +1353,28 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
+                    line: 2,
                     column: 3,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 4
                 },
                 {
                     messageId: "missingSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MemberExpression",
+                    line: 2,
                     column: 5,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 6
                 },
                 {
                     messageId: "missingSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "Property",
+                    line: 2,
                     column: 18,
-                    line: 2
+                    endLine: 2,
+                    endColumn: 19
                 }
             ]
         },
@@ -1132,22 +1396,28 @@ ruleTester.run("computed-property-spacing", rule, {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "Property",
-                    column: 3,
-                    line: 2
+                    line: 2,
+                    column: 4,
+                    endLine: 2,
+                    endColumn: 5
                 },
                 {
                     messageId: "unexpectedSpaceAfter",
                     data: { tokenValue: "[" },
                     type: "MemberExpression",
-                    column: 10,
-                    line: 2
+                    line: 2,
+                    column: 11,
+                    endLine: 2,
+                    endColumn: 12
                 },
                 {
                     messageId: "unexpectedSpaceBefore",
                     data: { tokenValue: "]" },
                     type: "MemberExpression",
-                    column: 19,
-                    line: 2
+                    line: 2,
+                    column: 18,
+                    endLine: 2,
+                    endColumn: 19
                 }
             ]
         }
diff --git a/tests/lib/rules/id-blacklist.js b/tests/lib/rules/id-blacklist.js
index f4380e2b8..5e92a4d5b 100644
--- a/tests/lib/rules/id-blacklist.js
+++ b/tests/lib/rules/id-blacklist.js
@@ -65,6 +65,26 @@ ruleTester.run("id-blacklist", rule, {
             code: "var obj = { key: foo.bar };",
             options: ["f", "fo", "fooo", "b", "ba", "barr", "bazz", "bingg"]
         },
+        {
+            code: "const {foo: bar} = baz",
+            options: ["foo", "bar"],
+            parserOptions: { ecmaVersion: 6 }
+        },
+        {
+            code: "const {foo: {bar: baz}} = qux",
+            options: ["foo", "bar", "baz"],
+            parserOptions: { ecmaVersion: 6 }
+        },
+        {
+            code: "function foo({ bar: baz }) {}",
+            options: ["bar", "baz"],
+            parserOptions: { ecmaVersion: 6 }
+        },
+        {
+            code: "function foo({ bar: {baz: qux} }) {}",
+            options: ["bar", "baz", "qux"],
+            parserOptions: { ecmaVersion: 6 }
+        },
         {
             code: "var arr = [foo.bar];",
             options: ["f", "fo", "fooo", "b", "ba", "barr", "bazz", "bingg"]