Repository: eslint/eslint
Pull request #9560 (2017-11-01 21:52:26)

Fix: edge-cases of semi-style
**What is the purpose of this pull request? (put an "X" next to item)**

[X] Bug fix

**Tell us about your environment**

* **ESLint Version:** 4.10.0
* **Node Version:** 8.9.0
* **npm Version:** 5.5.1

**What parser (default, Babel-ESLint, etc.) are you using?**

- default

**Please show your full configuration:**

- nothing

**What did you do? Please include the actual source code causing the issue.**

> [The online demo for `"first"` option](https://eslint.org/demo/#eyJ0ZXh0IjoiLyplc2xpbnQgc2VtaS1zdHlsZTogW2Vycm9yLCBmaXJzdF0gKi9cclxuXHJcbntcclxuXHQ7IC8vIFNob3VsZCBiZSBpZ25vcmVkLiBJdCdzIHJlcG9ydGVkIGJ5IGBuby1leHRyYS1zZW1pYC5cclxufVxyXG5cclxud2hpbGUgKGEpXHJcblx0OyAvLyBTaG91bGQgYmUgaWdub3JlZCB0byBrZWVwIHRoZSBpbmRlbnRlZCBsb29wIGJvZHkuXHJcbmZvb1xyXG5cclxuZG9cclxuXHQ7IC8vIFNob3VsZCBiZSBpZ25vcmVkIHRvIGtlZXAgdGhlIGluZGVudGVkIGxvb3AgYm9keS5cclxud2hpbGUgKGEpXHJcblxyXG5kb1xyXG5cdGZvbzsgLy8gU2hvdWxkIGJlIGlnbm9yZWQgaW5zdGVhZCBvZiBtYWtpbmcgYDt3aGlsZWAuXHJcbndoaWxlIChhKVxyXG5cclxuaWYgKGEpXHJcblx0Zm9vOyAvLyBTaG91bGQgYmUgaWdub3JlZCBpbnN0ZWFkIG9mIG1ha2luZyBgO2Vsc2VgLlxyXG5lbHNlXHJcblx0YmFyXHJcbiIsIm9wdGlvbnMiOnsicGFyc2VyT3B0aW9ucyI6eyJlY21hVmVyc2lvbiI6OCwic291cmNlVHlwZSI6Im1vZHVsZSIsImVjbWFGZWF0dXJlcyI6e319LCJydWxlcyI6e30sImVudiI6e319fQ==)

```js
/*eslint semi-style: [error, first] */

{
	; // Should be ignored. It's reported by `no-extra-semi`.
}

while (a)
	; // Should be ignored to keep the indented loop body.
foo

do
	; // Should be ignored to keep the indented loop body.
while (a)

do
	foo; // Should be ignored instead of making `;while`.
while (a)

if (a)
	foo; // Should be ignored instead of making `;else`.
else
	bar
```

> [The online demo for `"last"` option](https://eslint.org/demo/#eyJ0ZXh0IjoiLyplc2xpbnQgc2VtaS1zdHlsZTogW2Vycm9yLCBsYXN0XSAqL1xyXG5cclxue1xyXG5cdDsgLy8gU2hvdWxkIGJlIGlnbm9yZWQuIEl0J3MgcmVwb3J0ZWQgYnkgYG5vLWV4dHJhLXNlbWlgLlxyXG59XHJcblxyXG5zd2l0Y2ggKGEpIHtcclxuXHRjYXNlIDE6XHJcblx0XHQ7Zm9vIC8vIFNob3VsZCBiZSBpZ25vcmVkLiBJdCdzIHJlcG9ydGVkIGJ5IGBuby1leHRyYS1zZW1pYC5cclxufVxyXG5cclxud2hpbGUgKGEpXHJcblx0OyAvLyBTaG91bGQgYmUgaWdub3JlZCB0byBrZWVwIHRoZSBpbmRlbnRlZCBsb29wIGJvZHkuXHJcbmZvb1xyXG5cclxuZG9cclxuXHQ7IC8vIFNob3VsZCBiZSBpZ25vcmVkIHRvIGtlZXAgdGhlIGluZGVudGVkIGxvb3AgYm9keS5cclxud2hpbGUgKGEpXHJcbiIsIm9wdGlvbnMiOnsicGFyc2VyT3B0aW9ucyI6eyJlY21hVmVyc2lvbiI6OCwic291cmNlVHlwZSI6Im1vZHVsZSIsImVjbWFGZWF0dXJlcyI6e319LCJydWxlcyI6e30sImVudiI6e319fQ==)

```js
/*eslint semi-style: [error, last] */

{
	; // Should be ignored. It's reported by `no-extra-semi`.
}

switch (a) {
	case 1:
		;foo // Should be ignored. It's reported by `no-extra-semi`.
}

while (a)
	; // Should be ignored to keep the indented loop body.
foo

do
	; // Should be ignored to keep the indented loop body.
while (a)
```

**What did you expect to happen?**

No errors.

**What actually happened? Please include the actual, raw output from ESLint.**

Several errors are reported. See the demo pages.

**What changes did you make? (Give an overview)**

This PR fixes those false positives. Now the rule ignores semicolons at the first/last in a block/clause.

**Is there anything you'd like reviewers to focus on?**

Nothing in particular.



Patch:
diff --git a/docs/developer-guide/contributing/pull-requests.md b/docs/developer-guide/contributing/pull-requests.md
index 84990a758..a1bc8f6bf 100644
--- a/docs/developer-guide/contributing/pull-requests.md
+++ b/docs/developer-guide/contributing/pull-requests.md
@@ -60,7 +60,7 @@ The first line of the commit message (the summary) must have a specific format.
 The `Tag` is one of the following:
 
 * `Fix` - for a bug fix.
-* `Update` - for a backwards-compatible enhancement or a change to a rule that increases the number of reported problems.
+* `Update` - either for a backwards-compatible enhancement or for a rule change that adds reported problems.
 * `New` - implemented a new feature.
 * `Breaking` - for a backwards-incompatible enhancement or feature.
 * `Docs` - changes to documentation only.
diff --git a/docs/rules/no-underscore-dangle.md b/docs/rules/no-underscore-dangle.md
index e51a020db..7383815b3 100644
--- a/docs/rules/no-underscore-dangle.md
+++ b/docs/rules/no-underscore-dangle.md
@@ -42,7 +42,7 @@ This rule has an object option:
 * `"allow"` allows specified identifiers to have dangling underscores
 * `"allowAfterThis": false` (default) disallows dangling underscores in members of the `this` object
 * `"allowAfterSuper": false` (default) disallows dangling underscores in members of the `super` object
-* `"enforceInMethodNames": false (default) allows dangling underscores in method names`
+* `"enforceInMethodNames": false` (default) allows dangling underscores in method names
 
 ### allow
 
diff --git a/docs/rules/valid-typeof.md b/docs/rules/valid-typeof.md
index 2ce02b490..60539eecb 100644
--- a/docs/rules/valid-typeof.md
+++ b/docs/rules/valid-typeof.md
@@ -20,7 +20,7 @@ Examples of **incorrect** code for this rule:
 typeof foo === "strnig"
 typeof foo == "undefimed"
 typeof bar != "nunber"
-typeof bar !== "fucntion"
+typeof bar !== "function"
 ```
 
 Examples of **correct** code for this rule:
diff --git a/lib/ast-utils.js b/lib/ast-utils.js
index 23d2a7dcb..a186bdee5 100644
--- a/lib/ast-utils.js
+++ b/lib/ast-utils.js
@@ -406,6 +406,31 @@ function createGlobalLinebreakMatcher() {
     return new RegExp(LINEBREAK_MATCHER.source, "g");
 }
 
+/**
+ * Checks whether or not the tokens of two given nodes are same.
+ * @param {ASTNode} left - A node 1 to compare.
+ * @param {ASTNode} right - A node 2 to compare.
+ * @param {SourceCode} sourceCode - The ESLint source code object.
+ * @returns {boolean} the source code for the given node.
+ */
+function equalTokens(left, right, sourceCode) {
+    const tokensL = sourceCode.getTokens(left);
+    const tokensR = sourceCode.getTokens(right);
+
+    if (tokensL.length !== tokensR.length) {
+        return false;
+    }
+    for (let i = 0; i < tokensL.length; ++i) {
+        if (tokensL[i].type !== tokensR[i].type ||
+            tokensL[i].value !== tokensR[i].value
+        ) {
+            return false;
+        }
+    }
+
+    return true;
+}
+
 //------------------------------------------------------------------------------
 // Public Interface
 //------------------------------------------------------------------------------
@@ -438,6 +463,7 @@ module.exports = {
     isArrayFromMethod,
     isParenthesised,
     createGlobalLinebreakMatcher,
+    equalTokens,
 
     isArrowToken,
     isClosingBraceToken,
diff --git a/lib/cli-engine.js b/lib/cli-engine.js
index 4d093b742..39169dc42 100644
--- a/lib/cli-engine.js
+++ b/lib/cli-engine.js
@@ -24,7 +24,7 @@ const fs = require("fs"),
     fileEntryCache = require("file-entry-cache"),
     globUtil = require("./util/glob-util"),
     validator = require("./config/config-validator"),
-    stringify = require("json-stable-stringify"),
+    stringify = require("json-stable-stringify-without-jsonify"),
     hash = require("./util/hash"),
     ModuleResolver = require("./util/module-resolver"),
     naming = require("./util/naming"),
diff --git a/lib/config/config-file.js b/lib/config/config-file.js
index 4d391b3a1..8cefd437d 100644
--- a/lib/config/config-file.js
+++ b/lib/config/config-file.js
@@ -17,7 +17,7 @@ const fs = require("fs"),
     naming = require("../util/naming"),
     pathIsInside = require("path-is-inside"),
     stripComments = require("strip-json-comments"),
-    stringify = require("json-stable-stringify"),
+    stringify = require("json-stable-stringify-without-jsonify"),
     requireUncached = require("require-uncached");
 
 const debug = require("debug")("eslint:config-file");
@@ -29,7 +29,7 @@ const debug = require("debug")("eslint:config-file");
 /**
  * Determines sort order for object keys for json-stable-stringify
  *
- * see: https://github.com/substack/json-stable-stringify#cmp
+ * see: https://github.com/samn/json-stable-stringify#cmp
  *
  * @param   {Object} a The first comparison object ({key: akey, value: avalue})
  * @param   {Object} b The second comparison object ({key: bkey, value: bvalue})
diff --git a/lib/config/config-validator.js b/lib/config/config-validator.js
index 5aeb635c1..f2307dc63 100644
--- a/lib/config/config-validator.js
+++ b/lib/config/config-validator.js
@@ -89,7 +89,9 @@ function validateRuleSchema(id, localOptions, rulesContext) {
     if (validateRule) {
         validateRule(localOptions);
         if (validateRule.errors) {
-            throw new Error(validateRule.errors.map(error => `\tValue "${error.data}" ${error.message}.\n`).join(""));
+            throw new Error(validateRule.errors.map(
+                error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`
+            ).join(""));
         }
     }
 }
diff --git a/lib/rules/no-useless-call.js b/lib/rules/no-useless-call.js
index eb67bcb3b..e4820ac24 100644
--- a/lib/rules/no-useless-call.js
+++ b/lib/rules/no-useless-call.js
@@ -28,30 +28,6 @@ function isCallOrNonVariadicApply(node) {
     );
 }
 
-/**
- * Checks whether or not the tokens of two given nodes are same.
- * @param {ASTNode} left - A node 1 to compare.
- * @param {ASTNode} right - A node 2 to compare.
- * @param {SourceCode} sourceCode - The ESLint source code object.
- * @returns {boolean} the source code for the given node.
- */
-function equalTokens(left, right, sourceCode) {
-    const tokensL = sourceCode.getTokens(left);
-    const tokensR = sourceCode.getTokens(right);
-
-    if (tokensL.length !== tokensR.length) {
-        return false;
-    }
-    for (let i = 0; i < tokensL.length; ++i) {
-        if (tokensL[i].type !== tokensR[i].type ||
-            tokensL[i].value !== tokensR[i].value
-        ) {
-            return false;
-        }
-    }
-
-    return true;
-}
 
 /**
  * Checks whether or not `thisArg` is not changed by `.call()`/`.apply()`.
@@ -64,7 +40,7 @@ function isValidThisArg(expectedThis, thisArg, sourceCode) {
     if (!expectedThis) {
         return astUtils.isNullOrUndefined(thisArg);
     }
-    return equalTokens(expectedThis, thisArg, sourceCode);
+    return astUtils.equalTokens(expectedThis, thisArg, sourceCode);
 }
 
 //------------------------------------------------------------------------------
diff --git a/lib/rules/object-curly-newline.js b/lib/rules/object-curly-newline.js
index 42f277873..ebad69de2 100644
--- a/lib/rules/object-curly-newline.js
+++ b/lib/rules/object-curly-newline.js
@@ -131,8 +131,15 @@ module.exports = {
          */
         function check(node) {
             const options = normalizedOptions[node.type];
-            const openBrace = sourceCode.getFirstToken(node);
-            const closeBrace = sourceCode.getLastToken(node);
+            const openBrace = sourceCode.getFirstToken(node, token => token.value === "{");
+            let closeBrace;
+
+            if (node.typeAnnotation) {
+                closeBrace = sourceCode.getTokenBefore(node.typeAnnotation);
+            } else {
+                closeBrace = sourceCode.getLastToken(node);
+            }
+
             let first = sourceCode.getTokenAfter(openBrace, { includeComments: true });
             let last = sourceCode.getTokenBefore(closeBrace, { includeComments: true });
             const needsLinebreaks = (
diff --git a/lib/rules/prefer-spread.js b/lib/rules/prefer-spread.js
index 1f5785828..c111d5f98 100644
--- a/lib/rules/prefer-spread.js
+++ b/lib/rules/prefer-spread.js
@@ -28,30 +28,6 @@ function isVariadicApplyCalling(node) {
     );
 }
 
-/**
- * Checks whether or not the tokens of two given nodes are same.
- * @param {ASTNode} left - A node 1 to compare.
- * @param {ASTNode} right - A node 2 to compare.
- * @param {SourceCode} sourceCode - The ESLint source code object.
- * @returns {boolean} the source code for the given node.
- */
-function equalTokens(left, right, sourceCode) {
-    const tokensL = sourceCode.getTokens(left);
-    const tokensR = sourceCode.getTokens(right);
-
-    if (tokensL.length !== tokensR.length) {
-        return false;
-    }
-    for (let i = 0; i < tokensL.length; ++i) {
-        if (tokensL[i].type !== tokensR[i].type ||
-            tokensL[i].value !== tokensR[i].value
-        ) {
-            return false;
-        }
-    }
-
-    return true;
-}
 
 /**
  * Checks whether or not `thisArg` is not changed by `.apply()`.
@@ -64,7 +40,7 @@ function isValidThisArg(expectedThis, thisArg, context) {
     if (!expectedThis) {
         return astUtils.isNullOrUndefined(thisArg);
     }
-    return equalTokens(expectedThis, thisArg, context);
+    return astUtils.equalTokens(expectedThis, thisArg, context);
 }
 
 //------------------------------------------------------------------------------
diff --git a/lib/rules/semi-style.js b/lib/rules/semi-style.js
index 97fcc3ac8..41fb39246 100644
--- a/lib/rules/semi-style.js
+++ b/lib/rules/semi-style.js
@@ -18,13 +18,51 @@ const astUtils = require("../ast-utils");
 const SELECTOR = `:matches(${
     [
         "BreakStatement", "ContinueStatement", "DebuggerStatement",
-        "DoWhileStatement", "EmptyStatement", "ExportAllDeclaration",
+        "DoWhileStatement", "ExportAllDeclaration",
         "ExportDefaultDeclaration", "ExportNamedDeclaration",
         "ExpressionStatement", "ImportDeclaration", "ReturnStatement",
         "ThrowStatement", "VariableDeclaration"
     ].join(",")
 })`;
 
+/**
+ * Get the child node list of a given node.
+ * This returns `Program#body`, `BlockStatement#body`, or `SwitchCase#consequent`.
+ * This is used to check whether a node is the first/last child.
+ * @param {Node} node A node to get child node list.
+ * @returns {Node[]|null} The child node list.
+ */
+function getChildren(node) {
+    const t = node.type;
+
+    if (t === "BlockStatement" || t === "Program") {
+        return node.body;
+    }
+    if (t === "SwitchCase") {
+        return node.consequent;
+    }
+    return null;
+}
+
+/**
+ * Check whether a given node is the last statement in the parent block.
+ * @param {Node} node A node to check.
+ * @returns {boolean} `true` if the node is the last statement in the parent block.
+ */
+function isLastChild(node) {
+    const t = node.parent.type;
+
+    if (t === "IfStatement" && node.parent.consequent === node && node.parent.alternate) { // before `else` keyword.
+        return true;
+    }
+    if (t === "DoWhileStatement") { // before `while` keyword.
+        return true;
+    }
+    const nodeList = getChildren(node.parent);
+
+    return nodeList !== null && nodeList[nodeList.length - 1] === node; // before `}` or etc.
+}
+
 module.exports = {
     meta: {
         docs: {
@@ -40,23 +78,6 @@ module.exports = {
         const sourceCode = context.getSourceCode();
         const option = context.options[0] || "last";
 
-        /**
-         * Check whether comments exist between the given 2 tokens.
-         * @param {Token} left The left token to check.
-         * @param {Token} right The right token to check.
-         * @returns {boolean} `true` if comments exist between the given 2 tokens.
-         */
-        function commentsExistBetween(left, right) {
-            return sourceCode.getFirstTokenBetween(
-                left,
-                right,
-                {
-                    includeComments: true,
-                    filter: astUtils.isCommentToken
-                }
-            ) !== null;
-        }
-
         /**
          * Check the given semicolon token.
          * @param {Token} semiToken The semicolon token to check.
@@ -79,7 +100,7 @@ module.exports = {
                             : "the beginning of the next line"
                     },
                     fix(fixer) {
-                        if (prevToken && nextToken && commentsExistBetween(prevToken, nextToken)) {
+                        if (prevToken && nextToken && sourceCode.commentsExistBetween(prevToken, nextToken)) {
                             return null;
                         }
 
@@ -95,6 +116,10 @@ module.exports = {
 
         return {
             [SELECTOR](node) {
+                if (option === "first" && isLastChild(node)) {
+                    return;
+                }
+
                 const lastToken = sourceCode.getLastToken(node);
 
                 if (astUtils.isSemicolonToken(lastToken)) {
diff --git a/package.json b/package.json
index 46dc70e47..da71cf6d0 100644
--- a/package.json
+++ b/package.json
@@ -34,7 +34,7 @@
   "homepage": "https://eslint.org",
   "bugs": "https://github.com/eslint/eslint/issues/",
   "dependencies": {
-    "ajv": "^5.2.0",
+    "ajv": "^5.3.0",
     "babel-code-frame": "^6.22.0",
     "chalk": "^2.1.0",
     "concat-stream": "^1.6.0",
@@ -55,7 +55,7 @@
     "inquirer": "^3.0.6",
     "is-resolvable": "^1.0.0",
     "js-yaml": "^3.9.1",
-    "json-stable-stringify": "^1.0.1",
+    "json-stable-stringify-without-jsonify": "^1.0.1",
     "levn": "^0.3.0",
     "lodash": "^4.17.4",
     "minimatch": "^3.0.2",
diff --git a/packages/eslint-config-eslint/README.md b/packages/eslint-config-eslint/README.md
index 36635964d..d1c3dd0cb 100644
--- a/packages/eslint-config-eslint/README.md
+++ b/packages/eslint-config-eslint/README.md
@@ -5,7 +5,7 @@
 
 [Website](https://eslint.org) | [Configuring](https://eslint.org/docs/user-guide/configuring) | [Rules](https://eslint.org/docs/rules/) | [Contributing](https://eslint.org/docs/developer-guide/contributing) | [Twitter](https://twitter.com/geteslint) | [Mailing List](https://groups.google.com/group/eslint)
 
-Contains the default ESLint configuration for ESLint projects.
+Contains the ESLint configuration used for projects maintained by the ESLint team.
 
 ## Installation
 


Test patch:
diff --git a/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-multiline-type-literal.js b/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-multiline-type-literal.js
new file mode 100644
index 000000000..ae4bb5a3f
--- /dev/null
+++ b/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-multiline-type-literal.js
@@ -0,0 +1,821 @@
+
+/*
+  AST for:
+
+ function foo({
+ a,
+ b
+} : { a : string, b : string }) {}
+
+*/
+exports.parse = () => ({
+    "type": "Program",
+    "start": 0,
+    "end": 57,
+    "loc": {
+        "start": {
+            "line": 1,
+            "column": 0
+        },
+        "end": {
+            "line": 5,
+            "column": 0
+        }
+    },
+    "range": [
+        0,
+        57
+    ],
+    "comments": [],
+    "tokens": [
+        {
+            "type": "Keyword",
+            "value": "function",
+            "start": 0,
+            "end": 8,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 0
+                },
+                "end": {
+                    "line": 1,
+                    "column": 8
+                }
+            },
+            "range": [
+                0,
+                8
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "foo",
+            "start": 9,
+            "end": 12,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 9
+                },
+                "end": {
+                    "line": 1,
+                    "column": 12
+                }
+            },
+            "range": [
+                9,
+                12
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "(",
+            "start": 12,
+            "end": 13,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 12
+                },
+                "end": {
+                    "line": 1,
+                    "column": 13
+                }
+            },
+            "range": [
+                12,
+                13
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 13,
+            "end": 14,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 13
+                },
+                "end": {
+                    "line": 1,
+                    "column": 14
+                }
+            },
+            "range": [
+                13,
+                14
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "a",
+            "start": 16,
+            "end": 17,
+            "loc": {
+                "start": {
+                    "line": 2,
+                    "column": 1
+                },
+                "end": {
+                    "line": 2,
+                    "column": 2
+                }
+            },
+            "range": [
+                16,
+                17
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ",",
+            "start": 17,
+            "end": 18,
+            "loc": {
+                "start": {
+                    "line": 2,
+                    "column": 2
+                },
+                "end": {
+                    "line": 2,
+                    "column": 3
+                }
+            },
+            "range": [
+                17,
+                18
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "b",
+            "start": 20,
+            "end": 21,
+            "loc": {
+                "start": {
+                    "line": 3,
+                    "column": 1
+                },
+                "end": {
+                    "line": 3,
+                    "column": 2
+                }
+            },
+            "range": [
+                20,
+                21
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 22,
+            "end": 23,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 0
+                },
+                "end": {
+                    "line": 4,
+                    "column": 1
+                }
+            },
+            "range": [
+                22,
+                23
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ":",
+            "start": 24,
+            "end": 25,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 2
+                },
+                "end": {
+                    "line": 4,
+                    "column": 3
+                }
+            },
+            "range": [
+                24,
+                25
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 26,
+            "end": 27,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 4
+                },
+                "end": {
+                    "line": 4,
+                    "column": 5
+                }
+            },
+            "range": [
+                26,
+                27
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "a",
+            "start": 28,
+            "end": 29,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 6
+                },
+                "end": {
+                    "line": 4,
+                    "column": 7
+                }
+            },
+            "range": [
+                28,
+                29
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ":",
+            "start": 30,
+            "end": 31,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 8
+                },
+                "end": {
+                    "line": 4,
+                    "column": 9
+                }
+            },
+            "range": [
+                30,
+                31
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "string",
+            "start": 32,
+            "end": 38,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 10
+                },
+                "end": {
+                    "line": 4,
+                    "column": 16
+                }
+            },
+            "range": [
+                32,
+                38
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ",",
+            "start": 38,
+            "end": 39,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 16
+                },
+                "end": {
+                    "line": 4,
+                    "column": 17
+                }
+            },
+            "range": [
+                38,
+                39
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "b",
+            "start": 40,
+            "end": 41,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 18
+                },
+                "end": {
+                    "line": 4,
+                    "column": 19
+                }
+            },
+            "range": [
+                40,
+                41
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ":",
+            "start": 42,
+            "end": 43,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 20
+                },
+                "end": {
+                    "line": 4,
+                    "column": 21
+                }
+            },
+            "range": [
+                42,
+                43
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "string",
+            "start": 44,
+            "end": 50,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 22
+                },
+                "end": {
+                    "line": 4,
+                    "column": 28
+                }
+            },
+            "range": [
+                44,
+                50
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 51,
+            "end": 52,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 29
+                },
+                "end": {
+                    "line": 4,
+                    "column": 30
+                }
+            },
+            "range": [
+                51,
+                52
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ")",
+            "start": 52,
+            "end": 53,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 30
+                },
+                "end": {
+                    "line": 4,
+                    "column": 31
+                }
+            },
+            "range": [
+                52,
+                53
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 54,
+            "end": 55,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 32
+                },
+                "end": {
+                    "line": 4,
+                    "column": 33
+                }
+            },
+            "range": [
+                54,
+                55
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 55,
+            "end": 56,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 33
+                },
+                "end": {
+                    "line": 4,
+                    "column": 34
+                }
+            },
+            "range": [
+                55,
+                56
+            ]
+        }
+    ],
+    "sourceType": "module",
+    "body": [
+        {
+            "type": "FunctionDeclaration",
+            "start": 0,
+            "end": 56,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 0
+                },
+                "end": {
+                    "line": 4,
+                    "column": 34
+                }
+            },
+            "range": [
+                0,
+                56
+            ],
+            "id": {
+                "type": "Identifier",
+                "start": 9,
+                "end": 12,
+                "loc": {
+                    "start": {
+                        "line": 1,
+                        "column": 9
+                    },
+                    "end": {
+                        "line": 1,
+                        "column": 12
+                    },
+                    "identifierName": "foo"
+                },
+                "range": [
+                    9,
+                    12
+                ],
+                "name": "foo",
+                "_babelType": "Identifier"
+            },
+            "generator": false,
+            "expression": false,
+            "async": false,
+            "params": [
+                {
+                    "type": "ObjectPattern",
+                    "start": 13,
+                    "end": 52,
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 13
+                        },
+                        "end": {
+                            "line": 4,
+                            "column": 30
+                        }
+                    },
+                    "range": [
+                        13,
+                        52
+                    ],
+                    "properties": [
+                        {
+                            "type": "Property",
+                            "start": 16,
+                            "end": 17,
+                            "loc": {
+                                "start": {
+                                    "line": 2,
+                                    "column": 1
+                                },
+                                "end": {
+                                    "line": 2,
+                                    "column": 2
+                                }
+                            },
+                            "range": [
+                                16,
+                                17
+                            ],
+                            "method": false,
+                            "computed": false,
+                            "key": {
+                                "type": "Identifier",
+                                "start": 16,
+                                "end": 17,
+                                "loc": {
+                                    "start": {
+                                        "line": 2,
+                                        "column": 1
+                                    },
+                                    "end": {
+                                        "line": 2,
+                                        "column": 2
+                                    },
+                                    "identifierName": "a"
+                                },
+                                "range": [
+                                    16,
+                                    17
+                                ],
+                                "name": "a",
+                                "_babelType": "Identifier"
+                            },
+                            "shorthand": true,
+                            "value": {
+                                "type": "Identifier",
+                                "start": 16,
+                                "end": 17,
+                                "loc": {
+                                    "start": {
+                                        "line": 2,
+                                        "column": 1
+                                    },
+                                    "end": {
+                                        "line": 2,
+                                        "column": 2
+                                    },
+                                    "identifierName": "a"
+                                },
+                                "range": [
+                                    16,
+                                    17
+                                ],
+                                "name": "a",
+                                "_babelType": "Identifier"
+                            },
+                            "kind": "init",
+                            "extra": {
+                                "shorthand": true
+                            },
+                            "_babelType": "Property"
+                        },
+                        {
+                            "type": "Property",
+                            "start": 20,
+                            "end": 21,
+                            "loc": {
+                                "start": {
+                                    "line": 3,
+                                    "column": 1
+                                },
+                                "end": {
+                                    "line": 3,
+                                    "column": 2
+                                }
+                            },
+                            "range": [
+                                20,
+                                21
+                            ],
+                            "method": false,
+                            "computed": false,
+                            "key": {
+                                "type": "Identifier",
+                                "start": 20,
+                                "end": 21,
+                                "loc": {
+                                    "start": {
+                                        "line": 3,
+                                        "column": 1
+                                    },
+                                    "end": {
+                                        "line": 3,
+                                        "column": 2
+                                    },
+                                    "identifierName": "b"
+                                },
+                                "range": [
+                                    20,
+                                    21
+                                ],
+                                "name": "b",
+                                "_babelType": "Identifier"
+                            },
+                            "shorthand": true,
+                            "value": {
+                                "type": "Identifier",
+                                "start": 20,
+                                "end": 21,
+                                "loc": {
+                                    "start": {
+                                        "line": 3,
+                                        "column": 1
+                                    },
+                                    "end": {
+                                        "line": 3,
+                                        "column": 2
+                                    },
+                                    "identifierName": "b"
+                                },
+                                "range": [
+                                    20,
+                                    21
+                                ],
+                                "name": "b",
+                                "_babelType": "Identifier"
+                            },
+                            "kind": "init",
+                            "extra": {
+                                "shorthand": true
+                            },
+                            "_babelType": "Property"
+                        }
+                    ],
+                    "typeAnnotation": {
+                        "type": "TypeAnnotation",
+                        "start": 24,
+                        "end": 52,
+                        "loc": {
+                            "start": {
+                                "line": 4,
+                                "column": 2
+                            },
+                            "end": {
+                                "line": 4,
+                                "column": 30
+                            }
+                        },
+                        "range": [
+                            24,
+                            52
+                        ],
+                        "typeAnnotation": {
+                            "type": "ObjectTypeAnnotation",
+                            "start": 26,
+                            "end": 52,
+                            "loc": {
+                                "start": {
+                                    "line": 4,
+                                    "column": 4
+                                },
+                                "end": {
+                                    "line": 4,
+                                    "column": 30
+                                }
+                            },
+                            "range": [
+                                26,
+                                52
+                            ],
+                            "callProperties": [],
+                            "properties": [
+                                {
+                                    "type": "ObjectTypeProperty",
+                                    "start": 28,
+                                    "end": 38,
+                                    "loc": {
+                                        "start": {
+                                            "line": 4,
+                                            "column": 6
+                                        },
+                                        "end": {
+                                            "line": 4,
+                                            "column": 16
+                                        }
+                                    },
+                                    "range": [
+                                        28,
+                                        38
+                                    ],
+                                    "static": false,
+                                    "kind": "init",
+                                    "value": {
+                                        "type": "StringTypeAnnotation",
+                                        "start": 32,
+                                        "end": 38,
+                                        "loc": {
+                                            "start": {
+                                                "line": 4,
+                                                "column": 10
+                                            },
+                                            "end": {
+                                                "line": 4,
+                                                "column": 16
+                                            }
+                                        },
+                                        "range": [
+                                            32,
+                                            38
+                                        ],
+                                        "_babelType": "StringTypeAnnotation"
+                                    },
+                                    "variance": null,
+                                    "optional": false,
+                                    "_babelType": "ObjectTypeProperty"
+                                },
+                                {
+                                    "type": "ObjectTypeProperty",
+                                    "start": 40,
+                                    "end": 50,
+                                    "loc": {
+                                        "start": {
+                                            "line": 4,
+                                            "column": 18
+                                        },
+                                        "end": {
+                                            "line": 4,
+                                            "column": 28
+                                        }
+                                    },
+                                    "range": [
+                                        40,
+                                        50
+                                    ],
+                                    "static": false,
+                                    "kind": "init",
+                                    "value": {
+                                        "type": "StringTypeAnnotation",
+                                        "start": 44,
+                                        "end": 50,
+                                        "loc": {
+                                            "start": {
+                                                "line": 4,
+                                                "column": 22
+                                            },
+                                            "end": {
+                                                "line": 4,
+                                                "column": 28
+                                            }
+                                        },
+                                        "range": [
+                                            44,
+                                            50
+                                        ],
+                                        "_babelType": "StringTypeAnnotation"
+                                    },
+                                    "variance": null,
+                                    "optional": false,
+                                    "_babelType": "ObjectTypeProperty"
+                                }
+                            ],
+                            "indexers": [],
+                            "exact": false,
+                            "_babelType": "ObjectTypeAnnotation"
+                        },
+                        "_babelType": "TypeAnnotation"
+                    },
+                    "_babelType": "ObjectPattern"
+                }
+            ],
+            "body": {
+                "type": "BlockStatement",
+                "start": 54,
+                "end": 56,
+                "loc": {
+                    "start": {
+                        "line": 4,
+                        "column": 32
+                    },
+                    "end": {
+                        "line": 4,
+                        "column": 34
+                    }
+                },
+                "range": [
+                    54,
+                    56
+                ],
+                "body": [],
+                "_babelType": "BlockStatement"
+            },
+            "_babelType": "FunctionDeclaration"
+        }
+    ]
+});
+
diff --git a/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-multiline.js b/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-multiline.js
new file mode 100644
index 000000000..8e2f53b07
--- /dev/null
+++ b/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-multiline.js
@@ -0,0 +1,591 @@
+
+/*
+  AST for:
+
+function foo({
+ a,
+ b
+} : MyType) {}
+
+*/
+exports.parse = () => ({
+    "type": "Program",
+    "start": 0,
+    "end": 37,
+    "loc": {
+        "start": {
+            "line": 1,
+            "column": 0
+        },
+        "end": {
+            "line": 5,
+            "column": 0
+        }
+    },
+    "range": [
+        0,
+        37
+    ],
+    "comments": [],
+    "tokens": [
+        {
+            "type": "Keyword",
+            "value": "function",
+            "start": 0,
+            "end": 8,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 0
+                },
+                "end": {
+                    "line": 1,
+                    "column": 8
+                }
+            },
+            "range": [
+                0,
+                8
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "foo",
+            "start": 9,
+            "end": 12,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 9
+                },
+                "end": {
+                    "line": 1,
+                    "column": 12
+                }
+            },
+            "range": [
+                9,
+                12
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "(",
+            "start": 12,
+            "end": 13,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 12
+                },
+                "end": {
+                    "line": 1,
+                    "column": 13
+                }
+            },
+            "range": [
+                12,
+                13
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 13,
+            "end": 14,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 13
+                },
+                "end": {
+                    "line": 1,
+                    "column": 14
+                }
+            },
+            "range": [
+                13,
+                14
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "a",
+            "start": 16,
+            "end": 17,
+            "loc": {
+                "start": {
+                    "line": 2,
+                    "column": 1
+                },
+                "end": {
+                    "line": 2,
+                    "column": 2
+                }
+            },
+            "range": [
+                16,
+                17
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ",",
+            "start": 17,
+            "end": 18,
+            "loc": {
+                "start": {
+                    "line": 2,
+                    "column": 2
+                },
+                "end": {
+                    "line": 2,
+                    "column": 3
+                }
+            },
+            "range": [
+                17,
+                18
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "b",
+            "start": 20,
+            "end": 21,
+            "loc": {
+                "start": {
+                    "line": 3,
+                    "column": 1
+                },
+                "end": {
+                    "line": 3,
+                    "column": 2
+                }
+            },
+            "range": [
+                20,
+                21
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 22,
+            "end": 23,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 0
+                },
+                "end": {
+                    "line": 4,
+                    "column": 1
+                }
+            },
+            "range": [
+                22,
+                23
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ":",
+            "start": 24,
+            "end": 25,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 2
+                },
+                "end": {
+                    "line": 4,
+                    "column": 3
+                }
+            },
+            "range": [
+                24,
+                25
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "MyType",
+            "start": 26,
+            "end": 32,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 4
+                },
+                "end": {
+                    "line": 4,
+                    "column": 10
+                }
+            },
+            "range": [
+                26,
+                32
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ")",
+            "start": 32,
+            "end": 33,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 10
+                },
+                "end": {
+                    "line": 4,
+                    "column": 11
+                }
+            },
+            "range": [
+                32,
+                33
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 34,
+            "end": 35,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 12
+                },
+                "end": {
+                    "line": 4,
+                    "column": 13
+                }
+            },
+            "range": [
+                34,
+                35
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 35,
+            "end": 36,
+            "loc": {
+                "start": {
+                    "line": 4,
+                    "column": 13
+                },
+                "end": {
+                    "line": 4,
+                    "column": 14
+                }
+            },
+            "range": [
+                35,
+                36
+            ]
+        }
+    ],
+    "sourceType": "module",
+    "body": [
+        {
+            "type": "FunctionDeclaration",
+            "start": 0,
+            "end": 36,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 0
+                },
+                "end": {
+                    "line": 4,
+                    "column": 14
+                }
+            },
+            "range": [
+                0,
+                36
+            ],
+            "id": {
+                "type": "Identifier",
+                "start": 9,
+                "end": 12,
+                "loc": {
+                    "start": {
+                        "line": 1,
+                        "column": 9
+                    },
+                    "end": {
+                        "line": 1,
+                        "column": 12
+                    },
+                    "identifierName": "foo"
+                },
+                "range": [
+                    9,
+                    12
+                ],
+                "name": "foo",
+                "_babelType": "Identifier"
+            },
+            "generator": false,
+            "expression": false,
+            "async": false,
+            "params": [
+                {
+                    "type": "ObjectPattern",
+                    "start": 13,
+                    "end": 32,
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 13
+                        },
+                        "end": {
+                            "line": 4,
+                            "column": 10
+                        }
+                    },
+                    "range": [
+                        13,
+                        32
+                    ],
+                    "properties": [
+                        {
+                            "type": "Property",
+                            "start": 16,
+                            "end": 17,
+                            "loc": {
+                                "start": {
+                                    "line": 2,
+                                    "column": 1
+                                },
+                                "end": {
+                                    "line": 2,
+                                    "column": 2
+                                }
+                            },
+                            "range": [
+                                16,
+                                17
+                            ],
+                            "method": false,
+                            "computed": false,
+                            "key": {
+                                "type": "Identifier",
+                                "start": 16,
+                                "end": 17,
+                                "loc": {
+                                    "start": {
+                                        "line": 2,
+                                        "column": 1
+                                    },
+                                    "end": {
+                                        "line": 2,
+                                        "column": 2
+                                    },
+                                    "identifierName": "a"
+                                },
+                                "range": [
+                                    16,
+                                    17
+                                ],
+                                "name": "a",
+                                "_babelType": "Identifier"
+                            },
+                            "shorthand": true,
+                            "value": {
+                                "type": "Identifier",
+                                "start": 16,
+                                "end": 17,
+                                "loc": {
+                                    "start": {
+                                        "line": 2,
+                                        "column": 1
+                                    },
+                                    "end": {
+                                        "line": 2,
+                                        "column": 2
+                                    },
+                                    "identifierName": "a"
+                                },
+                                "range": [
+                                    16,
+                                    17
+                                ],
+                                "name": "a",
+                                "_babelType": "Identifier"
+                            },
+                            "kind": "init",
+                            "extra": {
+                                "shorthand": true
+                            },
+                            "_babelType": "Property"
+                        },
+                        {
+                            "type": "Property",
+                            "start": 20,
+                            "end": 21,
+                            "loc": {
+                                "start": {
+                                    "line": 3,
+                                    "column": 1
+                                },
+                                "end": {
+                                    "line": 3,
+                                    "column": 2
+                                }
+                            },
+                            "range": [
+                                20,
+                                21
+                            ],
+                            "method": false,
+                            "computed": false,
+                            "key": {
+                                "type": "Identifier",
+                                "start": 20,
+                                "end": 21,
+                                "loc": {
+                                    "start": {
+                                        "line": 3,
+                                        "column": 1
+                                    },
+                                    "end": {
+                                        "line": 3,
+                                        "column": 2
+                                    },
+                                    "identifierName": "b"
+                                },
+                                "range": [
+                                    20,
+                                    21
+                                ],
+                                "name": "b",
+                                "_babelType": "Identifier"
+                            },
+                            "shorthand": true,
+                            "value": {
+                                "type": "Identifier",
+                                "start": 20,
+                                "end": 21,
+                                "loc": {
+                                    "start": {
+                                        "line": 3,
+                                        "column": 1
+                                    },
+                                    "end": {
+                                        "line": 3,
+                                        "column": 2
+                                    },
+                                    "identifierName": "b"
+                                },
+                                "range": [
+                                    20,
+                                    21
+                                ],
+                                "name": "b",
+                                "_babelType": "Identifier"
+                            },
+                            "kind": "init",
+                            "extra": {
+                                "shorthand": true
+                            },
+                            "_babelType": "Property"
+                        }
+                    ],
+                    "typeAnnotation": {
+                        "type": "TypeAnnotation",
+                        "start": 24,
+                        "end": 32,
+                        "loc": {
+                            "start": {
+                                "line": 4,
+                                "column": 2
+                            },
+                            "end": {
+                                "line": 4,
+                                "column": 10
+                            }
+                        },
+                        "range": [
+                            24,
+                            32
+                        ],
+                        "typeAnnotation": {
+                            "type": "GenericTypeAnnotation",
+                            "start": 26,
+                            "end": 32,
+                            "loc": {
+                                "start": {
+                                    "line": 4,
+                                    "column": 4
+                                },
+                                "end": {
+                                    "line": 4,
+                                    "column": 10
+                                }
+                            },
+                            "range": [
+                                26,
+                                32
+                            ],
+                            "typeParameters": null,
+                            "id": {
+                                "type": "Identifier",
+                                "start": 26,
+                                "end": 32,
+                                "loc": {
+                                    "start": {
+                                        "line": 4,
+                                        "column": 4
+                                    },
+                                    "end": {
+                                        "line": 4,
+                                        "column": 10
+                                    },
+                                    "identifierName": "MyType"
+                                },
+                                "range": [
+                                    26,
+                                    32
+                                ],
+                                "name": "MyType",
+                                "_babelType": "Identifier"
+                            },
+                            "_babelType": "GenericTypeAnnotation"
+                        },
+                        "_babelType": "TypeAnnotation"
+                    },
+                    "_babelType": "ObjectPattern"
+                }
+            ],
+            "body": {
+                "type": "BlockStatement",
+                "start": 34,
+                "end": 36,
+                "loc": {
+                    "start": {
+                        "line": 4,
+                        "column": 12
+                    },
+                    "end": {
+                        "line": 4,
+                        "column": 14
+                    }
+                },
+                "range": [
+                    34,
+                    36
+                ],
+                "body": [],
+                "_babelType": "BlockStatement"
+            },
+            "_babelType": "FunctionDeclaration"
+        }
+    ]
+});
+
diff --git a/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-singleline-type-literal.js b/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-singleline-type-literal.js
new file mode 100644
index 000000000..96abb1f14
--- /dev/null
+++ b/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-singleline-type-literal.js
@@ -0,0 +1,818 @@
+
+/*
+  AST for:
+
+function foo({ a, b } : { a : string, b : string }) {}
+
+*/
+exports.parse = () => ({
+    "type": "Program",
+    "start": 0,
+    "end": 55,
+    "loc": {
+        "start": {
+            "line": 1,
+            "column": 0
+        },
+        "end": {
+            "line": 2,
+            "column": 0
+        }
+    },
+    "range": [
+        0,
+        55
+    ],
+    "comments": [],
+    "tokens": [
+        {
+            "type": "Keyword",
+            "value": "function",
+            "start": 0,
+            "end": 8,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 0
+                },
+                "end": {
+                    "line": 1,
+                    "column": 8
+                }
+            },
+            "range": [
+                0,
+                8
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "foo",
+            "start": 9,
+            "end": 12,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 9
+                },
+                "end": {
+                    "line": 1,
+                    "column": 12
+                }
+            },
+            "range": [
+                9,
+                12
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "(",
+            "start": 12,
+            "end": 13,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 12
+                },
+                "end": {
+                    "line": 1,
+                    "column": 13
+                }
+            },
+            "range": [
+                12,
+                13
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 13,
+            "end": 14,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 13
+                },
+                "end": {
+                    "line": 1,
+                    "column": 14
+                }
+            },
+            "range": [
+                13,
+                14
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "a",
+            "start": 15,
+            "end": 16,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 15
+                },
+                "end": {
+                    "line": 1,
+                    "column": 16
+                }
+            },
+            "range": [
+                15,
+                16
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ",",
+            "start": 16,
+            "end": 17,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 16
+                },
+                "end": {
+                    "line": 1,
+                    "column": 17
+                }
+            },
+            "range": [
+                16,
+                17
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "b",
+            "start": 18,
+            "end": 19,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 18
+                },
+                "end": {
+                    "line": 1,
+                    "column": 19
+                }
+            },
+            "range": [
+                18,
+                19
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 20,
+            "end": 21,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 20
+                },
+                "end": {
+                    "line": 1,
+                    "column": 21
+                }
+            },
+            "range": [
+                20,
+                21
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ":",
+            "start": 22,
+            "end": 23,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 22
+                },
+                "end": {
+                    "line": 1,
+                    "column": 23
+                }
+            },
+            "range": [
+                22,
+                23
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 24,
+            "end": 25,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 24
+                },
+                "end": {
+                    "line": 1,
+                    "column": 25
+                }
+            },
+            "range": [
+                24,
+                25
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "a",
+            "start": 26,
+            "end": 27,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 26
+                },
+                "end": {
+                    "line": 1,
+                    "column": 27
+                }
+            },
+            "range": [
+                26,
+                27
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ":",
+            "start": 28,
+            "end": 29,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 28
+                },
+                "end": {
+                    "line": 1,
+                    "column": 29
+                }
+            },
+            "range": [
+                28,
+                29
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "string",
+            "start": 30,
+            "end": 36,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 30
+                },
+                "end": {
+                    "line": 1,
+                    "column": 36
+                }
+            },
+            "range": [
+                30,
+                36
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ",",
+            "start": 36,
+            "end": 37,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 36
+                },
+                "end": {
+                    "line": 1,
+                    "column": 37
+                }
+            },
+            "range": [
+                36,
+                37
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "b",
+            "start": 38,
+            "end": 39,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 38
+                },
+                "end": {
+                    "line": 1,
+                    "column": 39
+                }
+            },
+            "range": [
+                38,
+                39
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ":",
+            "start": 40,
+            "end": 41,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 40
+                },
+                "end": {
+                    "line": 1,
+                    "column": 41
+                }
+            },
+            "range": [
+                40,
+                41
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "string",
+            "start": 42,
+            "end": 48,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 42
+                },
+                "end": {
+                    "line": 1,
+                    "column": 48
+                }
+            },
+            "range": [
+                42,
+                48
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 49,
+            "end": 50,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 49
+                },
+                "end": {
+                    "line": 1,
+                    "column": 50
+                }
+            },
+            "range": [
+                49,
+                50
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ")",
+            "start": 50,
+            "end": 51,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 50
+                },
+                "end": {
+                    "line": 1,
+                    "column": 51
+                }
+            },
+            "range": [
+                50,
+                51
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 52,
+            "end": 53,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 52
+                },
+                "end": {
+                    "line": 1,
+                    "column": 53
+                }
+            },
+            "range": [
+                52,
+                53
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 53,
+            "end": 54,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 53
+                },
+                "end": {
+                    "line": 1,
+                    "column": 54
+                }
+            },
+            "range": [
+                53,
+                54
+            ]
+        }
+    ],
+    "sourceType": "module",
+    "body": [
+        {
+            "type": "FunctionDeclaration",
+            "start": 0,
+            "end": 54,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 0
+                },
+                "end": {
+                    "line": 1,
+                    "column": 54
+                }
+            },
+            "range": [
+                0,
+                54
+            ],
+            "id": {
+                "type": "Identifier",
+                "start": 9,
+                "end": 12,
+                "loc": {
+                    "start": {
+                        "line": 1,
+                        "column": 9
+                    },
+                    "end": {
+                        "line": 1,
+                        "column": 12
+                    },
+                    "identifierName": "foo"
+                },
+                "range": [
+                    9,
+                    12
+                ],
+                "name": "foo",
+                "_babelType": "Identifier"
+            },
+            "generator": false,
+            "expression": false,
+            "async": false,
+            "params": [
+                {
+                    "type": "ObjectPattern",
+                    "start": 13,
+                    "end": 50,
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 13
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 50
+                        }
+                    },
+                    "range": [
+                        13,
+                        50
+                    ],
+                    "properties": [
+                        {
+                            "type": "Property",
+                            "start": 15,
+                            "end": 16,
+                            "loc": {
+                                "start": {
+                                    "line": 1,
+                                    "column": 15
+                                },
+                                "end": {
+                                    "line": 1,
+                                    "column": 16
+                                }
+                            },
+                            "range": [
+                                15,
+                                16
+                            ],
+                            "method": false,
+                            "computed": false,
+                            "key": {
+                                "type": "Identifier",
+                                "start": 15,
+                                "end": 16,
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 15
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 16
+                                    },
+                                    "identifierName": "a"
+                                },
+                                "range": [
+                                    15,
+                                    16
+                                ],
+                                "name": "a",
+                                "_babelType": "Identifier"
+                            },
+                            "shorthand": true,
+                            "value": {
+                                "type": "Identifier",
+                                "start": 15,
+                                "end": 16,
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 15
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 16
+                                    },
+                                    "identifierName": "a"
+                                },
+                                "range": [
+                                    15,
+                                    16
+                                ],
+                                "name": "a",
+                                "_babelType": "Identifier"
+                            },
+                            "kind": "init",
+                            "extra": {
+                                "shorthand": true
+                            },
+                            "_babelType": "Property"
+                        },
+                        {
+                            "type": "Property",
+                            "start": 18,
+                            "end": 19,
+                            "loc": {
+                                "start": {
+                                    "line": 1,
+                                    "column": 18
+                                },
+                                "end": {
+                                    "line": 1,
+                                    "column": 19
+                                }
+                            },
+                            "range": [
+                                18,
+                                19
+                            ],
+                            "method": false,
+                            "computed": false,
+                            "key": {
+                                "type": "Identifier",
+                                "start": 18,
+                                "end": 19,
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 18
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 19
+                                    },
+                                    "identifierName": "b"
+                                },
+                                "range": [
+                                    18,
+                                    19
+                                ],
+                                "name": "b",
+                                "_babelType": "Identifier"
+                            },
+                            "shorthand": true,
+                            "value": {
+                                "type": "Identifier",
+                                "start": 18,
+                                "end": 19,
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 18
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 19
+                                    },
+                                    "identifierName": "b"
+                                },
+                                "range": [
+                                    18,
+                                    19
+                                ],
+                                "name": "b",
+                                "_babelType": "Identifier"
+                            },
+                            "kind": "init",
+                            "extra": {
+                                "shorthand": true
+                            },
+                            "_babelType": "Property"
+                        }
+                    ],
+                    "typeAnnotation": {
+                        "type": "TypeAnnotation",
+                        "start": 22,
+                        "end": 50,
+                        "loc": {
+                            "start": {
+                                "line": 1,
+                                "column": 22
+                            },
+                            "end": {
+                                "line": 1,
+                                "column": 50
+                            }
+                        },
+                        "range": [
+                            22,
+                            50
+                        ],
+                        "typeAnnotation": {
+                            "type": "ObjectTypeAnnotation",
+                            "start": 24,
+                            "end": 50,
+                            "loc": {
+                                "start": {
+                                    "line": 1,
+                                    "column": 24
+                                },
+                                "end": {
+                                    "line": 1,
+                                    "column": 50
+                                }
+                            },
+                            "range": [
+                                24,
+                                50
+                            ],
+                            "callProperties": [],
+                            "properties": [
+                                {
+                                    "type": "ObjectTypeProperty",
+                                    "start": 26,
+                                    "end": 36,
+                                    "loc": {
+                                        "start": {
+                                            "line": 1,
+                                            "column": 26
+                                        },
+                                        "end": {
+                                            "line": 1,
+                                            "column": 36
+                                        }
+                                    },
+                                    "range": [
+                                        26,
+                                        36
+                                    ],
+                                    "static": false,
+                                    "kind": "init",
+                                    "value": {
+                                        "type": "StringTypeAnnotation",
+                                        "start": 30,
+                                        "end": 36,
+                                        "loc": {
+                                            "start": {
+                                                "line": 1,
+                                                "column": 30
+                                            },
+                                            "end": {
+                                                "line": 1,
+                                                "column": 36
+                                            }
+                                        },
+                                        "range": [
+                                            30,
+                                            36
+                                        ],
+                                        "_babelType": "StringTypeAnnotation"
+                                    },
+                                    "variance": null,
+                                    "optional": false,
+                                    "_babelType": "ObjectTypeProperty"
+                                },
+                                {
+                                    "type": "ObjectTypeProperty",
+                                    "start": 38,
+                                    "end": 48,
+                                    "loc": {
+                                        "start": {
+                                            "line": 1,
+                                            "column": 38
+                                        },
+                                        "end": {
+                                            "line": 1,
+                                            "column": 48
+                                        }
+                                    },
+                                    "range": [
+                                        38,
+                                        48
+                                    ],
+                                    "static": false,
+                                    "kind": "init",
+                                    "value": {
+                                        "type": "StringTypeAnnotation",
+                                        "start": 42,
+                                        "end": 48,
+                                        "loc": {
+                                            "start": {
+                                                "line": 1,
+                                                "column": 42
+                                            },
+                                            "end": {
+                                                "line": 1,
+                                                "column": 48
+                                            }
+                                        },
+                                        "range": [
+                                            42,
+                                            48
+                                        ],
+                                        "_babelType": "StringTypeAnnotation"
+                                    },
+                                    "variance": null,
+                                    "optional": false,
+                                    "_babelType": "ObjectTypeProperty"
+                                }
+                            ],
+                            "indexers": [],
+                            "exact": false,
+                            "_babelType": "ObjectTypeAnnotation"
+                        },
+                        "_babelType": "TypeAnnotation"
+                    },
+                    "_babelType": "ObjectPattern"
+                }
+            ],
+            "body": {
+                "type": "BlockStatement",
+                "start": 52,
+                "end": 54,
+                "loc": {
+                    "start": {
+                        "line": 1,
+                        "column": 52
+                    },
+                    "end": {
+                        "line": 1,
+                        "column": 54
+                    }
+                },
+                "range": [
+                    52,
+                    54
+                ],
+                "body": [],
+                "_babelType": "BlockStatement"
+            },
+            "_babelType": "FunctionDeclaration"
+        }
+    ]
+});
+
diff --git a/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-singleline.js b/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-singleline.js
new file mode 100644
index 000000000..a9df13092
--- /dev/null
+++ b/tests/fixtures/parsers/object-curly-newline/flow-stub-parser-singleline.js
@@ -0,0 +1,588 @@
+
+/*
+  AST for:
+
+function foo({ a, b } : MyType) {}
+
+*/
+exports.parse = () => ({
+    "type": "Program",
+    "start": 0,
+    "end": 35,
+    "loc": {
+        "start": {
+            "line": 1,
+            "column": 0
+        },
+        "end": {
+            "line": 2,
+            "column": 0
+        }
+    },
+    "range": [
+        0,
+        35
+    ],
+    "comments": [],
+    "tokens": [
+        {
+            "type": "Keyword",
+            "value": "function",
+            "start": 0,
+            "end": 8,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 0
+                },
+                "end": {
+                    "line": 1,
+                    "column": 8
+                }
+            },
+            "range": [
+                0,
+                8
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "foo",
+            "start": 9,
+            "end": 12,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 9
+                },
+                "end": {
+                    "line": 1,
+                    "column": 12
+                }
+            },
+            "range": [
+                9,
+                12
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "(",
+            "start": 12,
+            "end": 13,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 12
+                },
+                "end": {
+                    "line": 1,
+                    "column": 13
+                }
+            },
+            "range": [
+                12,
+                13
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 13,
+            "end": 14,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 13
+                },
+                "end": {
+                    "line": 1,
+                    "column": 14
+                }
+            },
+            "range": [
+                13,
+                14
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "a",
+            "start": 15,
+            "end": 16,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 15
+                },
+                "end": {
+                    "line": 1,
+                    "column": 16
+                }
+            },
+            "range": [
+                15,
+                16
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ",",
+            "start": 16,
+            "end": 17,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 16
+                },
+                "end": {
+                    "line": 1,
+                    "column": 17
+                }
+            },
+            "range": [
+                16,
+                17
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "b",
+            "start": 18,
+            "end": 19,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 18
+                },
+                "end": {
+                    "line": 1,
+                    "column": 19
+                }
+            },
+            "range": [
+                18,
+                19
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 20,
+            "end": 21,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 20
+                },
+                "end": {
+                    "line": 1,
+                    "column": 21
+                }
+            },
+            "range": [
+                20,
+                21
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ":",
+            "start": 22,
+            "end": 23,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 22
+                },
+                "end": {
+                    "line": 1,
+                    "column": 23
+                }
+            },
+            "range": [
+                22,
+                23
+            ]
+        },
+        {
+            "type": "Identifier",
+            "value": "MyType",
+            "start": 24,
+            "end": 30,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 24
+                },
+                "end": {
+                    "line": 1,
+                    "column": 30
+                }
+            },
+            "range": [
+                24,
+                30
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": ")",
+            "start": 30,
+            "end": 31,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 30
+                },
+                "end": {
+                    "line": 1,
+                    "column": 31
+                }
+            },
+            "range": [
+                30,
+                31
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "{",
+            "start": 32,
+            "end": 33,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 32
+                },
+                "end": {
+                    "line": 1,
+                    "column": 33
+                }
+            },
+            "range": [
+                32,
+                33
+            ]
+        },
+        {
+            "type": "Punctuator",
+            "value": "}",
+            "start": 33,
+            "end": 34,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 33
+                },
+                "end": {
+                    "line": 1,
+                    "column": 34
+                }
+            },
+            "range": [
+                33,
+                34
+            ]
+        }
+    ],
+    "sourceType": "module",
+    "body": [
+        {
+            "type": "FunctionDeclaration",
+            "start": 0,
+            "end": 34,
+            "loc": {
+                "start": {
+                    "line": 1,
+                    "column": 0
+                },
+                "end": {
+                    "line": 1,
+                    "column": 34
+                }
+            },
+            "range": [
+                0,
+                34
+            ],
+            "id": {
+                "type": "Identifier",
+                "start": 9,
+                "end": 12,
+                "loc": {
+                    "start": {
+                        "line": 1,
+                        "column": 9
+                    },
+                    "end": {
+                        "line": 1,
+                        "column": 12
+                    },
+                    "identifierName": "foo"
+                },
+                "range": [
+                    9,
+                    12
+                ],
+                "name": "foo",
+                "_babelType": "Identifier"
+            },
+            "generator": false,
+            "expression": false,
+            "async": false,
+            "params": [
+                {
+                    "type": "ObjectPattern",
+                    "start": 13,
+                    "end": 30,
+                    "loc": {
+                        "start": {
+                            "line": 1,
+                            "column": 13
+                        },
+                        "end": {
+                            "line": 1,
+                            "column": 30
+                        }
+                    },
+                    "range": [
+                        13,
+                        30
+                    ],
+                    "properties": [
+                        {
+                            "type": "Property",
+                            "start": 15,
+                            "end": 16,
+                            "loc": {
+                                "start": {
+                                    "line": 1,
+                                    "column": 15
+                                },
+                                "end": {
+                                    "line": 1,
+                                    "column": 16
+                                }
+                            },
+                            "range": [
+                                15,
+                                16
+                            ],
+                            "method": false,
+                            "computed": false,
+                            "key": {
+                                "type": "Identifier",
+                                "start": 15,
+                                "end": 16,
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 15
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 16
+                                    },
+                                    "identifierName": "a"
+                                },
+                                "range": [
+                                    15,
+                                    16
+                                ],
+                                "name": "a",
+                                "_babelType": "Identifier"
+                            },
+                            "shorthand": true,
+                            "value": {
+                                "type": "Identifier",
+                                "start": 15,
+                                "end": 16,
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 15
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 16
+                                    },
+                                    "identifierName": "a"
+                                },
+                                "range": [
+                                    15,
+                                    16
+                                ],
+                                "name": "a",
+                                "_babelType": "Identifier"
+                            },
+                            "kind": "init",
+                            "extra": {
+                                "shorthand": true
+                            },
+                            "_babelType": "Property"
+                        },
+                        {
+                            "type": "Property",
+                            "start": 18,
+                            "end": 19,
+                            "loc": {
+                                "start": {
+                                    "line": 1,
+                                    "column": 18
+                                },
+                                "end": {
+                                    "line": 1,
+                                    "column": 19
+                                }
+                            },
+                            "range": [
+                                18,
+                                19
+                            ],
+                            "method": false,
+                            "computed": false,
+                            "key": {
+                                "type": "Identifier",
+                                "start": 18,
+                                "end": 19,
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 18
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 19
+                                    },
+                                    "identifierName": "b"
+                                },
+                                "range": [
+                                    18,
+                                    19
+                                ],
+                                "name": "b",
+                                "_babelType": "Identifier"
+                            },
+                            "shorthand": true,
+                            "value": {
+                                "type": "Identifier",
+                                "start": 18,
+                                "end": 19,
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 18
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 19
+                                    },
+                                    "identifierName": "b"
+                                },
+                                "range": [
+                                    18,
+                                    19
+                                ],
+                                "name": "b",
+                                "_babelType": "Identifier"
+                            },
+                            "kind": "init",
+                            "extra": {
+                                "shorthand": true
+                            },
+                            "_babelType": "Property"
+                        }
+                    ],
+                    "typeAnnotation": {
+                        "type": "TypeAnnotation",
+                        "start": 22,
+                        "end": 30,
+                        "loc": {
+                            "start": {
+                                "line": 1,
+                                "column": 22
+                            },
+                            "end": {
+                                "line": 1,
+                                "column": 30
+                            }
+                        },
+                        "range": [
+                            22,
+                            30
+                        ],
+                        "typeAnnotation": {
+                            "type": "GenericTypeAnnotation",
+                            "start": 24,
+                            "end": 30,
+                            "loc": {
+                                "start": {
+                                    "line": 1,
+                                    "column": 24
+                                },
+                                "end": {
+                                    "line": 1,
+                                    "column": 30
+                                }
+                            },
+                            "range": [
+                                24,
+                                30
+                            ],
+                            "typeParameters": null,
+                            "id": {
+                                "type": "Identifier",
+                                "start": 24,
+                                "end": 30,
+                                "loc": {
+                                    "start": {
+                                        "line": 1,
+                                        "column": 24
+                                    },
+                                    "end": {
+                                        "line": 1,
+                                        "column": 30
+                                    },
+                                    "identifierName": "MyType"
+                                },
+                                "range": [
+                                    24,
+                                    30
+                                ],
+                                "name": "MyType",
+                                "_babelType": "Identifier"
+                            },
+                            "_babelType": "GenericTypeAnnotation"
+                        },
+                        "_babelType": "TypeAnnotation"
+                    },
+                    "_babelType": "ObjectPattern"
+                }
+            ],
+            "body": {
+                "type": "BlockStatement",
+                "start": 32,
+                "end": 34,
+                "loc": {
+                    "start": {
+                        "line": 1,
+                        "column": 32
+                    },
+                    "end": {
+                        "line": 1,
+                        "column": 34
+                    }
+                },
+                "range": [
+                    32,
+                    34
+                ],
+                "body": [],
+                "_babelType": "BlockStatement"
+            },
+            "_babelType": "FunctionDeclaration"
+        }
+    ]
+});
+
diff --git a/tests/lib/ast-utils.js b/tests/lib/ast-utils.js
index 65600f353..538b941cd 100644
--- a/tests/lib/ast-utils.js
+++ b/tests/lib/ast-utils.js
@@ -1198,4 +1198,22 @@ describe("ast-utils", () => {
             });
         });
     });
+
+    describe("equalTokens", () => {
+        it("should return true if tokens are equal", () => {
+            const code = "a=0;a=0;";
+            const ast = espree.parse(code, ESPREE_CONFIG);
+            const sourceCode = new SourceCode(code, ast);
+
+            assert.strictEqual(astUtils.equalTokens(ast.body[0], ast.body[1], sourceCode), true);
+        });
+
+        it("should return false if tokens are not equal", () => {
+            const code = "a=0;a=1;";
+            const ast = espree.parse(code, ESPREE_CONFIG);
+            const sourceCode = new SourceCode(code, ast);
+
+            assert.strictEqual(astUtils.equalTokens(ast.body[0], ast.body[1], sourceCode), false);
+        });
+    });
 });
diff --git a/tests/lib/config/config-validator.js b/tests/lib/config/config-validator.js
index 71503ef6e..5f3d65278 100644
--- a/tests/lib/config/config-validator.js
+++ b/tests/lib/config/config-validator.js
@@ -352,7 +352,7 @@ describe("Validator", () => {
 
                 const fn = validator.validate.bind(null, { rules: { "mock-no-options-rule": [2, "extra"] } }, "tests", linter.rules, linter.environments);
 
-                assert.throws(fn, "tests:\n\tConfiguration for rule \"mock-no-options-rule\" is invalid:\n\tValue \"extra\" should NOT have more than 0 items.\n");
+                assert.throws(fn, "tests:\n\tConfiguration for rule \"mock-no-options-rule\" is invalid:\n\tValue [\"extra\"] should NOT have more than 0 items.\n");
             });
         });
 
@@ -458,7 +458,7 @@ describe("Validator", () => {
         it("should throw for too many configuration values", () => {
             const fn = validator.validateRuleOptions.bind(null, "mock-rule", [2, "first", "second"], "tests", linter.rules);
 
-            assert.throws(fn, "tests:\n\tConfiguration for rule \"mock-rule\" is invalid:\n\tValue \"first,second\" should NOT have more than 1 items.\n");
+            assert.throws(fn, "tests:\n\tConfiguration for rule \"mock-rule\" is invalid:\n\tValue [\"first\",\"second\"] should NOT have more than 1 items.\n");
         });
 
     });
diff --git a/tests/lib/rules/object-curly-newline.js b/tests/lib/rules/object-curly-newline.js
index ce8f87165..cdbf75750 100644
--- a/tests/lib/rules/object-curly-newline.js
+++ b/tests/lib/rules/object-curly-newline.js
@@ -9,7 +9,8 @@
 // Requirements
 //------------------------------------------------------------------------------
 
-const rule = require("../../../lib/rules/object-curly-newline"),
+const resolvePath = require("path").resolve,
+    rule = require("../../../lib/rules/object-curly-newline"),
     RuleTester = require("../../../lib/testers/rule-tester");
 
 //------------------------------------------------------------------------------
@@ -64,6 +65,26 @@ ruleTester.run("object-curly-newline", rule, {
             ].join("\n"),
             options: ["always"]
         },
+        {
+            code: [
+                "function foo({",
+                " a,",
+                " b",
+                "} : MyType) {}"
+            ].join("\n"),
+            options: ["always"],
+            parser: resolvePath(__dirname, "../../fixtures/parsers/object-curly-newline/flow-stub-parser-multiline")
+        },
+        {
+            code: [
+                "function foo({",
+                " a,",
+                " b",
+                "} : { a : string, b : string }) {}"
+            ].join("\n"),
+            options: ["always"],
+            parser: resolvePath(__dirname, "../../fixtures/parsers/object-curly-newline/flow-stub-parser-multiline-type-literal")
+        },
 
         // "never" -------------------------------------------------------------
         {
@@ -99,6 +120,16 @@ ruleTester.run("object-curly-newline", rule, {
             ].join("\n"),
             options: ["never"]
         },
+        {
+            code: "function foo({ a, b } : MyType) {}",
+            options: ["never"],
+            parser: resolvePath(__dirname, "../../fixtures/parsers/object-curly-newline/flow-stub-parser-singleline")
+        },
+        {
+            code: "function foo({ a, b } : { a : string, b : string }) {}",
+            options: ["never"],
+            parser: resolvePath(__dirname, "../../fixtures/parsers/object-curly-newline/flow-stub-parser-singleline-type-literal")
+        },
 
         // "multiline" ---------------------------------------------------------
         {
@@ -486,6 +517,34 @@ ruleTester.run("object-curly-newline", rule, {
                 { line: 3, column: 2, message: "Expected a line break before this closing brace." }
             ]
         },
+        {
+            code: "function foo({ a, b } : MyType) {}",
+            output: [
+                "function foo({",
+                " a, b ",
+                "} : MyType) {}"
+            ].join("\n"),
+            options: ["always"],
+            errors: [
+                { line: 1, column: 14, message: "Expected a line break after this opening brace." },
+                { line: 1, column: 21, message: "Expected a line break before this closing brace." }
+            ],
+            parser: resolvePath(__dirname, "../../fixtures/parsers/object-curly-newline/flow-stub-parser-singleline")
+        },
+        {
+            code: "function foo({ a, b } : { a : string, b : string }) {}",
+            output: [
+                "function foo({",
+                " a, b ",
+                "} : { a : string, b : string }) {}"
+            ].join("\n"),
+            options: ["always"],
+            errors: [
+                { line: 1, column: 14, message: "Expected a line break after this opening brace." },
+                { line: 1, column: 21, message: "Expected a line break before this closing brace." }
+            ],
+            parser: resolvePath(__dirname, "../../fixtures/parsers/object-curly-newline/flow-stub-parser-singleline-type-literal")
+        },
 
         // "never" ------------------------------------------------------------
         {
@@ -568,6 +627,42 @@ ruleTester.run("object-curly-newline", rule, {
                 { line: 5, column: 1, message: "Unexpected line break before this closing brace." }
             ]
         },
+        {
+            code: [
+                "function foo({",
+                " a,",
+                " b",
+                "} : MyType) {}"
+            ].join("\n"),
+            output: [
+                "function foo({a,",
+                " b} : MyType) {}"
+            ].join("\n"),
+            options: ["never"],
+            errors: [
+                { line: 1, column: 14, message: "Unexpected line break after this opening brace." },
+                { line: 4, column: 1, message: "Unexpected line break before this closing brace." }
+            ],
+            parser: resolvePath(__dirname, "../../fixtures/parsers/object-curly-newline/flow-stub-parser-multiline")
+        },
+        {
+            code: [
+                "function foo({",
+                " a,",
+                " b",
+                "} : { a : string, b : string }) {}"
+            ].join("\n"),
+            output: [
+                "function foo({a,",
+                " b} : { a : string, b : string }) {}"
+            ].join("\n"),
+            options: ["never"],
+            errors: [
+                { line: 1, column: 14, message: "Unexpected line break after this opening brace." },
+                { line: 4, column: 1, message: "Unexpected line break before this closing brace." }
+            ],
+            parser: resolvePath(__dirname, "../../fixtures/parsers/object-curly-newline/flow-stub-parser-multiline-type-literal")
+        },
 
         // "multiline" ---------------------------------------------------------
         {
diff --git a/tests/lib/rules/semi-style.js b/tests/lib/rules/semi-style.js
index 43968facf..8b0834af3 100644
--- a/tests/lib/rules/semi-style.js
+++ b/tests/lib/rules/semi-style.js
@@ -27,18 +27,103 @@ ruleTester.run("semi-style", rule, {
         "for(a;\nb;\nc);",
         "for((a\n);\n(b\n);\n(c));",
         "if(a)foo;\nbar",
+        { code: ";", options: ["last"] },
         { code: ";foo;bar;baz;", options: ["last"] },
         { code: "foo;\nbar;", options: ["last"] },
         { code: "for(a;b;c);", options: ["last"] },
         { code: "for(a;\nb;\nc);", options: ["last"] },
         { code: "for((a\n);\n(b\n);\n(c));", options: ["last"] },
         { code: "if(a)foo;\nbar", options: ["last"] },
+        { code: ";", options: ["first"] },
         { code: ";foo;bar;baz;", options: ["first"] },
         { code: "foo\n;bar;", options: ["first"] },
         { code: "for(a;b;c);", options: ["first"] },
         { code: "for(a;\nb;\nc);", options: ["first"] },
         { code: "for((a\n);\n(b\n);\n(c));", options: ["first"] },
-        { code: "if(a)foo\n;bar", options: ["first"] }
+
+        // edge cases
+        {
+            code: `
+                {
+                    ;
+                }
+            `,
+            options: ["first"]
+        },
+        {
+            code: `
+                while (a)
+                    ;
+                foo
+            `,
+            options: ["first"]
+        },
+        {
+            code: `
+                do
+                    ;
+                while (a)
+            `,
+            options: ["first"]
+        },
+        {
+            code: `
+                do
+                    foo;
+                while (a)
+            `,
+            options: ["first"]
+        },
+        {
+            code: `
+                if (a)
+                    foo;
+                else
+                    bar
+            `,
+            options: ["first"]
+        },
+        {
+            code: `
+                if (a)
+                    foo
+                ;bar
+            `,
+            options: ["first"]
+        },
+        {
+            code: `
+                {
+                    ;
+                }
+            `,
+            options: ["last"]
+        },
+        {
+            code: `
+                switch (a) {
+                    case 1:
+                        ;foo
+                }
+            `,
+            options: ["last"]
+        },
+        {
+            code: `
+                while (a)
+                    ;
+                foo
+            `,
+            options: ["last"]
+        },
+        {
+            code: `
+                do
+                    ;
+                while (a)
+            `,
+            options: ["last"]
+        }
     ],
     invalid: [
         {