Repository: eslint/eslint
Pull request #12563 (2019-11-13 23:31:39)

Fix: improve report location for object-curly-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:

Change `object-curly-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 difference is small, the rule will now report complete `loc` of the curly braces 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 curly braces. like this:

![image](https://user-images.githubusercontent.com/44349756/68813294-b2dd2880-0675-11ea-914f-8610040ef5b7.png)

**Is there anything you'd like reviewers to focus on?**

Since this doesn't change the start line, it produces neither more nor fewer warnings, even in the case of `eslint-disable-*` comments.

I guess this could be accepted as a bug fix?



Patch:
diff --git a/docs/rules/camelcase.md b/docs/rules/camelcase.md
index 5c4efcfe4..96135f8c9 100644
--- a/docs/rules/camelcase.md
+++ b/docs/rules/camelcase.md
@@ -13,7 +13,7 @@ This rule has an object option:
 * `"properties": "always"` (default) enforces camelcase style for property names
 * `"properties": "never"` does not check property names
 * `"ignoreDestructuring": false` (default) enforces camelcase style for destructured identifiers
-* `"ignoreDestructuring": true` does not check destructured identifiers
+* `"ignoreDestructuring": true` does not check destructured identifiers (but still checks any use of those identifiers later in the code)
 * `"ignoreImports": false` (default) enforces camelcase style for ES2015 imports
 * `"ignoreImports": true` does not check ES2015 imports (but still checks any use of the imports later in the code except function arguments)
 * `allow` (`string[]`) list of properties to accept. Accept regex.
@@ -154,6 +154,39 @@ var { category_id = 1 } = query;
 var { category_id: category_id } = query;
 ```
 
+Please note that this option applies only to identifiers inside destructuring patterns. It doesn't additionally allow any particular use of the created variables later in the code apart from the use that is already allowed by default or by other options.
+
+Examples of additional **incorrect** code for this rule with the `{ "ignoreDestructuring": true }` option:
+
+```js
+/*eslint camelcase: ["error", {ignoreDestructuring: true}]*/
+
+var { some_property } = obj; // allowed by {ignoreDestructuring: true}
+var foo = some_property + 1; // error, ignoreDestructuring does not apply to this statement
+```
+
+A common use case for this option is to avoid useless renaming when the identifier is not intended to be used later in the code.
+
+Examples of additional **correct** code for this rule with the `{ "ignoreDestructuring": true }` option:
+
+```js
+/*eslint camelcase: ["error", {ignoreDestructuring: true}]*/
+
+var { some_property, ...rest } = obj;
+// do something with 'rest', nothing with 'some_property'
+```
+
+Another common use case for this option is in combination with `{ "properties": "never" }`, when the identifier is intended to be used only as a property shorthand.
+
+Examples of additional **correct** code for this rule with the `{ "properties": "never", "ignoreDestructuring": true }` options:
+
+```js
+/*eslint camelcase: ["error", {"properties": "never", ignoreDestructuring: true}]*/
+
+var { some_property } = obj;
+doSomething({ some_property });
+```
+
 ### ignoreImports: false
 
 Examples of **incorrect** code for this rule with the default `{ "ignoreImports": false }` option:
diff --git a/lib/rules/key-spacing.js b/lib/rules/key-spacing.js
index 994c35627..5aced89a6 100644
--- a/lib/rules/key-spacing.js
+++ b/lib/rules/key-spacing.js
@@ -42,6 +42,30 @@ function isSingleLine(node) {
     return (node.loc.end.line === node.loc.start.line);
 }
 
+/**
+ * Checks whether both nodes are on the same line.
+ * @param {ASTNode} nodeA AST Node being evaluated.
+ * @param {ASTNode} nodeB AST Node being evaluated.
+ * @returns {boolean} True if both nodes are on the same line.
+ */
+function isOnSameLine(nodeA, nodeB) {
+    return (nodeA.loc.end.line === nodeB.loc.end.line);
+}
+
+/**
+ * Checks whether the properties of a node on the same line.
+ * @param {ASTNode} node node
+ * @returns {boolean} True if the properties of a node are on the same line.
+ */
+function isPropertiesOnSameLine(node) {
+    if (node.properties.length <= 1) {
+        return true;
+    }
+    const [firstProperty] = node.properties;
+
+    return node.properties.every(property => isOnSameLine(firstProperty, property));
+}
+
 /**
  * Initializes a single option property from the configuration with defaults for undefined values
  * @param {Object} toOptions Object to be initialized
@@ -630,7 +654,7 @@ module.exports = {
 
             return {
                 ObjectExpression(node) {
-                    if (isSingleLine(node)) {
+                    if (isSingleLine(node) || isPropertiesOnSameLine(node)) {
                         verifyListSpacing(node.properties.filter(isKeyValueProperty));
                     } else {
                         verifyAlignment(node);
@@ -643,7 +667,9 @@ module.exports = {
         // Obey beforeColon and afterColon in each property as configured
         return {
             Property(node) {
-                verifySpacing(node, isSingleLine(node.parent) ? singleLineOptions : multiLineOptions);
+                const option = (isSingleLine(node.parent) || isPropertiesOnSameLine(node.parent)) ? singleLineOptions : multiLineOptions;
+
+                verifySpacing(node, option);
             }
         };
 
diff --git a/lib/rules/object-curly-spacing.js b/lib/rules/object-curly-spacing.js
index 53ddaaa24..117a7a354 100644
--- a/lib/rules/object-curly-spacing.js
+++ b/lib/rules/object-curly-spacing.js
@@ -74,16 +74,16 @@ module.exports = {
          * @returns {void}
          */
         function reportNoBeginningSpace(node, token) {
+            const nextToken = context.getSourceCode().getTokenAfter(token, { includeComments: true });
+
             context.report({
                 node,
-                loc: token.loc.start,
+                loc: { start: token.loc.end, end: nextToken.loc.start },
                 message: "There should be no space after '{{token}}'.",
                 data: {
                     token: token.value
                 },
                 fix(fixer) {
-                    const nextToken = context.getSourceCode().getTokenAfter(token, { includeComments: true });
-
                     return fixer.removeRange([token.range[1], nextToken.range[0]]);
                 }
             });
@@ -96,16 +96,16 @@ module.exports = {
          * @returns {void}
          */
         function reportNoEndingSpace(node, token) {
+            const previousToken = context.getSourceCode().getTokenBefore(token, { includeComments: true });
+
             context.report({
                 node,
-                loc: token.loc.start,
+                loc: { start: previousToken.loc.end, end: token.loc.start },
                 message: "There should be no space before '{{token}}'.",
                 data: {
                     token: token.value
                 },
                 fix(fixer) {
-                    const previousToken = context.getSourceCode().getTokenBefore(token, { includeComments: true });
-
                     return fixer.removeRange([previousToken.range[1], token.range[0]]);
                 }
             });
@@ -120,7 +120,7 @@ module.exports = {
         function reportRequiredBeginningSpace(node, token) {
             context.report({
                 node,
-                loc: token.loc.start,
+                loc: token.loc,
                 message: "A space is required after '{{token}}'.",
                 data: {
                     token: token.value
@@ -140,7 +140,7 @@ module.exports = {
         function reportRequiredEndingSpace(node, token) {
             context.report({
                 node,
-                loc: token.loc.start,
+                loc: token.loc,
                 message: "A space is required before '{{token}}'.",
                 data: {
                     token: token.value
diff --git a/lib/rules/spaced-comment.js b/lib/rules/spaced-comment.js
index 958bb2c64..daf56cd6b 100644
--- a/lib/rules/spaced-comment.js
+++ b/lib/rules/spaced-comment.js
@@ -249,7 +249,8 @@ module.exports = {
                 beginRegex: requireSpace ? createAlwaysStylePattern(markers, exceptions) : createNeverStylePattern(markers),
                 endRegex: balanced && requireSpace ? new RegExp(`${createExceptionsPattern(exceptions)}$`, "u") : new RegExp(endNeverPattern, "u"),
                 hasExceptions: exceptions.length > 0,
-                markers: new RegExp(`^(${markers.map(escape).join("|")})`, "u")
+                captureMarker: new RegExp(`^(${markers.map(escape).join("|")})`, "u"),
+                markers: new Set(markers)
             };
 
             return rule;
@@ -322,8 +323,8 @@ module.exports = {
                 rule = styleRules[type],
                 commentIdentifier = type === "block" ? "/*" : "//";
 
-            // Ignores empty comments.
-            if (node.value.length === 0) {
+            // Ignores empty comments and comments that consist only of a marker.
+            if (node.value.length === 0 || rule.markers.has(node.value)) {
                 return;
             }
 
@@ -333,7 +334,7 @@ module.exports = {
             // Checks.
             if (requireSpace) {
                 if (!beginMatch) {
-                    const hasMarker = rule.markers.exec(node.value);
+                    const hasMarker = rule.captureMarker.exec(node.value);
                     const marker = hasMarker ? commentIdentifier + hasMarker[0] : commentIdentifier;
 
                     if (rule.hasExceptions) {


Test patch:
diff --git a/tests/lib/rules/key-spacing.js b/tests/lib/rules/key-spacing.js
index a9ed53374..9225f8b8c 100644
--- a/tests/lib/rules/key-spacing.js
+++ b/tests/lib/rules/key-spacing.js
@@ -384,6 +384,214 @@ ruleTester.run("key-spacing", rule, {
         }],
         parserOptions: { ecmaVersion: 2018 }
     },
+    {
+        code: [
+            "({",
+            "    foo : 1, bar : 2, baz : 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            beforeColon: true
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            beforeColon: false
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            afterColon: true
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo:1, bar:2, baz:3",
+            "});"
+        ].join("\n"),
+        options: [{
+            afterColon: false
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo :1, bar :2, baz :3",
+            "});"
+        ].join("\n"),
+        options: [{
+            beforeColon: true,
+            afterColon: false
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            beforeColon: false,
+            afterColon: true
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo : 1, bar : 2, baz : 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            beforeColon: true,
+            afterColon: true
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo:1, bar:2, baz:3",
+            "});"
+        ].join("\n"),
+        options: [{
+            beforeColon: false,
+            afterColon: false
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            mode: "strict"
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo:  1, bar:  2, baz:  3",
+            "});"
+        ].join("\n"),
+        options: [{
+            mode: "minimum"
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            singleLine: {
+                afterColon: true,
+                beforeColon: false
+            }
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo :1, bar :2, baz :3",
+            "});"
+        ].join("\n"),
+        options: [{
+            singleLine: {
+                afterColon: false,
+                beforeColon: true
+            }
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 'bar',",
+            "});"
+        ].join("\n"),
+        options: [{
+            multiLine: {
+                align: "value"
+            }
+        }]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            multiLine: {
+                align: "value"
+            }
+        }]
+    },
+    {
+        code: [
+            "({",
+            "  foo: 1, bar: { qux: 4",
+            "  }, baz: 3,",
+            "})"
+        ].join("\n"),
+        options: [
+            {
+                singleLine: {
+                    afterColon: true,
+                    beforeColon: false
+                },
+                multiLine: {
+                    align: "value"
+                }
+            }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "  foo: 1, bar: { qux1: 4, qux2: 5",
+            "  }, baz: 3,",
+            "})"
+        ].join("\n"),
+        options: [
+            {
+                singleLine: {
+                    afterColon: true,
+                    beforeColon: false
+                },
+                multiLine: {
+                    align: "value"
+                }
+            }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "  foo: 1, bar: {",
+            "    qux1: 4, qux2: 5",
+            "  }, baz: 3,",
+            "})"
+        ].join("\n"),
+        options: [
+            {
+                multiLine: {
+                    align: "value"
+                }
+            }
+        ]
+    },
 
     // https://github.com/eslint/eslint/issues/4792
     {
@@ -1769,5 +1977,218 @@ ruleTester.run("key-spacing", rule, {
             { messageId: "missingKey", data: { computed: "", key: "foo" }, line: 1, column: 7, type: "Identifier" },
             { messageId: "missingValue", data: { computed: "", key: "foo" }, line: 1, column: 19, type: "Identifier" }
         ]
+    },
+    {
+        code: [
+            "({",
+            "    foo : 1, bar : 2, baz : 3",
+            "});"
+        ].join("\n"),
+        output: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            beforeColon: false
+        }],
+        errors: [
+            { messageId: "extraKey", data: { computed: "", key: "foo" }, line: 2, column: 5, type: "Identifier" },
+            { messageId: "extraKey", data: { computed: "", key: "bar" }, line: 2, column: 14, type: "Identifier" },
+            { messageId: "extraKey", data: { computed: "", key: "baz" }, line: 2, column: 23, type: "Identifier" }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        output: [
+            "({",
+            "    foo : 1, bar : 2, baz : 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            beforeColon: true
+        }],
+        errors: [
+            { messageId: "missingKey", data: { computed: "", key: "foo" }, line: 2, column: 5, type: "Identifier" },
+            { messageId: "missingKey", data: { computed: "", key: "bar" }, line: 2, column: 13, type: "Identifier" },
+            { messageId: "missingKey", data: { computed: "", key: "baz" }, line: 2, column: 21, type: "Identifier" }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        output: [
+            "({",
+            "    foo:1, bar:2, baz:3",
+            "});"
+        ].join("\n"),
+        options: [{
+            afterColon: false
+        }],
+        errors: [
+            { messageId: "extraValue", data: { computed: "", key: "foo" }, line: 2, column: 10, type: "Literal" },
+            { messageId: "extraValue", data: { computed: "", key: "bar" }, line: 2, column: 18, type: "Literal" },
+            { messageId: "extraValue", data: { computed: "", key: "baz" }, line: 2, column: 26, type: "Literal" }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "    foo:1, bar:2, baz:3",
+            "});"
+        ].join("\n"),
+        output: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            afterColon: true
+        }],
+        errors: [
+            { messageId: "missingValue", data: { computed: "", key: "foo" }, line: 2, column: 9, type: "Literal" },
+            { messageId: "missingValue", data: { computed: "", key: "bar" }, line: 2, column: 16, type: "Literal" },
+            { messageId: "missingValue", data: { computed: "", key: "baz" }, line: 2, column: 23, type: "Literal" }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        output: [
+            "({",
+            "    foo :1, bar :2, baz :3",
+            "});"
+        ].join("\n"),
+        options: [{
+            beforeColon: true,
+            afterColon: false
+        }],
+        errors: [
+            { messageId: "missingKey", data: { computed: "", key: "foo" }, line: 2, column: 5, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "foo" }, line: 2, column: 10, type: "Literal" },
+            { messageId: "missingKey", data: { computed: "", key: "bar" }, line: 2, column: 13, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "bar" }, line: 2, column: 18, type: "Literal" },
+            { messageId: "missingKey", data: { computed: "", key: "baz" }, line: 2, column: 21, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "baz" }, line: 2, column: 26, type: "Literal" }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "    foo :1, bar :2, baz :3",
+            "});"
+        ].join("\n"),
+        output: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            mode: "strict"
+        }],
+        errors: [
+            { messageId: "extraKey", data: { computed: "", key: "foo" }, line: 2, column: 5, type: "Identifier" },
+            { messageId: "missingValue", data: { computed: "", key: "foo" }, line: 2, column: 10, type: "Literal" },
+            { messageId: "extraKey", data: { computed: "", key: "bar" }, line: 2, column: 13, type: "Identifier" },
+            { messageId: "missingValue", data: { computed: "", key: "bar" }, line: 2, column: 18, type: "Literal" },
+            { messageId: "extraKey", data: { computed: "", key: "baz" }, line: 2, column: 21, type: "Identifier" },
+            { messageId: "missingValue", data: { computed: "", key: "baz" }, line: 2, column: 26, type: "Literal" }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "    foo :1, bar :2, baz :3",
+            "});"
+        ].join("\n"),
+        output: [
+            "({",
+            "    foo: 1, bar: 2, baz: 3",
+            "});"
+        ].join("\n"),
+        options: [{
+            mode: "minimum"
+        }],
+        errors: [
+            { messageId: "extraKey", data: { computed: "", key: "foo" }, line: 2, column: 5, type: "Identifier" },
+            { messageId: "missingValue", data: { computed: "", key: "foo" }, line: 2, column: 10, type: "Literal" },
+            { messageId: "extraKey", data: { computed: "", key: "bar" }, line: 2, column: 13, type: "Identifier" },
+            { messageId: "missingValue", data: { computed: "", key: "bar" }, line: 2, column: 18, type: "Literal" },
+            { messageId: "extraKey", data: { computed: "", key: "baz" }, line: 2, column: 21, type: "Identifier" },
+            { messageId: "missingValue", data: { computed: "", key: "baz" }, line: 2, column: 26, type: "Literal" }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "    foo: 1, bar: 2,",
+            "});"
+        ].join("\n"),
+        output: [
+            "({",
+            "    foo :1, bar :2,",
+            "});"
+        ].join("\n"),
+        options: [{
+            singleLine: {
+                beforeColon: true,
+                afterColon: false
+            }
+        }],
+        errors: [
+            { messageId: "missingKey", data: { computed: "", key: "foo" }, line: 2, column: 5, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "foo" }, line: 2, column: 10, type: "Literal" },
+            { messageId: "missingKey", data: { computed: "", key: "bar" }, line: 2, column: 13, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "bar" }, line: 2, column: 18, type: "Literal" }
+        ]
+    },
+    {
+        code: [
+            "({",
+            "  foo: 1, bar: { qux1: 4, qux2: 5",
+            "  }, baz: 3,",
+            "})"
+        ].join("\n"),
+        output: [
+            "({",
+            "  foo :1, bar :{ qux1 :4, qux2 :5",
+            "  }, baz :3,",
+            "})"
+        ].join("\n"),
+        options: [
+            {
+                singleLine: {
+                    afterColon: false,
+                    beforeColon: true
+                },
+                multiLine: {
+                    align: "value",
+                    afterColon: false,
+                    beforeColon: true
+                }
+            }
+        ],
+        errors: [
+            { messageId: "missingKey", data: { computed: "", key: "foo" }, line: 2, column: 3, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "foo" }, line: 2, column: 8, type: "Literal" },
+            { messageId: "missingKey", data: { computed: "", key: "bar" }, line: 2, column: 11, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "bar" }, line: 2, column: 16, type: "ObjectExpression" },
+            { messageId: "missingKey", data: { computed: "", key: "qux1" }, line: 2, column: 18, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "qux1" }, line: 2, column: 24, type: "Literal" },
+            { messageId: "missingKey", data: { computed: "", key: "qux2" }, line: 2, column: 27, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "qux2" }, line: 2, column: 33, type: "Literal" },
+            { messageId: "missingKey", data: { computed: "", key: "baz" }, line: 3, column: 6, type: "Identifier" },
+            { messageId: "extraValue", data: { computed: "", key: "baz" }, line: 3, column: 11, type: "Literal" }
+        ]
     }]
 });
diff --git a/tests/lib/rules/object-curly-spacing.js b/tests/lib/rules/object-curly-spacing.js
index 305ae2831..7d068f6e7 100644
--- a/tests/lib/rules/object-curly-spacing.js
+++ b/tests/lib/rules/object-curly-spacing.js
@@ -190,13 +190,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 8
+                    column: 8,
+                    endLine: 1,
+                    endColumn: 9
                 },
                 {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 12
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 13
                 }
             ]
         },
@@ -210,7 +214,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 18
+                    column: 18,
+                    endLine: 1,
+                    endColumn: 19
                 }
             ]
         },
@@ -224,13 +230,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 8
+                    column: 8,
+                    endLine: 1,
+                    endColumn: 9
                 },
                 {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 17
+                    column: 17,
+                    endLine: 1,
+                    endColumn: 18
                 }
             ]
         },
@@ -244,7 +254,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 13
+                    column: 13,
+                    endLine: 1,
+                    endColumn: 14
                 }
             ]
         },
@@ -258,7 +270,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 16
+                    column: 16,
+                    endLine: 1,
+                    endColumn: 17
                 }
 
             ]
@@ -273,7 +287,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 21
+                    column: 21,
+                    endLine: 1,
+                    endColumn: 22
                 }
             ]
         },
@@ -287,7 +303,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
@@ -301,7 +319,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
@@ -315,7 +335,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 21
+                    column: 21,
+                    endLine: 1,
+                    endColumn: 22
                 }
 
             ]
@@ -330,13 +352,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 },
                 {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 15
+                    column: 15,
+                    endLine: 1,
+                    endColumn: 16
                 }
 
             ]
@@ -351,13 +377,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 },
                 {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 20
+                    column: 20,
+                    endLine: 1,
+                    endColumn: 21
                 }
             ]
         },
@@ -371,13 +401,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 8
+                    column: 8,
+                    endLine: 1,
+                    endColumn: 9
                 },
                 {
                     message: "A space is required before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 13
+                    column: 13,
+                    endLine: 1,
+                    endColumn: 14
                 }
 
             ]
@@ -392,13 +426,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 8
+                    column: 9,
+                    endLine: 1,
+                    endColumn: 10
                 },
                 {
                     message: "There should be no space before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 15
+                    column: 14,
+                    endLine: 1,
+                    endColumn: 15
                 }
             ]
         },
@@ -412,13 +450,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 8
+                    column: 9,
+                    endLine: 1,
+                    endColumn: 10
                 },
                 {
                     message: "There should be no space before '}'.",
                     type: "ImportDeclaration",
                     line: 1,
-                    column: 27
+                    column: 26,
+                    endLine: 1,
+                    endColumn: 27
                 }
             ]
         },
@@ -432,7 +474,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ExportNamedDeclaration",
                     line: 2,
-                    column: 8
+                    column: 8,
+                    endLine: 2,
+                    endColumn: 9
                 },
                 {
                     message: "A space is required before '}'.",
@@ -452,13 +496,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ExportNamedDeclaration",
                     line: 2,
-                    column: 8
+                    column: 8,
+                    endLine: 2,
+                    endColumn: 9
                 },
                 {
                     message: "A space is required before '}'.",
                     type: "ExportNamedDeclaration",
                     line: 2,
-                    column: 24
+                    column: 24,
+                    endLine: 2,
+                    endColumn: 25
                 }
             ]
         },
@@ -472,7 +520,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ExportNamedDeclaration",
                     line: 2,
-                    column: 8
+                    column: 8,
+                    endLine: 2,
+                    endColumn: 9
                 }
             ]
         },
@@ -486,13 +536,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ExportNamedDeclaration",
                     line: 2,
-                    column: 8
+                    column: 9,
+                    endLine: 2,
+                    endColumn: 10
                 },
                 {
                     message: "There should be no space before '}'.",
                     type: "ExportNamedDeclaration",
                     line: 2,
-                    column: 26
+                    column: 25,
+                    endLine: 2,
+                    endColumn: 26
                 }
             ]
         },
@@ -505,7 +559,11 @@ ruleTester.run("object-curly-spacing", rule, {
             errors: [
                 {
                     message: "There should be no space before '}'.",
-                    type: "ObjectExpression"
+                    type: "ObjectExpression",
+                    line: 1,
+                    column: 28,
+                    endLine: 1,
+                    endColumn: 29
                 }
             ]
         },
@@ -516,7 +574,11 @@ ruleTester.run("object-curly-spacing", rule, {
             errors: [
                 {
                     message: "There should be no space before '}'.",
-                    type: "ObjectExpression"
+                    type: "ObjectExpression",
+                    line: 1,
+                    column: 54,
+                    endLine: 1,
+                    endColumn: 55
                 }
             ]
         },
@@ -531,7 +593,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 43
+                    column: 42,
+                    endLine: 1,
+                    endColumn: 43
                 }
             ]
         },
@@ -544,7 +608,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 61
+                    column: 60,
+                    endLine: 1,
+                    endColumn: 61
                 }
             ]
         },
@@ -560,7 +626,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 9
+                    column: 9,
+                    endLine: 1,
+                    endColumn: 10
                 }
             ]
         },
@@ -574,7 +642,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 9
+                    column: 8,
+                    endLine: 1,
+                    endColumn: 9
                 }
             ]
         },
@@ -588,7 +658,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 10
+                    column: 9,
+                    endLine: 1,
+                    endColumn: 10
                 }
             ]
         },
@@ -602,13 +674,65 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 5
+                    column: 6,
+                    endLine: 1,
+                    endColumn: 7
+                },
+                {
+                    message: "There should be no space before '}'.",
+                    type: "ObjectPattern",
+                    line: 1,
+                    column: 10,
+                    endLine: 1,
+                    endColumn: 11
+                }
+            ]
+        },
+        {
+            code: "var {  a:b  } = x;",
+            output: "var {a:b} = x;",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 6 },
+            errors: [
+                {
+                    message: "There should be no space after '{'.",
+                    type: "ObjectPattern",
+                    line: 1,
+                    column: 6,
+                    endLine: 1,
+                    endColumn: 8
                 },
                 {
                     message: "There should be no space before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 13
+                }
+            ]
+        },
+        {
+            code: "var {   a:b    } = x;",
+            output: "var {a:b} = x;",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 6 },
+            errors: [
+                {
+                    message: "There should be no space after '{'.",
+                    type: "ObjectPattern",
+                    line: 1,
+                    column: 6,
+                    endLine: 1,
+                    endColumn: 9
+                },
+                {
+                    message: "There should be no space before '}'.",
+                    type: "ObjectPattern",
+                    line: 1,
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 16
                 }
             ]
         },
@@ -623,7 +747,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 39
+                    column: 39,
+                    endLine: 1,
+                    endColumn: 40
                 }
             ]
         },
@@ -636,7 +762,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 55
+                    column: 55,
+                    endLine: 1,
+                    endColumn: 56
                 }
             ]
         },
@@ -651,13 +779,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 },
                 {
                     message: "A space is required before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 30
+                    column: 30,
+                    endLine: 1,
+                    endColumn: 31
                 }
             ]
         },
@@ -670,7 +802,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
@@ -683,7 +817,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
@@ -696,7 +832,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
@@ -709,7 +847,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 31
+                    column: 31,
+                    endLine: 1,
+                    endColumn: 32
                 }
             ]
         },
@@ -722,7 +862,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 36
+                    column: 36,
+                    endLine: 1,
+                    endColumn: 37
                 }
             ]
         },
@@ -735,13 +877,40 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 11
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 13
+                },
+                {
+                    message: "There should be no space before '}'.",
+                    type: "ObjectExpression",
+                    line: 1,
+                    column: 31,
+                    endLine: 1,
+                    endColumn: 32
+                }
+            ]
+        },
+        {
+            code: "var obj = {  foo: bar, baz: qux };",
+            output: "var obj = {foo: bar, baz: qux};",
+            options: ["never"],
+            errors: [
+                {
+                    message: "There should be no space after '{'.",
+                    type: "ObjectExpression",
+                    line: 1,
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 14
                 },
                 {
                     message: "There should be no space before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 32
+                    column: 32,
+                    endLine: 1,
+                    endColumn: 33
                 }
             ]
         },
@@ -754,7 +923,24 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 31
+                    column: 30,
+                    endLine: 1,
+                    endColumn: 31
+                }
+            ]
+        },
+        {
+            code: "var obj = {foo: bar, baz: qux  };",
+            output: "var obj = {foo: bar, baz: qux};",
+            options: ["never"],
+            errors: [
+                {
+                    message: "There should be no space before '}'.",
+                    type: "ObjectExpression",
+                    line: 1,
+                    column: 30,
+                    endLine: 1,
+                    endColumn: 32
                 }
             ]
         },
@@ -767,7 +953,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 37
+                    column: 36,
+                    endLine: 1,
+                    endColumn: 37
                 }
             ]
         },
@@ -780,7 +968,24 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 11
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 13
+                }
+            ]
+        },
+        {
+            code: "var obj = {  foo: bar, baz: qux};",
+            output: "var obj = {foo: bar, baz: qux};",
+            options: ["never"],
+            errors: [
+                {
+                    message: "There should be no space after '{'.",
+                    type: "ObjectExpression",
+                    line: 1,
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 14
                 }
             ]
         },
@@ -793,7 +998,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 11
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 13
                 }
             ]
         },
@@ -806,7 +1013,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectExpression",
                     line: 2,
-                    column: 11
+                    column: 10,
+                    endLine: 2,
+                    endColumn: 11
                 }
             ]
         },
@@ -819,13 +1028,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 11
+                    column: 12,
+                    endLine: 1,
+                    endColumn: 13
                 },
                 {
                     message: "There should be no space after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 18
+                    column: 19,
+                    endLine: 1,
+                    endColumn: 20
                 }
             ]
         },
@@ -838,13 +1051,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 28
+                    column: 27,
+                    endLine: 1,
+                    endColumn: 28
                 },
                 {
                     message: "There should be no space before '}'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 40
+                    column: 39,
+                    endLine: 1,
+                    endColumn: 40
                 }
             ]
         },
@@ -858,7 +1075,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ObjectExpression",
                     line: 1,
-                    column: 22
+                    column: 22,
+                    endLine: 1,
+                    endColumn: 23
                 }
             ]
         },
@@ -874,13 +1093,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 5
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 6
                 },
                 {
                     message: "A space is required before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 10
+                    column: 10,
+                    endLine: 1,
+                    endColumn: 11
                 }
             ]
         },
@@ -894,7 +1117,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
@@ -908,7 +1133,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 16
+                    column: 16,
+                    endLine: 1,
+                    endColumn: 17
                 }
             ]
         },
@@ -922,7 +1149,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 5
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 6
                 }
             ]
         },
@@ -936,7 +1165,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 5
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 6
                 }
             ]
         },
@@ -950,13 +1181,17 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 5
+                    column: 6,
+                    endLine: 1,
+                    endColumn: 7
                 },
                 {
                     message: "There should be no space before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 12
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
@@ -970,7 +1205,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 11
+                    column: 10,
+                    endLine: 1,
+                    endColumn: 11
                 }
             ]
         },
@@ -984,7 +1221,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 16
+                    column: 15,
+                    endLine: 1,
+                    endColumn: 16
                 }
             ]
         },
@@ -998,7 +1237,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "There should be no space after '{'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 5
+                    column: 6,
+                    endLine: 1,
+                    endColumn: 7
                 }
             ]
         },
@@ -1012,7 +1253,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required before '}'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 11
+                    column: 11,
+                    endLine: 1,
+                    endColumn: 12
                 }
             ]
         },
@@ -1026,7 +1269,9 @@ ruleTester.run("object-curly-spacing", rule, {
                     message: "A space is required after '{'.",
                     type: "ObjectPattern",
                     line: 1,
-                    column: 5
+                    column: 5,
+                    endLine: 1,
+                    endColumn: 6
                 }
             ]
         },
@@ -1039,7 +1284,11 @@ ruleTester.run("object-curly-spacing", rule, {
             errors: [
                 {
                     message: "A space is required before '}'.",
-                    type: "ObjectExpression"
+                    type: "ObjectExpression",
+                    line: 1,
+                    column: 25,
+                    endLine: 1,
+                    endColumn: 26
                 }
             ]
         },
@@ -1050,7 +1299,11 @@ ruleTester.run("object-curly-spacing", rule, {
             errors: [
                 {
                     message: "A space is required before '}'.",
-                    type: "ObjectExpression"
+                    type: "ObjectExpression",
+                    line: 1,
+                    column: 49,
+                    endLine: 1,
+                    endColumn: 50
                 }
             ]
         },
@@ -1064,7 +1317,11 @@ ruleTester.run("object-curly-spacing", rule, {
             errors: [
                 {
                     message: "There should be no space before '}'.",
-                    type: "ObjectPattern"
+                    type: "ObjectPattern",
+                    line: 1,
+                    column: 20,
+                    endLine: 1,
+                    endColumn: 21
                 }
             ]
         }
diff --git a/tests/lib/rules/spaced-comment.js b/tests/lib/rules/spaced-comment.js
index fd6b2e510..ee28203d1 100644
--- a/tests/lib/rules/spaced-comment.js
+++ b/tests/lib/rules/spaced-comment.js
@@ -304,6 +304,44 @@ ruleTester.run("spaced-comment", rule, {
         {
             code: "/***\u2028*/",
             options: ["always", { exceptions: ["*"] }]
+        },
+
+        // ignore marker-only comments, https://github.com/eslint/eslint/issues/12036
+        {
+            code: "//#endregion",
+            options: ["always", { line: { markers: ["#endregion"] } }]
+        },
+        {
+            code: "/*foo*/",
+            options: ["always", { block: { markers: ["foo"] } }]
+        },
+        {
+            code: "/*foo*/",
+            options: ["always", { block: { markers: ["foo"], balanced: true } }]
+        },
+        {
+            code: "/*foo*/ /*bar*/",
+            options: ["always", { markers: ["foo", "bar"] }]
+        },
+        {
+            code: "//foo\n//bar",
+            options: ["always", { markers: ["foo", "bar"] }]
+        },
+        {
+            code: "/* foo */",
+            options: ["never", { markers: [" foo "] }]
+        },
+        {
+            code: "// foo ",
+            options: ["never", { markers: [" foo "] }]
+        },
+        {
+            code: "//*", // "*" is a marker by default
+            options: ["always"]
+        },
+        {
+            code: "/***/", // "*" is a marker by default
+            options: ["always"]
         }
     ],
 
@@ -586,6 +624,65 @@ ruleTester.run("spaced-comment", rule, {
             output: null,
             options: ["never"],
             errors: 1
+        },
+
+        // not a marker-only comment, regression tests for https://github.com/eslint/eslint/issues/12036
+        {
+            code: "//#endregionfoo",
+            output: "//#endregion foo",
+            options: ["always", { line: { markers: ["#endregion"] } }],
+            errors: [{
+                message: "Expected space or tab after '//#endregion' in comment.",
+                type: "Line"
+            }]
+        },
+        {
+            code: "/*#endregion*/",
+            output: "/* #endregion*/", // not an allowed marker for block comments
+            options: ["always", { line: { markers: ["#endregion"] } }],
+            errors: [{
+                message: "Expected space or tab after '/*' in comment.",
+                type: "Block"
+            }]
+        },
+        {
+            code: "/****/",
+            output: "/** **/",
+            options: ["always"],
+            errors: [{
+                message: "Expected space or tab after '/**' in comment.",
+                type: "Block"
+            }]
+        },
+        {
+            code: "/****/",
+            output: "/** * */",
+            options: ["always", { block: { balanced: true } }],
+            errors: [
+                {
+                    message: "Expected space or tab after '/**' in comment.",
+                    type: "Block"
+                },
+                {
+                    message: "Expected space or tab before '*/' in comment.",
+                    type: "Block"
+                }
+            ]
+        },
+        {
+            code: "/* foo */",
+            output: "/*foo*/",
+            options: ["never", { block: { markers: ["foo"], balanced: true } }], // not " foo "
+            errors: [
+                {
+                    message: "Unexpected space or tab after '/*' in comment.",
+                    type: "Block"
+                },
+                {
+                    message: "Unexpected space or tab before '*/' in comment.",
+                    type: "Block"
+                }
+            ]
         }
     ]