From 6715abca765f0fbee10d48719c60de93a8b246f8 Mon Sep 17 00:00:00 2001 From: James Long Date: Fri, 30 Dec 2016 11:56:42 -0500 Subject: [PATCH] Tweak variable declaration printing --- src/printer.js | 5 +- .../any/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/annot2/__snapshots__/jsfmt.spec.js.snap | 8 +- tests/any/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../arraylib/__snapshots__/jsfmt.spec.js.snap | 32 +- tests/arrays/__snapshots__/jsfmt.spec.js.snap | 16 +- tests/arrows/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- tests/binary/__snapshots__/jsfmt.spec.js.snap | 66 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- tests/break/__snapshots__/jsfmt.spec.js.snap | 32 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../classes/__snapshots__/jsfmt.spec.js.snap | 32 +- .../commonjs/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 68 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../dir/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 10 +- .../__snapshots__/jsfmt.spec.js.snap | 20 +- .../__snapshots__/jsfmt.spec.js.snap | 24 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../testproj/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../subdir/__snapshots__/jsfmt.spec.js.snap | 14 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 20 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../ignore/__snapshots__/jsfmt.spec.js.snap | 4 +- .../no_flow/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../coverage/__snapshots__/jsfmt.spec.js.snap | 8 +- tests/cycle/__snapshots__/jsfmt.spec.js.snap | 8 +- tests/date/__snapshots__/jsfmt.spec.js.snap | 36 +- .../__snapshots__/jsfmt.spec.js.snap | 24 +- .../_d3/__snapshots__/jsfmt.spec.js.snap | 4 +- .../foo/bar/__snapshots__/jsfmt.spec.js.snap | 20 +- .../ws/test/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../foo/bar/__snapshots__/jsfmt.spec.js.snap | 12 +- .../ws/test/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 52 +- .../__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 258 +-- .../__snapshots__/jsfmt.spec.js.snap | 28 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- tests/demo/2/__snapshots__/jsfmt.spec.js.snap | 8 +- tests/deps/__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 20 +- tests/dom/__snapshots__/jsfmt.spec.js.snap | 152 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- tests/encaps/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 24 +- tests/equals/__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 330 ++-- .../__snapshots__/jsfmt.spec.js.snap | 60 +- .../__snapshots__/jsfmt.spec.js.snap | 20 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 48 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 56 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../fixpoint/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/for/__snapshots__/jsfmt.spec.js.snap | 72 +- .../__snapshots__/jsfmt.spec.js.snap | 160 +- .../generics/__snapshots__/jsfmt.spec.js.snap | 12 +- .../get-def/__snapshots__/jsfmt.spec.js.snap | 16 +- .../helpers/__snapshots__/jsfmt.spec.js.snap | 12 +- .../get-def2/__snapshots__/jsfmt.spec.js.snap | 32 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 32 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../models/__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 68 +- .../__snapshots__/jsfmt.spec.js.snap | 90 +- .../batman/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../tmp1/__snapshots__/jsfmt.spec.js.snap | 4 +- .../tmp3/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../tmp1/__snapshots__/jsfmt.spec.js.snap | 16 +- .../tmp2/__snapshots__/jsfmt.spec.js.snap | 8 +- .../tmp3/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 48 +- .../tmp1/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../dir/__snapshots__/jsfmt.spec.js.snap | 4 +- .../indexer/__snapshots__/jsfmt.spec.js.snap | 32 +- .../__snapshots__/jsfmt.spec.js.snap | 32 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- tests/iter/__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 52 +- .../__snapshots__/jsfmt.spec.js.snap | 54 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/keys/__snapshots__/jsfmt.spec.js.snap | 40 +- .../keyvalue/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- tests/lib/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../literal/__snapshots__/jsfmt.spec.js.snap | 48 +- tests/locals/__snapshots__/jsfmt.spec.js.snap | 66 +- tests/misc/__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 4 +- .../src/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 20 +- .../modules/__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 20 +- .../__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 34 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 20 +- .../__snapshots__/jsfmt.spec.js.snap | 925 ----------- .../fakelib/__snapshots__/jsfmt.spec.js.snap | 17 - .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../foo/bar/__snapshots__/jsfmt.spec.js.snap | 20 +- .../ws/test/__snapshots__/jsfmt.spec.js.snap | 4 +- .../root/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../assert/__snapshots__/jsfmt.spec.js.snap | 4 +- .../basic/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 6 +- .../bar_lib/__snapshots__/jsfmt.spec.js.snap | 4 +- .../crypto/__snapshots__/jsfmt.spec.js.snap | 52 +- .../fs/__snapshots__/jsfmt.spec.js.snap | 56 +- .../__snapshots__/jsfmt.spec.js.snap | 40 +- .../os/__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 10 +- .../foo/__snapshots__/jsfmt.spec.js.snap | 6 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../stream/__snapshots__/jsfmt.spec.js.snap | 40 +- .../url/__snapshots__/jsfmt.spec.js.snap | 8 +- .../nullable/__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 52 +- .../__snapshots__/jsfmt.spec.js.snap | 24 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../objects/__snapshots__/jsfmt.spec.js.snap | 92 +- .../__snapshots__/jsfmt.spec.js.snap | 40 +- .../overload/__snapshots__/jsfmt.spec.js.snap | 44 +- tests/path/__snapshots__/jsfmt.spec.js.snap | 8 +- .../plsummit/__snapshots__/jsfmt.spec.js.snap | 20 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../private/__snapshots__/jsfmt.spec.js.snap | 4 +- .../promises/__snapshots__/jsfmt.spec.js.snap | 52 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- tests/react/__snapshots__/jsfmt.spec.js.snap | 114 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../tmp2A/__snapshots__/jsfmt.spec.js.snap | 4 +- .../recheck/__snapshots__/jsfmt.spec.js.snap | 74 +- .../tmp1b/__snapshots__/jsfmt.spec.js.snap | 4 +- .../tmp1c/__snapshots__/jsfmt.spec.js.snap | 4 +- .../tmp1e/__snapshots__/jsfmt.spec.js.snap | 12 +- .../tmp2a/__snapshots__/jsfmt.spec.js.snap | 4 +- .../tmp2e/__snapshots__/jsfmt.spec.js.snap | 6 +- .../tmp3e/__snapshots__/jsfmt.spec.js.snap | 18 +- tests/record/__snapshots__/jsfmt.spec.js.snap | 12 +- tests/refi/__snapshots__/jsfmt.spec.js.snap | 590 +++---- .../__snapshots__/jsfmt.spec.js.snap | 12 +- tests/regexp/__snapshots__/jsfmt.spec.js.snap | 4 +- .../replace/__snapshots__/jsfmt.spec.js.snap | 4 +- .../require/__snapshots__/jsfmt.spec.js.snap | 48 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- tests/return/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- tests/seal/__snapshots__/jsfmt.spec.js.snap | 12 +- tests/sealed/__snapshots__/jsfmt.spec.js.snap | 18 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- tests/strict/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 14 +- .../__snapshots__/jsfmt.spec.js.snap | 24 +- .../suggest/__snapshots__/jsfmt.spec.js.snap | 8 +- .../suppress/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- tests/switch/__snapshots__/jsfmt.spec.js.snap | 84 +- tests/symbol/__snapshots__/jsfmt.spec.js.snap | 8 +- .../symlink/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 100 +- tests/taint/__snapshots__/jsfmt.spec.js.snap | 12 +- .../template/__snapshots__/jsfmt.spec.js.snap | 24 +- tests/this/__snapshots__/jsfmt.spec.js.snap | 24 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- tests/throw/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/try/__snapshots__/jsfmt.spec.js.snap | 72 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 1452 ++++++++--------- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 56 +- .../__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../typecast/__snapshots__/jsfmt.spec.js.snap | 20 +- tests/typeof/__snapshots__/jsfmt.spec.js.snap | 28 +- tests/unary/__snapshots__/jsfmt.spec.js.snap | 36 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- .../__snapshots__/jsfmt.spec.js.snap | 11 +- tests/value/__snapshots__/jsfmt.spec.js.snap | 12 +- .../weakmode/__snapshots__/jsfmt.spec.js.snap | 8 +- tests/while/__snapshots__/jsfmt.spec.js.snap | 8 +- 232 files changed, 3561 insertions(+), 4507 deletions(-) delete mode 100644 tests/new_react/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/new_react/fakelib/__snapshots__/jsfmt.spec.js.snap diff --git a/src/printer.js b/src/printer.js index ed9774f5..012c5fa9 100644 --- a/src/printer.js +++ b/src/printer.js @@ -798,8 +798,7 @@ function genericPrintNoParens(path, options, print) { " ", printed[0], indent(options.tabWidth, - join(concat([",", line]), - printed.slice(1))) + join(concat([",", line]), printed.slice(1))) ]; // We generally want to terminate all variable declarations with a @@ -814,7 +813,7 @@ function genericPrintNoParens(path, options, print) { parts.push(";"); } - return concat(parts); + return multilineGroup(concat(parts)); case "VariableDeclarator": return n.init ? concat([ diff --git a/tests/annot/any/__snapshots__/jsfmt.spec.js.snap b/tests/annot/any/__snapshots__/jsfmt.spec.js.snap index 90450e20..f6070a87 100644 --- a/tests/annot/any/__snapshots__/jsfmt.spec.js.snap +++ b/tests/annot/any/__snapshots__/jsfmt.spec.js.snap @@ -20,14 +20,14 @@ export default class { `; exports[`test B.js 1`] = ` -"import A from "./A" +"import A from \"./A\" class B extends A { p: string; // OK, string ~> any } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // OK, string ~> any -import A from "./A"; +import A from \"./A\"; class B extends A { p: string; } diff --git a/tests/annot2/__snapshots__/jsfmt.spec.js.snap b/tests/annot2/__snapshots__/jsfmt.spec.js.snap index a640ad3f..ad5e53c3 100644 --- a/tests/annot2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/annot2/__snapshots__/jsfmt.spec.js.snap @@ -4,7 +4,7 @@ exports[`test A.js 1`] = ` * @flow */ -import type T from "T"; +import type T from \"T\"; export default class { p: T; @@ -18,7 +18,7 @@ export default class { * @providesModule A * @flow */ -import type T from "T"; +import type T from \"T\"; export default class { p: T; constructor() { @@ -33,7 +33,7 @@ exports[`test B.js 1`] = ` * @flow */ -import A from "A" +import A from \"A\" class B extends A { p: string; // OK, string ~> any @@ -43,7 +43,7 @@ class B extends A { * @flow */ // OK, string ~> any -import A from "A"; +import A from \"A\"; class B extends A { p: string; } diff --git a/tests/any/__snapshots__/jsfmt.spec.js.snap b/tests/any/__snapshots__/jsfmt.spec.js.snap index 66cd8a8f..f412756f 100644 --- a/tests/any/__snapshots__/jsfmt.spec.js.snap +++ b/tests/any/__snapshots__/jsfmt.spec.js.snap @@ -156,14 +156,14 @@ function foo(c: C, x: any): string { return c.bar(0, y); // should be able to select first case and error } -var any_fun1 = require('./nonflowfile'); +var any_fun1 = require(\'./nonflowfile\'); function bar1(x: mixed) { if (any_fun1(x)) { (x: boolean); } } -var any_fun2 = require('./anyexportflowfile'); +var any_fun2 = require(\'./anyexportflowfile\'); function bar2(x: mixed) { if (any_fun2(x)) { (x: boolean); @@ -180,13 +180,13 @@ function foo(c: C, x: any): string { let y = x.y; return c.bar(0, y); } -var any_fun1 = require("./nonflowfile"); +var any_fun1 = require(\"./nonflowfile\"); function bar1(x: mixed) { if (any_fun1(x)) { (x: boolean); } } -var any_fun2 = require("./anyexportflowfile"); +var any_fun2 = require(\"./anyexportflowfile\"); function bar2(x: mixed) { if (any_fun2(x)) { (x: boolean); diff --git a/tests/array-filter/__snapshots__/jsfmt.spec.js.snap b/tests/array-filter/__snapshots__/jsfmt.spec.js.snap index 9967d824..7a576578 100644 --- a/tests/array-filter/__snapshots__/jsfmt.spec.js.snap +++ b/tests/array-filter/__snapshots__/jsfmt.spec.js.snap @@ -24,7 +24,7 @@ exports[`test test2.js 1`] = ` function filterItems(items: Array): Array { return items.map(item => { - if (typeof item === 'string') { + if (typeof item === \'string\') { return item.length > 2 ? item : null; } else { return item*10; @@ -32,7 +32,7 @@ function filterItems(items: Array): Array { }).filter(Boolean); } -const filteredItems = filterItems(['foo', 'b', 1, 2]); +const filteredItems = filterItems([\'foo\', \'b\', 1, 2]); console.log(filteredItems); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -40,7 +40,7 @@ console.log(filteredItems); function filterItems(items: Array): Array { return items.map( item => { - if (typeof item === "string") { + if (typeof item === \"string\") { return (item.length > 2 ? item : null); } else { return item * 10; @@ -48,7 +48,7 @@ function filterItems(items: Array): Array { } ).filter(Boolean); } -const filteredItems = filterItems([ "foo", "b", 1, 2 ]); +const filteredItems = filterItems([ \"foo\", \"b\", 1, 2 ]); console.log(filteredItems); " `; diff --git a/tests/array_spread/__snapshots__/jsfmt.spec.js.snap b/tests/array_spread/__snapshots__/jsfmt.spec.js.snap index 6f619048..c902ddba 100644 --- a/tests/array_spread/__snapshots__/jsfmt.spec.js.snap +++ b/tests/array_spread/__snapshots__/jsfmt.spec.js.snap @@ -5,15 +5,15 @@ var C = [1,2,3]; B.sort((a, b) => a - b); C.sort((a, b) => a - b); -var x: Array = ['1', '2']; -var y: Array = ['3', ...x]; +var x: Array = [\'1\', \'2\']; +var y: Array = [\'3\', ...x]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var A = [ 1, 2, 3 ]; var B = [ ...A ]; var C = [ 1, 2, 3 ]; B.sort((a, b) => a - b); C.sort((a, b) => a - b); -var x: Array = [ "1", "2" ]; -var y: Array = [ "3", ...x ]; +var x: Array = [ \"1\", \"2\" ]; +var y: Array = [ \"3\", ...x ]; " `; diff --git a/tests/arraylib/__snapshots__/jsfmt.spec.js.snap b/tests/arraylib/__snapshots__/jsfmt.spec.js.snap index 3a9390d2..317c40ec 100644 --- a/tests/arraylib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arraylib/__snapshots__/jsfmt.spec.js.snap @@ -3,23 +3,23 @@ exports[`test array_lib.js 1`] = ` function foo(x:string) { } var a = [0]; -var b = a.map(function (x) { foo(x); return "" + x; }); +var b = a.map(function (x) { foo(x); return \"\" + x; }); var c: number = a[0]; var d: number = b[0]; var e:Array = a.reverse(); -var f = [""]; +var f = [\"\"]; var g:number = f.map(function () { return 0; })[0]; var h: Array = [1,2,3]; -var i: Array = ['a', 'b', 'c']; +var i: Array = [\'a\', \'b\', \'c\']; var j: Array = h.concat(i); var k: Array = h.concat(h); var l: Array = h.concat(1,2,3); -var m: Array = h.concat('a', 'b', 'c'); -var n: Array = h.concat('a', 'b', 'c'); // Error +var m: Array = h.concat(\'a\', \'b\', \'c\'); +var n: Array = h.concat(\'a\', \'b\', \'c\'); // Error function reduce_test() { /* Adapted from the following source: @@ -44,13 +44,13 @@ function reduce_test() { /* Added later, because the above is insufficient */ // acc is element type of array when no init is provided - [""].reduce((acc, str) => acc * str.length); // error, string ~> number - [""].reduceRight((acc, str) => acc * str.length); // error, string ~> number + [\"\"].reduce((acc, str) => acc * str.length); // error, string ~> number + [\"\"].reduceRight((acc, str) => acc * str.length); // error, string ~> number } function from_test() { var a: Array = Array.from([1, 2, 3], function(val, index) { - return index % 2 ? "foo" : String(val); + return index % 2 ? \"foo\" : String(val); }); var b: Array = Array.from([1, 2, 3], function(val) { return String(val); @@ -73,25 +73,25 @@ var a = [ 0 ]; var b = a.map( function(x) { foo(x); - return "" + x; + return \"\" + x; } ); var c: number = a[0]; var d: number = b[0]; var e: Array = a.reverse(); -var f = [ "" ]; +var f = [ \"\" ]; var g: number = f.map( function() { return 0; } )[0]; var h: Array = [ 1, 2, 3 ]; -var i: Array = [ "a", "b", "c" ]; +var i: Array = [ \"a\", \"b\", \"c\" ]; var j: Array = h.concat(i); var k: Array = h.concat(h); var l: Array = h.concat(1, 2, 3); -var m: Array = h.concat("a", "b", "c"); -var n: Array = h.concat("a", "b", "c"); +var m: Array = h.concat(\"a\", \"b\", \"c\"); +var n: Array = h.concat(\"a\", \"b\", \"c\"); function reduce_test() { [ 0, 1, 2, 3, 4 ].reduce( function(previousValue, currentValue, index, array) { @@ -114,14 +114,14 @@ function reduce_test() { return a.concat(b); } ); - [ "" ].reduce((acc, str) => acc * str.length); - [ "" ].reduceRight((acc, str) => acc * str.length); + [ \"\" ].reduce((acc, str) => acc * str.length); + [ \"\" ].reduceRight((acc, str) => acc * str.length); } function from_test() { var a: Array = Array.from( [ 1, 2, 3 ], function(val, index) { - return (index % 2 ? "foo" : String(val)); + return (index % 2 ? \"foo\" : String(val)); } ); var b: Array = Array.from( diff --git a/tests/arrays/__snapshots__/jsfmt.spec.js.snap b/tests/arrays/__snapshots__/jsfmt.spec.js.snap index 710bc7a8..a81448d3 100644 --- a/tests/arrays/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrays/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ function foo(x:string) { } var a = []; a[0] = 1; -a[1] = "..."; +a[1] = \"...\"; foo(a[1]); var y; @@ -32,12 +32,12 @@ var abig2: Array<{x:number; y:number}> = [ {x:0, y:0}, {x:0, y:0}, {x:0, y:0, a:true}, - {x:0, y:0, b:"hey"}, + {x:0, y:0, b:\"hey\"}, {x:0, y:0, c:1}, - {x:0, y:0, c:"hey"} + {x:0, y:0, c:\"hey\"} ]; -module.exports = "arrays"; +module.exports = \"arrays\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Arrays */ // for literals, composite element type is union of individuals @@ -47,7 +47,7 @@ function foo(x: string) { } var a = [ ]; a[0] = 1; -a[1] = "..."; +a[1] = \"...\"; foo(a[1]); var y; a.forEach(x => y = x); @@ -68,11 +68,11 @@ var abig2: Array<{ x: number; y: number }> = [ { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0, a: true }, - { x: 0, y: 0, b: "hey" }, + { x: 0, y: 0, b: \"hey\" }, { x: 0, y: 0, c: 1 }, - { x: 0, y: 0, c: "hey" } + { x: 0, y: 0, c: \"hey\" } ]; -module.exports = "arrays"; +module.exports = \"arrays\"; " `; diff --git a/tests/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/arrows/__snapshots__/jsfmt.spec.js.snap index 09056331..471ce527 100644 --- a/tests/arrows/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrows/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ var bad = (x: number): string => x; // Error! var ident = (x: T): T => x; (ident(1): number); -(ident("hi"): number); // Error +(ident(\"hi\"): number); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow @@ -20,7 +20,7 @@ var add = (x: number, y: number): number => x + y; var bad = (x: number): string => x; var ident = (x: T): T => x; (ident(1): number); -(ident("hi"): number); +(ident(\"hi\"): number); " `; @@ -31,7 +31,7 @@ exports[`test arrows.js 1`] = ` ): Image { var maxPixelWidth = maxWidth; //images = images.sort(function (a, b) { return a.width - b.width }); - images = images.sort((a, b) => (a.width - b.width) + ""); + images = images.sort((a, b) => (a.width - b.width) + \"\"); return images.find(image => image.width >= maxPixelWidth) || images[images.length - 1]; } @@ -41,7 +41,7 @@ function selectBestEffortImageForWidth( maxWidth: number, images: Array ): Image { var maxPixelWidth = maxWidth; - images = images.sort((a, b) => a.width - b.width + ""); + images = images.sort((a, b) => a.width - b.width + \"\"); return images.find(image => image.width >= maxPixelWidth) || images[images.length - 1]; } diff --git a/tests/async_iteration/__snapshots__/jsfmt.spec.js.snap b/tests/async_iteration/__snapshots__/jsfmt.spec.js.snap index eb4a019d..f2f9d49a 100644 --- a/tests/async_iteration/__snapshots__/jsfmt.spec.js.snap +++ b/tests/async_iteration/__snapshots__/jsfmt.spec.js.snap @@ -78,7 +78,7 @@ async function* readLines(path) { } async function f() { - for await (const line of readLines("/path/to/file")) { + for await (const line of readLines(\"/path/to/file\")) { (line: void); // error: string ~> void } } @@ -97,7 +97,7 @@ async function* readLines(path) { } } async function f() { - for await (const line of readLines("/path/to/file")) { + for await (const line of readLines(\"/path/to/file\")) { (line: void); } } @@ -107,13 +107,13 @@ async function f() { exports[`test return.js 1`] = ` "declare var gen: AsyncGenerator; -// You can pass whatever you like to return, it doesn't need to be related to -// the AsyncGenerator's return type +// You can pass whatever you like to return, it doesn\'t need to be related to +// the AsyncGenerator\'s return type gen.return(0).then(result => { (result.value: void); // error: string | number ~> void }); -// However, a generator can "refuse" the return by catching an exception and +// However, a generator can \"refuse\" the return by catching an exception and // yielding or returning internally. async function *refuse_return() { try { @@ -122,16 +122,16 @@ async function *refuse_return() { return 0; } } -refuse_return().return("string").then(result => { +refuse_return().return(\"string\").then(result => { if (result.done) { (result.value: string); // error: number | void ~> string } }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// You can pass whatever you like to return, it doesn't need to be related to -// the AsyncGenerator's return type +// You can pass whatever you like to return, it doesn\'t need to be related to +// the AsyncGenerator\'s return type // error: string | number ~> void -// However, a generator can "refuse" the return by catching an exception and +// However, a generator can \"refuse\" the return by catching an exception and // yielding or returning internally. // error: number | void ~> string declare var gen: AsyncGenerator; @@ -147,7 +147,7 @@ async function* refuse_return() { return 0; } } -refuse_return().return("string").then( +refuse_return().return(\"string\").then( result => { if (result.done) { (result.value: string); @@ -167,7 +167,7 @@ exports[`test throw.js 1`] = ` } (async () => { - catch_return().throw("").then(({value}) => { + catch_return().throw(\"\").then(({value}) => { if (value !== undefined) { (value: void); // error: number ~> void } @@ -184,7 +184,7 @@ async function *yield_return() { } (async () => { - yield_return().throw("").then(({value}) => { + yield_return().throw(\"\").then(({value}) => { if (value !== undefined) { (value: void); // error: number ~> void } @@ -201,7 +201,7 @@ async function* catch_return() { } } async () => { - catch_return().throw("").then( + catch_return().throw(\"\").then( ({ value }) => { if (value !== undefined) { (value: void); @@ -218,7 +218,7 @@ async function* yield_return() { } } async () => { - yield_return().throw("").then( + yield_return().throw(\"\").then( ({ value }) => { if (value !== undefined) { (value: void); diff --git a/tests/binary/__snapshots__/jsfmt.spec.js.snap b/tests/binary/__snapshots__/jsfmt.spec.js.snap index cdb4ff02..419e0de1 100644 --- a/tests/binary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/binary/__snapshots__/jsfmt.spec.js.snap @@ -4,31 +4,31 @@ exports[`test in.js 1`] = ` let tests = [ // objects on RHS function() { - ('foo' in {}); - ('foo' in { foo: null }); + (\'foo\' in {}); + (\'foo\' in { foo: null }); (0 in {}); - (0 in { "0": null }); + (0 in { \"0\": null }); }, // arrays on RHS function() { - ('foo' in []); + (\'foo\' in []); (0 in []); - ('length' in []); + (\'length\' in []); }, // primitive classes on RHS function() { - ('foo' in new String('bar')); - ('foo' in new Number(123)); + (\'foo\' in new String(\'bar\')); + (\'foo\' in new Number(123)); }, // primitives on RHS function() { - ('foo' in 123); // error - ('foo' in 'bar'); // error - ('foo' in void 0); // error - ('foo' in null); // error + (\'foo\' in 123); // error + (\'foo\' in \'bar\'); // error + (\'foo\' in void 0); // error + (\'foo\' in null); // error }, // bogus stuff on LHS @@ -42,15 +42,15 @@ let tests = [ // in predicates function() { - if ('foo' in 123) {} // error - if (!'foo' in {}) {} // error, !'foo' is a boolean - if (!('foo' in {})) {} + if (\'foo\' in 123) {} // error + if (!\'foo\' in {}) {} // error, !\'foo\' is a boolean + if (!(\'foo\' in {})) {} }, // annotations on RHS function(x: Object, y: mixed) { - ('foo' in x); // ok - ('foo' in y); // error + (\'foo\' in x); // ok + (\'foo\' in y); // error }, ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -71,31 +71,31 @@ let tests = [ // error // in predicates // error -// error, !'foo' is a boolean +// error, !\'foo\' is a boolean // annotations on RHS // ok // error let tests = [ function() { - "foo" in {}; - "foo" in { foo: null }; + \"foo\" in {}; + \"foo\" in { foo: null }; 0 in {}; - 0 in { "0": null }; + 0 in { \"0\": null }; }, function() { - "foo" in [ ]; + \"foo\" in [ ]; 0 in [ ]; - "length" in [ ]; + \"length\" in [ ]; }, function() { - "foo" in new String("bar"); - "foo" in new Number(123); + \"foo\" in new String(\"bar\"); + \"foo\" in new Number(123); }, function() { - "foo" in 123; - "foo" in "bar"; - "foo" in void 0; - "foo" in null; + \"foo\" in 123; + \"foo\" in \"bar\"; + \"foo\" in void 0; + \"foo\" in null; }, function() { null in {}; @@ -105,19 +105,19 @@ let tests = [ false in [ ]; }, function() { - if ("foo" in 123) { + if (\"foo\" in 123) { } - if (!"foo" in {}) { + if (!\"foo\" in {}) { } - if (!("foo" in {})) { + if (!(\"foo\" in {})) { } }, function(x: Object, y: mixed) { - "foo" in x; - "foo" in y; + \"foo\" in x; + \"foo\" in y; } ]; " diff --git a/tests/bounded_poly/__snapshots__/jsfmt.spec.js.snap b/tests/bounded_poly/__snapshots__/jsfmt.spec.js.snap index d538915d..a918790e 100644 --- a/tests/bounded_poly/__snapshots__/jsfmt.spec.js.snap +++ b/tests/bounded_poly/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ exports[`test scope.js 1`] = ` "function foo(x:X, y:Y):void { } -foo(0, ""); +foo(0, \"\"); function bar(x:X, y:Y): number { return y*0; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: X, y: Y): void { } -foo(0, ""); +foo(0, \"\"); function bar(x: X, y: Y): number { return y * 0; } @@ -33,7 +33,7 @@ class C { } function example(o: T): T { o.x = 0; return o; } -var obj1: {x: number; y: string} = example({x: 0, y: ""}); +var obj1: {x: number; y: string} = example({x: 0, y: \"\"}); var obj2: {x: number} = example({x: 0}); var c: C = new C; // error, since T = string is incompatible with number @@ -70,7 +70,7 @@ function example(o: T): T { o.x = 0; return o; } -var obj1: { x: number; y: string } = example({ x: 0, y: "" }); +var obj1: { x: number; y: string } = example({ x: 0, y: \"\" }); var obj2: { x: number } = example({ x: 0 }); var c: C = new C(); var q: number = c.qux(0); diff --git a/tests/break/__snapshots__/jsfmt.spec.js.snap b/tests/break/__snapshots__/jsfmt.spec.js.snap index 1d22b1b4..2822ad3a 100644 --- a/tests/break/__snapshots__/jsfmt.spec.js.snap +++ b/tests/break/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test break.js 1`] = ` var x = b ? null: false; var z; while(b) { - if (x == null) { z = ""; break; } + if (x == null) { z = \"\"; break; } var y:number = x; // error: boolean !~> number } var w:number = z; // 2 errors: ?string !~> number @@ -12,10 +12,10 @@ exports[`test break.js 1`] = ` function bar(b) { var x = b ? null: false; if (x == null) return; - switch ("") { + switch (\"\") { case 0: var y:number = x; // error: boolean !~> number - x = ""; + x = \"\"; case 1: var z:number = x; // 2 errors: (boolean | string) !~> number break; @@ -27,10 +27,10 @@ function bar(b) { function bar2(b) { var x = b ? null: false; if (x == null) return; - switch ("") { + switch (\"\") { case 0: { let y:number = x; // error: boolean !~> number - x = ""; + x = \"\"; } case 1: { let z:number = x; // 2 errors: (boolean | string) !~> number @@ -45,7 +45,7 @@ function qux(b) { var z = 0; while(b) { var y:number = z; - if (b) { z = ""; continue; } // error: string !~> number + if (b) { z = \"\"; continue; } // error: string !~> number z = 0; } var w:number = z; // error: string !~> number @@ -54,10 +54,10 @@ function qux(b) { // same basic test as foo(), but with const. probes the // logic that still uses havoc to do env resets. function test_const() { - let st: string = 'abc'; + let st: string = \'abc\'; for (let i = 1; i < 100; i++) { - const fooRes: ?string = "HEY"; + const fooRes: ?string = \"HEY\"; if (!fooRes) { break; } @@ -86,7 +86,7 @@ function foo(b) { var z; while (b) { if (x == null) { - z = ""; + z = \"\"; break; } var y: number = x; @@ -97,10 +97,10 @@ function bar(b) { var x = (b ? null : false); if (x == null) return; - switch ("") { + switch (\"\") { case 0: var y: number = x; - x = ""; + x = \"\"; case 1: var z: number = x; break; @@ -112,11 +112,11 @@ function bar2(b) { var x = (b ? null : false); if (x == null) return; - switch ("") { + switch (\"\") { case 0: { let y: number = x; - x = ""; + x = \"\"; } case 1: { @@ -132,7 +132,7 @@ function qux(b) { while (b) { var y: number = z; if (b) { - z = ""; + z = \"\"; continue; } z = 0; @@ -140,9 +140,9 @@ function qux(b) { var w: number = z; } function test_const() { - let st: string = "abc"; + let st: string = \"abc\"; for (let i = 1; i < 100; i++) { - const fooRes: ?string = "HEY"; + const fooRes: ?string = \"HEY\"; if (!fooRes) { break; } diff --git a/tests/builtin_uses/__snapshots__/jsfmt.spec.js.snap b/tests/builtin_uses/__snapshots__/jsfmt.spec.js.snap index ec9d7cda..fead4428 100644 --- a/tests/builtin_uses/__snapshots__/jsfmt.spec.js.snap +++ b/tests/builtin_uses/__snapshots__/jsfmt.spec.js.snap @@ -10,10 +10,10 @@ module.exports = o; `; exports[`test test2.js 1`] = ` -"var o = require('./test'); +"var o = require(\'./test\'); (o.foo: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var o = require("./test"); +var o = require(\"./test\"); (o.foo: string); " `; diff --git a/tests/class_munging/__snapshots__/jsfmt.spec.js.snap b/tests/class_munging/__snapshots__/jsfmt.spec.js.snap index 7f3aaf52..78a33130 100644 --- a/tests/class_munging/__snapshots__/jsfmt.spec.js.snap +++ b/tests/class_munging/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ exports[`test with_munging.js 1`] = ` class Foo { _method(): string { - return 'this is private'; + return \'this is private\'; } } @@ -21,7 +21,7 @@ class Bar extends Foo { // error class Foo { _method(): string { - return "this is private"; + return \"this is private\"; } } class Bar extends Foo { @@ -40,7 +40,7 @@ exports[`test without_munging.js 1`] = ` class Foo { _method(): string { - return 'this is not private'; + return \'this is not private\'; } } @@ -57,7 +57,7 @@ class Bar extends Foo { // ok class Foo { _method(): string { - return "this is not private"; + return \"this is not private\"; } } class Bar extends Foo { diff --git a/tests/class_statics/__snapshots__/jsfmt.spec.js.snap b/tests/class_statics/__snapshots__/jsfmt.spec.js.snap index 6f13f01a..b495141d 100644 --- a/tests/class_statics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/class_statics/__snapshots__/jsfmt.spec.js.snap @@ -12,9 +12,9 @@ class B extends A { static foo(x: string) { } // error? static main() { B.x = 0; // error - B.x = ""; + B.x = \"\"; B.foo(0); // error - B.foo(""); + B.foo(\"\"); B.y = 0; // error B.bar(0); // error B.qux(0); // error @@ -94,9 +94,9 @@ class B extends A { } static main() { B.x = 0; - B.x = ""; + B.x = \"\"; B.foo(0); - B.foo(""); + B.foo(\"\"); B.y = 0; B.bar(0); B.qux(0); diff --git a/tests/class_subtyping/__snapshots__/jsfmt.spec.js.snap b/tests/class_subtyping/__snapshots__/jsfmt.spec.js.snap index 7f195ceb..960c0bc4 100644 --- a/tests/class_subtyping/__snapshots__/jsfmt.spec.js.snap +++ b/tests/class_subtyping/__snapshots__/jsfmt.spec.js.snap @@ -14,7 +14,7 @@ module.exports = { A, B }; exports[`test test2.js 1`] = ` "/* @flow */ -var I = require("./test.js"); +var I = require(\"./test.js\"); class C extends I.A {} @@ -22,7 +22,7 @@ var x: I.A = new C(); var y: I.B = new C(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var I = require("./test.js"); +var I = require(\"./test.js\"); class C extends I.A {} var x: I.A = new C(); var y: I.B = new C(); diff --git a/tests/classes/__snapshots__/jsfmt.spec.js.snap b/tests/classes/__snapshots__/jsfmt.spec.js.snap index 99a42871..b13f487e 100644 --- a/tests/classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/classes/__snapshots__/jsfmt.spec.js.snap @@ -15,7 +15,7 @@ module.exports = A; `; exports[`test B.js 1`] = ` -"var A = require('./A'); +"var A = require(\'./A\'); class B extends A { } @@ -25,7 +25,7 @@ let b = new B(); module.exports = B; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error, number !~> function -var A = require("./A"); +var A = require(\"./A\"); class B extends A {} let b = new B(); (b.foo: number); @@ -34,7 +34,7 @@ module.exports = B; `; exports[`test C.js 1`] = ` -"var B = require('./B'); +"var B = require(\'./B\'); class C extends B { foo(x:string):void { } @@ -46,7 +46,7 @@ let c = new C(); module.exports = C; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error, number !~> function -var B = require("./B"); +var B = require(\"./B\"); class C extends B { foo(x: string): void { @@ -74,9 +74,9 @@ exports[`test class_shapes.js 1`] = ` type Foo = { a: string; // exists in TestClass - b: string; // doesn't exist + b: string; // doesn\'t exist c?: ?string; // exists in TestClass, optional - d?: number; // doesn't exist + d?: number; // doesn\'t exist } class TestClass { @@ -92,8 +92,8 @@ x.c; // ok x.d; // error, TestClass has no d var y : Foo = x; -y.b; // error, doesn't exist in TestClass -y.d; // ok, it's optional +y.b; // error, doesn\'t exist in TestClass +y.d; // ok, it\'s optional class Test2Superclass { a: number; // conflicts with cast to Foo @@ -108,15 +108,15 @@ var w : Foo = z; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // exists in TestClass -// doesn't exist +// doesn\'t exist // exists in TestClass, optional -/* doesn't exist*/ +/* doesn\'t exist*/ // ok // error, TestClass has no b // ok // error, TestClass has no d -// error, doesn't exist in TestClass -// ok, it's optional +// error, doesn\'t exist in TestClass +// ok, it\'s optional // conflicts with cast to Foo // conflicts with cast to Foo // conflicts with cast to Foo @@ -155,7 +155,7 @@ exports[`test expr.js 1`] = ` var bar1: Bar = new Bar() // OK var bar2: Bar = Bar.factory() // OK -// NB: Don't write expected errors using Foo to avoid error collapse hiding an +// NB: Don\'t write expected errors using Foo to avoid error collapse hiding an // unexpected failure in the above code. var B = class Baz { } @@ -181,7 +181,7 @@ var alias2: Alias = _Alias.factory(); // error: bad pun // OK: Foo is a runtime binding in this scope // OK // OK -// NB: Don't write expected errors using Foo to avoid error collapse hiding an +// NB: Don\'t write expected errors using Foo to avoid error collapse hiding an // unexpected failure in the above code. // error: Baz is not a runtime binding in this scope // error: Qux is not a type in this scope @@ -232,7 +232,7 @@ exports[`test statics.js 1`] = ` class C { static p: string; } -C.p = "hi"; +C.p = \"hi\"; // Class static fields are compatible with object types (C: {p:string}); // ok @@ -249,7 +249,7 @@ declare var o: {p:number}; class C { static p: string; } -C.p = "hi"; +C.p = \"hi\"; (C: { p: string }); (C: { p: number }); declare var o: { p: number }; diff --git a/tests/commonjs/__snapshots__/jsfmt.spec.js.snap b/tests/commonjs/__snapshots__/jsfmt.spec.js.snap index 527f81bd..4f261d58 100644 --- a/tests/commonjs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/commonjs/__snapshots__/jsfmt.spec.js.snap @@ -13,11 +13,11 @@ module.exports = f; exports[`test Rel.js 1`] = ` " -var f = require('./Abs'); +var f = require(\'./Abs\'); f(0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var f = require("./Abs"); +var f = require(\"./Abs\"); f(0); " `; diff --git a/tests/computed_props/__snapshots__/jsfmt.spec.js.snap b/tests/computed_props/__snapshots__/jsfmt.spec.js.snap index fa3e437c..ce1cfa12 100644 --- a/tests/computed_props/__snapshots__/jsfmt.spec.js.snap +++ b/tests/computed_props/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test test.js 1`] = ` "var ColorId = { - RED: 'R', - GREEN: 'G', - BLUE: 'B', + RED: \'R\', + GREEN: \'G\', + BLUE: \'B\', }; var ColorNumber = { - RED: 'ff0000', - GREEN: '00ff00', - BLUE: '0000ff', + RED: \'ff0000\', + GREEN: \'00ff00\', + BLUE: \'0000ff\', }; var ColorIdToNumber = { @@ -17,7 +17,7 @@ var ColorIdToNumber = { [ColorId.BLUE]: ColorNumber.BLUE, }; -(ColorIdToNumber[ColorId.RED]: 'ffffff'); // oops +(ColorIdToNumber[ColorId.RED]: \'ffffff\'); // oops ColorIdToNumber.XXX; // oops @@ -25,91 +25,91 @@ module.exports = { ColorId, ColorNumber }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // oops // oops -var ColorId = { RED: "R", GREEN: "G", BLUE: "B" }; -var ColorNumber = { RED: "ff0000", GREEN: "00ff00", BLUE: "0000ff" }; +var ColorId = { RED: \"R\", GREEN: \"G\", BLUE: \"B\" }; +var ColorNumber = { RED: \"ff0000\", GREEN: \"00ff00\", BLUE: \"0000ff\" }; var ColorIdToNumber = { [ColorId.RED]: ColorNumber.RED, [ColorId.GREEN]: ColorNumber.GREEN, [ColorId.BLUE]: ColorNumber.BLUE }; -(ColorIdToNumber[ColorId.RED]: "ffffff"); +(ColorIdToNumber[ColorId.RED]: \"ffffff\"); ColorIdToNumber.XXX; module.exports = { ColorId, ColorNumber }; " `; exports[`test test2.js 1`] = ` -"var { ColorId, ColorNumber } = require('./test'); +"var { ColorId, ColorNumber } = require(\'./test\'); var ColorIdToNumber = { [ColorId.RED]: ColorNumber.RED, [ColorId.GREEN]: ColorNumber.GREEN, [ColorId.BLUE]: ColorNumber.BLUE, }; -(ColorIdToNumber[ColorId.GREEN]: 'ffffff'); // oops +(ColorIdToNumber[ColorId.GREEN]: \'ffffff\'); // oops module.exports = ColorIdToNumber; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // oops -var { ColorId, ColorNumber } = require("./test"); +var { ColorId, ColorNumber } = require(\"./test\"); var ColorIdToNumber = { [ColorId.RED]: ColorNumber.RED, [ColorId.GREEN]: ColorNumber.GREEN, [ColorId.BLUE]: ColorNumber.BLUE }; -(ColorIdToNumber[ColorId.GREEN]: "ffffff"); +(ColorIdToNumber[ColorId.GREEN]: \"ffffff\"); module.exports = ColorIdToNumber; " `; exports[`test test3.js 1`] = ` -"var { ColorId } = require('./test'); -var ColorIdToNumber = require('./test2'); +"var { ColorId } = require(\'./test\'); +var ColorIdToNumber = require(\'./test2\'); -(ColorIdToNumber[ColorId.BLUE]: 'ffffff'); // oops +(ColorIdToNumber[ColorId.BLUE]: \'ffffff\'); // oops ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // oops -var { ColorId } = require("./test"); -var ColorIdToNumber = require("./test2"); -(ColorIdToNumber[ColorId.BLUE]: "ffffff"); +var { ColorId } = require(\"./test\"); +var ColorIdToNumber = require(\"./test2\"); +(ColorIdToNumber[ColorId.BLUE]: \"ffffff\"); " `; exports[`test test4.js 1`] = ` -"module.exports = 'hello'; +"module.exports = \'hello\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = "hello"; +module.exports = \"hello\"; " `; exports[`test test5.js 1`] = ` -"var hello = require('./test4'); -var dummy = require('./test'); +"var hello = require(\'./test4\'); +var dummy = require(\'./test\'); module.exports = { ...dummy, - [hello]: 'world', + [hello]: \'world\', ...dummy, }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var hello = require("./test4"); -var dummy = require("./test"); -module.exports = { ...dummy, [hello]: "world", ...dummy }; +var hello = require(\"./test4\"); +var dummy = require(\"./test\"); +module.exports = { ...dummy, [hello]: \"world\", ...dummy }; " `; exports[`test test6.js 1`] = ` -"var o = require('./test5'); -(o.hello: 'nothing'); // oops +"var o = require(\'./test5\'); +(o.hello: \'nothing\'); // oops ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // oops -var o = require("./test5"); -(o.hello: "nothing"); +var o = require(\"./test5\"); +(o.hello: \"nothing\"); " `; exports[`test test7.js 1`] = ` "var obj = {x: 0, m() { return this.x }} -var x: string = obj['m'](); // error, number ~> string +var x: string = obj[\'m\'](); // error, number ~> string var arr = [function() { return this.length }]; var y: string = arr[0](); // error: number ~> string @@ -122,7 +122,7 @@ var obj = { return this.x; } }; -var x: string = obj["m"](); +var x: string = obj[\"m\"](); var arr = [ function() { return this.length; diff --git a/tests/config_all/__snapshots__/jsfmt.spec.js.snap b/tests/config_all/__snapshots__/jsfmt.spec.js.snap index ab82b6a0..7439bd43 100644 --- a/tests/config_all/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_all/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test no_at_flow.js 1`] = ` -"var x: number = "not a number"; // Error: string ~> number +"var x: number = \"not a number\"; // Error: string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Error: string ~> number -var x: number = "not a number"; +var x: number = \"not a number\"; " `; diff --git a/tests/config_all_false/__snapshots__/jsfmt.spec.js.snap b/tests/config_all_false/__snapshots__/jsfmt.spec.js.snap index 430e45dd..9c3f9553 100644 --- a/tests/config_all_false/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_all_false/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test no_at_flow.js 1`] = ` -"var x: number = "not a number"; // No error +"var x: number = \"not a number\"; // No error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // No error -var x: number = "not a number"; +var x: number = \"not a number\"; " `; diff --git a/tests/config_file_extensions/__snapshots__/jsfmt.spec.js.snap b/tests/config_file_extensions/__snapshots__/jsfmt.spec.js.snap index c0007055..f0084118 100644 --- a/tests/config_file_extensions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_file_extensions/__snapshots__/jsfmt.spec.js.snap @@ -4,21 +4,21 @@ exports[`test test.js 1`] = ` */ function foo(x) { - var a: number = 'asdf'; + var a: number = \'asdf\'; return x * 10; } // This file should be ignored, so this should not result in an error -foo('Hello, world!'); +foo(\'Hello, world!\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* * @flow */ // This file should be ignored, so this should not result in an error function foo(x) { - var a: number = "asdf"; + var a: number = \"asdf\"; return x * 10; } -foo("Hello, world!"); +foo(\"Hello, world!\"); " `; diff --git a/tests/config_ignore/__snapshots__/jsfmt.spec.js.snap b/tests/config_ignore/__snapshots__/jsfmt.spec.js.snap index de700412..3dded236 100644 --- a/tests/config_ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_ignore/__snapshots__/jsfmt.spec.js.snap @@ -2,10 +2,10 @@ exports[`test foo.js 1`] = ` "/* @flow */ // No error, this file is ignored -var x: number = "string"; +var x: number = \"string\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // No error, this file is ignored -var x: number = "string"; +var x: number = \"string\"; " `; diff --git a/tests/config_ignore/dir/__snapshots__/jsfmt.spec.js.snap b/tests/config_ignore/dir/__snapshots__/jsfmt.spec.js.snap index 6431e776..33fdb611 100644 --- a/tests/config_ignore/dir/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_ignore/dir/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ exports[`test foo.js 1`] = ` "/* @flow */ -var x: number = "string"; // Error string ~> number +var x: number = \"string\"; // Error string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Error string ~> number -var x: number = "string"; +var x: number = \"string\"; " `; diff --git a/tests/config_module_name_mapper_PROJECT_ROOT-1.0/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_name_mapper_PROJECT_ROOT-1.0/__snapshots__/jsfmt.spec.js.snap index d61626b5..4a767378 100644 --- a/tests/config_module_name_mapper_PROJECT_ROOT-1.0/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_name_mapper_PROJECT_ROOT-1.0/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test main.js 1`] = ` "// @flow -import {test} from 'testmodule'; +import {test} from \'testmodule\'; var a: number = test; var b: string = test; // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Error: number ~> string -import { test } from "testmodule"; +import { test } from \"testmodule\"; var a: number = test; var b: string = test; " diff --git a/tests/config_module_name_mapper_filetype/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_name_mapper_filetype/__snapshots__/jsfmt.spec.js.snap index 15215fe7..9da8c181 100644 --- a/tests/config_module_name_mapper_filetype/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_name_mapper_filetype/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ exports[`test test.js 1`] = ` "// @flow -import {className} from "./SomeCSSFile.css"; -import {doesntExist} from "./SomeCSSFile.css"; // Error: \`doestExist\` isn't an export +import {className} from \"./SomeCSSFile.css\"; +import {doesntExist} from \"./SomeCSSFile.css\"; // Error: \`doestExist\` isn\'t an export ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -// Error: \`doestExist\` isn't an export -import { className } from "./SomeCSSFile.css"; -import { doesntExist } from "./SomeCSSFile.css"; +// Error: \`doestExist\` isn\'t an export +import { className } from \"./SomeCSSFile.css\"; +import { doesntExist } from \"./SomeCSSFile.css\"; " `; diff --git a/tests/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap index 4ac58abf..aef90c39 100644 --- a/tests/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap @@ -1,31 +1,31 @@ exports[`test A.js 1`] = ` "/* @flow */ -var m1 = require('1DoesntExist'); -import {numVal as numVal1} from '1DoesntExist'; +var m1 = require(\'1DoesntExist\'); +import {numVal as numVal1} from \'1DoesntExist\'; var a_1: number = m1.numVal; var a_2: number = numVal1; -// Error: 'Exists2' is not a valid module name +// Error: \'Exists2\' is not a valid module name // // This tests that, for haste, the first name_mapper regexp that happens to // match the given module name string is picked. -var m2 = require('2DoesntExist'); // Error -import {numVal as numVal2} from '3DoesntExist'; // Error +var m2 = require(\'2DoesntExist\'); // Error +import {numVal as numVal2} from \'3DoesntExist\'; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -// Error: 'Exists2' is not a valid module name +// Error: \'Exists2\' is not a valid module name // // This tests that, for haste, the first name_mapper regexp that happens to // match the given module name string is picked. // Error // Error -var m1 = require("1DoesntExist"); -import { numVal as numVal1 } from "1DoesntExist"; +var m1 = require(\"1DoesntExist\"); +import { numVal as numVal1 } from \"1DoesntExist\"; var a_1: number = m1.numVal; var a_2: number = numVal1; -var m2 = require("2DoesntExist"); -import { numVal as numVal2 } from "3DoesntExist"; +var m2 = require(\"2DoesntExist\"); +import { numVal as numVal2 } from \"3DoesntExist\"; " `; diff --git a/tests/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap index 988dd773..f7fd5188 100644 --- a/tests/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap @@ -1,27 +1,27 @@ exports[`test A.js 1`] = ` "/* @flow */ -var m1 = require('./1DoesntExist'); +var m1 = require(\'./1DoesntExist\'); var a_1: number = m1.numVal; var a_2: string = m1.numVal; // Error: number ~> string -import {numVal} from './1DoesntExist'; +import {numVal} from \'./1DoesntExist\'; var a_3: number = numVal; var a_4: string = numVal; // Error: number ~> string // This tests that, for node, the first name mapping that both matches *and* // results in a valid module filename is picked. -var m2 = require('./2DoesntExist'); +var m2 = require(\'./2DoesntExist\'); var b_1: number = m2.numVal; var b_2: string = m2.numVal; // Error: number ~> string -import {numVal as numVal2} from './3DoesntExist'; +import {numVal as numVal2} from \'./3DoesntExist\'; var b_3: number = numVal2; var b_4: string = numVal2; // Error: number ~> string // node_modules/Exists/index.js -var m3 = require('4DoesntExist'); +var m3 = require(\'4DoesntExist\'); var c_1: number = m3.numVal; var c_2: string = m3.numVal; // Error: number ~> string -import {numVal as numVal3} from '5DoesntExist'; +import {numVal as numVal3} from \'5DoesntExist\'; var c_3: number = numVal3; var c_4: string = numVal3; // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -35,22 +35,22 @@ var c_4: string = numVal3; // Error: number ~> string // node_modules/Exists/index.js // Error: number ~> string // Error: number ~> string -var m1 = require("./1DoesntExist"); +var m1 = require(\"./1DoesntExist\"); var a_1: number = m1.numVal; var a_2: string = m1.numVal; -import { numVal } from "./1DoesntExist"; +import { numVal } from \"./1DoesntExist\"; var a_3: number = numVal; var a_4: string = numVal; -var m2 = require("./2DoesntExist"); +var m2 = require(\"./2DoesntExist\"); var b_1: number = m2.numVal; var b_2: string = m2.numVal; -import { numVal as numVal2 } from "./3DoesntExist"; +import { numVal as numVal2 } from \"./3DoesntExist\"; var b_3: number = numVal2; var b_4: string = numVal2; -var m3 = require("4DoesntExist"); +var m3 = require(\"4DoesntExist\"); var c_1: number = m3.numVal; var c_2: string = m3.numVal; -import { numVal as numVal3 } from "5DoesntExist"; +import { numVal as numVal3 } from \"5DoesntExist\"; var c_3: number = numVal3; var c_4: string = numVal3; " diff --git a/tests/config_module_system_node_resolve_dirname/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_system_node_resolve_dirname/__snapshots__/jsfmt.spec.js.snap index 3bde98e8..bcd8db5a 100644 --- a/tests/config_module_system_node_resolve_dirname/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_system_node_resolve_dirname/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ exports[`test toplevel.js 1`] = ` "// @flow -import {name} from "testproj"; +import {name} from \"testproj\"; -(name: "node_modules/testproj"); -(name: "custom_resolve_dir/testproj"); // Error: Resolve from node_modules first! +(name: \"node_modules/testproj\"); +(name: \"custom_resolve_dir/testproj\"); // Error: Resolve from node_modules first! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Error: Resolve from node_modules first! -import { name } from "testproj"; -(name: "node_modules/testproj"); -(name: "custom_resolve_dir/testproj"); +import { name } from \"testproj\"; +(name: \"node_modules/testproj\"); +(name: \"custom_resolve_dir/testproj\"); " `; diff --git a/tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/__snapshots__/jsfmt.spec.js.snap index 27676e6c..bbf8400e 100644 --- a/tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test index.js 1`] = ` "// @flow -export var name: "otherdir/testproj" = "otherdir/testproj"; +export var name: \"otherdir/testproj\" = \"otherdir/testproj\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export var name: "otherdir/testproj" = "otherdir/testproj"; +export var name: \"otherdir/testproj\" = \"otherdir/testproj\"; " `; diff --git a/tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap index 9671a1bb..24500e9d 100644 --- a/tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test index.js 1`] = ` "// @flow -export var name: "otherdir/testproj2" = "otherdir/testproj2"; +export var name: \"otherdir/testproj2\" = \"otherdir/testproj2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export var name: "otherdir/testproj2" = "otherdir/testproj2"; +export var name: \"otherdir/testproj2\" = \"otherdir/testproj2\"; " `; diff --git a/tests/config_module_system_node_resolve_dirname/subdir/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_system_node_resolve_dirname/subdir/__snapshots__/jsfmt.spec.js.snap index 5d03263c..6787dbb7 100644 --- a/tests/config_module_system_node_resolve_dirname/subdir/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_system_node_resolve_dirname/subdir/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ exports[`test sublevel.js 1`] = ` "// @flow -import {name} from "testproj2"; +import {name} from \"testproj2\"; -(name: "node_modules/testproj2"); // Error: Resolve from sibling 'custom_resolve_dir' first! -(name: "subdir/custom_resolve_dir/testproj2"); +(name: \"node_modules/testproj2\"); // Error: Resolve from sibling \'custom_resolve_dir\' first! +(name: \"subdir/custom_resolve_dir/testproj2\"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -// Error: Resolve from sibling 'custom_resolve_dir' first! -import { name } from "testproj2"; -(name: "node_modules/testproj2"); -(name: "subdir/custom_resolve_dir/testproj2"); +// Error: Resolve from sibling \'custom_resolve_dir\' first! +import { name } from \"testproj2\"; +(name: \"node_modules/testproj2\"); +(name: \"subdir/custom_resolve_dir/testproj2\"); " `; diff --git a/tests/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap index 59c7bbf9..9507811c 100644 --- a/tests/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test index.js 1`] = ` "// @flow -export var name: "subdir/custom_resolve_dir/testproj2" = "subdir/custom_resolve_dir/testproj2"; +export var name: \"subdir/custom_resolve_dir/testproj2\" = \"subdir/custom_resolve_dir/testproj2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export var name: "subdir/custom_resolve_dir/testproj2" = "subdir/custom_resolve_dir/testproj2"; +export var name: \"subdir/custom_resolve_dir/testproj2\" = \"subdir/custom_resolve_dir/testproj2\"; " `; diff --git a/tests/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap b/tests/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap index 7572be3d..6476b1b3 100644 --- a/tests/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap @@ -12,7 +12,7 @@ class A { return 1; } static _sMethod(): string { - return "some string"; + return \"some string\"; } } A._sProperty = 48; @@ -23,16 +23,16 @@ class B extends A { constructor() { super(); - this._property1 = "another string"; + this._property1 = \"another string\"; } _method1(): string { - return "yet another string"; + return \"yet another string\"; } static _sMethod(): number { return 23; } } -B._sProperty = "B._sProperty string"; +B._sProperty = \"B._sProperty string\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ class A { @@ -45,7 +45,7 @@ class A { return 1; } static _sMethod(): string { - return "some string"; + return \"some string\"; } } A._sProperty = 48; @@ -54,16 +54,16 @@ class B extends A { static _sProperty: string; constructor() { super(); - this._property1 = "another string"; + this._property1 = \"another string\"; } _method1(): string { - return "yet another string"; + return \"yet another string\"; } static _sMethod(): number { return 23; } } -B._sProperty = "B._sProperty string"; +B._sProperty = \"B._sProperty string\"; " `; @@ -87,9 +87,9 @@ module.exports = new C(); exports[`test commonjs_import.js 1`] = ` "/* @flow */ -import {_p} from "./commonjs_export"; +import {_p} from \"./commonjs_export\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import { _p } from "./commonjs_export"; +import { _p } from \"./commonjs_export\"; " `; diff --git a/tests/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap b/tests/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap index a9a08682..69d00c9c 100644 --- a/tests/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap @@ -12,7 +12,7 @@ class A { return 1; } static _sMethod(): string { - return "some string"; + return \"some string\"; } } A._sProperty = 48; @@ -23,16 +23,16 @@ class B extends A { constructor() { super(); - this._property1 = "another string"; + this._property1 = \"another string\"; } _method1(): string { - return "yet another string"; + return \"yet another string\"; } static _sMethod(): number { return 23; } } -B._sProperty = "B._sProperty string"; +B._sProperty = \"B._sProperty string\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ class A { @@ -45,7 +45,7 @@ class A { return 1; } static _sMethod(): string { - return "some string"; + return \"some string\"; } } A._sProperty = 48; @@ -54,15 +54,15 @@ class B extends A { static _sProperty: string; constructor() { super(); - this._property1 = "another string"; + this._property1 = \"another string\"; } _method1(): string { - return "yet another string"; + return \"yet another string\"; } static _sMethod(): number { return 23; } } -B._sProperty = "B._sProperty string"; +B._sProperty = \"B._sProperty string\"; " `; diff --git a/tests/const_params/__snapshots__/jsfmt.spec.js.snap b/tests/const_params/__snapshots__/jsfmt.spec.js.snap index caa0b994..24fef60f 100644 --- a/tests/const_params/__snapshots__/jsfmt.spec.js.snap +++ b/tests/const_params/__snapshots__/jsfmt.spec.js.snap @@ -15,16 +15,16 @@ exports[`test test.js 1`] = ` */ function cannot_reassign(x: string) { - x = "hey"; // error, const param cannot be reassigned + x = \"hey\"; // error, const param cannot be reassigned } // Note: const params use the same machinery as explicit // const bindings, which are tested more extensively elsewhere. -// Here we're just making sure the machinery is hooked up. +// Here we\'re just making sure the machinery is hooked up. // function durable_refi(x: ?number) { if (x) { - // ok: if x is truthy here, it's truthy everywhere + // ok: if x is truthy here, it\'s truthy everywhere return () => { var y:number = x; }; } } @@ -46,11 +46,11 @@ function durable_refi(x: ?number) { // error, const param cannot be reassigned // Note: const params use the same machinery as explicit // const bindings, which are tested more extensively elsewhere. -// Here we're just making sure the machinery is hooked up. +// Here we\'re just making sure the machinery is hooked up. // -// ok: if x is truthy here, it's truthy everywhere +// ok: if x is truthy here, it\'s truthy everywhere function cannot_reassign(x: string) { - x = "hey"; + x = \"hey\"; } function durable_refi(x: ?number) { if (x) { diff --git a/tests/contents/ignore/__snapshots__/jsfmt.spec.js.snap b/tests/contents/ignore/__snapshots__/jsfmt.spec.js.snap index 860e520b..19942181 100644 --- a/tests/contents/ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/contents/ignore/__snapshots__/jsfmt.spec.js.snap @@ -5,11 +5,11 @@ exports[`test dummy.js 1`] = ` `; exports[`test test.js 1`] = ` -"require('./dummy'); +"require(\'./dummy\'); var xxx = 0; xxx ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require("./dummy"); +require(\"./dummy\"); var xxx = 0; xxx; " diff --git a/tests/contents/no_flow/__snapshots__/jsfmt.spec.js.snap b/tests/contents/no_flow/__snapshots__/jsfmt.spec.js.snap index 860e520b..19942181 100644 --- a/tests/contents/no_flow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/contents/no_flow/__snapshots__/jsfmt.spec.js.snap @@ -5,11 +5,11 @@ exports[`test dummy.js 1`] = ` `; exports[`test test.js 1`] = ` -"require('./dummy'); +"require(\'./dummy\'); var xxx = 0; xxx ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require("./dummy"); +require(\"./dummy\"); var xxx = 0; xxx; " diff --git a/tests/covariance/__snapshots__/jsfmt.spec.js.snap b/tests/covariance/__snapshots__/jsfmt.spec.js.snap index cf140502..64e1dc5b 100644 --- a/tests/covariance/__snapshots__/jsfmt.spec.js.snap +++ b/tests/covariance/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test test.js 1`] = ` "type CovArrayVerbose = Array; var b: CovArrayVerbose = []; var y: CovArrayVerbose = b; -y[0] = ""; // error +y[0] = \"\"; // error class NVerbose { x: CovArrayVerbose; @@ -22,12 +22,12 @@ var z: CovArray = c; // error var d: CovArray = []; var w: CovArray = d; -w[0] = ""; // error +w[0] = \"\"; // error type P = CovArray; var p: P = []; (p[0]: number); // not an error! -p[0] = ""; // error +p[0] = \"\"; // error class M { x: CovArray; @@ -60,12 +60,12 @@ var z: CovArray = c; // error var d: CovArray = []; var w: CovArray = d; -w[0] = ""; // error +w[0] = \"\"; // error type P = CovArray; var p: P = []; (p[0]: number); // not an error! -p[0] = ""; // error +p[0] = \"\"; // error class M { x: CovArray; @@ -89,7 +89,7 @@ n.x = [0]; type CovArrayVerbose = Array; var b: CovArrayVerbose = [ ]; var y: CovArrayVerbose = b; -y[0] = ""; +y[0] = \"\"; class NVerbose { x: CovArrayVerbose; foo(): CovArrayVerbose { diff --git a/tests/coverage/__snapshots__/jsfmt.spec.js.snap b/tests/coverage/__snapshots__/jsfmt.spec.js.snap index 6be8b72e..dbd0e831 100644 --- a/tests/coverage/__snapshots__/jsfmt.spec.js.snap +++ b/tests/coverage/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,5 @@ exports[`test crash.js 1`] = ` -"// This file triggers a violation of the "disjoint-or-nested ranges invariant" +"// This file triggers a violation of the \"disjoint-or-nested ranges invariant\" // that we implicitly assume in type-at-pos and coverage implementations. In // particular, when unchecked it causes a crash with coverage --color. @@ -11,7 +11,7 @@ declare module bar { // TODO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// This file triggers a violation of the "disjoint-or-nested ranges invariant" +// This file triggers a violation of the \"disjoint-or-nested ranges invariant\" // that we implicitly assume in type-at-pos and coverage implementations. In // particular, when unchecked it causes a crash with coverage --color. // TODO @@ -47,7 +47,7 @@ let x = 0; `; exports[`test non-termination.js 1`] = ` -"// This file triggers a violation of the "disjoint-or-nested ranges invariant" +"// This file triggers a violation of the \"disjoint-or-nested ranges invariant\" // that we implicitly assume in type-at-pos and coverage implementations. In // particular, when unchecked it causes non-termination with coverage --color. @@ -62,7 +62,7 @@ declare module bar { declare class qux { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// This file triggers a violation of the "disjoint-or-nested ranges invariant" +// This file triggers a violation of the \"disjoint-or-nested ranges invariant\" // that we implicitly assume in type-at-pos and coverage implementations. In // particular, when unchecked it causes non-termination with coverage --color. // TODO diff --git a/tests/cycle/__snapshots__/jsfmt.spec.js.snap b/tests/cycle/__snapshots__/jsfmt.spec.js.snap index d71b9ae5..f652eb51 100644 --- a/tests/cycle/__snapshots__/jsfmt.spec.js.snap +++ b/tests/cycle/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ exports[`test A.js 1`] = ` -"var B = require('./B'); +"var B = require(\'./B\'); class A extends B { } module.exports = A; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var B = require("./B"); +var B = require(\"./B\"); class A extends B {} module.exports = A; " `; exports[`test B.js 1`] = ` -"var A = require('./A'); +"var A = require(\'./A\'); //class B extends A { } module.exports = B; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //class B extends A { } -var A = require("./A"); +var A = require(\"./A\"); module.exports = B; " `; diff --git a/tests/date/__snapshots__/jsfmt.spec.js.snap b/tests/date/__snapshots__/jsfmt.spec.js.snap index 5d10c0bc..e4ac978b 100644 --- a/tests/date/__snapshots__/jsfmt.spec.js.snap +++ b/tests/date/__snapshots__/jsfmt.spec.js.snap @@ -7,7 +7,7 @@ var y:number = d; // valid constructors new Date(); new Date(1234567890); -new Date('2015/06/18'); +new Date(\'2015/06/18\'); new Date(2015, 6); new Date(2015, 6, 18); new Date(2015, 6, 18, 11); @@ -17,16 +17,16 @@ new Date(2015, 6, 18, 11, 55, 42, 999); // invalid constructors new Date({}); -new Date(2015, '6'); -new Date(2015, 6, '18'); -new Date(2015, 6, 18, '11'); -new Date(2015, 6, 18, 11, '55'); -new Date(2015, 6, 18, 11, 55, '42'); -new Date(2015, 6, 18, 11, 55, 42, '999'); +new Date(2015, \'6\'); +new Date(2015, 6, \'18\'); +new Date(2015, 6, 18, \'11\'); +new Date(2015, 6, 18, 11, \'55\'); +new Date(2015, 6, 18, 11, 55, \'42\'); +new Date(2015, 6, 18, 11, 55, 42, \'999\'); // invalid constructors that we incorrectly consider valid -new Date('2015', 6); -new Date(2015, 6, 18, 11, 55, 42, 999, 'hahaha'); +new Date(\'2015\', 6); +new Date(2015, 6, 18, 11, 55, 42, 999, \'hahaha\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // valid constructors // invalid constructors @@ -36,7 +36,7 @@ var x: string = d.getTime(); var y: number = d; new Date(); new Date(1234567890); -new Date("2015/06/18"); +new Date(\"2015/06/18\"); new Date(2015, 6); new Date(2015, 6, 18); new Date(2015, 6, 18, 11); @@ -44,13 +44,13 @@ new Date(2015, 6, 18, 11, 55); new Date(2015, 6, 18, 11, 55, 42); new Date(2015, 6, 18, 11, 55, 42, 999); new Date({}); -new Date(2015, "6"); -new Date(2015, 6, "18"); -new Date(2015, 6, 18, "11"); -new Date(2015, 6, 18, 11, "55"); -new Date(2015, 6, 18, 11, 55, "42"); -new Date(2015, 6, 18, 11, 55, 42, "999"); -new Date("2015", 6); -new Date(2015, 6, 18, 11, 55, 42, 999, "hahaha"); +new Date(2015, \"6\"); +new Date(2015, 6, \"18\"); +new Date(2015, 6, 18, \"11\"); +new Date(2015, 6, 18, 11, \"55\"); +new Date(2015, 6, 18, 11, 55, \"42\"); +new Date(2015, 6, 18, 11, 55, 42, \"999\"); +new Date(\"2015\", 6); +new Date(2015, 6, 18, 11, 55, 42, 999, \"hahaha\"); " `; diff --git a/tests/declaration_files_haste/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_haste/__snapshots__/jsfmt.spec.js.snap index 2f2480f3..284cf97a 100644 --- a/tests/declaration_files_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_haste/__snapshots__/jsfmt.spec.js.snap @@ -4,13 +4,13 @@ exports[`test ExplicitProvidesModuleDifferentName.js 1`] = ` * @flow */ -module.exports.fun = (): string => "hello there"; +module.exports.fun = (): string => \"hello there\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* * @providesModule ExplicitProvidesModuleDifferentName * @flow */ -module.exports.fun = (): string => "hello there"; +module.exports.fun = (): string => \"hello there\"; " `; @@ -20,13 +20,13 @@ exports[`test ExplicitProvidesModuleSameName.js 1`] = ` * @flow */ -module.exports.fun = (): string => "hello there"; +module.exports.fun = (): string => \"hello there\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* * @providesModule ExplicitProvidesModuleSameName * @flow */ -module.exports.fun = (): string => "hello there"; +module.exports.fun = (): string => \"hello there\"; " `; @@ -36,13 +36,13 @@ exports[`test ImplicitProvidesModule.js 1`] = ` * @flow */ -module.exports.fun = (): string => "hello there"; +module.exports.fun = (): string => \"hello there\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* * @providesModule ImplicitProvidesModule * @flow */ -module.exports.fun = (): string => "hello there"; +module.exports.fun = (): string => \"hello there\"; " `; @@ -57,21 +57,21 @@ exports[`test md5.js 1`] = ` exports[`test test.js 1`] = ` "/* @flow */ -var Implicit = require('ImplicitProvidesModule'); +var Implicit = require(\'ImplicitProvidesModule\'); (Implicit.fun(): string); -var ExplicitSameName = require('ExplicitProvidesModuleSameName'); +var ExplicitSameName = require(\'ExplicitProvidesModuleSameName\'); (ExplicitSameName.fun(): string); -var ExplicitDifferentName = require('ExplicitProvidesModuleDifferentName'); +var ExplicitDifferentName = require(\'ExplicitProvidesModuleDifferentName\'); (ExplicitDifferentName.fun(): string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var Implicit = require("ImplicitProvidesModule"); +var Implicit = require(\"ImplicitProvidesModule\"); (Implicit.fun(): string); -var ExplicitSameName = require("ExplicitProvidesModuleSameName"); +var ExplicitSameName = require(\"ExplicitProvidesModuleSameName\"); (ExplicitSameName.fun(): string); -var ExplicitDifferentName = require("ExplicitProvidesModuleDifferentName"); +var ExplicitDifferentName = require(\"ExplicitProvidesModuleDifferentName\"); (ExplicitDifferentName.fun(): string); " `; diff --git a/tests/declaration_files_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap index 90dd7362..15ba9644 100644 --- a/tests/declaration_files_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ exports[`test min.js 1`] = ` -"module.exports.fun = (): string => "hello there"; +"module.exports.fun = (): string => \"hello there\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports.fun = (): string => "hello there"; +module.exports.fun = (): string => \"hello there\"; " `; diff --git a/tests/declaration_files_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap index 40ccdf13..43a7dfa3 100644 --- a/tests/declaration_files_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ exports[`test nested_test.js 1`] = ` "/* @flow */ -var docblock = require('qux/docblock'); -var min = require('d3/min.js'); -var corge = require('qux/corge'); +var docblock = require(\'qux/docblock\'); +var min = require(\'d3/min.js\'); +var corge = require(\'qux/corge\'); -// make sure we don't pick up non-header @providesModule +// make sure we don\'t pick up non-header @providesModule // annotations - see node_modules/qux/docblock.js -var unreachable = require('annotation'); +var unreachable = require(\'annotation\'); (docblock.fun(): string); (min.fun(): string); (corge.fun(): string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -// make sure we don't pick up non-header @providesModule +// make sure we don\'t pick up non-header @providesModule // annotations - see node_modules/qux/docblock.js -var docblock = require("qux/docblock"); -var min = require("d3/min.js"); -var corge = require("qux/corge"); -var unreachable = require("annotation"); +var docblock = require(\"qux/docblock\"); +var min = require(\"d3/min.js\"); +var corge = require(\"qux/corge\"); +var unreachable = require(\"annotation\"); (docblock.fun(): string); (min.fun(): string); (corge.fun(): string); diff --git a/tests/declaration_files_haste/ws/test/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_haste/ws/test/__snapshots__/jsfmt.spec.js.snap index f283b764..188da262 100644 --- a/tests/declaration_files_haste/ws/test/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_haste/ws/test/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ exports[`test client.js 1`] = ` -"var ws = require('../'); +"var ws = require(\'../\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var ws = require("../"); +var ws = require(\"../\"); " `; diff --git a/tests/declaration_files_incremental_haste/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_incremental_haste/__snapshots__/jsfmt.spec.js.snap index 5ab95f89..0a3ea919 100644 --- a/tests/declaration_files_incremental_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_incremental_haste/__snapshots__/jsfmt.spec.js.snap @@ -76,24 +76,24 @@ exports[`test md5.js 1`] = ` exports[`test test.js 1`] = ` "/* @flow */ -var Implicit = require('ImplicitProvidesModule'); +var Implicit = require(\'ImplicitProvidesModule\'); (Implicit.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean -var ExplicitSameName = require('ExplicitProvidesModuleSameName'); +var ExplicitSameName = require(\'ExplicitProvidesModuleSameName\'); (ExplicitSameName.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean -var ExplicitDifferentName = require('ExplicitProvidesModuleDifferentName'); +var ExplicitDifferentName = require(\'ExplicitProvidesModuleDifferentName\'); (ExplicitDifferentName.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Error: Either Implementation ~> boolean or Declaration ~> boolean // Error: Either Implementation ~> boolean or Declaration ~> boolean // Error: Either Implementation ~> boolean or Declaration ~> boolean -var Implicit = require("ImplicitProvidesModule"); +var Implicit = require(\"ImplicitProvidesModule\"); (Implicit.fun(): boolean); -var ExplicitSameName = require("ExplicitProvidesModuleSameName"); +var ExplicitSameName = require(\"ExplicitProvidesModuleSameName\"); (ExplicitSameName.fun(): boolean); -var ExplicitDifferentName = require("ExplicitProvidesModuleDifferentName"); +var ExplicitDifferentName = require(\"ExplicitProvidesModuleDifferentName\"); (ExplicitDifferentName.fun(): boolean); " `; diff --git a/tests/declaration_files_incremental_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_incremental_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap index bda6f99b..1642bb7e 100644 --- a/tests/declaration_files_incremental_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_incremental_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test nested_test.js 1`] = ` "/* @flow */ -var docblock = require('qux/docblock'); -var min = require('d3/min.js'); -var corge = require('qux/corge'); +var docblock = require(\'qux/docblock\'); +var min = require(\'d3/min.js\'); +var corge = require(\'qux/corge\'); (docblock.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean (min.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean @@ -13,9 +13,9 @@ var corge = require('qux/corge'); // Error: Either Implementation ~> boolean or Declaration ~> boolean // Error: Either Implementation ~> boolean or Declaration ~> boolean // Error: Either Implementation ~> boolean or Declaration ~> boolean -var docblock = require("qux/docblock"); -var min = require("d3/min.js"); -var corge = require("qux/corge"); +var docblock = require(\"qux/docblock\"); +var min = require(\"d3/min.js\"); +var corge = require(\"qux/corge\"); (docblock.fun(): boolean); (min.fun(): boolean); (corge.fun(): boolean); diff --git a/tests/declaration_files_incremental_haste/ws/test/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_incremental_haste/ws/test/__snapshots__/jsfmt.spec.js.snap index f283b764..188da262 100644 --- a/tests/declaration_files_incremental_haste/ws/test/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_incremental_haste/ws/test/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ exports[`test client.js 1`] = ` -"var ws = require('../'); +"var ws = require(\'../\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var ws = require("../"); +var ws = require(\"../\"); " `; diff --git a/tests/declaration_files_incremental_node/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_incremental_node/__snapshots__/jsfmt.spec.js.snap index a90d554d..4ad8d746 100644 --- a/tests/declaration_files_incremental_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_incremental_node/__snapshots__/jsfmt.spec.js.snap @@ -13,43 +13,43 @@ exports[`test test_absolute.js 1`] = ` "/* @flow */ // This will require ./node_modules/B.js.flow -var B1 = require('B'); +var B1 = require(\'B\'); (B1.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean // This will require ./node_modules/B.js.flow -var B2 = require('B.js'); +var B2 = require(\'B.js\'); (B2.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean -var C = require('package_with_full_main'); +var C = require(\'package_with_full_main\'); (C.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean -var D = require('package_with_partial_main'); +var D = require(\'package_with_partial_main\'); (D.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean -var E = require('package_with_no_package_json'); +var E = require(\'package_with_no_package_json\'); (E.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean -var F = require('package_with_dir_main'); +var F = require(\'package_with_dir_main\'); (F.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean // This will require ./node_modules/B.js.flow -var B1 = require('B'); +var B1 = require(\'B\'); (B1.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean // This will require ./node_modules/B.js.flow -var B2 = require('B.js'); +var B2 = require(\'B.js\'); (B2.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean -var C = require('package_with_full_main'); +var C = require(\'package_with_full_main\'); (C.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean -var D = require('package_with_partial_main'); +var D = require(\'package_with_partial_main\'); (D.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean -var E = require('package_with_no_package_json'); +var E = require(\'package_with_no_package_json\'); (E.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean -var F = require('package_with_dir_main'); +var F = require(\'package_with_dir_main\'); (F.fun(): boolean); // Error either Implementation ~> boolean or Declaration ~> boolean ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -69,40 +69,40 @@ var F = require('package_with_dir_main'); // Error either Implementation ~> boolean or Declaration ~> boolean // Error either Implementation ~> boolean or Declaration ~> boolean // Error either Implementation ~> boolean or Declaration ~> boolean -var B1 = require("B"); +var B1 = require(\"B\"); (B1.fun(): boolean); -var B2 = require("B.js"); +var B2 = require(\"B.js\"); (B2.fun(): boolean); -var C = require("package_with_full_main"); +var C = require(\"package_with_full_main\"); (C.fun(): boolean); -var D = require("package_with_partial_main"); +var D = require(\"package_with_partial_main\"); (D.fun(): boolean); -var E = require("package_with_no_package_json"); +var E = require(\"package_with_no_package_json\"); (E.fun(): boolean); -var F = require("package_with_dir_main"); +var F = require(\"package_with_dir_main\"); (F.fun(): boolean); -var B1 = require("B"); +var B1 = require(\"B\"); (B1.fun(): boolean); -var B2 = require("B.js"); +var B2 = require(\"B.js\"); (B2.fun(): boolean); -var C = require("package_with_full_main"); +var C = require(\"package_with_full_main\"); (C.fun(): boolean); -var D = require("package_with_partial_main"); +var D = require(\"package_with_partial_main\"); (D.fun(): boolean); -var E = require("package_with_no_package_json"); +var E = require(\"package_with_no_package_json\"); (E.fun(): boolean); -var F = require("package_with_dir_main"); +var F = require(\"package_with_dir_main\"); (F.fun(): boolean); " `; exports[`test test_relative.js 1`] = ` -"import { foo } from './A'; +"import { foo } from \'./A\'; (foo(): boolean); // Error: either Implementation ~> boolean or Definition ~> boolean ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Error: either Implementation ~> boolean or Definition ~> boolean -import { foo } from "./A"; +import { foo } from \"./A\"; (foo(): boolean); " `; diff --git a/tests/declaration_files_node/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_node/__snapshots__/jsfmt.spec.js.snap index 0fbbba77..777cf1f1 100644 --- a/tests/declaration_files_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_node/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ exports[`test A.js 1`] = ` "/* @flow */ -module.exports.fun = (): string => 'hello there!'; +module.exports.fun = (): string => \'hello there!\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -module.exports.fun = (): string => "hello there!"; +module.exports.fun = (): string => \"hello there!\"; " `; @@ -21,23 +21,23 @@ exports[`test test_absolute.js 1`] = ` "/* @flow */ // This will require ./node_modules/B.js.flow -var B1 = require('B'); +var B1 = require(\'B\'); (B1.fun(): string); // Error number ~> string // This will require ./node_modules/B.js.flow -var B2 = require('B.js'); +var B2 = require(\'B.js\'); (B2.fun(): string); // Error number ~> string -var C = require('package_with_full_main'); +var C = require(\'package_with_full_main\'); (C.fun(): string); // Error number ~> string -var D = require('package_with_partial_main'); +var D = require(\'package_with_partial_main\'); (D.fun(): string); // Error number ~> string -var E = require('package_with_no_package_json'); +var E = require(\'package_with_no_package_json\'); (E.fun(): string); // Error number ~> string -var F = require('package_with_dir_main'); +var F = require(\'package_with_dir_main\'); (F.fun(): string); // Error number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -49,17 +49,17 @@ var F = require('package_with_dir_main'); // Error number ~> string // Error number ~> string // Error number ~> string -var B1 = require("B"); +var B1 = require(\"B\"); (B1.fun(): string); -var B2 = require("B.js"); +var B2 = require(\"B.js\"); (B2.fun(): string); -var C = require("package_with_full_main"); +var C = require(\"package_with_full_main\"); (C.fun(): string); -var D = require("package_with_partial_main"); +var D = require(\"package_with_partial_main\"); (D.fun(): string); -var E = require("package_with_no_package_json"); +var E = require(\"package_with_no_package_json\"); (E.fun(): string); -var F = require("package_with_dir_main"); +var F = require(\"package_with_dir_main\"); (F.fun(): string); " `; @@ -68,14 +68,14 @@ exports[`test test_relative.js 1`] = ` "/* @flow */ // This will require ./A.js.flow -var A1 = require('./A'); +var A1 = require(\'./A\'); (A1.fun(): string); // Error number ~> string // This will require ./A.js.flow -var A2 = require('./A.js'); +var A2 = require(\'./A.js\'); (A2.fun(): string); // Error number ~> string -var CJS = require('./CJS.js'); +var CJS = require(\'./CJS.js\'); (CJS: string); (CJS: number); // Error: string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -85,11 +85,11 @@ var CJS = require('./CJS.js'); // This will require ./A.js.flow // Error number ~> string // Error: string ~> number -var A1 = require("./A"); +var A1 = require(\"./A\"); (A1.fun(): string); -var A2 = require("./A.js"); +var A2 = require(\"./A.js\"); (A2.fun(): string); -var CJS = require("./CJS.js"); +var CJS = require(\"./CJS.js\"); (CJS: string); (CJS: number); " diff --git a/tests/declare_export/__snapshots__/jsfmt.spec.js.snap b/tests/declare_export/__snapshots__/jsfmt.spec.js.snap index 18450d66..b110d7cc 100644 --- a/tests/declare_export/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_export/__snapshots__/jsfmt.spec.js.snap @@ -245,13 +245,13 @@ exports[`test ES6_ExportAllFrom_Intermediary1.js 1`] = ` * @flow */ -declare export * from "ES6_ExportAllFrom_Source1"; +declare export * from \"ES6_ExportAllFrom_Source1\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportAllFrom_Intermediary1 * @flow */ -declare export * from "ES6_ExportAllFrom_Source1" +declare export * from \"ES6_ExportAllFrom_Source1\" " `; @@ -261,13 +261,13 @@ exports[`test ES6_ExportAllFrom_Intermediary2.js 1`] = ` * @flow */ -declare export * from "ES6_ExportAllFrom_Source2"; +declare export * from \"ES6_ExportAllFrom_Source2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportAllFrom_Intermediary2 * @flow */ -declare export * from "ES6_ExportAllFrom_Source2" +declare export * from \"ES6_ExportAllFrom_Source2\" " `; @@ -306,12 +306,12 @@ declare export var numberValue2: number; exports[`test ES6_ExportAllFromMulti.js 1`] = ` "// @flow -declare export * from "./ES6_ExportAllFrom_Source1"; -declare export * from "./ES6_ExportAllFrom_Source2"; +declare export * from \"./ES6_ExportAllFrom_Source1\"; +declare export * from \"./ES6_ExportAllFrom_Source2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -declare export * from "./ES6_ExportAllFrom_Source1" -declare export * from "./ES6_ExportAllFrom_Source2" +declare export * from \"./ES6_ExportAllFrom_Source1\" +declare export * from \"./ES6_ExportAllFrom_Source2\" " `; @@ -324,13 +324,13 @@ exports[`test ES6_ExportFrom_Intermediary1.js 1`] = ` declare export { numberValue1, numberValue2 as numberValue2_renamed -} from "ES6_ExportFrom_Source1"; +} from \"ES6_ExportFrom_Source1\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary1 * @flow */ -declare export { numberValue1, numberValue2 as numberValue2_renamed } from "ES6_ExportFrom_Source1" +declare export { numberValue1, numberValue2 as numberValue2_renamed } from \"ES6_ExportFrom_Source1\" " `; @@ -343,13 +343,13 @@ exports[`test ES6_ExportFrom_Intermediary2.js 1`] = ` declare export { numberValue1, numberValue2 as numberValue2_renamed2 -} from "ES6_ExportFrom_Source2"; +} from \"ES6_ExportFrom_Source2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary2 * @flow */ -declare export { numberValue1, numberValue2 as numberValue2_renamed2 } from "ES6_ExportFrom_Source2" +declare export { numberValue1, numberValue2 as numberValue2_renamed2 } from \"ES6_ExportFrom_Source2\" " `; @@ -481,7 +481,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = "str"; +exports.stringValue = \"str\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule A @@ -491,7 +491,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = "str"; +exports.stringValue = \"str\"; " `; @@ -568,44 +568,44 @@ exports[`test es6modules.js 1`] = ` // ===================== // // @providesModule -import * as DefaultA from "A"; +import * as DefaultA from \"A\"; var a1: number = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1; // Error: number ~> string // File path -import * as DefaultB from "./B"; +import * as DefaultB from \"./B\"; var b1: number = DefaultB.numberValue; var b2: string = DefaultB.numberValue; // Error: number ~> string // C.js exists, but not as a providesModule -import DefaultC from "C"; // Error: No such module +import DefaultC from \"C\"; // Error: No such module // @providesModule D exists, but not as a filename -import DefaultD from "./D"; // Error: No such module +import DefaultD from \"./D\"; // Error: No such module // ================================================ // // == CommonJS Clobbering Literal Exports -> ES6 == // // ================================================ // -import {doesntExist1} from "CommonJS_Clobbering_Lit"; // Error: Not an exported binding +import {doesntExist1} from \"CommonJS_Clobbering_Lit\"; // Error: Not an exported binding -import {numberValue1} from "CommonJS_Clobbering_Lit"; +import {numberValue1} from \"CommonJS_Clobbering_Lit\"; var c1: number = numberValue1; var c2: string = numberValue1; // Error: number ~> string -import {numberValue2 as numVal1} from "CommonJS_Clobbering_Lit"; +import {numberValue2 as numVal1} from \"CommonJS_Clobbering_Lit\"; var d1: number = numVal1; var d2: string = numVal1; // Error: number ~> string -import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit"; +import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\"; var e1: number = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3; // Error: number ~> string -CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn't a property +CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn\'t a property -import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit"; +import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\"; var f1: number = CJS_Clobb_Lit_NS.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; -CJS_Clobb_Lit_NS.default.default; // Error: No 'default' property on the exported obj +CJS_Clobb_Lit_NS.default.default; // Error: No \'default\' property on the exported obj var f3: string = CJS_Clobb_Lit_NS.numberValue4; // Error: number ~> string var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> string @@ -613,15 +613,15 @@ var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> stri // == CommonJS Clobbering Class Exports -> ES6 == // // ============================================== // -import {doesntExist2} from "CommonJS_Clobbering_Class"; // Error: Not an exported binding +import {doesntExist2} from \"CommonJS_Clobbering_Class\"; // Error: Not an exported binding // The following import should error because class statics are not turned into // named exports for now. This avoids complexities with polymorphic static // members (where the polymophism is defined on the class itself rather than the // method). -import {staticNumber1, baseProp, childProp} from "CommonJS_Clobbering_Class"; // Error +import {staticNumber1, baseProp, childProp} from \"CommonJS_Clobbering_Class\"; // Error -import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; +import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\"; new CJS_Clobb_Class(); new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property var h1: number = CJS_Clobb_Class.staticNumber2(); @@ -629,8 +629,8 @@ var h2: string = CJS_Clobb_Class.staticNumber2(); // Error: number ~> string var h3: number = new CJS_Clobb_Class().instNumber1(); var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string -import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class"; -new CJS_Clobb_Class_NS(); // Error: Namespace object isn't constructable +import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\"; +new CJS_Clobb_Class_NS(); // Error: Namespace object isn\'t constructable var i1: number = CJS_Clobb_Class_NS.staticNumber3(); // Error: Class statics not copied to Namespace object var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: number ~> string @@ -639,22 +639,22 @@ var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: numbe // == CommonJS Named Exports -> ES6 == // // =================================== // -import {doesntExist3} from "CommonJS_Named"; // Error: Not an exported binding +import {doesntExist3} from \"CommonJS_Named\"; // Error: Not an exported binding -import {numberValue2} from "CommonJS_Named"; +import {numberValue2} from \"CommonJS_Named\"; var j1: number = numberValue2; var j2: string = numberValue2; // Error: number ~> string -import {numberValue3 as numVal3} from "CommonJS_Named"; +import {numberValue3 as numVal3} from \"CommonJS_Named\"; var k1: number = numVal3; var k2: string = numVal3; // Error: number ~> string -import * as CJS_Named from "CommonJS_Named"; +import * as CJS_Named from \"CommonJS_Named\"; var l1: number = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1; // Error: number ~> string -CJS_Named.doesntExist; // Error: doesntExist isn't a property +CJS_Named.doesntExist; // Error: doesntExist isn\'t a property -import * as CJS_Named_NS from "CommonJS_Named"; +import * as CJS_Named_NS from \"CommonJS_Named\"; var m1: number = CJS_Named_NS.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4; // Error: CommonJS_Named has no default export var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string @@ -663,13 +663,13 @@ var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string // == ES6 Default -> ES6 == // ////////////////////////////// -import {doesntExist4} from "ES6_Default_AnonFunction1"; // Error: Not an exported binding +import {doesntExist4} from \"ES6_Default_AnonFunction1\"; // Error: Not an exported binding -import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; +import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\"; var n1: number = ES6_Def_AnonFunc1(); var n2: string = ES6_Def_AnonFunc1(); // Error: number ~> string -import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1"; +import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\"; var o1: number = ES6_Def_NamedFunc1(); var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string @@ -677,7 +677,7 @@ var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string -import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1"; +import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\"; var q1: number = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> string @@ -685,35 +685,35 @@ var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> stri // == ES6 Named -> ES6 == // //////////////////////////// -import doesntExist5 from "ES6_Named1"; // Error: Not an exported binding +import doesntExist5 from \"ES6_Named1\"; // Error: Not an exported binding -import {specifierNumber1 as specifierNumber1_1} from "ES6_Named1"; +import {specifierNumber1 as specifierNumber1_1} from \"ES6_Named1\"; var r1: number = specifierNumber1_1; var r2: string = specifierNumber1_1; // Error: number ~> string -import {specifierNumber2Renamed} from "ES6_Named1"; +import {specifierNumber2Renamed} from \"ES6_Named1\"; var s1: number = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed; // Error: number ~> string -import {specifierNumber3 as specifierNumber3Renamed} from "ES6_Named1"; +import {specifierNumber3 as specifierNumber3Renamed} from \"ES6_Named1\"; var t1: number = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed; // Error: number ~> string -import {groupedSpecifierNumber1, groupedSpecifierNumber2} from "ES6_Named1"; +import {groupedSpecifierNumber1, groupedSpecifierNumber2} from \"ES6_Named1\"; var u1: number = groupedSpecifierNumber1; var u2: number = groupedSpecifierNumber2; var u3: string = groupedSpecifierNumber1; // Error: number ~> string var u4: string = groupedSpecifierNumber2; // Error: number ~> string -import {givesANumber} from "ES6_Named1"; +import {givesANumber} from \"ES6_Named1\"; var v1: number = givesANumber(); var v2: string = givesANumber(); // Error: number ~> string -import {NumberGenerator} from "ES6_Named1"; +import {NumberGenerator} from \"ES6_Named1\"; var w1: number = new NumberGenerator().givesANumber(); var w2: string = new NumberGenerator().givesANumber(); // Error: number ~> string -import {varDeclNumber1, varDeclNumber2} from "ES6_Named1"; +import {varDeclNumber1, varDeclNumber2} from \"ES6_Named1\"; var x1: number = varDeclNumber1; var x2: number = varDeclNumber2; var x3: string = varDeclNumber1; // Error: number ~> string @@ -727,15 +727,15 @@ var x4: string = varDeclNumber2; // Error: number ~> string -import {numberValue1 as numberValue4} from "ES6_ExportFrom_Intermediary1"; +import {numberValue1 as numberValue4} from \"ES6_ExportFrom_Intermediary1\"; var aa1: number = numberValue4; var aa2: string = numberValue4; // Error: number ~> string -import {numberValue2_renamed} from "ES6_ExportFrom_Intermediary1"; +import {numberValue2_renamed} from \"ES6_ExportFrom_Intermediary1\"; var ab1: number = numberValue2_renamed; var ab2: string = numberValue2_renamed; // Error: number ~> string -import {numberValue1 as numberValue5} from "ES6_ExportAllFrom_Intermediary1"; +import {numberValue1 as numberValue5} from \"ES6_ExportAllFrom_Intermediary1\"; var ac1: number = numberValue5; var ac2: string = numberValue5; // Error: number ~> string @@ -743,13 +743,13 @@ var ac2: string = numberValue5; // Error: number ~> string // == ES6 Default -> CommonJS == // /////////////////////////////////// -require('ES6_Default_AnonFunction2').doesntExist; // Error: 'doesntExist' isn't an export +require(\'ES6_Default_AnonFunction2\').doesntExist; // Error: \'doesntExist\' isn\'t an export -var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default; +var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default; var ad1: number = ES6_Def_AnonFunc2(); var ad2: string = ES6_Def_AnonFunc2(); // Error: number ~> string -var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default; +var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default; var ae1: number = ES6_Def_NamedFunc2(); var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string @@ -757,7 +757,7 @@ var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string -var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default; +var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default; var ag1: number = new ES6_Def_NamedClass2().givesANum(); var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> string @@ -765,31 +765,31 @@ var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> str // == ES6 Named -> CommonJS == // ///////////////////////////////// -var specifierNumber4 = require("ES6_Named2").specifierNumber4; +var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4; var ah1: number = specifierNumber4; var ah2: string = specifierNumber4; // Error: number ~> string -var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; +var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed; // Error: number ~> string -var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; -var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; +var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3; +var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4; var aj1: number = groupedSpecifierNumber3; var aj2: number = groupedSpecifierNumber4; var aj3: string = groupedSpecifierNumber3; // Error: number ~> string var aj4: string = groupedSpecifierNumber4; // Error: number ~> string -var givesANumber2 = require("ES6_Named2").givesANumber2; +var givesANumber2 = require(\"ES6_Named2\").givesANumber2; var ak1: number = givesANumber2(); var ak2: string = givesANumber2(); // Error: number ~> string -var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; +var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2; var al1: number = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string -var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; -var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; +var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3; +var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4; var am1: number = varDeclNumber3; var am2: number = varDeclNumber4; var am3: string = varDeclNumber3; // Error: number ~> string @@ -803,15 +803,15 @@ var am4: string = varDeclNumber4; // Error: number ~> string -var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; +var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1; var ap1: number = numberValue6; var ap2: string = numberValue6; // Error: number ~> string -var numberValue2_renamed2 = require("ES6_ExportFrom_Intermediary2").numberValue2_renamed2; +var numberValue2_renamed2 = require(\"ES6_ExportFrom_Intermediary2\").numberValue2_renamed2; var aq1: number = numberValue2_renamed2; var aq2: string = numberValue2_renamed2; // Error: number ~> string -var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2; +var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2; var ar1: number = numberValue7; var ar2: string = numberValue7; // Error: number ~> string @@ -819,7 +819,7 @@ var ar2: string = numberValue7; // Error: number ~> string // == ES6 Default+Named -> ES6 import Default+Named== // //////////////////////////////////////////////////////// -import defaultNum, {str as namedStr} from "./ES6_DefaultAndNamed"; +import defaultNum, {str as namedStr} from \"./ES6_DefaultAndNamed\"; var as1: number = defaultNum; var as2: string = defaultNum; // Error: number ~> string @@ -831,13 +831,13 @@ var as4: number = namedStr; // Error: string ~> number // == Side-effect only ES6 imports == // //////////////////////////////////////// -import "./SideEffects"; +import \"./SideEffects\"; ////////////////////////////////////////////// // == Suggest export name on likely typo == // ////////////////////////////////////////////// -import specifierNumber1 from "ES6_Named1"; // Error: Did you mean \`import {specifierNumber1} from ...\`? -import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNumber1\`? +import specifierNumber1 from \"ES6_Named1\"; // Error: Did you mean \`import {specifierNumber1} from ...\`? +import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifierNumber1\`? /////////////////////////////////////////////////// // == Multi \`export *\` should combine exports == // @@ -845,7 +845,7 @@ import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNu import { numberValue1 as numberValue8, numberValue2 as numberValue9 -} from "./ES6_ExportAllFromMulti"; +} from \"./ES6_ExportAllFromMulti\"; var at1: number = numberValue8; var at2: string = numberValue8; // Error: number ~> string @@ -872,8 +872,8 @@ var at4: string = numberValue9; // Error: number ~> string // Error: number ~> string // Error: number ~> string // Error: number ~> string -// Error: doesntExist isn't a property -// Error: No 'default' property on the exported obj +// Error: doesntExist isn\'t a property +// Error: No \'default\' property on the exported obj // Error: number ~> string // Error: number ~> string // ============================================== // @@ -888,7 +888,7 @@ var at4: string = numberValue9; // Error: number ~> string // Error: Class has no \`doesntExist\` property // Error: number ~> string // Error: number ~> string -// Error: Namespace object isn't constructable +// Error: Namespace object isn\'t constructable // Error: Class statics not copied to Namespace object // Error: number ~> string // =================================== // @@ -898,7 +898,7 @@ var at4: string = numberValue9; // Error: number ~> string // Error: number ~> string // Error: number ~> string // Error: number ~> string -// Error: doesntExist isn't a property +// Error: doesntExist isn\'t a property // Error: CommonJS_Named has no default export // Error: number ~> string ////////////////////////////// @@ -927,7 +927,7 @@ var at4: string = numberValue9; // Error: number ~> string /////////////////////////////////// // == ES6 Default -> CommonJS == // /////////////////////////////////// -// Error: 'doesntExist' isn't an export +// Error: \'doesntExist\' isn\'t an export // Error: number ~> string // Error: number ~> string // Error: number ~> string @@ -963,159 +963,159 @@ var at4: string = numberValue9; // Error: number ~> string /////////////////////////////////////////////////// // Error: number ~> string // Error: number ~> string -import * as DefaultA from "A"; +import * as DefaultA from \"A\"; var a1: number = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1; -import * as DefaultB from "./B"; +import * as DefaultB from \"./B\"; var b1: number = DefaultB.numberValue; var b2: string = DefaultB.numberValue; -import DefaultC from "C"; -import DefaultD from "./D"; -import { doesntExist1 } from "CommonJS_Clobbering_Lit"; -import { numberValue1 } from "CommonJS_Clobbering_Lit"; +import DefaultC from \"C\"; +import DefaultD from \"./D\"; +import { doesntExist1 } from \"CommonJS_Clobbering_Lit\"; +import { numberValue1 } from \"CommonJS_Clobbering_Lit\"; var c1: number = numberValue1; var c2: string = numberValue1; -import { numberValue2 as numVal1 } from "CommonJS_Clobbering_Lit"; +import { numberValue2 as numVal1 } from \"CommonJS_Clobbering_Lit\"; var d1: number = numVal1; var d2: string = numVal1; -import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit"; +import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\"; var e1: number = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3; CJS_Clobb_Lit.doesntExist; -import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit"; +import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\"; var f1: number = CJS_Clobb_Lit_NS.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; CJS_Clobb_Lit_NS.default.default; var f3: string = CJS_Clobb_Lit_NS.numberValue4; var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; -import { doesntExist2 } from "CommonJS_Clobbering_Class"; -import { staticNumber1, baseProp, childProp } from "CommonJS_Clobbering_Class"; -import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; +import { doesntExist2 } from \"CommonJS_Clobbering_Class\"; +import { staticNumber1, baseProp, childProp } from \"CommonJS_Clobbering_Class\"; +import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\"; new CJS_Clobb_Class(); new CJS_Clobb_Class().doesntExist; var h1: number = CJS_Clobb_Class.staticNumber2(); var h2: string = CJS_Clobb_Class.staticNumber2(); var h3: number = new CJS_Clobb_Class().instNumber1(); var h4: string = new CJS_Clobb_Class().instNumber1(); -import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class"; +import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\"; new CJS_Clobb_Class_NS(); var i1: number = CJS_Clobb_Class_NS.staticNumber3(); var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); -import { doesntExist3 } from "CommonJS_Named"; -import { numberValue2 } from "CommonJS_Named"; +import { doesntExist3 } from \"CommonJS_Named\"; +import { numberValue2 } from \"CommonJS_Named\"; var j1: number = numberValue2; var j2: string = numberValue2; -import { numberValue3 as numVal3 } from "CommonJS_Named"; +import { numberValue3 as numVal3 } from \"CommonJS_Named\"; var k1: number = numVal3; var k2: string = numVal3; -import * as CJS_Named from "CommonJS_Named"; +import * as CJS_Named from \"CommonJS_Named\"; var l1: number = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1; CJS_Named.doesntExist; -import * as CJS_Named_NS from "CommonJS_Named"; +import * as CJS_Named_NS from \"CommonJS_Named\"; var m1: number = CJS_Named_NS.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4; var m3: string = CJS_Named_NS.numberValue4; -import { doesntExist4 } from "ES6_Default_AnonFunction1"; -import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; +import { doesntExist4 } from \"ES6_Default_AnonFunction1\"; +import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\"; var n1: number = ES6_Def_AnonFunc1(); var n2: string = ES6_Def_AnonFunc1(); -import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1"; +import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\"; var o1: number = ES6_Def_NamedFunc1(); var o2: string = ES6_Def_NamedFunc1(); -import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1"; +import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\"; var q1: number = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum(); -import doesntExist5 from "ES6_Named1"; -import { specifierNumber1 as specifierNumber1_1 } from "ES6_Named1"; +import doesntExist5 from \"ES6_Named1\"; +import { specifierNumber1 as specifierNumber1_1 } from \"ES6_Named1\"; var r1: number = specifierNumber1_1; var r2: string = specifierNumber1_1; -import { specifierNumber2Renamed } from "ES6_Named1"; +import { specifierNumber2Renamed } from \"ES6_Named1\"; var s1: number = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed; -import { specifierNumber3 as specifierNumber3Renamed } from "ES6_Named1"; +import { specifierNumber3 as specifierNumber3Renamed } from \"ES6_Named1\"; var t1: number = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed; -import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from "ES6_Named1"; +import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from \"ES6_Named1\"; var u1: number = groupedSpecifierNumber1; var u2: number = groupedSpecifierNumber2; var u3: string = groupedSpecifierNumber1; var u4: string = groupedSpecifierNumber2; -import { givesANumber } from "ES6_Named1"; +import { givesANumber } from \"ES6_Named1\"; var v1: number = givesANumber(); var v2: string = givesANumber(); -import { NumberGenerator } from "ES6_Named1"; +import { NumberGenerator } from \"ES6_Named1\"; var w1: number = new NumberGenerator().givesANumber(); var w2: string = new NumberGenerator().givesANumber(); -import { varDeclNumber1, varDeclNumber2 } from "ES6_Named1"; +import { varDeclNumber1, varDeclNumber2 } from \"ES6_Named1\"; var x1: number = varDeclNumber1; var x2: number = varDeclNumber2; var x3: string = varDeclNumber1; var x4: string = varDeclNumber2; -import { numberValue1 as numberValue4 } from "ES6_ExportFrom_Intermediary1"; +import { numberValue1 as numberValue4 } from \"ES6_ExportFrom_Intermediary1\"; var aa1: number = numberValue4; var aa2: string = numberValue4; -import { numberValue2_renamed } from "ES6_ExportFrom_Intermediary1"; +import { numberValue2_renamed } from \"ES6_ExportFrom_Intermediary1\"; var ab1: number = numberValue2_renamed; var ab2: string = numberValue2_renamed; -import { numberValue1 as numberValue5 } from "ES6_ExportAllFrom_Intermediary1"; +import { numberValue1 as numberValue5 } from \"ES6_ExportAllFrom_Intermediary1\"; var ac1: number = numberValue5; var ac2: string = numberValue5; -require("ES6_Default_AnonFunction2").doesntExist; -var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default; +require(\"ES6_Default_AnonFunction2\").doesntExist; +var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default; var ad1: number = ES6_Def_AnonFunc2(); var ad2: string = ES6_Def_AnonFunc2(); -var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default; +var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default; var ae1: number = ES6_Def_NamedFunc2(); var ae2: string = ES6_Def_NamedFunc2(); -var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default; +var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default; var ag1: number = new ES6_Def_NamedClass2().givesANum(); var ag2: string = new ES6_Def_NamedClass2().givesANum(); -var specifierNumber4 = require("ES6_Named2").specifierNumber4; +var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4; var ah1: number = specifierNumber4; var ah2: string = specifierNumber4; -var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; +var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed; -var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; -var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; +var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3; +var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4; var aj1: number = groupedSpecifierNumber3; var aj2: number = groupedSpecifierNumber4; var aj3: string = groupedSpecifierNumber3; var aj4: string = groupedSpecifierNumber4; -var givesANumber2 = require("ES6_Named2").givesANumber2; +var givesANumber2 = require(\"ES6_Named2\").givesANumber2; var ak1: number = givesANumber2(); var ak2: string = givesANumber2(); -var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; +var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2; var al1: number = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber(); -var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; -var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; +var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3; +var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4; var am1: number = varDeclNumber3; var am2: number = varDeclNumber4; var am3: string = varDeclNumber3; var am4: string = varDeclNumber4; -var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; +var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1; var ap1: number = numberValue6; var ap2: string = numberValue6; var numberValue2_renamed2 = require( - "ES6_ExportFrom_Intermediary2" + \"ES6_ExportFrom_Intermediary2\" ).numberValue2_renamed2; var aq1: number = numberValue2_renamed2; var aq2: string = numberValue2_renamed2; -var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2; +var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2; var ar1: number = numberValue7; var ar2: string = numberValue7; -import defaultNum, { str as namedStr } from "./ES6_DefaultAndNamed"; +import defaultNum, { str as namedStr } from \"./ES6_DefaultAndNamed\"; var as1: number = defaultNum; var as2: string = defaultNum; var as3: string = namedStr; var as4: number = namedStr; -import "./SideEffects"; -import specifierNumber1 from "ES6_Named1"; -import { specifierNumber } from "ES6_Named1"; -import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from "./ES6_ExportAllFromMulti"; +import \"./SideEffects\"; +import specifierNumber1 from \"ES6_Named1\"; +import { specifierNumber } from \"ES6_Named1\"; +import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from \"./ES6_ExportAllFromMulti\"; var at1: number = numberValue8; var at2: string = numberValue8; var at3: number = numberValue9; diff --git a/tests/declare_module_exports/__snapshots__/jsfmt.spec.js.snap b/tests/declare_module_exports/__snapshots__/jsfmt.spec.js.snap index df203472..8bb999e6 100644 --- a/tests/declare_module_exports/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_module_exports/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ exports[`test main.js 1`] = ` "// @flow -import declare_module_exports from "declare_module_exports"; +import declare_module_exports from \"declare_module_exports\"; (declare_module_exports: number); (declare_module_exports: string); // Error: number ~> string -// Error: Has no named export "str"! -import {str} from "declare_m_e_with_other_value_declares"; +// Error: Has no named export \"str\"! +import {str} from \"declare_m_e_with_other_value_declares\"; -import type {str2} from "declare_m_e_with_other_type_declares"; -("asdf": str2); +import type {str2} from \"declare_m_e_with_other_type_declares\"; +(\"asdf\": str2); (42: str2); // Error: number ~> string /** @@ -17,17 +17,17 @@ import type {str2} from "declare_m_e_with_other_type_declares"; * syntaxes will work. */ -import DEPRECATED__declare_var_exports from "DEPRECATED__declare_var_exports"; +import DEPRECATED__declare_var_exports from \"DEPRECATED__declare_var_exports\"; (DEPRECATED__declare_var_exports: number); (DEPRECATED__declare_var_exports: string); // Error: number ~> string -import declare_m_e_with_declare_var_e from "declare_m_e_with_declare_var_e"; +import declare_m_e_with_declare_var_e from \"declare_m_e_with_declare_var_e\"; (declare_m_e_with_declare_var_e: number); (declare_m_e_with_declare_var_e: string); // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Error: number ~> string -// Error: Has no named export "str"! +// Error: Has no named export \"str\"! // Error: number ~> string /** * \`declare var exports\` is deprecated, so we have a grace period where both @@ -35,17 +35,17 @@ import declare_m_e_with_declare_var_e from "declare_m_e_with_declare_var_e"; */ // Error: number ~> string // Error: number ~> string -import declare_module_exports from "declare_module_exports"; +import declare_module_exports from \"declare_module_exports\"; (declare_module_exports: number); (declare_module_exports: string); -import { str } from "declare_m_e_with_other_value_declares"; -import type { str2 } from "declare_m_e_with_other_type_declares"; -("asdf": str2); +import { str } from \"declare_m_e_with_other_value_declares\"; +import type { str2 } from \"declare_m_e_with_other_type_declares\"; +(\"asdf\": str2); (42: str2); -import DEPRECATED__declare_var_exports from "DEPRECATED__declare_var_exports"; +import DEPRECATED__declare_var_exports from \"DEPRECATED__declare_var_exports\"; (DEPRECATED__declare_var_exports: number); (DEPRECATED__declare_var_exports: string); -import declare_m_e_with_declare_var_e from "declare_m_e_with_declare_var_e"; +import declare_m_e_with_declare_var_e from \"declare_m_e_with_declare_var_e\"; (declare_m_e_with_declare_var_e: number); (declare_m_e_with_declare_var_e: string); " diff --git a/tests/declare_type/__snapshots__/jsfmt.spec.js.snap b/tests/declare_type/__snapshots__/jsfmt.spec.js.snap index ec1f29a9..299932ee 100644 --- a/tests/declare_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_type/__snapshots__/jsfmt.spec.js.snap @@ -6,21 +6,21 @@ exports[`test import_declare_type.js 1`] = ` //////////////////////////////////////////////////////////// // == Import Declared Type Alias From Declared Module == // ////////////////////////////////////////////////////////// -import type {baz} from "ModuleAliasFoo"; -import {foo} from "ModuleAliasFoo"; +import type {baz} from \"ModuleAliasFoo\"; +import {foo} from \"ModuleAliasFoo\"; var k1: baz = 42; -var k2: baz = "shab"; // Error: string to int +var k2: baz = \"shab\"; // Error: string to int var k3: toz = foo(k1); // works -import type {toz} from "ModuleAliasFoo"; +import type {toz} from \"ModuleAliasFoo\"; var k4: toz = foo(k1); // works ////////////////////////////////////////////////////////// // == Declared Module with exports prop (issue 880) == // //////////////////////////////////////////////////////// -import blah from 'foo'; -import type { Foo, Bar, Id } from 'foo'; +import blah from \'foo\'; +import type { Foo, Bar, Id } from \'foo\'; blah(0, 0); @@ -28,7 +28,7 @@ blah(0, 0); (3 : Bar); // error : number ~> A -("lol" : Id); // error : string ~> number +(\"lol\" : Id); // error : string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow @@ -45,18 +45,18 @@ blah(0, 0); // error : {toz : number} ~> string // error : number ~> A // error : string ~> number -import type { baz } from "ModuleAliasFoo"; -import { foo } from "ModuleAliasFoo"; +import type { baz } from \"ModuleAliasFoo\"; +import { foo } from \"ModuleAliasFoo\"; var k1: baz = 42; -var k2: baz = "shab"; +var k2: baz = \"shab\"; var k3: toz = foo(k1); -import type { toz } from "ModuleAliasFoo"; +import type { toz } from \"ModuleAliasFoo\"; var k4: toz = foo(k1); -import blah from "foo"; -import type { Foo, Bar, Id } from "foo"; +import blah from \"foo\"; +import type { Foo, Bar, Id } from \"foo\"; blah(0, 0); ({ toz: 3 }: Foo); (3: Bar); -("lol": Id); +(\"lol\": Id); " `; diff --git a/tests/demo/2/__snapshots__/jsfmt.spec.js.snap b/tests/demo/2/__snapshots__/jsfmt.spec.js.snap index ac8f8bcb..d62a8fbb 100644 --- a/tests/demo/2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/demo/2/__snapshots__/jsfmt.spec.js.snap @@ -43,11 +43,11 @@ module.exports = A; `; exports[`test B.js 1`] = ` -"var A = require('Demo'); +"var A = require(\'Demo\'); -var z = new A("42").getX(); +var z = new A(\"42\").getX(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var A = require("Demo"); -var z = new A("42").getX(); +var A = require(\"Demo\"); +var z = new A(\"42\").getX(); " `; diff --git a/tests/deps/__snapshots__/jsfmt.spec.js.snap b/tests/deps/__snapshots__/jsfmt.spec.js.snap index 05ac5e35..70f5644e 100644 --- a/tests/deps/__snapshots__/jsfmt.spec.js.snap +++ b/tests/deps/__snapshots__/jsfmt.spec.js.snap @@ -1,41 +1,41 @@ exports[`test A.js 1`] = ` -"require('./C'); +"require(\'./C\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require("./C"); +require(\"./C\"); " `; exports[`test B.js 1`] = ` -"require('./C'); +"require(\'./C\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require("./C"); +require(\"./C\"); " `; exports[`test C.js 1`] = ` -"require('./D'); -require('./E'); -require('./F'); -require('./G'); +"require(\'./D\'); +require(\'./E\'); +require(\'./F\'); +require(\'./G\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require("./D"); -require("./E"); -require("./F"); -require("./G"); +require(\"./D\"); +require(\"./E\"); +require(\"./F\"); +require(\"./G\"); " `; exports[`test D.js 1`] = ` -"require('./I'); +"require(\'./I\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require("./I"); +require(\"./I\"); " `; exports[`test E.js 1`] = ` -"require('./I'); +"require(\'./I\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require("./I"); +require(\"./I\"); " `; @@ -48,9 +48,9 @@ exports[`test F.js 1`] = ` `; exports[`test G.js 1`] = ` -"require('./H'); +"require(\'./H\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require("./H"); +require(\"./H\"); " `; @@ -63,8 +63,8 @@ exports[`test H.js 1`] = ` `; exports[`test I.js 1`] = ` -"require('./A'); +"require(\'./A\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require("./A"); +require(\"./A\"); " `; diff --git a/tests/docblock_flow/__snapshots__/jsfmt.spec.js.snap b/tests/docblock_flow/__snapshots__/jsfmt.spec.js.snap index dec99708..205f3c27 100644 --- a/tests/docblock_flow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/docblock_flow/__snapshots__/jsfmt.spec.js.snap @@ -2,12 +2,12 @@ exports[`test license_with_flow.js 1`] = ` "/* Copyright example */ /* @flow */ -("": void); // error +(\"\": void); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* Copyright example */ /* @flow */ // error -("": void); +(\"\": void); " `; @@ -94,36 +94,36 @@ exports[`test multiple_providesModule_2.js 1`] = ` `; exports[`test use_strict_with_flow.js 1`] = ` -""use strict"; +"\"use strict\"; /* @flow */ -("": void); // error +(\"\": void); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // error -"use strict"; -("": void); +\"use strict\"; +(\"\": void); " `; exports[`test with_flow.js 1`] = ` "/* @flow */ -("": void); // error +(\"\": void); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // error -("": void); +(\"\": void); " `; exports[`test without_flow.js 1`] = ` "/* some other comment */ -("": void); // no error +(\"\": void); // no error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* some other comment */ // no error -("": void); +(\"\": void); " `; diff --git a/tests/dom/__snapshots__/jsfmt.spec.js.snap b/tests/dom/__snapshots__/jsfmt.spec.js.snap index 3fd4f9e8..f62e8cbb 100644 --- a/tests/dom/__snapshots__/jsfmt.spec.js.snap +++ b/tests/dom/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ let tests = [ // moveTo function(ctx: CanvasRenderingContext2D) { - ctx.moveTo('0', '1'); // error: should be numbers + ctx.moveTo(\'0\', \'1\'); // error: should be numbers }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -22,7 +22,7 @@ let tests = [ ctx.fillRect(0, 0, 200, 100); }, function(ctx: CanvasRenderingContext2D) { - ctx.moveTo("0", "1"); + ctx.moveTo(\"0\", \"1\"); } ]; " @@ -34,8 +34,8 @@ exports[`test CustomEvent.js 1`] = ` let tests = [ // CustomEvent function(document: Document) { - const event = document.createEvent('CustomEvent'); - event.initCustomEvent('butts', true, false, { nice: 42 }); + const event = document.createEvent(\'CustomEvent\'); + event.initCustomEvent(\'butts\', true, false, { nice: 42 }); } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -43,8 +43,8 @@ let tests = [ // CustomEvent let tests = [ function(document: Document) { - const event = document.createEvent("CustomEvent"); - event.initCustomEvent("butts", true, false, { nice: 42 }); + const event = document.createEvent(\"CustomEvent\"); + event.initCustomEvent(\"butts\", true, false, { nice: 42 }); } ]; " @@ -56,10 +56,10 @@ exports[`test Document.js 1`] = ` let tests = [ // createElement function(document: Document) { - (document.createElement('canvas'): HTMLCanvasElement); - (document.createElement('link'): HTMLLinkElement); - (document.createElement('option'): HTMLOptionElement); - (document.createElement('select'): HTMLSelectElement); + (document.createElement(\'canvas\'): HTMLCanvasElement); + (document.createElement(\'link\'): HTMLLinkElement); + (document.createElement(\'option\'): HTMLOptionElement); + (document.createElement(\'select\'): HTMLSelectElement); } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -67,10 +67,10 @@ let tests = [ // createElement let tests = [ function(document: Document) { - (document.createElement("canvas"): HTMLCanvasElement); - (document.createElement("link"): HTMLLinkElement); - (document.createElement("option"): HTMLOptionElement); - (document.createElement("select"): HTMLSelectElement); + (document.createElement(\"canvas\"): HTMLCanvasElement); + (document.createElement(\"link\"): HTMLLinkElement); + (document.createElement(\"option\"): HTMLOptionElement); + (document.createElement(\"select\"): HTMLSelectElement); } ]; " @@ -85,13 +85,13 @@ let tests = [ element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({}); - element.scrollIntoView({ behavior: 'smooth', block: 'end' }); - element.scrollIntoView({ block: 'end' }); - element.scrollIntoView({ behavior: 'smooth' }); + element.scrollIntoView({ behavior: \'smooth\', block: \'end\' }); + element.scrollIntoView({ block: \'end\' }); + element.scrollIntoView({ behavior: \'smooth\' }); // fails - element.scrollIntoView({ behavior: 'invalid' }); - element.scrollIntoView({ block: 'invalid' }); + element.scrollIntoView({ behavior: \'invalid\' }); + element.scrollIntoView({ block: \'invalid\' }); element.scrollIntoView(1); } ]; @@ -104,11 +104,11 @@ let tests = [ element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({}); - element.scrollIntoView({ behavior: "smooth", block: "end" }); - element.scrollIntoView({ block: "end" }); - element.scrollIntoView({ behavior: "smooth" }); - element.scrollIntoView({ behavior: "invalid" }); - element.scrollIntoView({ block: "invalid" }); + element.scrollIntoView({ behavior: \"smooth\", block: \"end\" }); + element.scrollIntoView({ block: \"end\" }); + element.scrollIntoView({ behavior: \"smooth\" }); + element.scrollIntoView({ behavior: \"invalid\" }); + element.scrollIntoView({ block: \"invalid\" }); element.scrollIntoView(1); } ]; @@ -121,7 +121,7 @@ exports[`test HTMLCanvasElement.js 1`] = ` let tests = [ // getContext function(el: HTMLCanvasElement) { - (el.getContext('2d'): ?CanvasRenderingContext2D); + (el.getContext(\'2d\'): ?CanvasRenderingContext2D); } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -129,7 +129,7 @@ let tests = [ // getContext let tests = [ function(el: HTMLCanvasElement) { - (el.getContext("2d"): ?CanvasRenderingContext2D); + (el.getContext(\"2d\"): ?CanvasRenderingContext2D); } ]; " @@ -144,13 +144,13 @@ let tests = [ element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({}); - element.scrollIntoView({ behavior: 'smooth', block: 'end' }); - element.scrollIntoView({ block: 'end' }); - element.scrollIntoView({ behavior: 'smooth' }); + element.scrollIntoView({ behavior: \'smooth\', block: \'end\' }); + element.scrollIntoView({ block: \'end\' }); + element.scrollIntoView({ behavior: \'smooth\' }); // fails - element.scrollIntoView({ behavior: 'invalid' }); - element.scrollIntoView({ block: 'invalid' }); + element.scrollIntoView({ behavior: \'invalid\' }); + element.scrollIntoView({ block: \'invalid\' }); element.scrollIntoView(1); } ]; @@ -163,11 +163,11 @@ let tests = [ element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({}); - element.scrollIntoView({ behavior: "smooth", block: "end" }); - element.scrollIntoView({ block: "end" }); - element.scrollIntoView({ behavior: "smooth" }); - element.scrollIntoView({ behavior: "invalid" }); - element.scrollIntoView({ block: "invalid" }); + element.scrollIntoView({ behavior: \"smooth\", block: \"end\" }); + element.scrollIntoView({ block: \"end\" }); + element.scrollIntoView({ behavior: \"smooth\" }); + element.scrollIntoView({ behavior: \"invalid\" }); + element.scrollIntoView({ block: \"invalid\" }); element.scrollIntoView(1); } ]; @@ -180,11 +180,11 @@ exports[`test HTMLInputElement.js 1`] = ` let tests = [ // setRangeText function(el: HTMLInputElement) { - el.setRangeText('foo'); - el.setRangeText('foo', 123); // end is required - el.setRangeText('foo', 123, 234); - el.setRangeText('foo', 123, 234, 'select'); - el.setRangeText('foo', 123, 234, 'bogus'); // invalid value + el.setRangeText(\'foo\'); + el.setRangeText(\'foo\', 123); // end is required + el.setRangeText(\'foo\', 123, 234); + el.setRangeText(\'foo\', 123, 234, \'select\'); + el.setRangeText(\'foo\', 123, 234, \'bogus\'); // invalid value } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -194,11 +194,11 @@ let tests = [ // invalid value let tests = [ function(el: HTMLInputElement) { - el.setRangeText("foo"); - el.setRangeText("foo", 123); - el.setRangeText("foo", 123, 234); - el.setRangeText("foo", 123, 234, "select"); - el.setRangeText("foo", 123, 234, "bogus"); + el.setRangeText(\"foo\"); + el.setRangeText(\"foo\", 123); + el.setRangeText(\"foo\", 123, 234); + el.setRangeText(\"foo\", 123, 234, \"select\"); + el.setRangeText(\"foo\", 123, 234, \"bogus\"); } ]; " @@ -207,9 +207,9 @@ let tests = [ exports[`test URL.js 1`] = ` "/* @flow */ -const a = new URL('http://flowtype.org/'); // correct -const b = new URL('/docs', a); // correct -const c = new URL('/docs', 'http://flowtype.org/'); // correct +const a = new URL(\'http://flowtype.org/\'); // correct +const b = new URL(\'/docs\', a); // correct +const c = new URL(\'/docs\', \'http://flowtype.org/\'); // correct const d: URLSearchParams = c.searchParams; // correct const e: string = c.path; // not correct @@ -244,9 +244,9 @@ const r: string = c.username; // correct // correct // correct // correct -const a = new URL("http://flowtype.org/"); -const b = new URL("/docs", a); -const c = new URL("/docs", "http://flowtype.org/"); +const a = new URL(\"http://flowtype.org/\"); +const b = new URL(\"/docs\", a); +const c = new URL(\"/docs\", \"http://flowtype.org/\"); const d: URLSearchParams = c.searchParams; const e: string = c.path; const f: string = c.pathname; @@ -273,15 +273,15 @@ let tests = [ // attachEvent function() { let target = new EventTarget(); - (target.attachEvent('foo', listener): void); // invalid, may be undefined - (target.attachEvent && target.attachEvent('foo', listener): void); // valid + (target.attachEvent(\'foo\', listener): void); // invalid, may be undefined + (target.attachEvent && target.attachEvent(\'foo\', listener): void); // valid }, // detachEvent function() { let target = new EventTarget(); - (target.detachEvent('foo', listener): void); // invalid, may be undefined - (target.detachEvent && target.detachEvent('foo', listener): void); // valid + (target.detachEvent(\'foo\', listener): void); // invalid, may be undefined + (target.detachEvent && target.detachEvent(\'foo\', listener): void); // valid }, function() { @@ -304,13 +304,13 @@ let listener: EventListener = function(event: Event): void { let tests = [ function() { let target = new EventTarget(); - (target.attachEvent("foo", listener): void); - (target.attachEvent && target.attachEvent("foo", listener): void); + (target.attachEvent(\"foo\", listener): void); + (target.attachEvent && target.attachEvent(\"foo\", listener): void); }, function() { let target = new EventTarget(); - (target.detachEvent("foo", listener): void); - (target.detachEvent && target.detachEvent("foo", listener): void); + (target.detachEvent(\"foo\", listener): void); + (target.detachEvent && target.detachEvent(\"foo\", listener): void); }, function() { window.onmessage = (event: MessageEvent) => { @@ -330,7 +330,7 @@ let tests = [ let path = new Path2D(); (path.arcTo(0, 0, 0, 0, 10): void); // valid (path.arcTo(0, 0, 0, 0, 10, 20, 5): void); // valid - (path.arcTo(0, 0, 0, 0, 10, '20', 5): void); // invalid + (path.arcTo(0, 0, 0, 0, 10, \'20\', 5): void); // invalid }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -344,7 +344,7 @@ let tests = [ let path = new Path2D(); (path.arcTo(0, 0, 0, 0, 10): void); (path.arcTo(0, 0, 0, 0, 10, 20, 5): void); - (path.arcTo(0, 0, 0, 0, 10, "20", 5): void); + (path.arcTo(0, 0, 0, 0, 10, \"20\", 5): void); } ]; " @@ -356,7 +356,7 @@ exports[`test registerElement.js 1`] = ` let tests = [ // should work with Object.create() function() { - document.registerElement('custom-element', { + document.registerElement(\'custom-element\', { prototype: Object.create(HTMLElement.prototype, { createdCallback: { value: function createdCallback () { }}, @@ -378,7 +378,7 @@ let tests = [ }, // or with Object.assign() function() { - document.registerElement('custom-element', { + document.registerElement(\'custom-element\', { prototype: Object.assign(Object.create(HTMLElement.prototype), { createdCallback () { }, @@ -398,7 +398,7 @@ let tests = [ }, // should complain about invalid callback parameters function() { - document.registerElement('custom-element', { + document.registerElement(\'custom-element\', { prototype: { attributeChangedCallback( localName: string, @@ -419,7 +419,7 @@ let tests = [ let tests = [ function() { document.registerElement( - "custom-element", + \"custom-element\", { prototype: Object.create( HTMLElement.prototype, @@ -456,7 +456,7 @@ let tests = [ }, function() { document.registerElement( - "custom-element", + \"custom-element\", { prototype: Object.assign( Object.create(HTMLElement.prototype), @@ -483,7 +483,7 @@ let tests = [ }, function() { document.registerElement( - "custom-element", + \"custom-element\", { prototype: { attributeChangedCallback(localName: string, @@ -683,16 +683,16 @@ let tests = [ // NodeFilterInterface function() { document.createNodeIterator(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid - document.createNodeIterator(document.body, -1, node => 'accept'); // invalid + document.createNodeIterator(document.body, -1, node => \'accept\'); // invalid document.createNodeIterator(document.body, -1, { accept: node => NodeFilter.FILTER_ACCEPT }); // valid - document.createNodeIterator(document.body, -1, { accept: node => 'accept' }); // invalid + document.createNodeIterator(document.body, -1, { accept: node => \'accept\' }); // invalid document.createNodeIterator(document.body, -1, {}); // invalid }, function() { document.createTreeWalker(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid - document.createTreeWalker(document.body, -1, node => 'accept'); // invalid + document.createTreeWalker(document.body, -1, node => \'accept\'); // invalid document.createTreeWalker(document.body, -1, { accept: node => NodeFilter.FILTER_ACCEPT }); // valid - document.createTreeWalker(document.body, -1, { accept: node => 'accept' }); // invalid + document.createTreeWalker(document.body, -1, { accept: node => \'accept\' }); // invalid document.createTreeWalker(document.body, -1, {}); // invalid }, ]; @@ -897,7 +897,7 @@ let tests = [ -1, node => NodeFilter.FILTER_ACCEPT ); - document.createNodeIterator(document.body, -1, node => "accept"); + document.createNodeIterator(document.body, -1, node => \"accept\"); document.createNodeIterator( document.body, -1, @@ -906,7 +906,7 @@ let tests = [ document.createNodeIterator( document.body, -1, - { accept: node => "accept" } + { accept: node => \"accept\" } ); document.createNodeIterator(document.body, -1, {}); }, @@ -916,13 +916,13 @@ let tests = [ -1, node => NodeFilter.FILTER_ACCEPT ); - document.createTreeWalker(document.body, -1, node => "accept"); + document.createTreeWalker(document.body, -1, node => \"accept\"); document.createTreeWalker( document.body, -1, { accept: node => NodeFilter.FILTER_ACCEPT } ); - document.createTreeWalker(document.body, -1, { accept: node => "accept" }); + document.createTreeWalker(document.body, -1, { accept: node => \"accept\" }); document.createTreeWalker(document.body, -1, {}); } ]; diff --git a/tests/dump-types/__snapshots__/jsfmt.spec.js.snap b/tests/dump-types/__snapshots__/jsfmt.spec.js.snap index 38fd1a02..089688f9 100644 --- a/tests/dump-types/__snapshots__/jsfmt.spec.js.snap +++ b/tests/dump-types/__snapshots__/jsfmt.spec.js.snap @@ -17,7 +17,7 @@ module.exports = num; exports[`test test.js 1`] = ` "// @flow -var num = require('./import'); +var num = require(\'./import\'); function foo(x) { } foo(0); var a:string = num; @@ -40,7 +40,7 @@ const idxResult = idx(obj, obj => obj.a.b.c.d); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // test deduping of inferred types -var num = require("./import"); +var num = require(\"./import\"); function foo(x) { } diff --git a/tests/encaps/__snapshots__/jsfmt.spec.js.snap b/tests/encaps/__snapshots__/jsfmt.spec.js.snap index c25e009d..425186a3 100644 --- a/tests/encaps/__snapshots__/jsfmt.spec.js.snap +++ b/tests/encaps/__snapshots__/jsfmt.spec.js.snap @@ -10,7 +10,7 @@ function tag(strings,...values) { var s2 = tag \`l\${42}r\`; function tag2(strings,...values) { - return { foo: "" }; // ok: tagged templates can return whatever + return { foo: \"\" }; // ok: tagged templates can return whatever } var s3 = tag2 \`la la la\`; @@ -29,7 +29,7 @@ function tag(strings, ...values) { } var s2 = tag\`l\${42}r\`; function tag2(strings, ...values) { - return { foo: "" }; + return { foo: \"\" }; } var s3 = tag2\`la la la\`; (s3.foo: number); diff --git a/tests/enumerror/__snapshots__/jsfmt.spec.js.snap b/tests/enumerror/__snapshots__/jsfmt.spec.js.snap index 6b348d0e..182ea2b4 100644 --- a/tests/enumerror/__snapshots__/jsfmt.spec.js.snap +++ b/tests/enumerror/__snapshots__/jsfmt.spec.js.snap @@ -6,22 +6,22 @@ function isActive(ad: {state: $Keys<{ ACTIVE: string; DELETED: string; }>}): boolean { - return ad.state === 'ACTIVE'; + return ad.state === \'ACTIVE\'; }; -isActive({state: 'PAUSE'}); +isActive({state: \'PAUSE\'}); var MyStates = { - PAUSED: 'PAUSED', - ACTIVE: 'ACTIVE', - DELETED: 'DELETED', + PAUSED: \'PAUSED\', + ACTIVE: \'ACTIVE\', + DELETED: \'DELETED\', }; function isActive2(ad: {state: $Keys}): boolean { return ad.state === MyStates.ACTIVE; }; -isActive2({state: 'PAUSE'}); +isActive2({state: \'PAUSE\'}); type Keys = $Keys<{ x: any, y: any }>; -type Union = "x" | "y" +type Union = \"x\" | \"y\" function keys2union(s: Keys): Union { return s; } // ok function union2keys(s: Union): Keys { return s; } // ok @@ -32,16 +32,16 @@ function union2keys(s: Union): Keys { return s; } // ok function isActive( ad: { state: $Keys<{ PAUSED: string; ACTIVE: string; DELETED: string }> } ): boolean { - return ad.state === "ACTIVE"; + return ad.state === \"ACTIVE\"; } -isActive({ state: "PAUSE" }); -var MyStates = { PAUSED: "PAUSED", ACTIVE: "ACTIVE", DELETED: "DELETED" }; +isActive({ state: \"PAUSE\" }); +var MyStates = { PAUSED: \"PAUSED\", ACTIVE: \"ACTIVE\", DELETED: \"DELETED\" }; function isActive2(ad: { state: $Keys }): boolean { return ad.state === MyStates.ACTIVE; } -isActive2({ state: "PAUSE" }); +isActive2({ state: \"PAUSE\" }); type Keys = $Keys<{ x: any; y: any }>; -type Union = "x" | "y"; +type Union = \"x\" | \"y\"; function keys2union(s: Keys): Union { return s; } diff --git a/tests/equals/__snapshots__/jsfmt.spec.js.snap b/tests/equals/__snapshots__/jsfmt.spec.js.snap index 756fac15..8830a42a 100644 --- a/tests/equals/__snapshots__/jsfmt.spec.js.snap +++ b/tests/equals/__snapshots__/jsfmt.spec.js.snap @@ -2,11 +2,11 @@ exports[`test equals.js 1`] = ` "/* @flow */ (1 == 1); -("foo" == "bar"); +(\"foo\" == \"bar\"); (1 == null); (null == 1); -(1 == ""); // error -("" == 1); // error +(1 == \"\"); // error +(\"\" == 1); // error var x = (null : ?number); (x == 1); @@ -16,11 +16,11 @@ var x = (null : ?number); // error // error 1 == 1; -"foo" == "bar"; +\"foo\" == \"bar\"; 1 == null; null == 1; -1 == ""; -"" == 1; +1 == \"\"; +\"\" == 1; var x = (null: ?number); x == 1; 1 == x; diff --git a/tests/error_messages/__snapshots__/jsfmt.spec.js.snap b/tests/error_messages/__snapshots__/jsfmt.spec.js.snap index 46f2d0b1..a2250ec3 100644 --- a/tests/error_messages/__snapshots__/jsfmt.spec.js.snap +++ b/tests/error_messages/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test errors.js 1`] = ` -"if (typeof define === 'function' && define.amd) { } +"if (typeof define === \'function\' && define.amd) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -if (typeof define === "function" && define.amd) { +if (typeof define === \"function\" && define.amd) { } " diff --git a/tests/es6modules/__snapshots__/jsfmt.spec.js.snap b/tests/es6modules/__snapshots__/jsfmt.spec.js.snap index cc7923ae..ab879755 100644 --- a/tests/es6modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/es6modules/__snapshots__/jsfmt.spec.js.snap @@ -303,11 +303,11 @@ exports[`test ES6_DefaultAndNamed.js 1`] = ` "/* @flow */ export default 42; -export var str = 'asdf'; +export var str = \'asdf\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ export default 42 -export var str = "asdf"; +export var str = \"asdf\"; " `; @@ -317,13 +317,13 @@ exports[`test ES6_ExportAllFrom_Intermediary1.js 1`] = ` * @flow */ -export * from "ES6_ExportAllFrom_Source1"; +export * from \"ES6_ExportAllFrom_Source1\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportAllFrom_Intermediary1 * @flow */ -export * from "ES6_ExportAllFrom_Source1" +export * from \"ES6_ExportAllFrom_Source1\" " `; @@ -333,13 +333,13 @@ exports[`test ES6_ExportAllFrom_Intermediary2.js 1`] = ` * @flow */ -export * from "ES6_ExportAllFrom_Source2"; +export * from \"ES6_ExportAllFrom_Source2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportAllFrom_Intermediary2 * @flow */ -export * from "ES6_ExportAllFrom_Source2" +export * from \"ES6_ExportAllFrom_Source2\" " `; @@ -378,12 +378,12 @@ export var numberValue2 = 1; exports[`test ES6_ExportAllFromMulti.js 1`] = ` "// @flow -export * from "./ES6_ExportAllFrom_Source1"; -export * from "./ES6_ExportAllFrom_Source2"; +export * from \"./ES6_ExportAllFrom_Source1\"; +export * from \"./ES6_ExportAllFrom_Source2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export * from "./ES6_ExportAllFrom_Source1" -export * from "./ES6_ExportAllFrom_Source2" +export * from \"./ES6_ExportAllFrom_Source1\" +export * from \"./ES6_ExportAllFrom_Source2\" " `; @@ -396,13 +396,13 @@ exports[`test ES6_ExportFrom_Intermediary1.js 1`] = ` export { numberValue1, numberValue2 as numberValue2_renamed -} from "ES6_ExportFrom_Source1"; +} from \"ES6_ExportFrom_Source1\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary1 * @flow */ -export { numberValue1, numberValue2 as numberValue2_renamed } from "ES6_ExportFrom_Source1" +export { numberValue1, numberValue2 as numberValue2_renamed } from \"ES6_ExportFrom_Source1\" " `; @@ -415,13 +415,13 @@ exports[`test ES6_ExportFrom_Intermediary2.js 1`] = ` export { numberValue1, numberValue2 as numberValue2_renamed2 -} from "ES6_ExportFrom_Source2"; +} from \"ES6_ExportFrom_Source2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary2 * @flow */ -export { numberValue1, numberValue2 as numberValue2_renamed2 } from "ES6_ExportFrom_Source2" +export { numberValue1, numberValue2 as numberValue2_renamed2 } from \"ES6_ExportFrom_Source2\" " `; @@ -575,7 +575,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = "str"; +exports.stringValue = \"str\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule A @@ -585,7 +585,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = "str"; +exports.stringValue = \"str\"; " `; @@ -662,44 +662,44 @@ exports[`test es6modules.js 1`] = ` // ===================== // // @providesModule -import * as DefaultA from "A"; +import * as DefaultA from \"A\"; var a1: number = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1; // Error: number ~> string // File path -import * as DefaultB from "./B"; +import * as DefaultB from \"./B\"; var b1: number = DefaultB.numberValue; var b2: string = DefaultB.numberValue; // Error: number ~> string // C.js exists, but not as a providesModule -import DefaultC from "C"; // Error: No such module +import DefaultC from \"C\"; // Error: No such module // @providesModule D exists, but not as a filename -import DefaultD from "./D"; // Error: No such module +import DefaultD from \"./D\"; // Error: No such module // ================================================ // // == CommonJS Clobbering Literal Exports -> ES6 == // // ================================================ // -import {doesntExist1} from "CommonJS_Clobbering_Lit"; // Error: Not an exported binding +import {doesntExist1} from \"CommonJS_Clobbering_Lit\"; // Error: Not an exported binding -import {numberValue1} from "CommonJS_Clobbering_Lit"; +import {numberValue1} from \"CommonJS_Clobbering_Lit\"; var c1: number = numberValue1; var c2: string = numberValue1; // Error: number ~> string -import {numberValue2 as numVal1} from "CommonJS_Clobbering_Lit"; +import {numberValue2 as numVal1} from \"CommonJS_Clobbering_Lit\"; var d1: number = numVal1; var d2: string = numVal1; // Error: number ~> string -import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit"; +import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\"; var e1: number = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3; // Error: number ~> string -CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn't a property +CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn\'t a property -import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit"; +import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\"; var f1: number = CJS_Clobb_Lit_NS.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; -CJS_Clobb_Lit_NS.default.default; // Error: No 'default' property on the exported obj +CJS_Clobb_Lit_NS.default.default; // Error: No \'default\' property on the exported obj var f3: string = CJS_Clobb_Lit_NS.numberValue4; // Error: number ~> string var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> string @@ -707,15 +707,15 @@ var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> stri // == CommonJS Clobbering Class Exports -> ES6 == // // ============================================== // -import {doesntExist2} from "CommonJS_Clobbering_Class"; // Error: Not an exported binding +import {doesntExist2} from \"CommonJS_Clobbering_Class\"; // Error: Not an exported binding // The following import should error because class statics are not turned into // named exports for now. This avoids complexities with polymorphic static // members (where the polymophism is defined on the class itself rather than the // method). -import {staticNumber1, baseProp, childProp} from "CommonJS_Clobbering_Class"; // Error +import {staticNumber1, baseProp, childProp} from \"CommonJS_Clobbering_Class\"; // Error -import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; +import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\"; new CJS_Clobb_Class(); new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property var h1: number = CJS_Clobb_Class.staticNumber2(); @@ -723,8 +723,8 @@ var h2: string = CJS_Clobb_Class.staticNumber2(); // Error: number ~> string var h3: number = new CJS_Clobb_Class().instNumber1(); var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string -import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class"; -new CJS_Clobb_Class_NS(); // Error: Namespace object isn't constructable +import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\"; +new CJS_Clobb_Class_NS(); // Error: Namespace object isn\'t constructable var i1: number = CJS_Clobb_Class_NS.staticNumber3(); // Error: Class statics not copied to Namespace object var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: number ~> string @@ -733,22 +733,22 @@ var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: numbe // == CommonJS Named Exports -> ES6 == // // =================================== // -import {doesntExist3} from "CommonJS_Named"; // Error: Not an exported binding +import {doesntExist3} from \"CommonJS_Named\"; // Error: Not an exported binding -import {numberValue2} from "CommonJS_Named"; +import {numberValue2} from \"CommonJS_Named\"; var j1: number = numberValue2; var j2: string = numberValue2; // Error: number ~> string -import {numberValue3 as numVal3} from "CommonJS_Named"; +import {numberValue3 as numVal3} from \"CommonJS_Named\"; var k1: number = numVal3; var k2: string = numVal3; // Error: number ~> string -import * as CJS_Named from "CommonJS_Named"; +import * as CJS_Named from \"CommonJS_Named\"; var l1: number = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1; // Error: number ~> string -CJS_Named.doesntExist; // Error: doesntExist isn't a property +CJS_Named.doesntExist; // Error: doesntExist isn\'t a property -import * as CJS_Named_NS from "CommonJS_Named"; +import * as CJS_Named_NS from \"CommonJS_Named\"; var m1: number = CJS_Named_NS.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4; // Error: CommonJS_Named has no default export var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string @@ -757,21 +757,21 @@ var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string // == ES6 Default -> ES6 == // ////////////////////////////// -import {doesntExist4} from "ES6_Default_AnonFunction1"; // Error: Not an exported binding +import {doesntExist4} from \"ES6_Default_AnonFunction1\"; // Error: Not an exported binding -import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; +import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\"; var n1: number = ES6_Def_AnonFunc1(); var n2: string = ES6_Def_AnonFunc1(); // Error: number ~> string -import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1"; +import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\"; var o1: number = ES6_Def_NamedFunc1(); var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string -import ES6_Def_AnonClass1 from "ES6_Default_AnonClass1"; +import ES6_Def_AnonClass1 from \"ES6_Default_AnonClass1\"; var p1: number = new ES6_Def_AnonClass1().givesANum(); var p2: string = new ES6_Def_AnonClass1().givesANum(); // Error: number ~> string -import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1"; +import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\"; var q1: number = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> string @@ -779,57 +779,57 @@ var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> stri // == ES6 Named -> ES6 == // //////////////////////////// -import doesntExist5 from "ES6_Named1"; // Error: Not an exported binding +import doesntExist5 from \"ES6_Named1\"; // Error: Not an exported binding -import {specifierNumber1 as specifierNumber1_1} from "ES6_Named1"; +import {specifierNumber1 as specifierNumber1_1} from \"ES6_Named1\"; var r1: number = specifierNumber1_1; var r2: string = specifierNumber1_1; // Error: number ~> string -import {specifierNumber2Renamed} from "ES6_Named1"; +import {specifierNumber2Renamed} from \"ES6_Named1\"; var s1: number = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed; // Error: number ~> string -import {specifierNumber3 as specifierNumber3Renamed} from "ES6_Named1"; +import {specifierNumber3 as specifierNumber3Renamed} from \"ES6_Named1\"; var t1: number = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed; // Error: number ~> string -import {groupedSpecifierNumber1, groupedSpecifierNumber2} from "ES6_Named1"; +import {groupedSpecifierNumber1, groupedSpecifierNumber2} from \"ES6_Named1\"; var u1: number = groupedSpecifierNumber1; var u2: number = groupedSpecifierNumber2; var u3: string = groupedSpecifierNumber1; // Error: number ~> string var u4: string = groupedSpecifierNumber2; // Error: number ~> string -import {givesANumber} from "ES6_Named1"; +import {givesANumber} from \"ES6_Named1\"; var v1: number = givesANumber(); var v2: string = givesANumber(); // Error: number ~> string -import {NumberGenerator} from "ES6_Named1"; +import {NumberGenerator} from \"ES6_Named1\"; var w1: number = new NumberGenerator().givesANumber(); var w2: string = new NumberGenerator().givesANumber(); // Error: number ~> string -import {varDeclNumber1, varDeclNumber2} from "ES6_Named1"; +import {varDeclNumber1, varDeclNumber2} from \"ES6_Named1\"; var x1: number = varDeclNumber1; var x2: number = varDeclNumber2; var x3: string = varDeclNumber1; // Error: number ~> string var x4: string = varDeclNumber2; // Error: number ~> string -import {destructuredObjNumber} from "ES6_Named1"; +import {destructuredObjNumber} from \"ES6_Named1\"; var y1: number = destructuredObjNumber; var y2: string = destructuredObjNumber; // Error: number ~> string -import {destructuredArrNumber} from "ES6_Named1"; +import {destructuredArrNumber} from \"ES6_Named1\"; var z1: number = destructuredArrNumber; var z2: string = destructuredArrNumber; // Error: number ~> string -import {numberValue1 as numberValue4} from "ES6_ExportFrom_Intermediary1"; +import {numberValue1 as numberValue4} from \"ES6_ExportFrom_Intermediary1\"; var aa1: number = numberValue4; var aa2: string = numberValue4; // Error: number ~> string -import {numberValue2_renamed} from "ES6_ExportFrom_Intermediary1"; +import {numberValue2_renamed} from \"ES6_ExportFrom_Intermediary1\"; var ab1: number = numberValue2_renamed; var ab2: string = numberValue2_renamed; // Error: number ~> string -import {numberValue1 as numberValue5} from "ES6_ExportAllFrom_Intermediary1"; +import {numberValue1 as numberValue5} from \"ES6_ExportAllFrom_Intermediary1\"; var ac1: number = numberValue5; var ac2: string = numberValue5; // Error: number ~> string @@ -837,21 +837,21 @@ var ac2: string = numberValue5; // Error: number ~> string // == ES6 Default -> CommonJS == // /////////////////////////////////// -require('ES6_Default_AnonFunction2').doesntExist; // Error: 'doesntExist' isn't an export +require(\'ES6_Default_AnonFunction2\').doesntExist; // Error: \'doesntExist\' isn\'t an export -var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default; +var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default; var ad1: number = ES6_Def_AnonFunc2(); var ad2: string = ES6_Def_AnonFunc2(); // Error: number ~> string -var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default; +var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default; var ae1: number = ES6_Def_NamedFunc2(); var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string -var ES6_Def_AnonClass2 = require("ES6_Default_AnonClass2").default; +var ES6_Def_AnonClass2 = require(\"ES6_Default_AnonClass2\").default; var af1: number = new ES6_Def_AnonClass2().givesANum(); var af2: string = new ES6_Def_AnonClass2().givesANum(); // Error: number ~> string -var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default; +var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default; var ag1: number = new ES6_Def_NamedClass2().givesANum(); var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> string @@ -859,53 +859,53 @@ var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> str // == ES6 Named -> CommonJS == // ///////////////////////////////// -var specifierNumber4 = require("ES6_Named2").specifierNumber4; +var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4; var ah1: number = specifierNumber4; var ah2: string = specifierNumber4; // Error: number ~> string -var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; +var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed; // Error: number ~> string -var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; -var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; +var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3; +var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4; var aj1: number = groupedSpecifierNumber3; var aj2: number = groupedSpecifierNumber4; var aj3: string = groupedSpecifierNumber3; // Error: number ~> string var aj4: string = groupedSpecifierNumber4; // Error: number ~> string -var givesANumber2 = require("ES6_Named2").givesANumber2; +var givesANumber2 = require(\"ES6_Named2\").givesANumber2; var ak1: number = givesANumber2(); var ak2: string = givesANumber2(); // Error: number ~> string -var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; +var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2; var al1: number = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string -var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; -var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; +var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3; +var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4; var am1: number = varDeclNumber3; var am2: number = varDeclNumber4; var am3: string = varDeclNumber3; // Error: number ~> string var am4: string = varDeclNumber4; // Error: number ~> string -var destructuredObjNumber2 = require("ES6_Named2").destructuredObjNumber2; +var destructuredObjNumber2 = require(\"ES6_Named2\").destructuredObjNumber2; var an1: number = destructuredObjNumber2; var an2: string = destructuredObjNumber2; // Error: number ~> string -var destructuredArrNumber2 = require("ES6_Named2").destructuredArrNumber2; +var destructuredArrNumber2 = require(\"ES6_Named2\").destructuredArrNumber2; var ao1: number = destructuredArrNumber2; var ao2: string = destructuredArrNumber2; // Error: number ~> string -var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; +var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1; var ap1: number = numberValue6; var ap2: string = numberValue6; // Error: number ~> string -var numberValue2_renamed2 = require("ES6_ExportFrom_Intermediary2").numberValue2_renamed2; +var numberValue2_renamed2 = require(\"ES6_ExportFrom_Intermediary2\").numberValue2_renamed2; var aq1: number = numberValue2_renamed2; var aq2: string = numberValue2_renamed2; // Error: number ~> string -var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2; +var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2; var ar1: number = numberValue7; var ar2: string = numberValue7; // Error: number ~> string @@ -913,7 +913,7 @@ var ar2: string = numberValue7; // Error: number ~> string // == ES6 Default+Named -> ES6 import Default+Named== // //////////////////////////////////////////////////////// -import defaultNum, {str as namedStr} from "./ES6_DefaultAndNamed"; +import defaultNum, {str as namedStr} from \"./ES6_DefaultAndNamed\"; var as1: number = defaultNum; var as2: string = defaultNum; // Error: number ~> string @@ -925,13 +925,13 @@ var as4: number = namedStr; // Error: string ~> number // == Side-effect only ES6 imports == // //////////////////////////////////////// -import "./SideEffects"; +import \"./SideEffects\"; ////////////////////////////////////////////// // == Suggest export name on likely typo == // ////////////////////////////////////////////// -import specifierNumber1 from "ES6_Named1"; // Error: Did you mean \`import {specifierNumber1} from ...\`? -import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNumber1\`? +import specifierNumber1 from \"ES6_Named1\"; // Error: Did you mean \`import {specifierNumber1} from ...\`? +import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifierNumber1\`? /////////////////////////////////////////////////// // == Multi \`export *\` should combine exports == // @@ -939,7 +939,7 @@ import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNu import { numberValue1 as numberValue8, numberValue2 as numberValue9 -} from "./ES6_ExportAllFromMulti"; +} from \"./ES6_ExportAllFromMulti\"; var at1: number = numberValue8; var at2: string = numberValue8; // Error: number ~> string @@ -950,7 +950,7 @@ var at4: string = numberValue9; // Error: number ~> string ///////////////////////////////////////////////////////////// // == Vanilla \`import\` cannot import a type-only export == // ///////////////////////////////////////////////////////////// -import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type alias! +import {typeAlias} from \"./ExportType\"; // Error: Cannot vanilla-import a type alias! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // ===================== // @@ -971,8 +971,8 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a // Error: number ~> string // Error: number ~> string // Error: number ~> string -// Error: doesntExist isn't a property -// Error: No 'default' property on the exported obj +// Error: doesntExist isn\'t a property +// Error: No \'default\' property on the exported obj // Error: number ~> string // Error: number ~> string // ============================================== // @@ -987,7 +987,7 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a // Error: Class has no \`doesntExist\` property // Error: number ~> string // Error: number ~> string -// Error: Namespace object isn't constructable +// Error: Namespace object isn\'t constructable // Error: Class statics not copied to Namespace object // Error: number ~> string // =================================== // @@ -997,7 +997,7 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a // Error: number ~> string // Error: number ~> string // Error: number ~> string -// Error: doesntExist isn't a property +// Error: doesntExist isn\'t a property // Error: CommonJS_Named has no default export // Error: number ~> string ////////////////////////////// @@ -1029,7 +1029,7 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a /////////////////////////////////// // == ES6 Default -> CommonJS == // /////////////////////////////////// -// Error: 'doesntExist' isn't an export +// Error: \'doesntExist\' isn\'t an export // Error: number ~> string // Error: number ~> string // Error: number ~> string @@ -1072,182 +1072,182 @@ import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type a // == Vanilla \`import\` cannot import a type-only export == // ///////////////////////////////////////////////////////////// // Error: Cannot vanilla-import a type alias! -import * as DefaultA from "A"; +import * as DefaultA from \"A\"; var a1: number = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1; -import * as DefaultB from "./B"; +import * as DefaultB from \"./B\"; var b1: number = DefaultB.numberValue; var b2: string = DefaultB.numberValue; -import DefaultC from "C"; -import DefaultD from "./D"; -import { doesntExist1 } from "CommonJS_Clobbering_Lit"; -import { numberValue1 } from "CommonJS_Clobbering_Lit"; +import DefaultC from \"C\"; +import DefaultD from \"./D\"; +import { doesntExist1 } from \"CommonJS_Clobbering_Lit\"; +import { numberValue1 } from \"CommonJS_Clobbering_Lit\"; var c1: number = numberValue1; var c2: string = numberValue1; -import { numberValue2 as numVal1 } from "CommonJS_Clobbering_Lit"; +import { numberValue2 as numVal1 } from \"CommonJS_Clobbering_Lit\"; var d1: number = numVal1; var d2: string = numVal1; -import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit"; +import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\"; var e1: number = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3; CJS_Clobb_Lit.doesntExist; -import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit"; +import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\"; var f1: number = CJS_Clobb_Lit_NS.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; CJS_Clobb_Lit_NS.default.default; var f3: string = CJS_Clobb_Lit_NS.numberValue4; var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; -import { doesntExist2 } from "CommonJS_Clobbering_Class"; -import { staticNumber1, baseProp, childProp } from "CommonJS_Clobbering_Class"; -import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; +import { doesntExist2 } from \"CommonJS_Clobbering_Class\"; +import { staticNumber1, baseProp, childProp } from \"CommonJS_Clobbering_Class\"; +import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\"; new CJS_Clobb_Class(); new CJS_Clobb_Class().doesntExist; var h1: number = CJS_Clobb_Class.staticNumber2(); var h2: string = CJS_Clobb_Class.staticNumber2(); var h3: number = new CJS_Clobb_Class().instNumber1(); var h4: string = new CJS_Clobb_Class().instNumber1(); -import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class"; +import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\"; new CJS_Clobb_Class_NS(); var i1: number = CJS_Clobb_Class_NS.staticNumber3(); var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); -import { doesntExist3 } from "CommonJS_Named"; -import { numberValue2 } from "CommonJS_Named"; +import { doesntExist3 } from \"CommonJS_Named\"; +import { numberValue2 } from \"CommonJS_Named\"; var j1: number = numberValue2; var j2: string = numberValue2; -import { numberValue3 as numVal3 } from "CommonJS_Named"; +import { numberValue3 as numVal3 } from \"CommonJS_Named\"; var k1: number = numVal3; var k2: string = numVal3; -import * as CJS_Named from "CommonJS_Named"; +import * as CJS_Named from \"CommonJS_Named\"; var l1: number = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1; CJS_Named.doesntExist; -import * as CJS_Named_NS from "CommonJS_Named"; +import * as CJS_Named_NS from \"CommonJS_Named\"; var m1: number = CJS_Named_NS.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4; var m3: string = CJS_Named_NS.numberValue4; -import { doesntExist4 } from "ES6_Default_AnonFunction1"; -import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; +import { doesntExist4 } from \"ES6_Default_AnonFunction1\"; +import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\"; var n1: number = ES6_Def_AnonFunc1(); var n2: string = ES6_Def_AnonFunc1(); -import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1"; +import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\"; var o1: number = ES6_Def_NamedFunc1(); var o2: string = ES6_Def_NamedFunc1(); -import ES6_Def_AnonClass1 from "ES6_Default_AnonClass1"; +import ES6_Def_AnonClass1 from \"ES6_Default_AnonClass1\"; var p1: number = new ES6_Def_AnonClass1().givesANum(); var p2: string = new ES6_Def_AnonClass1().givesANum(); -import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1"; +import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\"; var q1: number = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum(); -import doesntExist5 from "ES6_Named1"; -import { specifierNumber1 as specifierNumber1_1 } from "ES6_Named1"; +import doesntExist5 from \"ES6_Named1\"; +import { specifierNumber1 as specifierNumber1_1 } from \"ES6_Named1\"; var r1: number = specifierNumber1_1; var r2: string = specifierNumber1_1; -import { specifierNumber2Renamed } from "ES6_Named1"; +import { specifierNumber2Renamed } from \"ES6_Named1\"; var s1: number = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed; -import { specifierNumber3 as specifierNumber3Renamed } from "ES6_Named1"; +import { specifierNumber3 as specifierNumber3Renamed } from \"ES6_Named1\"; var t1: number = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed; -import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from "ES6_Named1"; +import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from \"ES6_Named1\"; var u1: number = groupedSpecifierNumber1; var u2: number = groupedSpecifierNumber2; var u3: string = groupedSpecifierNumber1; var u4: string = groupedSpecifierNumber2; -import { givesANumber } from "ES6_Named1"; +import { givesANumber } from \"ES6_Named1\"; var v1: number = givesANumber(); var v2: string = givesANumber(); -import { NumberGenerator } from "ES6_Named1"; +import { NumberGenerator } from \"ES6_Named1\"; var w1: number = new NumberGenerator().givesANumber(); var w2: string = new NumberGenerator().givesANumber(); -import { varDeclNumber1, varDeclNumber2 } from "ES6_Named1"; +import { varDeclNumber1, varDeclNumber2 } from \"ES6_Named1\"; var x1: number = varDeclNumber1; var x2: number = varDeclNumber2; var x3: string = varDeclNumber1; var x4: string = varDeclNumber2; -import { destructuredObjNumber } from "ES6_Named1"; +import { destructuredObjNumber } from \"ES6_Named1\"; var y1: number = destructuredObjNumber; var y2: string = destructuredObjNumber; -import { destructuredArrNumber } from "ES6_Named1"; +import { destructuredArrNumber } from \"ES6_Named1\"; var z1: number = destructuredArrNumber; var z2: string = destructuredArrNumber; -import { numberValue1 as numberValue4 } from "ES6_ExportFrom_Intermediary1"; +import { numberValue1 as numberValue4 } from \"ES6_ExportFrom_Intermediary1\"; var aa1: number = numberValue4; var aa2: string = numberValue4; -import { numberValue2_renamed } from "ES6_ExportFrom_Intermediary1"; +import { numberValue2_renamed } from \"ES6_ExportFrom_Intermediary1\"; var ab1: number = numberValue2_renamed; var ab2: string = numberValue2_renamed; -import { numberValue1 as numberValue5 } from "ES6_ExportAllFrom_Intermediary1"; +import { numberValue1 as numberValue5 } from \"ES6_ExportAllFrom_Intermediary1\"; var ac1: number = numberValue5; var ac2: string = numberValue5; -require("ES6_Default_AnonFunction2").doesntExist; -var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default; +require(\"ES6_Default_AnonFunction2\").doesntExist; +var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default; var ad1: number = ES6_Def_AnonFunc2(); var ad2: string = ES6_Def_AnonFunc2(); -var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default; +var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default; var ae1: number = ES6_Def_NamedFunc2(); var ae2: string = ES6_Def_NamedFunc2(); -var ES6_Def_AnonClass2 = require("ES6_Default_AnonClass2").default; +var ES6_Def_AnonClass2 = require(\"ES6_Default_AnonClass2\").default; var af1: number = new ES6_Def_AnonClass2().givesANum(); var af2: string = new ES6_Def_AnonClass2().givesANum(); -var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default; +var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default; var ag1: number = new ES6_Def_NamedClass2().givesANum(); var ag2: string = new ES6_Def_NamedClass2().givesANum(); -var specifierNumber4 = require("ES6_Named2").specifierNumber4; +var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4; var ah1: number = specifierNumber4; var ah2: string = specifierNumber4; -var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; +var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed; -var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; -var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; +var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3; +var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4; var aj1: number = groupedSpecifierNumber3; var aj2: number = groupedSpecifierNumber4; var aj3: string = groupedSpecifierNumber3; var aj4: string = groupedSpecifierNumber4; -var givesANumber2 = require("ES6_Named2").givesANumber2; +var givesANumber2 = require(\"ES6_Named2\").givesANumber2; var ak1: number = givesANumber2(); var ak2: string = givesANumber2(); -var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; +var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2; var al1: number = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber(); -var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; -var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; +var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3; +var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4; var am1: number = varDeclNumber3; var am2: number = varDeclNumber4; var am3: string = varDeclNumber3; var am4: string = varDeclNumber4; -var destructuredObjNumber2 = require("ES6_Named2").destructuredObjNumber2; +var destructuredObjNumber2 = require(\"ES6_Named2\").destructuredObjNumber2; var an1: number = destructuredObjNumber2; var an2: string = destructuredObjNumber2; -var destructuredArrNumber2 = require("ES6_Named2").destructuredArrNumber2; +var destructuredArrNumber2 = require(\"ES6_Named2\").destructuredArrNumber2; var ao1: number = destructuredArrNumber2; var ao2: string = destructuredArrNumber2; -var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; +var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1; var ap1: number = numberValue6; var ap2: string = numberValue6; var numberValue2_renamed2 = require( - "ES6_ExportFrom_Intermediary2" + \"ES6_ExportFrom_Intermediary2\" ).numberValue2_renamed2; var aq1: number = numberValue2_renamed2; var aq2: string = numberValue2_renamed2; -var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2; +var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2; var ar1: number = numberValue7; var ar2: string = numberValue7; -import defaultNum, { str as namedStr } from "./ES6_DefaultAndNamed"; +import defaultNum, { str as namedStr } from \"./ES6_DefaultAndNamed\"; var as1: number = defaultNum; var as2: string = defaultNum; var as3: string = namedStr; var as4: number = namedStr; -import "./SideEffects"; -import specifierNumber1 from "ES6_Named1"; -import { specifierNumber } from "ES6_Named1"; -import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from "./ES6_ExportAllFromMulti"; +import \"./SideEffects\"; +import specifierNumber1 from \"ES6_Named1\"; +import { specifierNumber } from \"ES6_Named1\"; +import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from \"./ES6_ExportAllFromMulti\"; var at1: number = numberValue8; var at2: string = numberValue8; var at3: number = numberValue9; var at4: string = numberValue9; -import { typeAlias } from "./ExportType"; +import { typeAlias } from \"./ExportType\"; " `; @@ -1259,27 +1259,27 @@ exports[`test test_imports_are_frozen.js 1`] = ` // // CommonJS module -import * as DefaultA from "A"; +import * as DefaultA from \"A\"; DefaultA.numberValue1 = 123; // Error: DefaultA is frozen // ES6 module -import * as ES6_Named1 from "ES6_Named1"; +import * as ES6_Named1 from \"ES6_Named1\"; ES6_Named1.varDeclNumber1 = 123; // Error: ES6_Named1 is frozen // CommonJS module that clobbers module.exports -import * as CommonJS_Star from "CommonJS_Clobbering_Lit"; +import * as CommonJS_Star from \"CommonJS_Clobbering_Lit\"; CommonJS_Star.numberValue1 = 123; // Error: frozen CommonJS_Star.default.numberValue1 = 123; // ok -import CommonJS_Clobbering_Lit from "CommonJS_Clobbering_Lit"; +import CommonJS_Clobbering_Lit from \"CommonJS_Clobbering_Lit\"; CommonJS_Clobbering_Lit.numberValue1 = 123; // ok // CommonJS module that clobbers module.exports with a frozen object -import * as CommonJS_Frozen_Star from "CommonJS_Clobbering_Frozen"; +import * as CommonJS_Frozen_Star from \"CommonJS_Clobbering_Frozen\"; CommonJS_Frozen_Star.numberValue1 = 123; // Error: frozen CommonJS_Frozen_Star.default.numberValue1 = 123; // Error: frozen -import CommonJS_Clobbering_Frozen from "CommonJS_Clobbering_Frozen"; +import CommonJS_Clobbering_Frozen from \"CommonJS_Clobbering_Frozen\"; CommonJS_Clobbering_Frozen.numberValue1 = 123; // Error: exports are frozen @@ -1289,19 +1289,19 @@ CommonJS_Clobbering_Frozen.numberValue1 = 123; // Error: exports are frozen function testRequires() { // CommonJS module - var DefaultA = require("A"); + var DefaultA = require(\"A\"); DefaultA.numberValue1 = 123; // ok, not frozen by default // ES6 module - var ES6_Named1 = require("ES6_Named1"); + var ES6_Named1 = require(\"ES6_Named1\"); ES6_Named1.numberValue = 123; // error, es6 exports are frozen // CommonJS module that clobbers module.exports - var CommonJS_Star = require("CommonJS_Clobbering_Lit"); + var CommonJS_Star = require(\"CommonJS_Clobbering_Lit\"); CommonJS_Star.numberValue1 = 123; // ok, not frozen by default // CommonJS module that clobbers module.exports with a frozen object - var CommonJS_Frozen_Star = require("CommonJS_Clobbering_Frozen"); + var CommonJS_Frozen_Star = require(\"CommonJS_Clobbering_Frozen\"); CommonJS_Frozen_Star.numberValue1 = 123; // Error: frozen } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1332,28 +1332,28 @@ function testRequires() { // ok, not frozen by default // CommonJS module that clobbers module.exports with a frozen object // Error: frozen -import * as DefaultA from "A"; +import * as DefaultA from \"A\"; DefaultA.numberValue1 = 123; -import * as ES6_Named1 from "ES6_Named1"; +import * as ES6_Named1 from \"ES6_Named1\"; ES6_Named1.varDeclNumber1 = 123; -import * as CommonJS_Star from "CommonJS_Clobbering_Lit"; +import * as CommonJS_Star from \"CommonJS_Clobbering_Lit\"; CommonJS_Star.numberValue1 = 123; CommonJS_Star.default.numberValue1 = 123; -import CommonJS_Clobbering_Lit from "CommonJS_Clobbering_Lit"; +import CommonJS_Clobbering_Lit from \"CommonJS_Clobbering_Lit\"; CommonJS_Clobbering_Lit.numberValue1 = 123; -import * as CommonJS_Frozen_Star from "CommonJS_Clobbering_Frozen"; +import * as CommonJS_Frozen_Star from \"CommonJS_Clobbering_Frozen\"; CommonJS_Frozen_Star.numberValue1 = 123; CommonJS_Frozen_Star.default.numberValue1 = 123; -import CommonJS_Clobbering_Frozen from "CommonJS_Clobbering_Frozen"; +import CommonJS_Clobbering_Frozen from \"CommonJS_Clobbering_Frozen\"; CommonJS_Clobbering_Frozen.numberValue1 = 123; function testRequires() { - var DefaultA = require("A"); + var DefaultA = require(\"A\"); DefaultA.numberValue1 = 123; - var ES6_Named1 = require("ES6_Named1"); + var ES6_Named1 = require(\"ES6_Named1\"); ES6_Named1.numberValue = 123; - var CommonJS_Star = require("CommonJS_Clobbering_Lit"); + var CommonJS_Star = require(\"CommonJS_Clobbering_Lit\"); CommonJS_Star.numberValue1 = 123; - var CommonJS_Frozen_Star = require("CommonJS_Clobbering_Frozen"); + var CommonJS_Frozen_Star = require(\"CommonJS_Clobbering_Frozen\"); CommonJS_Frozen_Star.numberValue1 = 123; } " diff --git a/tests/es_declare_module/__snapshots__/jsfmt.spec.js.snap b/tests/es_declare_module/__snapshots__/jsfmt.spec.js.snap index 5cc373af..ce91e694 100644 --- a/tests/es_declare_module/__snapshots__/jsfmt.spec.js.snap +++ b/tests/es_declare_module/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test es_declare_module.js 1`] = ` "// @flow -import {num1, str1} from "CJS_Named"; -import CJS_Named from "CJS_Named"; +import {num1, str1} from \"CJS_Named\"; +import CJS_Named from \"CJS_Named\"; (num1: number); (num1: string); // Error: number ~> string (str1: string); @@ -10,36 +10,36 @@ import CJS_Named from "CJS_Named"; (CJS_Named: {num1: number, str1: string}); (CJS_Named: number); // Error: Module ~> number -import {num2} from "CJS_Clobbered"; // Error: No such export! -import {numExport} from "CJS_Clobbered"; +import {num2} from \"CJS_Clobbered\"; // Error: No such export! +import {numExport} from \"CJS_Clobbered\"; (numExport: number); (numExport: string); // Error: number ~> string -import type {numType} from "CJS_Clobbered"; +import type {numType} from \"CJS_Clobbered\"; (42: numType); -('asdf': numType); // Error: string ~> number +(\'asdf\': numType); // Error: string ~> number -import {strHidden} from "ES"; // Error: No such export! -import {str3} from "ES"; +import {strHidden} from \"ES\"; // Error: No such export! +import {str3} from \"ES\"; (str3: string); (str3: number); // Error: string ~> number -import {num3} from "ES"; +import {num3} from \"ES\"; (num3: number); (num3: string); // Error: number ~> string -import {C} from "ES"; -import type {C as CType} from "ES"; +import {C} from \"ES\"; +import type {C as CType} from \"ES\"; (new C(): C); (42: C); // Error: number ~> C (new C(): CType); (42: CType); // Error: number ~> CType -import {T} from "ES"; // Error: T is a type import, not a value -import type {T as T2} from "ES"; +import {T} from \"ES\"; // Error: T is a type import, not a value +import type {T as T2} from \"ES\"; (42: T2); -('asdf': T2); // Error: string ~> number +(\'asdf\': T2); // Error: string ~> number -import {exports as nope} from "ES"; // Error: Not an export +import {exports as nope} from \"ES\"; // Error: Not an export ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Error: number ~> string @@ -56,38 +56,38 @@ import {exports as nope} from "ES"; // Error: Not an export // Error: T is a type import, not a value // Error: string ~> number // Error: Not an export -import { num1, str1 } from "CJS_Named"; -import CJS_Named from "CJS_Named"; +import { num1, str1 } from \"CJS_Named\"; +import CJS_Named from \"CJS_Named\"; (num1: number); (num1: string); (str1: string); (str1: number); (CJS_Named: { num1: number; str1: string }); (CJS_Named: number); -import { num2 } from "CJS_Clobbered"; -import { numExport } from "CJS_Clobbered"; +import { num2 } from \"CJS_Clobbered\"; +import { numExport } from \"CJS_Clobbered\"; (numExport: number); (numExport: string); -import type { numType } from "CJS_Clobbered"; +import type { numType } from \"CJS_Clobbered\"; (42: numType); -("asdf": numType); -import { strHidden } from "ES"; -import { str3 } from "ES"; +(\"asdf\": numType); +import { strHidden } from \"ES\"; +import { str3 } from \"ES\"; (str3: string); (str3: number); -import { num3 } from "ES"; +import { num3 } from \"ES\"; (num3: number); (num3: string); -import { C } from "ES"; -import type { C as CType } from "ES"; +import { C } from \"ES\"; +import type { C as CType } from \"ES\"; (new C(): C); (42: C); (new C(): CType); (42: CType); -import { T } from "ES"; -import type { T as T2 } from "ES"; +import { T } from \"ES\"; +import type { T as T2 } from \"ES\"; (42: T2); -("asdf": T2); -import { exports as nope } from "ES"; +(\"asdf\": T2); +import { exports as nope } from \"ES\"; " `; diff --git a/tests/export_default/__snapshots__/jsfmt.spec.js.snap b/tests/export_default/__snapshots__/jsfmt.spec.js.snap index fa030d77..2ca98135 100644 --- a/tests/export_default/__snapshots__/jsfmt.spec.js.snap +++ b/tests/export_default/__snapshots__/jsfmt.spec.js.snap @@ -1,27 +1,27 @@ exports[`test P.js 1`] = ` -"module.exports = require('M'); +"module.exports = require(\'M\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = require("M"); +module.exports = require(\"M\"); " `; exports[`test test.js 1`] = ` -"var M = require('M'); -var N = require('N'); +"var M = require(\'M\'); +var N = require(\'N\'); N.x = M(N.x); -var P = require('./P'); // implementation of P redirects to module M +var P = require(\'./P\'); // implementation of P redirects to module M N.y = P(N.y); -var Q = require('Q'); // declaration of Q redirects to module M +var Q = require(\'Q\'); // declaration of Q redirects to module M N.z = Q(N.z); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // implementation of P redirects to module M // declaration of Q redirects to module M -var M = require("M"); -var N = require("N"); +var M = require(\"M\"); +var N = require(\"N\"); N.x = M(N.x); -var P = require("./P"); +var P = require(\"./P\"); N.y = P(N.y); -var Q = require("Q"); +var Q = require(\"Q\"); N.z = Q(N.z); " `; diff --git a/tests/export_default/lib/__snapshots__/jsfmt.spec.js.snap b/tests/export_default/lib/__snapshots__/jsfmt.spec.js.snap index 9abce5e8..6d1560fc 100644 --- a/tests/export_default/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/export_default/lib/__snapshots__/jsfmt.spec.js.snap @@ -8,7 +8,7 @@ declare module N { declare var z: number; } declare module Q { - declare var exports: $Exports<'M'>; + declare var exports: $Exports<\'M\'>; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare module M { @@ -20,7 +20,7 @@ declare module N { declare var z: number; } declare module Q { - declare var exports: $Exports<"M">; + declare var exports: $Exports<\"M\">; } " `; diff --git a/tests/export_type/__snapshots__/jsfmt.spec.js.snap b/tests/export_type/__snapshots__/jsfmt.spec.js.snap index e3746780..9e441236 100644 --- a/tests/export_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/export_type/__snapshots__/jsfmt.spec.js.snap @@ -21,30 +21,30 @@ import type { standaloneType1, talias1, talias3, -} from "./types_only"; +} from \"./types_only\"; var a: inlinedType1 = 42; -var b: inlinedType1 = 'asdf'; // Error: string ~> number +var b: inlinedType1 = \'asdf\'; // Error: string ~> number var c: standaloneType1 = 42; -var d: standaloneType1 = 'asdf'; // Error: string ~> number +var d: standaloneType1 = \'asdf\'; // Error: string ~> number var e: talias1 = 42; -var f: talias1 = 'asdf'; // Error: string ~> number +var f: talias1 = \'asdf\'; // Error: string ~> number var g: talias3 = 42; -var h: talias3 = 'asdf'; // Error: string ~> number +var h: talias3 = \'asdf\'; // Error: string ~> number -import type {talias4} from "./cjs_with_types"; +import type {talias4} from \"./cjs_with_types\"; var i: talias4 = 42; -var j: talias4 = 'asdf'; // Error: string ~> number +var j: talias4 = \'asdf\'; // Error: string ~> number -import {IFoo, IFoo2} from "./types_only"; +import {IFoo, IFoo2} from \"./types_only\"; var k: IFoo = {prop: 42}; -var l: IFoo = {prop: 'asdf'}; // Error: {prop:string} ~> {prop:number} +var l: IFoo = {prop: \'asdf\'}; // Error: {prop:string} ~> {prop:number} -var m: IFoo2 = {prop: 'asdf'}; +var m: IFoo2 = {prop: \'asdf\'}; var n: IFoo2 = {prop: 42}; // Error: {prop:number} ~> {prop:string} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -55,22 +55,22 @@ var n: IFoo2 = {prop: 42}; // Error: {prop:number} ~> {prop:string} // Error: string ~> number // Error: {prop:string} ~> {prop:number} // Error: {prop:number} ~> {prop:string} -import type { inlinedType1, standaloneType1, talias1, talias3 } from "./types_only"; +import type { inlinedType1, standaloneType1, talias1, talias3 } from \"./types_only\"; var a: inlinedType1 = 42; -var b: inlinedType1 = "asdf"; +var b: inlinedType1 = \"asdf\"; var c: standaloneType1 = 42; -var d: standaloneType1 = "asdf"; +var d: standaloneType1 = \"asdf\"; var e: talias1 = 42; -var f: talias1 = "asdf"; +var f: talias1 = \"asdf\"; var g: talias3 = 42; -var h: talias3 = "asdf"; -import type { talias4 } from "./cjs_with_types"; +var h: talias3 = \"asdf\"; +import type { talias4 } from \"./cjs_with_types\"; var i: talias4 = 42; -var j: talias4 = "asdf"; -import { IFoo, IFoo2 } from "./types_only"; +var j: talias4 = \"asdf\"; +import { IFoo, IFoo2 } from \"./types_only\"; var k: IFoo = { prop: 42 }; -var l: IFoo = { prop: "asdf" }; -var m: IFoo2 = { prop: "asdf" }; +var l: IFoo = { prop: \"asdf\" }; +var m: IFoo2 = { prop: \"asdf\" }; var n: IFoo2 = { prop: 42 }; " `; @@ -80,7 +80,7 @@ exports[`test types_only.js 1`] = ` export type inlinedType1 = number; var a: inlinedType1 = 42; -var b: inlinedType1 = 'asdf'; // Error: string ~> number +var b: inlinedType1 = \'asdf\'; // Error: string ~> number type standaloneType1 = number; export type {standaloneType1}; @@ -88,7 +88,7 @@ export type {standaloneType1}; type standaloneType2 = number; export {standaloneType2}; // Error: Missing \`type\` keyword -export type {talias1, talias2 as talias3, IFoo2} from "./types_only2"; +export type {talias1, talias2 as talias3, IFoo2} from \"./types_only2\"; export interface IFoo { prop: number }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -97,12 +97,12 @@ export interface IFoo { prop: number }; // Error: Missing \`type\` keyword export type inlinedType1 = number; var a: inlinedType1 = 42; -var b: inlinedType1 = "asdf"; +var b: inlinedType1 = \"asdf\"; type standaloneType1 = number; export { standaloneType1 } type standaloneType2 = number; export { standaloneType2 } -export { talias1, talias2 as talias3, IFoo2 } from "./types_only2" +export { talias1, talias2 as talias3, IFoo2 } from \"./types_only2\" export interface IFoo { prop: number } " `; diff --git a/tests/extensions/__snapshots__/jsfmt.spec.js.snap b/tests/extensions/__snapshots__/jsfmt.spec.js.snap index fff08926..524d171e 100644 --- a/tests/extensions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/extensions/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test foo.js 1`] = ` -"var imp = require('./bar'); +"var imp = require(\'./bar\'); imp(1337); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var imp = require("./bar"); +var imp = require(\"./bar\"); imp(1337); " `; diff --git a/tests/facebook_fbt_none/__snapshots__/jsfmt.spec.js.snap b/tests/facebook_fbt_none/__snapshots__/jsfmt.spec.js.snap index e9e0a0d5..8b22529f 100644 --- a/tests/facebook_fbt_none/__snapshots__/jsfmt.spec.js.snap +++ b/tests/facebook_fbt_none/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ exports[`test main.js 1`] = ` "// @flow -var React = require('react'); +var React = require(\'react\'); (: React.Element<*>); (: number); // Error: ReactElement ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Error: ReactElement ~> number -var React = require("react"); +var React = require(\"react\"); (: React.Element<*>); (: number); " diff --git a/tests/facebookisms/__snapshots__/jsfmt.spec.js.snap b/tests/facebookisms/__snapshots__/jsfmt.spec.js.snap index 0fdd701a..59729c9d 100644 --- a/tests/facebookisms/__snapshots__/jsfmt.spec.js.snap +++ b/tests/facebookisms/__snapshots__/jsfmt.spec.js.snap @@ -22,15 +22,15 @@ let tests = [ result.baz = false; (copyProperties( result, - { foo: 'a' }, + { foo: \'a\' }, { bar: 123 } ): { foo: string, bar: number, baz: boolean }); }, // module from lib function() { - const copyProperties = require('copyProperties'); - let x = { foo: 'a' }; + const copyProperties = require(\'copyProperties\'); + let x = { foo: \'a\' }; let y = { bar: 123 }; (copyProperties({}, x, y): { foo: string, bar: number }); }, @@ -38,7 +38,7 @@ let tests = [ // too few args function(copyProperties: Object$Assign) { copyProperties(); - (copyProperties({ foo: 'a' }): { foo: number }); // err, num !~> string + (copyProperties({ foo: \'a\' }): { foo: number }); // err, num !~> string }, // passed as a function @@ -63,21 +63,21 @@ let tests = [ function(copyProperties: Object$Assign) { let result = {}; result.baz = false; - (copyProperties(result, { foo: "a" }, { bar: 123 }): { + (copyProperties(result, { foo: \"a\" }, { bar: 123 }): { foo: string; bar: number; baz: boolean }); }, function() { - const copyProperties = require("copyProperties"); - let x = { foo: "a" }; + const copyProperties = require(\"copyProperties\"); + let x = { foo: \"a\" }; let y = { bar: 123 }; (copyProperties({}, x, y): { foo: string; bar: number }); }, function(copyProperties: Object$Assign) { copyProperties(); - (copyProperties({ foo: "a" }): { foo: number }); + (copyProperties({ foo: \"a\" }): { foo: number }); }, function(copyProperties: Object$Assign) { function x(cb: Function) { @@ -95,7 +95,7 @@ exports[`test invariant.js 1`] = ` let tests = [ function() { let x: ?string = null; - invariant(x, 'truthy only'); // error, forgot to require invariant + invariant(x, \'truthy only\'); // error, forgot to require invariant }, function(invariant: Function) { @@ -110,7 +110,7 @@ let tests = [ let tests = [ function() { let x: ?string = null; - invariant(x, "truthy only"); + invariant(x, \"truthy only\"); }, function(invariant: Function) { let x: ?string = null; @@ -122,25 +122,25 @@ let tests = [ `; exports[`test lib.js 1`] = ` -"declare module "copyProperties" { +"declare module \"copyProperties\" { declare var exports: Object$Assign; } -declare module "mergeInto" { +declare module \"mergeInto\" { declare var exports: $Facebookism$MergeInto; } -declare module "mixin" { +declare module \"mixin\" { declare var exports: $Facebookism$Mixin; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare module "copyProperties" { +declare module \"copyProperties\" { declare var exports: Object$Assign; } -declare module "mergeInto" { +declare module \"mergeInto\" { declare var exports: $Facebookism$MergeInto; } -declare module "mixin" { +declare module \"mixin\" { declare var exports: $Facebookism$Mixin; } " @@ -159,15 +159,15 @@ let tests = [ function(mergeInto: $Facebookism$MergeInto) { let result = {}; result.baz = false; - (mergeInto(result, { foo: 'a' }, { bar: 123 }): void); + (mergeInto(result, { foo: \'a\' }, { bar: 123 }): void); (result: { foo: string, bar: number, baz: boolean }); }, // module from lib function() { - const mergeInto = require('mergeInto'); + const mergeInto = require(\'mergeInto\'); let result: { foo?: string, bar?: number, baz: boolean } = { baz: false }; - (mergeInto(result, { foo: 'a' }, { bar: 123 }): void); + (mergeInto(result, { foo: \'a\' }, { bar: 123 }): void); }, // too few args @@ -196,13 +196,13 @@ let tests = [ function(mergeInto: $Facebookism$MergeInto) { let result = {}; result.baz = false; - (mergeInto(result, { foo: "a" }, { bar: 123 }): void); + (mergeInto(result, { foo: \"a\" }, { bar: 123 }): void); (result: { foo: string; bar: number; baz: boolean }); }, function() { - const mergeInto = require("mergeInto"); + const mergeInto = require(\"mergeInto\"); let result: { foo?: string; bar?: number; baz: boolean } = { baz: false }; - (mergeInto(result, { foo: "a" }, { bar: 123 }): void); + (mergeInto(result, { foo: \"a\" }, { bar: 123 }): void); }, function(mergeInto: $Facebookism$MergeInto) { mergeInto(); @@ -218,22 +218,22 @@ let tests = [ `; exports[`test test.js 1`] = ` -"var Bar = require('./Bar'); -var mixin = require('mixin'); +"var Bar = require(\'./Bar\'); +var mixin = require(\'mixin\'); class Foo extends mixin(Bar) { m() { var x: string = this.x; - this.y = ""; + this.y = \"\"; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var Bar = require("./Bar"); -var mixin = require("mixin"); +var Bar = require(\"./Bar\"); +var mixin = require(\"mixin\"); class Foo extends mixin(Bar) { m() { var x: string = this.x; - this.y = ""; + this.y = \"\"; } } " diff --git a/tests/find-module/__snapshots__/jsfmt.spec.js.snap b/tests/find-module/__snapshots__/jsfmt.spec.js.snap index 2a5d7b4d..3a5cd026 100644 --- a/tests/find-module/__snapshots__/jsfmt.spec.js.snap +++ b/tests/find-module/__snapshots__/jsfmt.spec.js.snap @@ -6,13 +6,13 @@ module.exports = 0; `; exports[`test test.js 1`] = ` -"var x = require('./req'); +"var x = require(\'./req\'); (x: string); -import x from './req'; +import x from \'./req\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require("./req"); +var x = require(\"./req\"); (x: string); -import x from "./req"; +import x from \"./req\"; " `; diff --git a/tests/fixpoint/__snapshots__/jsfmt.spec.js.snap b/tests/fixpoint/__snapshots__/jsfmt.spec.js.snap index 2077ae5f..ce3d432b 100644 --- a/tests/fixpoint/__snapshots__/jsfmt.spec.js.snap +++ b/tests/fixpoint/__snapshots__/jsfmt.spec.js.snap @@ -26,7 +26,7 @@ function mk_factorial() { var factorial = mk_factorial(); -factorial("..."); +factorial(\"...\"); module.exports = {fn: fix}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -64,7 +64,7 @@ function mk_factorial() { ); } var factorial = mk_factorial(); -factorial("..."); +factorial(\"...\"); module.exports = { fn: fix }; " `; diff --git a/tests/for/__snapshots__/jsfmt.spec.js.snap b/tests/for/__snapshots__/jsfmt.spec.js.snap index 0ec90a03..71d3dcdd 100644 --- a/tests/for/__snapshots__/jsfmt.spec.js.snap +++ b/tests/for/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ function foo(x: boolean) { } return; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function bar(x: boolean) { @@ -17,7 +17,7 @@ function bar(x: boolean) { for (var ii = 0; ii < max; ii++) { return; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function baz(x: boolean) { @@ -25,7 +25,7 @@ function baz(x: boolean) { for (var ii = 0; ii < max; ii++) { continue; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function bliffl(x: boolean) { @@ -34,9 +34,9 @@ function bliffl(x: boolean) { loop2: for (var jj = 0; jj < max; jj++) { break loop1; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function corge(x: boolean) { @@ -44,7 +44,7 @@ function corge(x: boolean) { for (var ii = 0; ii < max; ii++) { break; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -56,21 +56,21 @@ function foo(x: boolean) { } return; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function bar(x: boolean) { var max = 0; for (var ii = 0; ii < max; ii++) { return; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function baz(x: boolean) { var max = 0; for (var ii = 0; ii < max; ii++) { continue; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function bliffl(x: boolean) { var max = 10; @@ -80,16 +80,16 @@ for (var ii = 0; ii < max; ii++) { for (var jj = 0; jj < max; jj++) { break loop1; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function corge(x: boolean) { var max = 0; for (var ii = 0; ii < max; ii++) { break; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } " `; @@ -103,21 +103,21 @@ exports[`test abnormal_for_in.js 1`] = ` } return; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function bar(x: boolean) { for (var prop in {}) { return; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function baz(x: boolean) { for (var prop in {}) { continue; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function bliffl(x: boolean) { @@ -126,16 +126,16 @@ function bliffl(x: boolean) { loop2: for (var prop2 in obj) { break loop1; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function corge(x: boolean) { for (var prop in {}) { break; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: boolean) { @@ -146,19 +146,19 @@ function foo(x: boolean) { } return; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function bar(x: boolean) { for (var prop in {}) { return; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function baz(x: boolean) { for (var prop in {}) { continue; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function bliffl(x: boolean) { var obj = { a: 1, b: 2 }; @@ -168,15 +168,15 @@ for (var prop1 in obj) { for (var prop2 in obj) { break loop1; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function corge(x: boolean) { for (var prop in {}) { break; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } " `; @@ -190,21 +190,21 @@ exports[`test abnormal_for_of.js 1`] = ` } return; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function bar(x: boolean) { for (var elem of []) { return; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function baz(x: boolean) { for (var elem of []) { continue; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function bliffl(x: boolean) { @@ -213,16 +213,16 @@ function bliffl(x: boolean) { loop2: for (var elem of arr) { break loop1; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } function corge(x: boolean) { for (var elem of []) { break; } - console.log('this is still reachable'); + console.log(\'this is still reachable\'); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: boolean) { @@ -233,19 +233,19 @@ function foo(x: boolean) { } return; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function bar(x: boolean) { for (var elem of [ ]) { return; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function baz(x: boolean) { for (var elem of [ ]) { continue; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function bliffl(x: boolean) { var arr = [ 1, 2, 3 ]; @@ -255,15 +255,15 @@ for (var elem of arr) { for (var elem of arr) { break loop1; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } function corge(x: boolean) { for (var elem of [ ]) { break; } - console.log("this is still reachable"); + console.log(\"this is still reachable\"); } " `; diff --git a/tests/generators/__snapshots__/jsfmt.spec.js.snap b/tests/generators/__snapshots__/jsfmt.spec.js.snap index f2de7b0a..cd6b604c 100644 --- a/tests/generators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/generators/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test class.js 1`] = ` "class GeneratorExamples { *stmt_yield(): Generator { yield 0; // ok - yield ""; // error: string ~> number + yield \"\"; // error: string ~> number } *stmt_next(): Generator { @@ -22,18 +22,18 @@ exports[`test class.js 1`] = ` } *stmt_return_err(): Generator { - return ""; // error: string ~> number + return \"\"; // error: string ~> number } *infer_stmt() { var x: boolean = yield 0; // error: number ~> boolean - return ""; + return \"\"; } *widen_next() { var x = yield 0; - if (typeof x === "number") { - } else if (typeof x === "boolean") { + if (typeof x === \"number\") { + } else if (typeof x === \"boolean\") { } else { (x : string) // ok, sherlock } @@ -41,7 +41,7 @@ exports[`test class.js 1`] = ` *widen_yield() { yield 0; - yield ""; + yield \"\"; yield true; } @@ -54,7 +54,7 @@ exports[`test class.js 1`] = ` *delegate_yield_generator() { function *inner() { - yield ""; + yield \"\"; } yield *inner(); @@ -62,7 +62,7 @@ exports[`test class.js 1`] = ` *delegate_return_generator() { function *inner() { - return ""; + return \"\"; } var x: number = yield *inner(); // error: string ~> number @@ -99,31 +99,31 @@ var examples = new GeneratorExamples(); for (var x of examples.infer_stmt()) { (x : string) } // error: number ~> string var infer_stmt_next = examples.infer_stmt().next(0).value; // error: number ~> boolean -if (typeof infer_stmt_next === "undefined") { -} else if (typeof infer_stmt_next === "number") { +if (typeof infer_stmt_next === \"undefined\") { +} else if (typeof infer_stmt_next === \"number\") { } else { (infer_stmt_next : boolean) // error: string ~> boolean } examples.widen_next().next(0) -examples.widen_next().next("") +examples.widen_next().next(\"\") examples.widen_next().next(true) for (var x of examples.widen_yield()) { - if (typeof x === "number") { - } else if (typeof x === "boolean") { + if (typeof x === \"number\") { + } else if (typeof x === \"boolean\") { } else { (x : string) // ok, sherlock } } -examples.delegate_next_generator().next(""); +examples.delegate_next_generator().next(\"\"); for (var x of examples.delegate_yield_generator()) { (x : number) // error: string ~> number } -examples.delegate_next_iterable([]).next(""); // error: Iterator has no next value +examples.delegate_next_iterable([]).next(\"\"); // error: Iterator has no next value for (var x of examples.delegate_yield_iterable([])) { (x : string) // error: number ~> string @@ -151,7 +151,7 @@ for (var x of examples.delegate_yield_iterable([])) { class GeneratorExamples { *stmt_yield(): Generator { yield 0; - yield ""; + yield \"\"; } *stmt_next(): Generator { var a = yield; @@ -167,18 +167,18 @@ class GeneratorExamples { return 0; } *stmt_return_err(): Generator { - return ""; + return \"\"; } *infer_stmt() { var x: boolean = yield 0; - return ""; + return \"\"; } *widen_next() { var x = yield 0; - if (typeof x === "number") { + if (typeof x === \"number\") { } else - if (typeof x === "boolean") { + if (typeof x === \"boolean\") { } else { (x: string); @@ -186,7 +186,7 @@ class GeneratorExamples { } *widen_yield() { yield 0; - yield ""; + yield \"\"; yield true; } *delegate_next_generator() { @@ -197,13 +197,13 @@ class GeneratorExamples { } *delegate_yield_generator() { function* inner() { - yield ""; + yield \"\"; } yield* inner(); } *delegate_return_generator() { function* inner() { - return ""; + return \"\"; } var x: number = yield* inner(); } @@ -231,32 +231,32 @@ for (var x of examples.infer_stmt()) { (x: string); } var infer_stmt_next = examples.infer_stmt().next(0).value; -if (typeof infer_stmt_next === "undefined") { +if (typeof infer_stmt_next === \"undefined\") { } else - if (typeof infer_stmt_next === "number") { + if (typeof infer_stmt_next === \"number\") { } else { (infer_stmt_next: boolean); } examples.widen_next().next(0); -examples.widen_next().next(""); +examples.widen_next().next(\"\"); examples.widen_next().next(true); for (var x of examples.widen_yield()) { - if (typeof x === "number") { + if (typeof x === \"number\") { } else - if (typeof x === "boolean") { + if (typeof x === \"boolean\") { } else { (x: string); } } -examples.delegate_next_generator().next(""); +examples.delegate_next_generator().next(\"\"); for (var x of examples.delegate_yield_generator()) { (x: number); } -examples.delegate_next_iterable([ ]).next(""); +examples.delegate_next_iterable([ ]).next(\"\"); for (var x of examples.delegate_yield_iterable([ ])) { (x: string); } @@ -269,7 +269,7 @@ exports[`test class_failure.js 1`] = ` class GeneratorExamples { *infer_stmt() { var x: boolean = yield 0; // error: number ~> boolean - return ""; + return \"\"; } } @@ -279,8 +279,8 @@ for (var x of examples.infer_stmt()) { (x : string) } // error: number ~> string var infer_stmt_next = examples.infer_stmt().next(0).value; // error: number ~> boolean -if (typeof infer_stmt_next === "undefined") { -} else if (typeof infer_stmt_next === "number") { +if (typeof infer_stmt_next === \"undefined\") { +} else if (typeof infer_stmt_next === \"number\") { } else { (infer_stmt_next : boolean) // error: string ~> boolean } @@ -293,7 +293,7 @@ if (typeof infer_stmt_next === "undefined") { class GeneratorExamples { *infer_stmt() { var x: boolean = yield 0; - return ""; + return \"\"; } } var examples = new GeneratorExamples(); @@ -301,10 +301,10 @@ for (var x of examples.infer_stmt()) { (x: string); } var infer_stmt_next = examples.infer_stmt().next(0).value; -if (typeof infer_stmt_next === "undefined") { +if (typeof infer_stmt_next === \"undefined\") { } else - if (typeof infer_stmt_next === "number") { + if (typeof infer_stmt_next === \"number\") { } else { (infer_stmt_next: boolean); @@ -315,7 +315,7 @@ if (typeof infer_stmt_next === "undefined") { exports[`test generators.js 1`] = ` "function *stmt_yield(): Generator { yield 0; // ok - yield ""; // error: string ~> number + yield \"\"; // error: string ~> number } function *stmt_next(): Generator { @@ -335,41 +335,41 @@ function *stmt_return_ok(): Generator { } function *stmt_return_err(): Generator { - return ""; // error: string ~> number + return \"\"; // error: string ~> number } function *infer_stmt() { var x: boolean = yield 0; - return ""; + return \"\"; } for (var x of infer_stmt()) { (x : string) } // error: number ~> string var infer_stmt_next = infer_stmt().next(0).value; // error: number ~> boolean -if (typeof infer_stmt_next === "undefined") { -} else if (typeof infer_stmt_next === "number") { +if (typeof infer_stmt_next === \"undefined\") { +} else if (typeof infer_stmt_next === \"number\") { } else { (infer_stmt_next : boolean) // error: string ~> boolean } function *widen_next() { var x = yield 0; - if (typeof x === "number") { - } else if (typeof x === "boolean") { + if (typeof x === \"number\") { + } else if (typeof x === \"boolean\") { } else { (x : string) // ok, sherlock } } widen_next().next(0) -widen_next().next("") +widen_next().next(\"\") widen_next().next(true) function *widen_yield() { yield 0; - yield ""; + yield \"\"; yield true; } for (var x of widen_yield()) { - if (typeof x === "number") { - } else if (typeof x === "boolean") { + if (typeof x === \"number\") { + } else if (typeof x === \"boolean\") { } else { (x : string) // ok, sherlock } @@ -381,11 +381,11 @@ function *delegate_next_generator() { } yield *inner(); } -delegate_next_generator().next(""); +delegate_next_generator().next(\"\"); function *delegate_yield_generator() { function *inner() { - yield ""; + yield \"\"; } yield *inner(); @@ -396,7 +396,7 @@ for (var x of delegate_yield_generator()) { function *delegate_return_generator() { function *inner() { - return ""; + return \"\"; } var x: number = yield *inner(); // error: string ~> number @@ -406,7 +406,7 @@ function *delegate_return_generator() { function *delegate_next_iterable(xs: Array) { yield *xs; } -delegate_next_iterable([]).next(""); // error: Iterator has no next value +delegate_next_iterable([]).next(\"\"); // error: Iterator has no next value function *delegate_yield_iterable(xs: Array) { yield *xs; @@ -435,7 +435,7 @@ function *multiple_return(b) { if (b) { return 0; } else { - return "foo"; + return \"foo\"; } } let multiple_return_result = multiple_return().next(); @@ -464,7 +464,7 @@ if (multiple_return_result.done) { // error: number|string ~> void function* stmt_yield(): Generator { yield 0; - yield ""; + yield \"\"; } function* stmt_next(): Generator { var a = yield; @@ -480,48 +480,48 @@ function* stmt_return_ok(): Generator { return 0; } function* stmt_return_err(): Generator { - return ""; + return \"\"; } function* infer_stmt() { var x: boolean = yield 0; - return ""; + return \"\"; } for (var x of infer_stmt()) { (x: string); } var infer_stmt_next = infer_stmt().next(0).value; -if (typeof infer_stmt_next === "undefined") { +if (typeof infer_stmt_next === \"undefined\") { } else - if (typeof infer_stmt_next === "number") { + if (typeof infer_stmt_next === \"number\") { } else { (infer_stmt_next: boolean); } function* widen_next() { var x = yield 0; - if (typeof x === "number") { + if (typeof x === \"number\") { } else - if (typeof x === "boolean") { + if (typeof x === \"boolean\") { } else { (x: string); } } widen_next().next(0); -widen_next().next(""); +widen_next().next(\"\"); widen_next().next(true); function* widen_yield() { yield 0; - yield ""; + yield \"\"; yield true; } for (var x of widen_yield()) { - if (typeof x === "number") { + if (typeof x === \"number\") { } else - if (typeof x === "boolean") { + if (typeof x === \"boolean\") { } else { (x: string); @@ -533,10 +533,10 @@ function* delegate_next_generator() { } yield* inner(); } -delegate_next_generator().next(""); +delegate_next_generator().next(\"\"); function* delegate_yield_generator() { function* inner() { - yield ""; + yield \"\"; } yield* inner(); } @@ -545,14 +545,14 @@ for (var x of delegate_yield_generator()) { } function* delegate_return_generator() { function* inner() { - return ""; + return \"\"; } var x: number = yield* inner(); } function* delegate_next_iterable(xs: Array) { yield* xs; } -delegate_next_iterable([ ]).next(""); +delegate_next_iterable([ ]).next(\"\"); function* delegate_yield_iterable(xs: Array) { yield* xs; } @@ -575,7 +575,7 @@ function* multiple_return(b) { if (b) { return 0; } else { - return "foo"; + return \"foo\"; } } let multiple_return_result = multiple_return().next(); @@ -587,13 +587,13 @@ if (multiple_return_result.done) { exports[`test return.js 1`] = ` "function test1(gen: Generator) { - // You can pass whatever you like to return, it doesn't need to be related to - // the Generator's return type + // You can pass whatever you like to return, it doesn\'t need to be related to + // the Generator\'s return type var ret = gen.return(0); (ret.value: void); // error: string | number ~> void } -// However, a generator can "refuse" the return by catching an exception and +// However, a generator can \"refuse\" the return by catching an exception and // yielding or returning internally. function *refuse_return() { try { @@ -603,15 +603,15 @@ function *refuse_return() { } } var refuse_return_gen = refuse_return(); -var refuse_return_result = refuse_return_gen.return("string"); +var refuse_return_result = refuse_return_gen.return(\"string\"); if (refuse_return_result.done) { (refuse_return_result.value: string); // error: number | void ~> string } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// You can pass whatever you like to return, it doesn't need to be related to -// the Generator's return type +// You can pass whatever you like to return, it doesn\'t need to be related to +// the Generator\'s return type // error: string | number ~> void -// However, a generator can "refuse" the return by catching an exception and +// However, a generator can \"refuse\" the return by catching an exception and // yielding or returning internally. // error: number | void ~> string function test1(gen: Generator) { @@ -626,7 +626,7 @@ function* refuse_return() { } } var refuse_return_gen = refuse_return(); -var refuse_return_result = refuse_return_gen.return("string"); +var refuse_return_result = refuse_return_gen.return(\"string\"); if (refuse_return_result.done) { (refuse_return_result.value: string); } @@ -642,7 +642,7 @@ exports[`test throw.js 1`] = ` } } -var catch_return_value = catch_return().throw("").value; +var catch_return_value = catch_return().throw(\"\").value; if (catch_return_value !== undefined) { (catch_return_value : string); // error: number ~> string } @@ -655,7 +655,7 @@ function *yield_return() { yield e; } } -var yield_return_value = yield_return().throw("").value; +var yield_return_value = yield_return().throw(\"\").value; if (yield_return_value !== undefined) { (yield_return_value: string); // error: number ~> string } @@ -669,7 +669,7 @@ function* catch_return() { return e; } } -var catch_return_value = catch_return().throw("").value; +var catch_return_value = catch_return().throw(\"\").value; if (catch_return_value !== undefined) { (catch_return_value: string); } @@ -681,7 +681,7 @@ function* yield_return() { yield e; } } -var yield_return_value = yield_return().throw("").value; +var yield_return_value = yield_return().throw(\"\").value; if (yield_return_value !== undefined) { (yield_return_value: string); } diff --git a/tests/generics/__snapshots__/jsfmt.spec.js.snap b/tests/generics/__snapshots__/jsfmt.spec.js.snap index 28aaeeae..d9d39010 100644 --- a/tests/generics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/generics/__snapshots__/jsfmt.spec.js.snap @@ -36,12 +36,12 @@ class H extends G> { } var h1 = new H(); -h1.foo(["..."]); +h1.foo([\"...\"]); var h2:F>>> = h1; var obj : Object = {} // error, arity 0 -var fn : Function = function() { return 'foo'; } // error, arity 0 -var fn : function = function() { return 'foo'; } // error, arity 0 +var fn : Function = function() { return \'foo\'; } // error, arity 0 +var fn : function = function() { return \'foo\'; } // error, arity 0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //x:X; /*return x;*/ @@ -89,14 +89,14 @@ class H extends G> { } } var h1 = new H(); -h1.foo([ "..." ]); +h1.foo([ \"...\" ]); var h2: F>>> = h1; var obj: Object = {}; var fn: Function = function() { - return "foo"; + return \"foo\"; }; var fn: function = function() { - return "foo"; + return \"foo\"; }; " `; diff --git a/tests/get-def/__snapshots__/jsfmt.spec.js.snap b/tests/get-def/__snapshots__/jsfmt.spec.js.snap index 62362d0a..71a3899a 100644 --- a/tests/get-def/__snapshots__/jsfmt.spec.js.snap +++ b/tests/get-def/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test example.js 1`] = ` "/* @flow */ -var lib = require('./library'); +var lib = require(\'./library\'); function add(a: number, b: number): number { return a + b; @@ -18,7 +18,7 @@ lib.bar(); /* @flow */ // t123456 // D123456 -var lib = require("./library"); +var lib = require(\"./library\"); function add(a: number, b: number): number { return a + b; } @@ -31,23 +31,23 @@ lib.bar(); exports[`test imports.js 1`] = ` "// @flow -import thing from "./helpers/exports_default.js"; +import thing from \"./helpers/exports_default.js\"; thing; -import {foo, bar as baz} from "./helpers/exports_named.js"; +import {foo, bar as baz} from \"./helpers/exports_named.js\"; foo; baz; -import * as things from "./helpers/exports_named.js"; +import * as things from \"./helpers/exports_named.js\"; things; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import thing from "./helpers/exports_default.js"; +import thing from \"./helpers/exports_default.js\"; thing; -import { foo, bar as baz } from "./helpers/exports_named.js"; +import { foo, bar as baz } from \"./helpers/exports_named.js\"; foo; baz; -import * as things from "./helpers/exports_named.js"; +import * as things from \"./helpers/exports_named.js\"; things; " `; diff --git a/tests/get-def/helpers/__snapshots__/jsfmt.spec.js.snap b/tests/get-def/helpers/__snapshots__/jsfmt.spec.js.snap index 9d99b413..fa3b3479 100644 --- a/tests/get-def/helpers/__snapshots__/jsfmt.spec.js.snap +++ b/tests/get-def/helpers/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ exports[`test exports_default.js 1`] = ` "// @flow -const x = "foo"; +const x = \"foo\"; export default x; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const x = "foo"; +const x = \"foo\"; export default x " `; @@ -14,11 +14,11 @@ export default x exports[`test exports_named.js 1`] = ` "// @flow -export const foo = "foo"; -export const bar = "bar"; +export const foo = \"foo\"; +export const bar = \"bar\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export const foo = "foo"; -export const bar = "bar"; +export const foo = \"foo\"; +export const bar = \"bar\"; " `; diff --git a/tests/get-def2/__snapshots__/jsfmt.spec.js.snap b/tests/get-def2/__snapshots__/jsfmt.spec.js.snap index d6871079..55805842 100644 --- a/tests/get-def2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/get-def2/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ exports[`test Parent.js 1`] = ` "// @flow -var ParentFoo = {foo: 'bar'}; +var ParentFoo = {foo: \'bar\'}; module.exports = {ParentFoo}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var ParentFoo = { foo: "bar" }; +var ParentFoo = { foo: \"bar\" }; module.exports = { ParentFoo }; " `; @@ -13,14 +13,14 @@ module.exports = { ParentFoo }; exports[`test main.js 1`] = ` "// @flow -var Parent = require('./Parent'); +var Parent = require(\'./Parent\'); // Hops through destructuring let ParentFoo; ({ParentFoo} = Parent); ParentFoo; // Points to lval in line above this -// Follows assignment on simple/"non-destructuring" patterns +// Follows assignment on simple/\"non-destructuring\" patterns let ParentFoo2; ParentFoo2 = Parent; ParentFoo2; // Points to LHS of line above this @@ -29,21 +29,21 @@ ParentFoo2; // Points to LHS of line above this let ParentFoo3 = Parent; ParentFoo3; // Points to LHS of line above this -// Follows non-destructured property access of \`require('Parent')\` -let foo = require('./Parent').ParentFoo.foo; +// Follows non-destructured property access of \`require(\'Parent\')\` +let foo = require(\'./Parent\').ParentFoo.foo; foo; -import type {Foo} from './types'; +import type {Foo} from \'./types\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Hops through destructuring // Points to lval in line above this -// Follows assignment on simple/"non-destructuring" patterns +// Follows assignment on simple/\"non-destructuring\" patterns // Points to LHS of line above this // Follows assignment with declaration // Points to LHS of line above this -// Follows non-destructured property access of \`require('Parent')\` -var Parent = require("./Parent"); +// Follows non-destructured property access of \`require(\'Parent\')\` +var Parent = require(\"./Parent\"); let ParentFoo; { ParentFoo } = Parent; ParentFoo; @@ -52,9 +52,9 @@ ParentFoo2 = Parent; ParentFoo2; let ParentFoo3 = Parent; ParentFoo3; -let foo = require("./Parent").ParentFoo.foo; +let foo = require(\"./Parent\").ParentFoo.foo; foo; -import type { Foo } from "./types"; +import type { Foo } from \"./types\"; " `; @@ -92,23 +92,23 @@ class D extends C { `; exports[`test react.js 1`] = ` -"var React = require('react'); +"var React = require(\'react\'); class C extends React.Component { props: { x: string }; } -let msg = "hello"; +let msg = \"hello\"; (); (
); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require("react"); +var React = require(\"react\"); class C extends React.Component { props: { x: string }; } -let msg = "hello"; +let msg = \"hello\"; ;
; " diff --git a/tests/get-def2/lib/__snapshots__/jsfmt.spec.js.snap b/tests/get-def2/lib/__snapshots__/jsfmt.spec.js.snap index 1b17c7e5..9bc4ce37 100644 --- a/tests/get-def2/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/get-def2/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,5 @@ exports[`test jsx.js 1`] = ` -"declare var $React: $Exports<'react'>; // fake import +"declare var $React: $Exports<\'react\'>; // fake import type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { @@ -8,7 +8,7 @@ type $JSXIntrinsics = { }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // fake import -declare var $React: $Exports<"react">; +declare var $React: $Exports<\"react\">; type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { div: $JSXIntrinsic<{ id: string }>; diff --git a/tests/get-imports-and-importers/__snapshots__/jsfmt.spec.js.snap b/tests/get-imports-and-importers/__snapshots__/jsfmt.spec.js.snap index 35639421..2a1fec9b 100644 --- a/tests/get-imports-and-importers/__snapshots__/jsfmt.spec.js.snap +++ b/tests/get-imports-and-importers/__snapshots__/jsfmt.spec.js.snap @@ -11,23 +11,23 @@ exports[`test b.js 1`] = ` * @flow * @providesModule b */ -require('./a'); +require(\'./a\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow * @providesModule b */ -require("./a"); +require(\"./a\"); " `; exports[`test c.js 1`] = ` "// @flow -require('./a.js'); -require('b'); +require(\'./a.js\'); +require(\'b\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -require("./a.js"); -require("b"); +require(\"./a.js\"); +require(\"b\"); " `; diff --git a/tests/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap b/tests/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap index e72641a7..ca2c8ab5 100644 --- a/tests/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap +++ b/tests/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap @@ -24,10 +24,10 @@ class Foo { get propWithSubtypingGetterAndSetterReordered(): ?number { return 4; } get propWithMismatchingGetterAndSetter(): number { return 4; } - set propWithMismatchingGetterAndSetter(x: string) { } // doesn't match getter (OK) + set propWithMismatchingGetterAndSetter(x: string) { } // doesn\'t match getter (OK) propOverriddenWithGetter: number; - get propOverriddenWithGetter() { return "hello"; } + get propOverriddenWithGetter() { return \"hello\"; } propOverriddenWithSetter: number; set propOverriddenWithSetter(x: string) { } @@ -47,8 +47,8 @@ foo.goodSetterNoAnnotation = 123; foo.goodSetterWithAnnotation = 123; // TODO: Why does no annotation mean no error? -foo.goodSetterNoAnnotation = "hello"; // Error string ~> number -foo.goodSetterWithAnnotation = "hello"; // Error string ~> number +foo.goodSetterNoAnnotation = \"hello\"; // Error string ~> number +foo.goodSetterWithAnnotation = \"hello\"; // Error string ~> number var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter; // Error ?number ~> number @@ -60,7 +60,7 @@ foo.propOverriddenWithSetter = 123; // Error number ~> string */ // The getter and setter need not have the same type - no error // The getter and setter need not have the same type - no error -// doesn't match getter (OK) +// doesn\'t match getter (OK) // Test getting properties with getters // Error number ~> string // Error number ~> string @@ -111,7 +111,7 @@ class Foo { } propOverriddenWithGetter: number; get propOverriddenWithGetter() { - return "hello"; + return \"hello\"; } propOverriddenWithSetter: number; set propOverriddenWithSetter(x: string) { @@ -125,8 +125,8 @@ var testGetterWithError1: string = foo.goodGetterNoAnnotation; var testGetterWithError2: string = foo.goodGetterWithAnnotation; foo.goodSetterNoAnnotation = 123; foo.goodSetterWithAnnotation = 123; -foo.goodSetterNoAnnotation = "hello"; -foo.goodSetterWithAnnotation = "hello"; +foo.goodSetterNoAnnotation = \"hello\"; +foo.goodSetterWithAnnotation = \"hello\"; var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter; var testPropOverridenWithGetter: number = foo.propOverriddenWithGetter; foo.propOverriddenWithSetter = 123; @@ -181,17 +181,17 @@ var testGetterWithError2: string = obj.goodGetterWithAnnotation; // Error number obj.goodSetterNoAnnotation = 123; obj.goodSetterWithAnnotation = 123; -obj.goodSetterNoAnnotation = "hello"; // Error string ~> number -obj.goodSetterWithAnnotation = "hello"; // Error string ~> number +obj.goodSetterNoAnnotation = \"hello\"; // Error string ~> number +obj.goodSetterWithAnnotation = \"hello\"; // Error string ~> number var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; // Error ?number ~> number // When building this feature, it was tempting to flow the setter into the // getter and then use either the getter or setter as the type of the property. -// This example shows the danger of using the getter's type +// This example shows the danger of using the getter\'s type obj.exampleOfOrderOfGetterAndSetter = new C(); // Error C ~> B -// And this example shows the danger of using the setter's type. +// And this example shows the danger of using the setter\'s type. var testExampleOrOrderOfGetterAndSetterReordered: number = obj.exampleOfOrderOfGetterAndSetterReordered; // Error A ~> B ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -210,9 +210,9 @@ var testExampleOrOrderOfGetterAndSetterReordered: number = // Error ?number ~> number // When building this feature, it was tempting to flow the setter into the // getter and then use either the getter or setter as the type of the property. -// This example shows the danger of using the getter's type +// This example shows the danger of using the getter\'s type // Error C ~> B -// And this example shows the danger of using the setter's type. +// And this example shows the danger of using the setter\'s type. // Error A ~> B var z: number = 123; class A {} @@ -268,8 +268,8 @@ var testGetterWithError1: string = obj.goodGetterNoAnnotation; var testGetterWithError2: string = obj.goodGetterWithAnnotation; obj.goodSetterNoAnnotation = 123; obj.goodSetterWithAnnotation = 123; -obj.goodSetterNoAnnotation = "hello"; -obj.goodSetterWithAnnotation = "hello"; +obj.goodSetterNoAnnotation = \"hello\"; +obj.goodSetterWithAnnotation = \"hello\"; var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; obj.exampleOfOrderOfGetterAndSetter = new C(); var testExampleOrOrderOfGetterAndSetterReordered: number = obj.exampleOfOrderOfGetterAndSetterReordered; diff --git a/tests/haste_cycle/__snapshots__/jsfmt.spec.js.snap b/tests/haste_cycle/__snapshots__/jsfmt.spec.js.snap index c1f29445..de063e9d 100644 --- a/tests/haste_cycle/__snapshots__/jsfmt.spec.js.snap +++ b/tests/haste_cycle/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test API.js 1`] = ` "// @flow -var OpenGraphObject = require('./models/OpenGraphObject.js'); +var OpenGraphObject = require(\'./models/OpenGraphObject.js\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var OpenGraphObject = require("./models/OpenGraphObject.js"); +var OpenGraphObject = require(\"./models/OpenGraphObject.js\"); " `; diff --git a/tests/haste_cycle/models/__snapshots__/jsfmt.spec.js.snap b/tests/haste_cycle/models/__snapshots__/jsfmt.spec.js.snap index e8eb69ba..b9d5ecea 100644 --- a/tests/haste_cycle/models/__snapshots__/jsfmt.spec.js.snap +++ b/tests/haste_cycle/models/__snapshots__/jsfmt.spec.js.snap @@ -1,29 +1,29 @@ exports[`test OpenGraphAction.js 1`] = ` "// @flow -var OpenGraphValueContainer = require('./OpenGraphValueContainer.js'); +var OpenGraphValueContainer = require(\'./OpenGraphValueContainer.js\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var OpenGraphValueContainer = require("./OpenGraphValueContainer.js"); +var OpenGraphValueContainer = require(\"./OpenGraphValueContainer.js\"); " `; exports[`test OpenGraphObject.js 1`] = ` "// @flow -var OpenGraphValueContainer = require('./OpenGraphValueContainer.js'); +var OpenGraphValueContainer = require(\'./OpenGraphValueContainer.js\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var OpenGraphValueContainer = require("./OpenGraphValueContainer.js"); +var OpenGraphValueContainer = require(\"./OpenGraphValueContainer.js\"); " `; exports[`test OpenGraphValueContainer.js 1`] = ` "// @flow -var OpenGraphObject = require('./OpenGraphObject.js'); +var OpenGraphObject = require(\'./OpenGraphObject.js\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var OpenGraphObject = require("./OpenGraphObject.js"); +var OpenGraphObject = require(\"./OpenGraphObject.js\"); " `; diff --git a/tests/haste_dupe/__snapshots__/jsfmt.spec.js.snap b/tests/haste_dupe/__snapshots__/jsfmt.spec.js.snap index 7509fa95..daebb535 100644 --- a/tests/haste_dupe/__snapshots__/jsfmt.spec.js.snap +++ b/tests/haste_dupe/__snapshots__/jsfmt.spec.js.snap @@ -4,14 +4,14 @@ exports[`test dupe1.js 1`] = ` * @providesModule Dupe * @flow */ -module.exports = "dupe1"; +module.exports = \"dupe1\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 1/2 * @providesModule Dupe * @flow */ -module.exports = "dupe1"; +module.exports = \"dupe1\"; " `; @@ -21,14 +21,14 @@ exports[`test dupe2.js 1`] = ` * @providesModule Dupe * @flow */ -module.exports = "dupe2"; +module.exports = \"dupe2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 2/2 * @providesModule Dupe * @flow */ -module.exports = "dupe2"; +module.exports = \"dupe2\"; " `; @@ -37,12 +37,12 @@ exports[`test requires_dupe.js 1`] = ` * depends on doubly-provided module * @flow */ -var dupe = require('Dupe'); +var dupe = require(\'Dupe\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * depends on doubly-provided module * @flow */ -var dupe = require("Dupe"); +var dupe = require(\"Dupe\"); " `; diff --git a/tests/ignore_package/__snapshots__/jsfmt.spec.js.snap b/tests/ignore_package/__snapshots__/jsfmt.spec.js.snap index 262523a5..de3a76b7 100644 --- a/tests/ignore_package/__snapshots__/jsfmt.spec.js.snap +++ b/tests/ignore_package/__snapshots__/jsfmt.spec.js.snap @@ -3,10 +3,10 @@ exports[`test foo.js 1`] = ` /* this require routes to nothing, because our node_modules/underscore directory has been excluded. If package.json files - are being excluded properly, we'll get - 'Required module not found'. + are being excluded properly, we\'ll get + \'Required module not found\'. */ -var _ = require('underscore'); +var _ = require(\'underscore\'); function foo(): string { return _.foo(); @@ -18,10 +18,10 @@ module.exports = foo; /* this require routes to nothing, because our node_modules/underscore directory has been excluded. If package.json files - are being excluded properly, we'll get - 'Required module not found'. + are being excluded properly, we\'ll get + \'Required module not found\'. */ -var _ = require("underscore"); +var _ = require(\"underscore\"); function foo(): string { return _.foo(); } diff --git a/tests/import_type/__snapshots__/jsfmt.spec.js.snap b/tests/import_type/__snapshots__/jsfmt.spec.js.snap index 5f6919d3..b43f1483 100644 --- a/tests/import_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/import_type/__snapshots__/jsfmt.spec.js.snap @@ -170,8 +170,8 @@ exports[`test import_type.js 1`] = ` // == Importing Class Type (Default Export) == // ///////////////////////////////////////////////// -import type ClassFoo1 from "./ExportDefault_Class"; -import {foo1Inst} from "./ExportDefault_Class"; +import type ClassFoo1 from \"./ExportDefault_Class\"; +import {foo1Inst} from \"./ExportDefault_Class\"; var a1: ClassFoo1 = foo1Inst; var a2: number = foo1Inst; // Error: ClassFoo1 ~> number @@ -181,8 +181,8 @@ new ClassFoo1(); // Error: ClassFoo1 is not a value-identifier // == Importing Class Type (Named Export) == // /////////////////////////////////////////////// -import type {ClassFoo2} from "./ExportNamed_Class"; -import {foo2Inst} from "./ExportNamed_Class"; +import type {ClassFoo2} from \"./ExportNamed_Class\"; +import {foo2Inst} from \"./ExportNamed_Class\"; var b1: ClassFoo2 = foo2Inst; var b2: number = foo2Inst; // Error: ClassFoo2 ~> number @@ -192,8 +192,8 @@ new ClassFoo2(); // Error: ClassFoo2 is not a value-identifier // == Importing Class Type (CJS Default Export) == // ///////////////////////////////////////////////////// -import type ClassFoo3T from "./ExportCJSDefault_Class"; -import ClassFoo3 from "./ExportCJSDefault_Class"; +import type ClassFoo3T from \"./ExportCJSDefault_Class\"; +import ClassFoo3 from \"./ExportCJSDefault_Class\"; var c1: ClassFoo3T = new ClassFoo3(); new ClassFoo3T(); // Error: ClassFoo3 is not a value-identifier @@ -201,38 +201,38 @@ new ClassFoo3T(); // Error: ClassFoo3 is not a value-identifier // == Importing Class Type (CJS Named Export) == // /////////////////////////////////////////////////// -import type {ClassFoo4, ClassFoo5} from "./ExportCJSNamed_Class"; -import {foo4Inst, foo5Inst} from "./ExportCJSNamed_Class"; +import type {ClassFoo4, ClassFoo5} from \"./ExportCJSNamed_Class\"; +import {foo4Inst, foo5Inst} from \"./ExportCJSNamed_Class\"; var d1: ClassFoo4 = foo4Inst; var d2: number = foo4Inst; // Error: ClassFoo4 ~> number new ClassFoo4(); // Error: ClassFoo4 is not a value-identifier -// TODO: this errors correctly, but the message is just 'can't resolve name' -var d3: typeof ClassFoo5 = foo5Inst; // Error: Can't typeof a type alias +// TODO: this errors correctly, but the message is just \'can\'t resolve name\' +var d3: typeof ClassFoo5 = foo5Inst; // Error: Can\'t typeof a type alias //////////////////////////////////////////// // == Import Type Alias (Named Export) == // //////////////////////////////////////////// -import type {AliasFoo3} from "./ExportNamed_Alias"; -import {givesAFoo3Obj} from "./ExportNamed_Alias"; +import type {AliasFoo3} from \"./ExportNamed_Alias\"; +import {givesAFoo3Obj} from \"./ExportNamed_Alias\"; var e1: AliasFoo3 = givesAFoo3Obj(); var e2: number = givesAFoo3Obj(); // Error: AliasFoo3 ~> number -var e3: typeof AliasFoo3 = givesAFoo3Obj(); // Error: Can't typeof a type alias +var e3: typeof AliasFoo3 = givesAFoo3Obj(); // Error: Can\'t typeof a type alias ////////////////////////////////////////////// // == Import Type Alias (Default Export) == // ////////////////////////////////////////////// -// TODO: No support for this right now. It's most likely possible, but it's +// TODO: No support for this right now. It\'s most likely possible, but it\'s // unclear how useful it is at the moment and it entails a little -// more work than named type exports, so I'm punting on it for now. +// more work than named type exports, so I\'m punting on it for now. /////////////////////////////////////////////////////// // == Import Type With Non-Alias Compatible Value == // /////////////////////////////////////////////////////// -import type {numValue} from "./ExportsANumber"; // Error: Cannot import-type a number value +import type {numValue} from \"./ExportsANumber\"; // Error: Cannot import-type a number value //////////////////////////////////////////////////////////////////////// // == Regression Test: https://github.com/facebook/flow/issues/359 == // @@ -240,7 +240,7 @@ import type {numValue} from "./ExportsANumber"; // Error: Cannot import-type a n // env contexts. // //////////////////////////////////////////////////////////////////////// -import type ClassFoo6 from "./issue-359"; +import type ClassFoo6 from \"./issue-359\"; function foo() { ClassFoo6; // Error: Not a value binding } @@ -267,19 +267,19 @@ function foo() { /////////////////////////////////////////////////// // Error: ClassFoo4 ~> number // Error: ClassFoo4 is not a value-identifier -// TODO: this errors correctly, but the message is just 'can't resolve name' -// Error: Can't typeof a type alias +// TODO: this errors correctly, but the message is just \'can\'t resolve name\' +// Error: Can\'t typeof a type alias //////////////////////////////////////////// // == Import Type Alias (Named Export) == // //////////////////////////////////////////// // Error: AliasFoo3 ~> number -// Error: Can't typeof a type alias +// Error: Can\'t typeof a type alias ////////////////////////////////////////////// // == Import Type Alias (Default Export) == // ////////////////////////////////////////////// -// TODO: No support for this right now. It's most likely possible, but it's +// TODO: No support for this right now. It\'s most likely possible, but it\'s // unclear how useful it is at the moment and it entails a little -// more work than named type exports, so I'm punting on it for now. +// more work than named type exports, so I\'m punting on it for now. /////////////////////////////////////////////////////// // == Import Type With Non-Alias Compatible Value == // /////////////////////////////////////////////////////// @@ -290,33 +290,33 @@ function foo() { // env contexts. // //////////////////////////////////////////////////////////////////////// // Error: Not a value binding -import type ClassFoo1 from "./ExportDefault_Class"; -import { foo1Inst } from "./ExportDefault_Class"; +import type ClassFoo1 from \"./ExportDefault_Class\"; +import { foo1Inst } from \"./ExportDefault_Class\"; var a1: ClassFoo1 = foo1Inst; var a2: number = foo1Inst; new ClassFoo1(); -import type { ClassFoo2 } from "./ExportNamed_Class"; -import { foo2Inst } from "./ExportNamed_Class"; +import type { ClassFoo2 } from \"./ExportNamed_Class\"; +import { foo2Inst } from \"./ExportNamed_Class\"; var b1: ClassFoo2 = foo2Inst; var b2: number = foo2Inst; new ClassFoo2(); -import type ClassFoo3T from "./ExportCJSDefault_Class"; -import ClassFoo3 from "./ExportCJSDefault_Class"; +import type ClassFoo3T from \"./ExportCJSDefault_Class\"; +import ClassFoo3 from \"./ExportCJSDefault_Class\"; var c1: ClassFoo3T = new ClassFoo3(); new ClassFoo3T(); -import type { ClassFoo4, ClassFoo5 } from "./ExportCJSNamed_Class"; -import { foo4Inst, foo5Inst } from "./ExportCJSNamed_Class"; +import type { ClassFoo4, ClassFoo5 } from \"./ExportCJSNamed_Class\"; +import { foo4Inst, foo5Inst } from \"./ExportCJSNamed_Class\"; var d1: ClassFoo4 = foo4Inst; var d2: number = foo4Inst; new ClassFoo4(); var d3: typeof ClassFoo5 = foo5Inst; -import type { AliasFoo3 } from "./ExportNamed_Alias"; -import { givesAFoo3Obj } from "./ExportNamed_Alias"; +import type { AliasFoo3 } from \"./ExportNamed_Alias\"; +import { givesAFoo3Obj } from \"./ExportNamed_Alias\"; var e1: AliasFoo3 = givesAFoo3Obj(); var e2: number = givesAFoo3Obj(); var e3: typeof AliasFoo3 = givesAFoo3Obj(); -import type { numValue } from "./ExportsANumber"; -import type ClassFoo6 from "./issue-359"; +import type { numValue } from \"./ExportsANumber\"; +import type ClassFoo6 from \"./issue-359\"; function foo() { ClassFoo6; } diff --git a/tests/import_typeof/__snapshots__/jsfmt.spec.js.snap b/tests/import_typeof/__snapshots__/jsfmt.spec.js.snap index 3657997b..3da3d3df 100644 --- a/tests/import_typeof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/import_typeof/__snapshots__/jsfmt.spec.js.snap @@ -152,11 +152,11 @@ exports[`test ExportNamed_Multi.js 1`] = ` "// @flow export var num = 42; -export var str = 'asdf'; +export var str = \'asdf\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export var num = 42; -export var str = "asdf"; +export var str = \"asdf\"; " `; @@ -179,8 +179,8 @@ exports[`test import_typeof.js 1`] = ` // == Importing Class Typeof (Default Export) == // /////////////////////////////////////////////////// -import typeof ClassFoo1T from "./ExportDefault_Class"; -import ClassFoo1 from "./ExportDefault_Class"; +import typeof ClassFoo1T from \"./ExportDefault_Class\"; +import ClassFoo1 from \"./ExportDefault_Class\"; var a1: ClassFoo1T = ClassFoo1; var a2: ClassFoo1T = new ClassFoo1(); // Error: ClassFoo1 (inst) ~> ClassFoo1 (class) @@ -190,8 +190,8 @@ new ClassFoo1T(); // Error: ClassFoo1T is not bound to a value // == Importing Class Typeof (Named Export) == // ///////////////////////////////////////////////// -import typeof {ClassFoo2 as ClassFoo2T} from "./ExportNamed_Class"; -import {ClassFoo2} from "./ExportNamed_Class"; +import typeof {ClassFoo2 as ClassFoo2T} from \"./ExportNamed_Class\"; +import {ClassFoo2} from \"./ExportNamed_Class\"; var b1: ClassFoo2T = ClassFoo2; var b2: ClassFoo2T = new ClassFoo2(); // Error: ClassFoo2 (inst) ~> ClassFoo2 (class) @@ -201,8 +201,8 @@ new ClassFoo2T(); // Error: ClassFoo2T is not bound to a value // == Importing Class Typeof (CJS Default Export) == // /////////////////////////////////////////////////////// -import typeof ClassFoo3T from "./ExportCJSDefault_Class"; -import ClassFoo3 from "./ExportCJSDefault_Class"; +import typeof ClassFoo3T from \"./ExportCJSDefault_Class\"; +import ClassFoo3 from \"./ExportCJSDefault_Class\"; var c1: ClassFoo3T = ClassFoo3; var c2: ClassFoo3T = new ClassFoo3(); // Error: ClassFoo3 (inst) ~> ClassFoo3 (class) @@ -211,8 +211,8 @@ var c2: ClassFoo3T = new ClassFoo3(); // Error: ClassFoo3 (inst) ~> ClassFoo3 (c // == Importing Class Typeof (CJS Named Export) == // ///////////////////////////////////////////////////// -import typeof {ClassFoo4 as ClassFoo4T} from "./ExportCJSNamed_Class"; -import {ClassFoo4} from "./ExportCJSNamed_Class"; +import typeof {ClassFoo4 as ClassFoo4T} from \"./ExportCJSNamed_Class\"; +import {ClassFoo4} from \"./ExportCJSNamed_Class\"; var d1: ClassFoo4T = ClassFoo4; var d2: ClassFoo4T = new ClassFoo4(); // Error: ClassFoo4 (inst) ~> ClassFoo4 (class) @@ -221,58 +221,58 @@ var d2: ClassFoo4T = new ClassFoo4(); // Error: ClassFoo4 (inst) ~> ClassFoo4 (c // == Import Typeof Alias (Named Export) == // ////////////////////////////////////////////// -import typeof {AliasFoo3} from "./ExportNamed_Alias"; // Error: Can't \`import typeof\` type aliases! +import typeof {AliasFoo3} from \"./ExportNamed_Alias\"; // Error: Can\'t \`import typeof\` type aliases! //////////////////////////////////////////////// // == Import Typeof Alias (Default Export) == // //////////////////////////////////////////////// -// TODO: No support for this right now. It's most likely possible, but it's +// TODO: No support for this right now. It\'s most likely possible, but it\'s // unclear how useful it is at the moment and it entails a little -// more work than named type exports, so I'm punting on it for now. +// more work than named type exports, so I\'m punting on it for now. /////////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (Default Export) == // /////////////////////////////////////////////////////////////// -import typeof num_default from "./ExportDefault_Number"; +import typeof num_default from \"./ExportDefault_Number\"; var f1: num_default = 42; -var f2: num_default = 'asdf'; // Error: string ~> number +var f2: num_default = \'asdf\'; // Error: string ~> number ///////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (Named Export) == // ///////////////////////////////////////////////////////////// -import typeof {num as num_named} from "./ExportNamed_Number"; +import typeof {num as num_named} from \"./ExportNamed_Number\"; var g1: num_named = 42; -var g2: num_named = 'asdf'; // Error: string ~> number +var g2: num_named = \'asdf\'; // Error: string ~> number /////////////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (CJS Default Export) == // /////////////////////////////////////////////////////////////////// -import typeof num_cjs_default from "./ExportCJSDefault_Number"; +import typeof num_cjs_default from \"./ExportCJSDefault_Number\"; var h1: num_cjs_default = 42; -var h2: num_cjs_default = 'asdf'; // Error: string ~> number +var h2: num_cjs_default = \'asdf\'; // Error: string ~> number ///////////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (CJS Named Export) == // ///////////////////////////////////////////////////////////////// -import typeof {num as num_cjs_named} from "./ExportCJSNamed_Number"; +import typeof {num as num_cjs_named} from \"./ExportCJSNamed_Number\"; var i1: num_cjs_named = 42; -var i2: num_cjs_named = 'asdf'; // Error: string ~> number +var i2: num_cjs_named = \'asdf\'; // Error: string ~> number /////////////////////////////////////////////// // == Import Typeof ModuleNamespaceObject == // /////////////////////////////////////////////// -import typeof * as ModuleNSObjT from "./ExportNamed_Multi"; -var j1: ModuleNSObjT = {num: 42, str: 'asdf'}; +import typeof * as ModuleNSObjT from \"./ExportNamed_Multi\"; +var j1: ModuleNSObjT = {num: 42, str: \'asdf\'}; var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @@ -299,13 +299,13 @@ var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string ////////////////////////////////////////////// // == Import Typeof Alias (Named Export) == // ////////////////////////////////////////////// -// Error: Can't \`import typeof\` type aliases! +// Error: Can\'t \`import typeof\` type aliases! //////////////////////////////////////////////// // == Import Typeof Alias (Default Export) == // //////////////////////////////////////////////// -// TODO: No support for this right now. It's most likely possible, but it's +// TODO: No support for this right now. It\'s most likely possible, but it\'s // unclear how useful it is at the moment and it entails a little -// more work than named type exports, so I'm punting on it for now. +// more work than named type exports, so I\'m punting on it for now. /////////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (Default Export) == // /////////////////////////////////////////////////////////////// @@ -326,39 +326,39 @@ var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string // == Import Typeof ModuleNamespaceObject == // /////////////////////////////////////////////// // Error: number ~> string -import typeof ClassFoo1T from "./ExportDefault_Class"; -import ClassFoo1 from "./ExportDefault_Class"; +import typeof ClassFoo1T from \"./ExportDefault_Class\"; +import ClassFoo1 from \"./ExportDefault_Class\"; var a1: ClassFoo1T = ClassFoo1; var a2: ClassFoo1T = new ClassFoo1(); new ClassFoo1T(); -import typeof { ClassFoo2 as ClassFoo2T } from "./ExportNamed_Class"; -import { ClassFoo2 } from "./ExportNamed_Class"; +import typeof { ClassFoo2 as ClassFoo2T } from \"./ExportNamed_Class\"; +import { ClassFoo2 } from \"./ExportNamed_Class\"; var b1: ClassFoo2T = ClassFoo2; var b2: ClassFoo2T = new ClassFoo2(); new ClassFoo2T(); -import typeof ClassFoo3T from "./ExportCJSDefault_Class"; -import ClassFoo3 from "./ExportCJSDefault_Class"; +import typeof ClassFoo3T from \"./ExportCJSDefault_Class\"; +import ClassFoo3 from \"./ExportCJSDefault_Class\"; var c1: ClassFoo3T = ClassFoo3; var c2: ClassFoo3T = new ClassFoo3(); -import typeof { ClassFoo4 as ClassFoo4T } from "./ExportCJSNamed_Class"; -import { ClassFoo4 } from "./ExportCJSNamed_Class"; +import typeof { ClassFoo4 as ClassFoo4T } from \"./ExportCJSNamed_Class\"; +import { ClassFoo4 } from \"./ExportCJSNamed_Class\"; var d1: ClassFoo4T = ClassFoo4; var d2: ClassFoo4T = new ClassFoo4(); -import typeof { AliasFoo3 } from "./ExportNamed_Alias"; -import typeof num_default from "./ExportDefault_Number"; +import typeof { AliasFoo3 } from \"./ExportNamed_Alias\"; +import typeof num_default from \"./ExportDefault_Number\"; var f1: num_default = 42; -var f2: num_default = "asdf"; -import typeof { num as num_named } from "./ExportNamed_Number"; +var f2: num_default = \"asdf\"; +import typeof { num as num_named } from \"./ExportNamed_Number\"; var g1: num_named = 42; -var g2: num_named = "asdf"; -import typeof num_cjs_default from "./ExportCJSDefault_Number"; +var g2: num_named = \"asdf\"; +import typeof num_cjs_default from \"./ExportCJSDefault_Number\"; var h1: num_cjs_default = 42; -var h2: num_cjs_default = "asdf"; -import typeof { num as num_cjs_named } from "./ExportCJSNamed_Number"; +var h2: num_cjs_default = \"asdf\"; +import typeof { num as num_cjs_named } from \"./ExportCJSNamed_Number\"; var i1: num_cjs_named = 42; -var i2: num_cjs_named = "asdf"; -import typeof * as ModuleNSObjT from "./ExportNamed_Multi"; -var j1: ModuleNSObjT = { num: 42, str: "asdf" }; +var i2: num_cjs_named = \"asdf\"; +import typeof * as ModuleNSObjT from \"./ExportNamed_Multi\"; +var j1: ModuleNSObjT = { num: 42, str: \"asdf\" }; var j2: ModuleNSObjT = { num: 42, str: 42 }; " `; diff --git a/tests/include/foo/batman/__snapshots__/jsfmt.spec.js.snap b/tests/include/foo/batman/__snapshots__/jsfmt.spec.js.snap index b26a2561..4f3304d6 100644 --- a/tests/include/foo/batman/__snapshots__/jsfmt.spec.js.snap +++ b/tests/include/foo/batman/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ exports[`test baz.js 1`] = ` "/* @flow */ -var x: number = "not a number" // Error string ~> number +var x: number = \"not a number\" // Error string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Error string ~> number -var x: number = "not a number"; +var x: number = \"not a number\"; " `; diff --git a/tests/incremental/__snapshots__/jsfmt.spec.js.snap b/tests/incremental/__snapshots__/jsfmt.spec.js.snap index f9f62a40..096c7563 100644 --- a/tests/incremental/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental/__snapshots__/jsfmt.spec.js.snap @@ -11,12 +11,12 @@ exports[`test b.js 1`] = ` @flow */ -var A = require('IncrModuleA'); +var A = require(\'IncrModuleA\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule IncrModuleB @flow */ -var A = require("IncrModuleA"); +var A = require(\"IncrModuleA\"); " `; diff --git a/tests/incremental_basic/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_basic/__snapshots__/jsfmt.spec.js.snap index 6e2e1426..a0eb1b11 100644 --- a/tests/incremental_basic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_basic/__snapshots__/jsfmt.spec.js.snap @@ -11,12 +11,12 @@ module.exports = a; exports[`test b.js 1`] = ` "// @flow -var a = require('./a'); +var a = require(\'./a\'); var b: number = a; module.exports = b; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var a = require("./a"); +var a = require(\"./a\"); var b: number = a; module.exports = b; " @@ -24,12 +24,12 @@ module.exports = b; exports[`test c.js 1`] = ` "// @flow -var b = require('./b'); +var b = require(\'./b\'); var c: string = b; module.exports = c; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var b = require("./b"); +var b = require(\"./b\"); var c: string = b; module.exports = c; " diff --git a/tests/incremental_basic/tmp1/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_basic/tmp1/__snapshots__/jsfmt.spec.js.snap index f5ce03cb..11d82fe8 100644 --- a/tests/incremental_basic/tmp1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_basic/tmp1/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ exports[`test b.js 1`] = ` "// @flow -var a = require('./a'); +var a = require(\'./a\'); var b = a; module.exports = b; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var a = require("./a"); +var a = require(\"./a\"); var b = a; module.exports = b; " diff --git a/tests/incremental_basic/tmp3/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_basic/tmp3/__snapshots__/jsfmt.spec.js.snap index 142a0fe2..b56a5d3b 100644 --- a/tests/incremental_basic/tmp3/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_basic/tmp3/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ exports[`test b.js 1`] = ` "// @flow -var a = require('./a'); +var a = require(\'./a\'); var b: number = a; module.exports = b; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var a = require("./a"); +var a = require(\"./a\"); var b: number = a; module.exports = b; " diff --git a/tests/incremental_cycle/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_cycle/__snapshots__/jsfmt.spec.js.snap index 035399b3..47f24548 100644 --- a/tests/incremental_cycle/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_cycle/__snapshots__/jsfmt.spec.js.snap @@ -19,8 +19,8 @@ module.exports = A; exports[`test B.js 1`] = ` "// @flow -var A = require ('./A'); -import type C from './C'; +var A = require (\'./A\'); +import type C from \'./C\'; class B extends A { c: C; @@ -29,8 +29,8 @@ class B extends A { module.exports = B; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var A = require("./A"); -import type C from "./C"; +var A = require(\"./A\"); +import type C from \"./C\"; class B extends A { c: C; } @@ -40,8 +40,8 @@ module.exports = B; exports[`test C.js 1`] = ` "// @flow -var A = require ('./A'); -import type B from './B'; +var A = require (\'./A\'); +import type B from \'./B\'; class C extends A { b: B; @@ -50,8 +50,8 @@ class C extends A { module.exports = C; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var A = require("./A"); -import type B from "./B"; +var A = require(\"./A\"); +import type B from \"./B\"; class C extends A { b: B; } diff --git a/tests/incremental_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap index feb2e6cf..741c8d32 100644 --- a/tests/incremental_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap @@ -1,21 +1,21 @@ exports[`test B.js 1`] = ` "// @flow -var A = require ('./A'); -import type C from './C'; +var A = require (\'./A\'); +import type C from \'./C\'; export type B = string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var A = require("./A"); -import type C from "./C"; +var A = require(\"./A\"); +import type C from \"./C\"; export type B = string; " `; exports[`test C.js 1`] = ` "// @flow -var A = require ('./A'); -import type { B } from './B' +var A = require (\'./A\'); +import type { B } from \'./B\' class C extends A { b: B; @@ -24,8 +24,8 @@ class C extends A { module.exports = C; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var A = require("./A"); -import type { B } from "./B"; +var A = require(\"./A\"); +import type { B } from \"./B\"; class C extends A { b: B; } diff --git a/tests/incremental_cycle/tmp2/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_cycle/tmp2/__snapshots__/jsfmt.spec.js.snap index 2d1a5f31..cc9ad232 100644 --- a/tests/incremental_cycle/tmp2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_cycle/tmp2/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ exports[`test B.js 1`] = ` "// @flow -var A = require ('./A'); -//import type C from './C'; +var A = require (\'./A\'); +//import type C from \'./C\'; export type B = string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -//import type C from './C'; -var A = require("./A"); +//import type C from \'./C\'; +var A = require(\"./A\"); export type B = string; " `; diff --git a/tests/incremental_cycle/tmp3/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_cycle/tmp3/__snapshots__/jsfmt.spec.js.snap index 0eb31305..69cb9ed2 100644 --- a/tests/incremental_cycle/tmp3/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_cycle/tmp3/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test B.js 1`] = ` "// @flow -var A = require ('./A'); -import type C from './C'; +var A = require (\'./A\'); +import type C from \'./C\'; export type B = string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var A = require("./A"); -import type C from "./C"; +var A = require(\"./A\"); +import type C from \"./C\"; export type B = string; " `; diff --git a/tests/incremental_delete/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_delete/__snapshots__/jsfmt.spec.js.snap index 36644249..85093731 100644 --- a/tests/incremental_delete/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_delete/__snapshots__/jsfmt.spec.js.snap @@ -11,12 +11,12 @@ module.exports = a; exports[`test b.js 1`] = ` "// @flow -var a = require('./a'); +var a = require(\'./a\'); var b: number = a; module.exports = b; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var a = require("./a"); +var a = require(\"./a\"); var b: number = a; module.exports = b; " @@ -24,12 +24,12 @@ module.exports = b; exports[`test c.js 1`] = ` "// @flow -var b = require('./b'); +var b = require(\'./b\'); var c: string = b; module.exports = c; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var b = require("./b"); +var b = require(\"./b\"); var c: string = b; module.exports = c; " @@ -41,14 +41,14 @@ exports[`test dupe1.js 1`] = ` * @providesModule Dupe * @flow */ -module.exports = "dupe1"; +module.exports = \"dupe1\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 1/2 * @providesModule Dupe * @flow */ -module.exports = "dupe1"; +module.exports = \"dupe1\"; " `; @@ -58,14 +58,14 @@ exports[`test dupe2.js 1`] = ` * @providesModule Dupe * @flow */ -module.exports = "dupe2"; +module.exports = \"dupe2\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 2/2 * @providesModule Dupe * @flow */ -module.exports = "dupe2"; +module.exports = \"dupe2\"; " `; @@ -74,13 +74,13 @@ exports[`test requires_dupe.js 1`] = ` * depends on doubly-provided module * @flow */ -var dupe = require('Dupe'); +var dupe = require(\'Dupe\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * depends on doubly-provided module * @flow */ -var dupe = require("Dupe"); +var dupe = require(\"Dupe\"); " `; @@ -89,13 +89,13 @@ exports[`test requires_unchecked.js 1`] = ` * depends on an unchecked module, which will be deleted * @flow */ -var unchecked = require('Unchecked'); +var unchecked = require(\'Unchecked\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * depends on an unchecked module, which will be deleted * @flow */ -var unchecked = require("Unchecked"); +var unchecked = require(\"Unchecked\"); " `; @@ -104,12 +104,12 @@ exports[`test unchecked.js 1`] = ` * Not a flow module. * @providesModule Unchecked */ -module.exports = "unchecked"; +module.exports = \"unchecked\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Not a flow module. * @providesModule Unchecked */ -module.exports = "unchecked"; +module.exports = \"unchecked\"; " `; diff --git a/tests/incremental_json/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_json/__snapshots__/jsfmt.spec.js.snap index a5160a9a..74c31c79 100644 --- a/tests/incremental_json/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_json/__snapshots__/jsfmt.spec.js.snap @@ -2,13 +2,13 @@ exports[`test test.js 1`] = ` "/** * @flow */ -var data = require('./data'); +var data = require(\'./data\'); var x: number = data.x; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow */ -var data = require("./data"); +var data = require(\"./data\"); var x: number = data.x; " `; diff --git a/tests/incremental_mixed_naming_cycle/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_mixed_naming_cycle/__snapshots__/jsfmt.spec.js.snap index 7030aad4..3d5a61e0 100644 --- a/tests/incremental_mixed_naming_cycle/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_mixed_naming_cycle/__snapshots__/jsfmt.spec.js.snap @@ -4,18 +4,18 @@ exports[`test a.js 1`] = ` * @flow */ -(require('./b'): void); -(require('C'): void); +(require(\'./b\'): void); +(require(\'C\'): void); -module.exports = 'A'; +module.exports = \'A\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule A * @flow */ -(require("./b"): void); -(require("C"): void); -module.exports = "A"; +(require(\"./b\"): void); +(require(\"C\"): void); +module.exports = \"A\"; " `; @@ -25,18 +25,18 @@ exports[`test b.js 1`] = ` * @flow */ -(require('A'): void); -(require('D'): void); +(require(\'A\'): void); +(require(\'D\'): void); -module.exports = 'B'; +module.exports = \'B\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule B * @flow */ -(require("A"): void); -(require("D"): void); -module.exports = "B"; +(require(\"A\"): void); +(require(\"D\"): void); +module.exports = \"B\"; " `; @@ -46,18 +46,18 @@ exports[`test c.js 1`] = ` * @flow */ -require('Root'); -(require('./b'): void); +require(\'Root\'); +(require(\'./b\'): void); -module.exports = 'C'; +module.exports = \'C\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule C * @flow */ -require("Root"); -(require("./b"): void); -module.exports = "C"; +require(\"Root\"); +(require(\"./b\"): void); +module.exports = \"C\"; " `; @@ -67,16 +67,16 @@ exports[`test d.js 1`] = ` * @flow */ -(require('./b'): void); +(require(\'./b\'): void); -module.exports = 'D'; +module.exports = \'D\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule D * @flow */ -(require("./b"): void); -module.exports = "D"; +(require(\"./b\"): void); +module.exports = \"D\"; " `; @@ -86,12 +86,12 @@ exports[`test root.js 1`] = ` * @flow */ -module.exports = 'Root'; +module.exports = \'Root\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule Root * @flow */ -module.exports = "Root"; +module.exports = \"Root\"; " `; diff --git a/tests/incremental_mixed_naming_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_mixed_naming_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap index e6210d4b..d0a8df0e 100644 --- a/tests/incremental_mixed_naming_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_mixed_naming_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap @@ -5,13 +5,13 @@ exports[`test root.js 1`] = ` */ // trivial edit (adding this comment) -module.exports = 'Root'; +module.exports = \'Root\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule Root * @flow */ // trivial edit (adding this comment) -module.exports = "Root"; +module.exports = \"Root\"; " `; diff --git a/tests/incremental_non_flow_move/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_non_flow_move/__snapshots__/jsfmt.spec.js.snap index 9da18831..94131559 100644 --- a/tests/incremental_non_flow_move/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_non_flow_move/__snapshots__/jsfmt.spec.js.snap @@ -15,11 +15,11 @@ exports[`test test.js 1`] = ` * @flow */ -require('Foo'); +require(\'Foo\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow */ -require("Foo"); +require(\"Foo\"); " `; diff --git a/tests/incremental_path/dir/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_path/dir/__snapshots__/jsfmt.spec.js.snap index 673a17e8..630bf072 100644 --- a/tests/incremental_path/dir/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_path/dir/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test a.js 1`] = ` "// @flow -(require('b'): boolean); +(require(\'b\'): boolean); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -(require("b"): boolean); +(require(\"b\"): boolean); " `; diff --git a/tests/indexer/__snapshots__/jsfmt.spec.js.snap b/tests/indexer/__snapshots__/jsfmt.spec.js.snap index bd9a2ea0..a47ec802 100644 --- a/tests/indexer/__snapshots__/jsfmt.spec.js.snap +++ b/tests/indexer/__snapshots__/jsfmt.spec.js.snap @@ -1,42 +1,42 @@ exports[`test A.js 1`] = ` "// No indexer should be fine function foo0(): {} { - return { foo: "bar" } + return { foo: \"bar\" } } // Matching indexer should be fine function foo1(): {[key: string]: string} { - return { foo: "bar" } + return { foo: \"bar\" } } // Indexer with different key type is an error when it matches function foo2(): {[key: number]: string} { - return { foo: "bar" } + return { foo: \"bar\" } } // Matching indexer with different value type is an error function foo3(): {[key: string]: number} { - return { foo: "bar" } + return { foo: \"bar\" } } // Indexer with different key type and different value type is twice an error function foo4(): {[key: number]: number} { - return { foo: "bar" } + return { foo: \"bar\" } } // If key exists in object type then indexer is not matched function foo5(): {[key: string]: number; foo: string} { - return { foo: "bar" } + return { foo: \"bar\" } } // If key exists in object type then indexer is not matched function foo6(): {[key: number]: number; foo: string} { - return { foo: "bar" } + return { foo: \"bar\" } } // Should still complain about mistyped properties function foo7(): {[key: string]: number; foo: number} { - return { foo: "bar" } + return { foo: \"bar\" } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // No indexer should be fine @@ -48,28 +48,28 @@ function foo7(): {[key: string]: number; foo: number} { // If key exists in object type then indexer is not matched // Should still complain about mistyped properties function foo0(): {} { - return { foo: "bar" }; + return { foo: \"bar\" }; } function foo1(): { [key: string]: string } { - return { foo: "bar" }; + return { foo: \"bar\" }; } function foo2(): { [key: number]: string } { - return { foo: "bar" }; + return { foo: \"bar\" }; } function foo3(): { [key: string]: number } { - return { foo: "bar" }; + return { foo: \"bar\" }; } function foo4(): { [key: number]: number } { - return { foo: "bar" }; + return { foo: \"bar\" }; } function foo5(): { [key: string]: number; foo: string } { - return { foo: "bar" }; + return { foo: \"bar\" }; } function foo6(): { [key: number]: number; foo: string } { - return { foo: "bar" }; + return { foo: \"bar\" }; } function foo7(): { [key: string]: number; foo: number } { - return { foo: "bar" }; + return { foo: \"bar\" }; } " `; diff --git a/tests/instanceof/__snapshots__/jsfmt.spec.js.snap b/tests/instanceof/__snapshots__/jsfmt.spec.js.snap index 91c2dc61..f17c7de0 100644 --- a/tests/instanceof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/instanceof/__snapshots__/jsfmt.spec.js.snap @@ -9,13 +9,13 @@ function x(b) { return b ? new X1 : new X2; } function consumer1(b) { var g = x(b); - if (g instanceof X2) g.foo = '1337'; + if (g instanceof X2) g.foo = \'1337\'; else g.foo = 1337; } function consumer2(b) { var g = x(b); - if (g instanceof X1) g.foo = '1337'; // oops + if (g instanceof X1) g.foo = \'1337\'; // oops } // x.y instanceof t @@ -26,13 +26,13 @@ function y(b) { return b ? new Y1 : new Y2; } function consumer3(b) { var g = y(b); - if (g.bar instanceof X2) g.bar.foo = '1337'; + if (g.bar instanceof X2) g.bar.foo = \'1337\'; else g.bar.foo = 1337; } function consumer4(b) { var g = y(b); - if (g.bar instanceof X1) g.bar.foo = '1337'; // oops + if (g.bar instanceof X1) g.bar.foo = \'1337\'; // oops } // x.y.z instance of t @@ -43,13 +43,13 @@ function z(b) { return b ? new Z1 : new Z2; } function consumer5(b) { var g = z(b); - if (g.baz.bar instanceof X2) g.baz.bar.foo = '1337'; + if (g.baz.bar instanceof X2) g.baz.bar.foo = \'1337\'; else g.baz.bar.foo = 1337; } function consumer6(b) { var g = z(b); - if (g.baz.bar instanceof X1) g.baz.bar.foo = '1337'; // oops + if (g.baz.bar instanceof X1) g.baz.bar.foo = \'1337\'; // oops } // this instanceof t @@ -58,7 +58,7 @@ class C { if (this instanceof D) alert(this.s); else - alert("nope"); + alert(\"nope\"); } } @@ -66,7 +66,7 @@ class D extends C { s: string; constructor() { super(); - this.s = "yup"; + this.s = \"yup\"; } } @@ -109,14 +109,14 @@ function x(b) { function consumer1(b) { var g = x(b); if (g instanceof X2) - g.foo = "1337"; + g.foo = \"1337\"; else g.foo = 1337; } function consumer2(b) { var g = x(b); if (g instanceof X1) - g.foo = "1337"; + g.foo = \"1337\"; } class Y1 { bar: X1; @@ -130,14 +130,14 @@ function y(b) { function consumer3(b) { var g = y(b); if (g.bar instanceof X2) - g.bar.foo = "1337"; + g.bar.foo = \"1337\"; else g.bar.foo = 1337; } function consumer4(b) { var g = y(b); if (g.bar instanceof X1) - g.bar.foo = "1337"; + g.bar.foo = \"1337\"; } class Z1 { baz: Y1; @@ -151,28 +151,28 @@ function z(b) { function consumer5(b) { var g = z(b); if (g.baz.bar instanceof X2) - g.baz.bar.foo = "1337"; + g.baz.bar.foo = \"1337\"; else g.baz.bar.foo = 1337; } function consumer6(b) { var g = z(b); if (g.baz.bar instanceof X1) - g.baz.bar.foo = "1337"; + g.baz.bar.foo = \"1337\"; } class C { m() { if (this instanceof D) alert(this.s); else - alert("nope"); + alert(\"nope\"); } } class D extends C { s: string; constructor() { super(); - this.s = "yup"; + this.s = \"yup\"; } } function foo0(x: Array | number) { diff --git a/tests/integration/__snapshots__/jsfmt.spec.js.snap b/tests/integration/__snapshots__/jsfmt.spec.js.snap index 2e401ace..9ea067be 100644 --- a/tests/integration/__snapshots__/jsfmt.spec.js.snap +++ b/tests/integration/__snapshots__/jsfmt.spec.js.snap @@ -8,9 +8,9 @@ exports[`test bar.js 1`] = ` exports[`test foo.js 1`] = ` "// @flow -require('./bar'); +require(\'./bar\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -require("./bar"); +require(\"./bar\"); " `; diff --git a/tests/issues-11/__snapshots__/jsfmt.spec.js.snap b/tests/issues-11/__snapshots__/jsfmt.spec.js.snap index df05715b..31d0b8f3 100644 --- a/tests/issues-11/__snapshots__/jsfmt.spec.js.snap +++ b/tests/issues-11/__snapshots__/jsfmt.spec.js.snap @@ -1,22 +1,22 @@ exports[`test export.js 1`] = ` "/* @flow */ exports.x = 1; -exports.y = ""; +exports.y = \"\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ exports.x = 1; -exports.y = ""; +exports.y = \"\"; " `; exports[`test import.js 1`] = ` "/* @flow */ -var e = require('./export'); +var e = require(\'./export\'); var x: string = e.x; var y: number = e.y; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var e = require("./export"); +var e = require(\"./export\"); var x: string = e.x; var y: number = e.y; " diff --git a/tests/iter/__snapshots__/jsfmt.spec.js.snap b/tests/iter/__snapshots__/jsfmt.spec.js.snap index 4adfe042..8d040ac1 100644 --- a/tests/iter/__snapshots__/jsfmt.spec.js.snap +++ b/tests/iter/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ for (var i=0;i<3;i++) { foo(a[i]); } for (var k in a) { - foo(a[k]); // k is a string, which shouldn't be used for array access + foo(a[k]); // k is a string, which shouldn\'t be used for array access } var b = (null : ?{[key: string]: string}); @@ -21,7 +21,7 @@ for (var m in (c = b)) { var d; for (var n in (d = a)) { - foo(d[n]); // d is a string, which shouldn't be used for array access + foo(d[n]); // d is a string, which shouldn\'t be used for array access } for (var x in undefined) { @@ -33,16 +33,16 @@ for (var x in null) { } for (var y in this) { - // regression test to make sure \`in this\` doesn't fatal. it's currently - // allowed, even though we can't actually enumerate all the keys on \`this\`. + // regression test to make sure \`in this\` doesn\'t fatal. it\'s currently + // allowed, even though we can\'t actually enumerate all the keys on \`this\`. } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// k is a string, which shouldn't be used for array access -// d is a string, which shouldn't be used for array access +// k is a string, which shouldn\'t be used for array access +// d is a string, which shouldn\'t be used for array access // unreachable // unreachable -// regression test to make sure \`in this\` doesn't fatal. it's currently -// allowed, even though we can't actually enumerate all the keys on \`this\`. +// regression test to make sure \`in this\` doesn\'t fatal. it\'s currently +// allowed, even though we can\'t actually enumerate all the keys on \`this\`. var a = [ true, false ]; function foo(x) { diff --git a/tests/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap b/tests/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap index b2519930..654f05bb 100644 --- a/tests/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test main.js 1`] = ` "// @flow -var React = require('react'); +var React = require(\'react\'); class CustomComponent extends React.Component { props: { @@ -9,56 +9,56 @@ class CustomComponent extends React.Component { }; } -var a: React.Element<{prop: string}> = ; -var b: React.Element<{prop1: string}> = ; // Error: Props<{prop}> ~> Props<{prop1}> +var a: React.Element<{prop: string}> = ; +var b: React.Element<{prop1: string}> = ; // Error: Props<{prop}> ~> Props<{prop1}> // Since intrinsics are typed as \`any\` out of the box, we can pass any // attributes to intrinsics! -var c: React.Element =
; -// However, we don't allow such elements to be viewed as React elements with +var c: React.Element =
; +// However, we don\'t allow such elements to be viewed as React elements with // different attributes. -var d: React.Element<{doesntmatch: string}> =
; +var d: React.Element<{doesntmatch: string}> =
; // No error as long as expectations are consistent, though. -var e: React.Element<{not_a_real_attr: string}> =
; +var e: React.Element<{not_a_real_attr: string}> =
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Error: Props<{prop}> ~> Props<{prop1}> // Since intrinsics are typed as \`any\` out of the box, we can pass any // attributes to intrinsics! -// However, we don't allow such elements to be viewed as React elements with +// However, we don\'t allow such elements to be viewed as React elements with // different attributes. // No error as long as expectations are consistent, though. -var React = require("react"); +var React = require(\"react\"); class CustomComponent extends React.Component { props: { prop: string }; } -var a: React.Element<{ prop: string }> = ; -var b: React.Element<{ prop1: string }> = ; -var c: React.Element =
; -var d: React.Element<{ doesntmatch: string }> =
; +var a: React.Element<{ prop: string }> = ; +var b: React.Element<{ prop1: string }> = ; +var c: React.Element =
; +var d: React.Element<{ doesntmatch: string }> =
; var e: React.Element<{ not_a_real_attr: string -}> =
; +}> =
; " `; exports[`test strings.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); // The builtin $JSXIntrinsics should allow any string -var Div = 'div'; -var Bad = 'bad'; -var Str: string = 'str'; +var Div = \'div\'; +var Bad = \'bad\'; +var Str: string = \'str\';
; // This is fine ; // This is fine ; // This is fine -React.createElement('div', {}); // This is fine -React.createElement('bad', {}); // This is fine +React.createElement(\'div\', {}); // This is fine +React.createElement(\'bad\', {}); // This is fine
; // This is fine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -70,15 +70,15 @@ React.createElement('bad', {}); // This is fine // This is fine /* This is fine*/ // This is fine -var React = require("react"); -var Div = "div"; -var Bad = "bad"; -var Str: string = "str"; +var React = require(\"react\"); +var Div = \"div\"; +var Bad = \"bad\"; +var Str: string = \"str\";
; ; ; -React.createElement("div", {}); -React.createElement("bad", {}); +React.createElement(\"div\", {}); +React.createElement(\"bad\", {});
; " `; diff --git a/tests/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap b/tests/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap index a25ce0b3..f2adad66 100644 --- a/tests/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test main.js 1`] = ` "// @flow -var React = require('react'); +var React = require(\'react\'); class CustomComponent extends React.Component { props: { @@ -9,46 +9,46 @@ class CustomComponent extends React.Component { }; } -var a: React.Element<{prop: string}> = ; -var b: React.Element<{prop1: string}> = ; // Error: Props<{prop}> ~> Props<{prop1}> +var a: React.Element<{prop: string}> = ; +var b: React.Element<{prop1: string}> = ; // Error: Props<{prop}> ~> Props<{prop1}> -
; +
;
; // Error: (\`id\` prop) number ~> string -var c: React.Element<{id: string}> =
; -var d: React.Element<{id: number}> =
; // Error: Props<{id:string}> ~> Props<{id:number}> +var c: React.Element<{id: string}> =
; +var d: React.Element<{id: number}> =
; // Error: Props<{id:string}> ~> Props<{id:number}> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow /* Error: Props<{prop}> ~> Props<{prop1}>*/ // Error: (\`id\` prop) number ~> string // Error: Props<{id:string}> ~> Props<{id:number}> -var React = require("react"); +var React = require(\"react\"); class CustomComponent extends React.Component { props: { prop: string }; } -var a: React.Element<{ prop: string }> = ; -var b: React.Element<{ prop1: string }> = ; -
; +var a: React.Element<{ prop: string }> = ; +var b: React.Element<{ prop1: string }> = ; +
;
; -var c: React.Element<{ id: string }> =
; -var d: React.Element<{ id: number }> =
; +var c: React.Element<{ id: string }> =
; +var d: React.Element<{ id: number }> =
; " `; exports[`test strings.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); -var Div = 'div'; -var Bad = 'bad'; -var Str: string = 'str'; +var Div = \'div\'; +var Bad = \'bad\'; +var Str: string = \'str\';
; // This is fine -; // Error: 'bad' not in JSXIntrinsics +; // Error: \'bad\' not in JSXIntrinsics ; // Error: string ~> keys of JSXIntrinsics -React.createElement('div', {}); // This is fine -React.createElement('bad', {}); // Error: 'bad' not in JSXIntrinsics +React.createElement(\'div\', {}); // This is fine +React.createElement(\'bad\', {}); // Error: \'bad\' not in JSXIntrinsics React.createElement(Str, {}); // Error: string ~> keys of JSXIntrinsics // TODO: Make this an error @@ -56,22 +56,22 @@ React.createElement(Str, {}); // Error: string ~> keys of JSXIntrinsics ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ /* This is fine*/ -/* Error: 'bad' not in JSXIntrinsics*/ +/* Error: \'bad\' not in JSXIntrinsics*/ // Error: string ~> keys of JSXIntrinsics // This is fine -// Error: 'bad' not in JSXIntrinsics +// Error: \'bad\' not in JSXIntrinsics /* Error: string ~> keys of JSXIntrinsics*/ /* TODO: Make this an error*/ // Not an error but should be eventually -var React = require("react"); -var Div = "div"; -var Bad = "bad"; -var Str: string = "str"; +var React = require(\"react\"); +var Div = \"div\"; +var Bad = \"bad\"; +var Str: string = \"str\";
; ; ; -React.createElement("div", {}); -React.createElement("bad", {}); +React.createElement(\"div\", {}); +React.createElement(\"bad\", {}); React.createElement(Str, {});
; " diff --git a/tests/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap b/tests/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap index 1b17c7e5..9bc4ce37 100644 --- a/tests/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,5 @@ exports[`test jsx.js 1`] = ` -"declare var $React: $Exports<'react'>; // fake import +"declare var $React: $Exports<\'react\'>; // fake import type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { @@ -8,7 +8,7 @@ type $JSXIntrinsics = { }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // fake import -declare var $React: $Exports<"react">; +declare var $React: $Exports<\"react\">; type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { div: $JSXIntrinsic<{ id: string }>; diff --git a/tests/keys/__snapshots__/jsfmt.spec.js.snap b/tests/keys/__snapshots__/jsfmt.spec.js.snap index 76525e8d..5429c131 100644 --- a/tests/keys/__snapshots__/jsfmt.spec.js.snap +++ b/tests/keys/__snapshots__/jsfmt.spec.js.snap @@ -1,46 +1,46 @@ exports[`test keys.js 1`] = ` "/* @flow */ -function testKeysOfObject(str: string, lit: 'hi') { +function testKeysOfObject(str: string, lit: \'hi\') { (str: $Keys); // Any string should be fine if (str) { (str: $Keys); // No error, truthy string should be fine } - ('hi': $Keys); // String literal should be fine + (\'hi\': $Keys); // String literal should be fine (123: $Keys); // Error: number -> keys of Object } type StrDict = {[key: string]: mixed}; -function testKeysOfStrDict(str: string, lit: 'hi') { +function testKeysOfStrDict(str: string, lit: \'hi\') { (str: $Keys); // Any string should be fine if (str) { (str: $Keys); // No error, truthy string should be fine } - ('hi': $Keys); // String literal should be fine + (\'hi\': $Keys); // String literal should be fine (123: $Keys); // Error: number -> keys of StrDict } -type StrLitDict = {[key: 'hi']: mixed}; -function testKeysOfStrLitDict(str: string, lit: 'hi') { +type StrLitDict = {[key: \'hi\']: mixed}; +function testKeysOfStrLitDict(str: string, lit: \'hi\') { (str: $Keys); // Error: Not all strings are allowed if (str) { (str: $Keys); // Error: Not all truthy strings are allowed } - ('hi': $Keys); // The right string literal is allowed - ('bye': $Keys); // Error: The wrong string literal is not allowed + (\'hi\': $Keys); // The right string literal is allowed + (\'bye\': $Keys); // Error: The wrong string literal is not allowed (123: $Keys); // Error: number -> keys of StrLitDict } type ObjLit = {hi: mixed}; -function testKeysOfOtherObj(str: string, lit: 'hi') { +function testKeysOfOtherObj(str: string, lit: \'hi\') { (str: $Keys); // Error: string -> keys of ObjLit if (str) { (str: $Keys); // Error: truthy string -> keys of ObjLit } - ('hi': $Keys); // String literal should be fine + (\'hi\': $Keys); // String literal should be fine (123: $Keys); // Error: number -> keys of ObjLit } @@ -63,40 +63,40 @@ function testKeysOfOtherObj(str: string, lit: 'hi') { // Error: truthy string -> keys of ObjLit // String literal should be fine // Error: number -> keys of ObjLit -function testKeysOfObject(str: string, lit: "hi") { +function testKeysOfObject(str: string, lit: \"hi\") { (str: $Keys); if (str) { (str: $Keys); } - ("hi": $Keys); + (\"hi\": $Keys); (123: $Keys); } type StrDict = { [key: string]: mixed }; -function testKeysOfStrDict(str: string, lit: "hi") { +function testKeysOfStrDict(str: string, lit: \"hi\") { (str: $Keys); if (str) { (str: $Keys); } - ("hi": $Keys); + (\"hi\": $Keys); (123: $Keys); } -type StrLitDict = { [key: "hi"]: mixed }; -function testKeysOfStrLitDict(str: string, lit: "hi") { +type StrLitDict = { [key: \"hi\"]: mixed }; +function testKeysOfStrLitDict(str: string, lit: \"hi\") { (str: $Keys); if (str) { (str: $Keys); } - ("hi": $Keys); - ("bye": $Keys); + (\"hi\": $Keys); + (\"bye\": $Keys); (123: $Keys); } type ObjLit = { hi: mixed }; -function testKeysOfOtherObj(str: string, lit: "hi") { +function testKeysOfOtherObj(str: string, lit: \"hi\") { (str: $Keys); if (str) { (str: $Keys); } - ("hi": $Keys); + (\"hi\": $Keys); (123: $Keys); } " diff --git a/tests/keyvalue/__snapshots__/jsfmt.spec.js.snap b/tests/keyvalue/__snapshots__/jsfmt.spec.js.snap index c0be7cee..78d31136 100644 --- a/tests/keyvalue/__snapshots__/jsfmt.spec.js.snap +++ b/tests/keyvalue/__snapshots__/jsfmt.spec.js.snap @@ -3,14 +3,14 @@ exports[`test keyvalue.js 1`] = ` let tests = [ function(x: { [key: number]: string }) { - (x[""]: number); + (x[\"\"]: number); } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow let tests = [ function(x: { [key: number]: string }) { - (x[""]: number); + (x[\"\"]: number); } ]; " diff --git a/tests/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap b/tests/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap index aea2ff68..78425ba0 100644 --- a/tests/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap +++ b/tests/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap @@ -5,13 +5,13 @@ exports[`test test.js 1`] = ` class C { foo(): number { return 0; } - foo(): string { return "hello" } // last wins + foo(): string { return \"hello\" } // last wins x: number; x: string; // last wins bar(): number { return 0; } bar: string; // field wins over method qux: number; - qux(): string { return "hello" } // method loses to field! + qux(): string { return \"hello\" } // method loses to field! } // check @@ -19,19 +19,19 @@ class C { ((new C).foo(): boolean); // last wins ((new C).x: boolean); // last wins ((new C).bar: boolean); // last wins -((new C).qux: boolean); // weird outlier where last doesn't win in classes +((new C).qux: boolean); // weird outlier where last doesn\'t win in classes // Objects const o = { foo(): number { return 0; }, - foo(): string { return "hello" }, // last wins + foo(): string { return \"hello\" }, // last wins x: 42, - x: "hello", // last wins + x: \"hello\", // last wins bar(): number { return 0; }, - bar: "hello", // last wins + bar: \"hello\", // last wins qux: 42, - qux(): string { return "hello" }, // last wins + qux(): string { return \"hello\" }, // last wins }; // check @@ -51,7 +51,7 @@ const o = { // last wins // last wins // last wins -// weird outlier where last doesn't win in classes +// weird outlier where last doesn\'t win in classes // Objects // last wins // last wins @@ -67,7 +67,7 @@ class C { return 0; } foo(): string { - return "hello"; + return \"hello\"; } x: number; x: string; @@ -77,7 +77,7 @@ class C { bar: string; qux: number; qux(): string { - return "hello"; + return \"hello\"; } } (new C().foo(): boolean); @@ -89,17 +89,17 @@ const o = { return 0; }, foo(): string { - return "hello"; + return \"hello\"; }, x: 42, - x: "hello", + x: \"hello\", bar(): number { return 0; }, - bar: "hello", + bar: \"hello\", qux: 42, qux(): string { - return "hello"; + return \"hello\"; } }; (o.foo(): boolean); diff --git a/tests/lib/__snapshots__/jsfmt.spec.js.snap b/tests/lib/__snapshots__/jsfmt.spec.js.snap index a9d2e31d..305e1b07 100644 --- a/tests/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/lib/__snapshots__/jsfmt.spec.js.snap @@ -2,10 +2,10 @@ exports[`test libtest.js 1`] = ` "var x:string = NaN var y:string = Number.MAX_VALUE; var z:number = new TypeError().name; -var w:string = parseInt("..."); +var w:string = parseInt(\"...\"); var a = new Map(); -a.delete('foobar'); +a.delete(\'foobar\'); var b = undefined; if (undefined) { @@ -14,9 +14,9 @@ if (undefined) { var x: string = NaN; var y: string = Number.MAX_VALUE; var z: number = new TypeError().name; -var w: string = parseInt("..."); +var w: string = parseInt(\"...\"); var a = new Map(); -a.delete("foobar"); +a.delete(\"foobar\"); var b = undefined; if (undefined) { diff --git a/tests/libdef_ignored_module/__snapshots__/jsfmt.spec.js.snap b/tests/libdef_ignored_module/__snapshots__/jsfmt.spec.js.snap index 5e4e0871..6bc3f2f4 100644 --- a/tests/libdef_ignored_module/__snapshots__/jsfmt.spec.js.snap +++ b/tests/libdef_ignored_module/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ exports[`test test.js 1`] = ` "/* @flow */ -import foo from "foo"; +import foo from \"foo\"; (foo.bar : string); // error number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // error number ~> string -import foo from "foo"; +import foo from \"foo\"; (foo.bar: string); " `; diff --git a/tests/libflow-typed/__snapshots__/jsfmt.spec.js.snap b/tests/libflow-typed/__snapshots__/jsfmt.spec.js.snap index d6b4a01e..c41c08da 100644 --- a/tests/libflow-typed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/libflow-typed/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test libtest.js 1`] = ` "/* @flow */ -const dino : Dinosaur = "Stegosaurus" +const dino : Dinosaur = \"Stegosaurus\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -const dino: Dinosaur = "Stegosaurus"; +const dino: Dinosaur = \"Stegosaurus\"; " `; diff --git a/tests/libflow-typed/flow-typed/__snapshots__/jsfmt.spec.js.snap b/tests/libflow-typed/flow-typed/__snapshots__/jsfmt.spec.js.snap index 730d6786..8d037dfd 100644 --- a/tests/libflow-typed/flow-typed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/libflow-typed/flow-typed/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ exports[`test dino.js 1`] = ` -"declare type Dinosaur = "T-Rex" | "Apatosaurus"; +"declare type Dinosaur = \"T-Rex\" | \"Apatosaurus\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -type Dinosaur = "T-Rex" | "Apatosaurus"; +type Dinosaur = \"T-Rex\" | \"Apatosaurus\"; " `; diff --git a/tests/literal/__snapshots__/jsfmt.spec.js.snap b/tests/literal/__snapshots__/jsfmt.spec.js.snap index 95f1639d..60a307f5 100644 --- a/tests/literal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/literal/__snapshots__/jsfmt.spec.js.snap @@ -1,53 +1,53 @@ exports[`test enum.js 1`] = ` "var APIKeys = { - AGE: 'age', - NAME: 'name', + AGE: \'age\', + NAME: \'name\', }; module.exports = APIKeys; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var APIKeys = { AGE: "age", NAME: "name" }; +var APIKeys = { AGE: \"age\", NAME: \"name\" }; module.exports = APIKeys; " `; exports[`test enum_client.js 1`] = ` -"var APIKeys = require('./enum'); -// object that maps "AGE" to "age", "NAME" to "name" +"var APIKeys = require(\'./enum\'); +// object that maps \"AGE\" to \"age\", \"NAME\" to \"name\" function foo(x: $Keys) { } -foo("AGE"); -foo("LOCATION"); // error +foo(\"AGE\"); +foo(\"LOCATION\"); // error function bar(x: $Keys<{age: number}>) { } -bar(APIKeys.AGE); // not an error: APIKeys.AGE = "age" -bar(APIKeys.NAME); // error: since "NAME" is not in the smaller enum +bar(APIKeys.AGE); // not an error: APIKeys.AGE = \"age\" +bar(APIKeys.NAME); // error: since \"NAME\" is not in the smaller enum var object = {}; object[APIKeys.AGE] = 123; // i.e., object.age = 123 -object[APIKeys.NAME] = "FOO"; // i.e., object.name = "FOO" +object[APIKeys.NAME] = \"FOO\"; // i.e., object.name = \"FOO\" var age:number = object[APIKeys.AGE]; var name:number = object[APIKeys.NAME]; // error: object.name is a string var indices = { red: 0, green: 1, blue: 2 }; -var tuple = [42, "hello", false]; +var tuple = [42, \"hello\", false]; var red:string = tuple[indices.red]; // error: tuple[0] is a number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// object that maps "AGE" to "age", "NAME" to "name" +// object that maps \"AGE\" to \"age\", \"NAME\" to \"name\" // error -// not an error: APIKeys.AGE = "age" -// error: since "NAME" is not in the smaller enum +// not an error: APIKeys.AGE = \"age\" +// error: since \"NAME\" is not in the smaller enum // i.e., object.age = 123 -// i.e., object.name = "FOO" +// i.e., object.name = \"FOO\" // error: object.name is a string // error: tuple[0] is a number -var APIKeys = require("./enum"); +var APIKeys = require(\"./enum\"); function foo(x: $Keys) { } -foo("AGE"); -foo("LOCATION"); +foo(\"AGE\"); +foo(\"LOCATION\"); function bar(x: $Keys<{ age: number }>) { } @@ -55,11 +55,11 @@ bar(APIKeys.AGE); bar(APIKeys.NAME); var object = {}; object[APIKeys.AGE] = 123; -object[APIKeys.NAME] = "FOO"; +object[APIKeys.NAME] = \"FOO\"; var age: number = object[APIKeys.AGE]; var name: number = object[APIKeys.NAME]; var indices = { red: 0, green: 1, blue: 2 }; -var tuple = [ 42, "hello", false ]; +var tuple = [ 42, \"hello\", false ]; var red: string = tuple[indices.red]; " `; @@ -73,8 +73,8 @@ function test2(x: string): number { return -x; } -// sanity checks to make sure merging envs doesn't keep creating new NumT's -// because of the UnaryMinusT's, causing nontermination +// sanity checks to make sure merging envs doesn\'t keep creating new NumT\'s +// because of the UnaryMinusT\'s, causing nontermination function test3(x: number, flip_times: number): number { for (var i = 0; i < flip_times; i++) { x = -x; @@ -89,8 +89,8 @@ function test4(flip_times: number): number { return x; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// sanity checks to make sure merging envs doesn't keep creating new NumT's -// because of the UnaryMinusT's, causing nontermination +// sanity checks to make sure merging envs doesn\'t keep creating new NumT\'s +// because of the UnaryMinusT\'s, causing nontermination function test1(x: number): number { return -x; } diff --git a/tests/locals/__snapshots__/jsfmt.spec.js.snap b/tests/locals/__snapshots__/jsfmt.spec.js.snap index 26cb0450..db1a3e12 100644 --- a/tests/locals/__snapshots__/jsfmt.spec.js.snap +++ b/tests/locals/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ exports[`test lex.js 1`] = ` "function switch_scope(x: mixed) { - let a = ""; - let b = ""; + let a = \"\"; + let b = \"\"; switch (x) { - case "foo": + case \"foo\": let a; - a = 0; // doesn't add lower bound to outer a + a = 0; // doesn\'t add lower bound to outer a b = 0; } (a : string); // OK @@ -16,11 +16,11 @@ function try_scope_finally() { let a; let b; try { - a = ""; - b = ""; + a = \"\"; + b = \"\"; } finally { let a; - a = 0; // doesn't add lower bound to outer a + a = 0; // doesn\'t add lower bound to outer a b = 0; } (a : string); // ok @@ -28,10 +28,10 @@ function try_scope_finally() { } function for_scope() { - let a = ""; - let b = ""; + let a = \"\"; + let b = \"\"; for (let a;;) { - a = 0; // doesn't add lower bound to outer a + a = 0; // doesn\'t add lower bound to outer a b = 0; } (a : string); @@ -42,41 +42,41 @@ function for_in_scope(o: Object) { let a = 0; let b = 0; for (let a in o) { - a = ""; // doesn't add lower bound to outer a - b = ""; + a = \"\"; // doesn\'t add lower bound to outer a + b = \"\"; } (a : number); (b : number); // error: string ~> number } function for_of_scope(xs: number[]) { - let a = ""; - let b = ""; + let a = \"\"; + let b = \"\"; for (let a of xs) { - a = 0; // doesn't add lower bound to outer a + a = 0; // doesn\'t add lower bound to outer a b = 0; } (a : string); (b : string); // error: number ~> string } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// doesn't add lower bound to outer a +// doesn\'t add lower bound to outer a // OK // error: number ~> string -// doesn't add lower bound to outer a +// doesn\'t add lower bound to outer a // ok // error: number ~> string -// doesn't add lower bound to outer a +// doesn\'t add lower bound to outer a // error: number ~> string -// doesn't add lower bound to outer a +// doesn\'t add lower bound to outer a // error: string ~> number -// doesn't add lower bound to outer a +// doesn\'t add lower bound to outer a // error: number ~> string function switch_scope(x: mixed) { - let a = ""; - let b = ""; + let a = \"\"; + let b = \"\"; switch (x) { - case "foo": + case \"foo\": let a; a = 0; b = 0; @@ -88,8 +88,8 @@ function try_scope_finally() { let a; let b; try { - a = ""; - b = ""; + a = \"\"; + b = \"\"; } finally { let a; a = 0; @@ -99,8 +99,8 @@ function try_scope_finally() { (b: string); } function for_scope() { - let a = ""; - let b = ""; + let a = \"\"; + let b = \"\"; for (let a; ; ) { a = 0; b = 0; @@ -112,15 +112,15 @@ function for_in_scope(o: Object) { let a = 0; let b = 0; for (let a in o) { - a = ""; - b = ""; + a = \"\"; + b = \"\"; } (a: number); (b: number); } function for_of_scope(xs: number[]) { - let a = ""; - let b = ""; + let a = \"\"; + let b = \"\"; for (let a of xs) { a = 0; b = 0; @@ -151,7 +151,7 @@ function sorry(really: bool) { function foo0(b: bool): number { var x = 0; if (b) { - var x = ""; // error: string ~> number + var x = \"\"; // error: string ~> number } return x; } @@ -174,7 +174,7 @@ function sorry(really: boolean) { function foo0(b: boolean): number { var x = 0; if (b) { - var x = ""; + var x = \"\"; } return x; } diff --git a/tests/misc/__snapshots__/jsfmt.spec.js.snap b/tests/misc/__snapshots__/jsfmt.spec.js.snap index 9597ac3b..46f10dc8 100644 --- a/tests/misc/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/__snapshots__/jsfmt.spec.js.snap @@ -10,7 +10,7 @@ module.exports.cls = A; function f(x:boolean) { } module.exports.fn = f; -A.y = "?"; +A.y = \"?\"; A.x = A.y; f(A.x); // A.x is now a string, by def assign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -23,7 +23,7 @@ function f(x: boolean) { } module.exports.fn = f; -A.y = "?"; +A.y = \"?\"; A.x = A.y; f(A.x); " @@ -33,10 +33,10 @@ exports[`test B.js 1`] = ` " /* @providesModule B */ -var A = require('A').cls; +var A = require(\'A\').cls; function B() { - this.b = "..."; + this.b = \"...\"; } function f():number { return this.b; } @@ -47,9 +47,9 @@ B.prototype.fn = f; module.exports = B; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule B */ -var A = require("A").cls; +var A = require(\"A\").cls; function B() { - this.b = "..."; + this.b = \"...\"; } function f(): number { return this.b; @@ -64,8 +64,8 @@ exports[`test C.js 1`] = ` " /* @providesModule C */ -var B = require('B'); -var f = require('A').fn; +var B = require(\'B\'); +var f = require(\'A\').fn; function C() { var o = new B(); @@ -77,8 +77,8 @@ function C() { module.exports = C; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule C */ -var B = require("B"); -var f = require("A").fn; +var B = require(\"B\"); +var f = require(\"A\").fn; function C() { var o = new B(); f(o.b); @@ -93,7 +93,7 @@ exports[`test D.js 1`] = ` " /* @providesModule D */ -var f = require('A').fn; +var f = require(\'A\').fn; function g():string { return this.i; } @@ -103,10 +103,10 @@ o.i = true; var i = o.fn(); f(i); -module.exports = "D for dummy"; +module.exports = \"D for dummy\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule D */ -var f = require("A").fn; +var f = require(\"A\").fn; function g(): string { return this.i; } @@ -114,7 +114,7 @@ var o = { fn: g, ...{} }; o.i = true; var i = o.fn(); f(i); -module.exports = "D for dummy"; +module.exports = \"D for dummy\"; " `; @@ -143,7 +143,7 @@ module.exports = { obj: o }; exports[`test F.js 1`] = ` "function fn2(x) { return x.length * 4; } -fn2({length: 'hi'}); +fn2({length: \'hi\'}); function foo(x: Array): string { return x.length; @@ -152,7 +152,7 @@ function foo(x: Array): string { function fn2(x) { return x.length * 4; } -fn2({ length: "hi" }); +fn2({ length: \"hi\" }); function foo(x: Array): string { return x.length; } @@ -160,19 +160,19 @@ function foo(x: Array): string { `; exports[`test G.js 1`] = ` -"var a = { length: "duck" }; +"var a = { length: \"duck\" }; a.length = 123; a.length(); var b = [ 123 ]; -b.length = "duck"; +b.length = \"duck\"; b.length(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var a = { length: "duck" }; +var a = { length: \"duck\" }; a.length = 123; a.length(); var b = [ 123 ]; -b.length = "duck"; +b.length = \"duck\"; b.length(); " `; diff --git a/tests/modified_lib/__snapshots__/jsfmt.spec.js.snap b/tests/modified_lib/__snapshots__/jsfmt.spec.js.snap index fc83ea8d..1ac16e79 100644 --- a/tests/modified_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/modified_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ exports[`test test.js 1`] = ` "// @flow -import {bar} from 'foo'; +import {bar} from \'foo\'; bar(5); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { bar } from "foo"; +import { bar } from \"foo\"; bar(5); " `; diff --git a/tests/modified_lib/lib/__snapshots__/jsfmt.spec.js.snap b/tests/modified_lib/lib/__snapshots__/jsfmt.spec.js.snap index ca113eca..4a8925e2 100644 --- a/tests/modified_lib/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/modified_lib/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test lib.js 1`] = ` -"declare module 'foo' { +"declare module \'foo\' { declare function bar(str: string): number; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare module "foo" { +declare module \"foo\" { declare function bar(str: string): number; } " diff --git a/tests/module_not_found_errors/src/__snapshots__/jsfmt.spec.js.snap b/tests/module_not_found_errors/src/__snapshots__/jsfmt.spec.js.snap index a994c8a4..f0bdd78a 100644 --- a/tests/module_not_found_errors/src/__snapshots__/jsfmt.spec.js.snap +++ b/tests/module_not_found_errors/src/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ exports[`test index.js 1`] = ` "// @flow -require('module_completely_absent'); +require(\'module_completely_absent\'); // node_modules/module_outside_of_root/ sits outside of the Flow project root. // Flow should give a descriptive error about this -require('module_outside_of_root'); +require(\'module_outside_of_root\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // node_modules/module_outside_of_root/ sits outside of the Flow project root. // Flow should give a descriptive error about this -require("module_completely_absent"); -require("module_outside_of_root"); +require(\"module_completely_absent\"); +require(\"module_outside_of_root\"); " `; diff --git a/tests/module_redirect/__snapshots__/jsfmt.spec.js.snap b/tests/module_redirect/__snapshots__/jsfmt.spec.js.snap index 89e99031..35a4f84e 100644 --- a/tests/module_redirect/__snapshots__/jsfmt.spec.js.snap +++ b/tests/module_redirect/__snapshots__/jsfmt.spec.js.snap @@ -15,13 +15,13 @@ exports[`test B.js 1`] = ` * @flow */ -module.exports = require('A'); +module.exports = require(\'A\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule B * @flow */ -module.exports = require("A"); +module.exports = require(\"A\"); " `; @@ -31,13 +31,13 @@ exports[`test C.js 1`] = ` * @flow */ -module.exports = require('B'); +module.exports = require(\'B\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule C * @flow */ -module.exports = require("B"); +module.exports = require(\"B\"); " `; @@ -47,16 +47,16 @@ exports[`test D.js 1`] = ` * @flow */ -var bar1: string = require('A'); -var bar2: string = require('B'); -var bar3: string = require('C'); +var bar1: string = require(\'A\'); +var bar2: string = require(\'B\'); +var bar3: string = require(\'C\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule D * @flow */ -var bar1: string = require("A"); -var bar2: string = require("B"); -var bar3: string = require("C"); +var bar1: string = require(\"A\"); +var bar2: string = require(\"B\"); +var bar3: string = require(\"C\"); " `; diff --git a/tests/modules/__snapshots__/jsfmt.spec.js.snap b/tests/modules/__snapshots__/jsfmt.spec.js.snap index 2e0663a6..1472c43d 100644 --- a/tests/modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/modules/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ exports[`test cli.js 1`] = ` "/* @flow */ -var f = require('./lib'); +var f = require(\'./lib\'); var y:number = f(0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var f = require("./lib"); +var f = require(\"./lib\"); var y: number = f(0); " `; @@ -14,13 +14,13 @@ var y: number = f(0); exports[`test cli2.js 1`] = ` "/* @flow */ -var f = require('./lib'); +var f = require(\'./lib\'); -f("..."); +f(\"...\"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var f = require("./lib"); -f("..."); +var f = require(\"./lib\"); +f(\"...\"); " `; diff --git a/tests/more_classes/__snapshots__/jsfmt.spec.js.snap b/tests/more_classes/__snapshots__/jsfmt.spec.js.snap index 01c5aecb..4bd4e61b 100644 --- a/tests/more_classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/more_classes/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test Bar.js 1`] = ` " /* @providesModule Bar */ -var Qux = require('Qux'); +var Qux = require(\'Qux\'); class Bar { y:number; @@ -13,7 +13,7 @@ class Bar { } bar(z:string,u:string):string { - new Qux().w = "?"; + new Qux().w = \"?\"; return z; } } @@ -21,7 +21,7 @@ class Bar { module.exports = Bar; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Bar */ -var Qux = require("Qux"); +var Qux = require(\"Qux\"); class Bar { y: number; self: Bar; @@ -30,7 +30,7 @@ class Bar { this.self = this; } bar(z: string, u: string): string { - new Qux().w = "?"; + new Qux().w = \"?\"; return z; } } @@ -42,8 +42,8 @@ exports[`test Foo.js 1`] = ` " /* @providesModule Foo */ -var Bar = require('Bar'); -var Qux = require('Qux'); +var Bar = require(\'Bar\'); +var Qux = require(\'Qux\'); class Foo extends Qux { x:string; @@ -53,7 +53,7 @@ class Foo extends Qux { foo(y:string,z):number { this.x = y; - var u = new Foo("...").qux(); + var u = new Foo(\"...\").qux(); var v = new Bar(y); v.self = v; return v.bar(z,u); @@ -67,8 +67,8 @@ class Foo extends Qux { module.exports = Foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Foo */ -var Bar = require("Bar"); -var Qux = require("Qux"); +var Bar = require(\"Bar\"); +var Qux = require(\"Qux\"); class Foo extends Qux { x: string; constructor(x: string) { @@ -76,7 +76,7 @@ class Foo extends Qux { } foo(y: string, z): number { this.x = y; - var u = new Foo("...").qux(); + var u = new Foo(\"...\").qux(); var v = new Bar(y); v.self = v; return v.bar(z, u); diff --git a/tests/more_path/__snapshots__/jsfmt.spec.js.snap b/tests/more_path/__snapshots__/jsfmt.spec.js.snap index 4fb617aa..3a6ae913 100644 --- a/tests/more_path/__snapshots__/jsfmt.spec.js.snap +++ b/tests/more_path/__snapshots__/jsfmt.spec.js.snap @@ -2,10 +2,10 @@ exports[`test Condition.js 1`] = ` "/* @providesModule Condition */ function f(x:number) { } -function g() { return (42 || "hello"); } +function g() { return (42 || \"hello\"); } var x = g(); -if (typeof x === "string") { +if (typeof x === \"string\") { x = 0; } f(x); @@ -25,7 +25,7 @@ class C { qux() { } } function foo() { - var c = "..."; + var c = \"...\"; c = new C(); if (bar()) { c.qux(); @@ -35,20 +35,20 @@ function foo() { function goofy() { var x = g(); - if (typeof x == 'function') { + if (typeof x == \'function\') { x(); - } else { // if (typeof x == 'number') { + } else { // if (typeof x == \'number\') { //f(x); } } function goofy2() { var o = {x : 0} - if (typeof o.x == 'function') { + if (typeof o.x == \'function\') { o.x(); } var y = o.x; - if (typeof y == 'function') { + if (typeof y == \'function\') { y(); } else { //f(y); @@ -59,17 +59,17 @@ module.exports = true; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Condition */ //f(y); -// if (typeof x == 'number') { +// if (typeof x == \'number\') { //f(x); //f(y); function f(x: number) { } function g() { - return 42 || "hello"; + return 42 || \"hello\"; } var x = g(); -if (typeof x === "string") { +if (typeof x === \"string\") { x = 0; } f(x); @@ -90,7 +90,7 @@ class C { } } function foo() { - var c = "..."; + var c = \"...\"; c = new C(); if (bar()) { c.qux(); @@ -98,7 +98,7 @@ function foo() { } function goofy() { var x = g(); - if (typeof x == "function") { + if (typeof x == \"function\") { x(); } else { @@ -106,11 +106,11 @@ function goofy() { } function goofy2() { var o = { x: 0 }; - if (typeof o.x == "function") { + if (typeof o.x == \"function\") { o.x(); } var y = o.x; - if (typeof y == "function") { + if (typeof y == \"function\") { y(); } else { @@ -128,7 +128,7 @@ function check(x:string) { } function FlowSA() { var x = 0; - x = "..."; + x = \"...\"; check(x); } @@ -140,7 +140,7 @@ function check(x: string) { } function FlowSA() { var x = 0; - x = "..."; + x = \"...\"; check(x); } module.exports = FlowSA; @@ -183,18 +183,18 @@ class D { d() {} } function baz(x:D) { if (x instanceof A) { - // unreachable, TODO: this shouldn't throw + // unreachable, TODO: this shouldn\'t throw } } -module.exports = "sigma"; +module.exports = \"sigma\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Sigma */ // error // TODO no error? since unreachable (x: B implies x: A) // error // error -// unreachable, TODO: this shouldn't throw +// unreachable, TODO: this shouldn\'t throw class A { a() { @@ -239,7 +239,7 @@ function baz(x: D) { } } -module.exports = "sigma"; +module.exports = \"sigma\"; " `; diff --git a/tests/more_react/__snapshots__/jsfmt.spec.js.snap b/tests/more_react/__snapshots__/jsfmt.spec.js.snap index 9b369dea..7f531901 100644 --- a/tests/more_react/__snapshots__/jsfmt.spec.js.snap +++ b/tests/more_react/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ exports[`test API.react.js 1`] = ` " -var app = require('JSX'); +var app = require(\'JSX\'); app.setProps({y:42}); // error, y:number but foo expects string in App.react app.setState({z:42}); // error, z:number but foo expects string in App.react function bar(x:number) { } -bar(app.props.children); // No error, App doesn't specify propTypes so anything goes +bar(app.props.children); // No error, App doesn\'t specify propTypes so anything goes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error, y:number but foo expects string in App.react // error, z:number but foo expects string in App.react -// No error, App doesn't specify propTypes so anything goes -var app = require("JSX"); +// No error, App doesn\'t specify propTypes so anything goes +var app = require(\"JSX\"); app.setProps({ y: 42 }); app.setState({ z: 42 }); function bar(x: number) { @@ -28,7 +28,7 @@ exports[`test App.react.js 1`] = ` * @jsx React.DOM */ -var React = require('react'); +var React = require(\'react\'); // expect args to be strings function foo(p:string,q:string):string { return p+q; } @@ -36,7 +36,7 @@ function foo(p:string,q:string):string { return p+q; } var App = React.createClass({ getDefaultProps: function(): { y: string } { - return {y:""}; // infer props.y: string + return {y:\"\"}; // infer props.y: string }, getInitialState: function() { @@ -75,13 +75,13 @@ module.exports = App; // infer state.z: number // ok //this.state; -var React = require("react"); +var React = require(\"react\"); function foo(p: string, q: string): string { return p + q; } var App = React.createClass({ getDefaultProps: function(): { y: string } { - return { y: "" }; + return { y: \"\" }; }, getInitialState: function() { return { z: 0 }; @@ -108,8 +108,8 @@ exports[`test JSX.js 1`] = ` " /* @providesModule JSX */ -var React = require('react'); -var App = require('App.react'); +var React = require(\'react\'); +var App = require(\'App.react\'); var app = // error, y: number but foo expects string in App.react @@ -119,15 +119,15 @@ var app = module.exports = app; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule JSX */ -var React = require("react"); -var App = require("App.react"); +var React = require(\"react\"); +var App = require(\"App.react\"); var app = // error, y: number but foo expects string in App.react[object Object] Some text.; module.exports = app; " `; exports[`test propTypes.js 1`] = ` -"var React = require('React'); +"var React = require(\'React\'); var C = React.createClass({ propTypes: { @@ -142,19 +142,19 @@ var D = React.createClass({ }); ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* error (as usual)*/ /* OK (error ignored when spread is used)*/ -var React = require("React"); +var React = require(\"React\"); var C = React.createClass({ propTypes: { title: React.PropTypes.string.isRequired } }); var D = React.createClass({ propTypes: { name: React.PropTypes.string.isRequired, ...C.propTypes } }); -; +; " `; diff --git a/tests/more_statics/__snapshots__/jsfmt.spec.js.snap b/tests/more_statics/__snapshots__/jsfmt.spec.js.snap index c907805c..11146568 100644 --- a/tests/more_statics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/more_statics/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ exports[`test class_static.js 1`] = ` "class B { - static foo(): string { return ""; } + static foo(): string { return \"\"; } } class C extends B { - static bar(): string { return ""; } + static bar(): string { return \"\"; } } var x: number = C.bar(); @@ -12,12 +12,12 @@ var y: number = C.foo(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class B { static foo(): string { - return ""; + return \"\"; } } class C extends B { static bar(): string { - return ""; + return \"\"; } } var x: number = C.bar(); diff --git a/tests/name_prop/__snapshots__/jsfmt.spec.js.snap b/tests/name_prop/__snapshots__/jsfmt.spec.js.snap index 8b37b7f8..14f68d41 100644 --- a/tests/name_prop/__snapshots__/jsfmt.spec.js.snap +++ b/tests/name_prop/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ exports[`test class.js 1`] = ` "class A {} -var test1 = A.bar; // Error bar doesn't exist +var test1 = A.bar; // Error bar doesn\'t exist var test2: string = A.name; var test3: number = A.name; // Error string ~> number var a = new A(); -var test4 = a.constructor.bar; // Error bar doesn't exist +var test4 = a.constructor.bar; // Error bar doesn\'t exist var test5: string = a.constructor.name; var test6: number = a.constructor.name; // Error string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Error bar doesn't exist +// Error bar doesn\'t exist // Error string ~> number -// Error bar doesn't exist +// Error bar doesn\'t exist // Error string ~> number class A {} var test1 = A.bar; @@ -26,13 +26,13 @@ var test6: number = a.constructor.name; `; exports[`test function.js 1`] = ` -"/* TODO - we currently say that a function's statics are an AnyObjT and - * anything goes. When we start enforcing the statics properly, we'll need to +"/* TODO - we currently say that a function\'s statics are an AnyObjT and + * anything goes. When we start enforcing the statics properly, we\'ll need to * know that .name exists */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* TODO - we currently say that a function's statics are an AnyObjT and - * anything goes. When we start enforcing the statics properly, we'll need to +/* TODO - we currently say that a function\'s statics are an AnyObjT and + * anything goes. When we start enforcing the statics properly, we\'ll need to * know that .name exists */ diff --git a/tests/namespace/__snapshots__/jsfmt.spec.js.snap b/tests/namespace/__snapshots__/jsfmt.spec.js.snap index 403ae990..faff8b91 100644 --- a/tests/namespace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/namespace/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ exports[`test client.js 1`] = ` -"var ns = require('./namespace') +"var ns = require(\'./namespace\') var bar: string = ns.foo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var ns = require("./namespace"); +var ns = require(\"./namespace\"); var bar: string = ns.foo; " `; exports[`test namespace.js 1`] = ` -"/*@flow*/// import type { T } from '...' +"/*@flow*/// import type { T } from \'...\' type T = (x:number) => void; var f: T = function(x:string): void { } @@ -19,16 +19,16 @@ function bar(x:U, f:Map): V { return f(x); } -var y:number = bar(0, x => ""); +var y:number = bar(0, x => \"\"); type Seq = number | Array; var s1:Seq = [0,[0]]; -var s2:Seq = [[""]]; +var s2:Seq = [[\"\"]]; -module.exports = { foo: ("": number) }; +module.exports = { foo: (\"\": number) }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /*@flow*/ -// import type { T } from '...' +// import type { T } from \'...\' type T = (x: number) => void; var f: T = function(x: string): void { @@ -37,10 +37,10 @@ type Map = (x: X) => Y; function bar(x: U, f: Map): V { return f(x); } -var y: number = bar(0, x => ""); +var y: number = bar(0, x => \"\"); type Seq = number | Array; var s1: Seq = [ 0, [ 0 ] ]; -var s2: Seq = [ [ "" ] ]; -module.exports = { foo: ("": number) }; +var s2: Seq = [ [ \"\" ] ]; +module.exports = { foo: (\"\": number) }; " `; diff --git a/tests/new_react/__snapshots__/jsfmt.spec.js.snap b/tests/new_react/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 3df69236..00000000 --- a/tests/new_react/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,925 +0,0 @@ -exports[`test FeedUFI.react.js 1`] = ` -"/** - * Copyright 2004-present Facebook. All Rights Reserved. - * - * @providesModule FeedUFI.react - * @flow - */ - -'use strict'; - -var UFILikeCount = require('UFILikeCount.react'); -var React = require('react'); - -var FeedUFI = React.createClass({ - _renderLikeCount: function( - feedback: any - ) { - var props = { - className: "", - key: "", - feedback: {feedback}, - permalink: "", - }; - var ignored = ; - return ( - - ); - }, - - render: function(): ?React.Element { - return ( -
- ); - } - -}); - -module.exports = FeedUFI; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * Copyright 2004-present Facebook. All Rights Reserved. - * - * @providesModule FeedUFI.react - * @flow - */ -"use strict"; -var UFILikeCount = require("UFILikeCount.react"); -var React = require("react"); -var FeedUFI = React.createClass({ - _renderLikeCount: function(feedback: any) { - var props = { - className: "", - key: "", - feedback: { feedback }, - permalink: "" - }; - var ignored = ; - return ; - }, - render: function(): ?React.Element { - return
; - } -}); -module.exports = FeedUFI; -" -`; - -exports[`test Mixin.js 1`] = ` -"/* @providesModule Mixin */ -module.exports = { - success: function() { } -}; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @providesModule Mixin */ -module.exports = { - success: function() { - - } -}; -" -`; - -exports[`test UFILikeCount.react.js 1`] = ` -"/** - * Copyright 2004-present Facebook. All Rights Reserved. - * - * @providesModule UFILikeCount.react - * @flow - */ - -'use strict'; - -var React = require('react'); - -var UFILikeCount = React.createClass({ - propTypes: { - permalink: React.PropTypes.string, - feedback: React.PropTypes.object.isRequired - }, - - render: function(): ?React.Element { - return
; - } -}); - -module.exports = UFILikeCount; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * Copyright 2004-present Facebook. All Rights Reserved. - * - * @providesModule UFILikeCount.react - * @flow - */ -"use strict"; -var React = require("react"); -var UFILikeCount = React.createClass({ - propTypes: { - permalink: React.PropTypes.string, - feedback: React.PropTypes.object.isRequired - }, - render: function(): ?React.Element { - return
; - } -}); -module.exports = UFILikeCount; -" -`; - -exports[`test bad_default_props.js 1`] = ` -"var React = require('React'); - -type T1 = { } -type T2 = { x: number } -type T3 = { x: number, y: number } - -class C1 extends React.Component { // error -} - -class C2 extends React.Component { // OK -} - -// no need to add type arguments to React.Component -class C3 extends React.Component { // OK - static defaultProps: T1; - props: T2; -} - -class C4 extends React.Component { // OK, recommended - // no need to declare defaultProps unless necessary - props: T2; -} - -class C5 extends React.Component { // error -} - -class C6 extends React.Component { // OK, recommended - static defaultProps: T2; - props: T3; -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// error -// OK -// no need to add type arguments to React.Component -// OK -// OK, recommended -// no need to declare defaultProps unless necessary -// error -// OK, recommended -var React = require("React"); -type T1 = {}; -type T2 = { x: number }; -type T3 = { x: number; y: number }; -class C1 extends React.Component {} -class C2 extends React.Component {} -class C3 extends React.Component { - static defaultProps: T1; - props: T2; -} -class C4 extends React.Component { - props: T2; -} -class C5 extends React.Component {} -class C6 extends React.Component { - static defaultProps: T2; - props: T3; -} -" -`; - -exports[`test classes.js 1`] = ` -"var React = require('React'); - -type DefaultProps = { }; -type Props = { x: number }; -type State = { y: number }; - -class Foo extends React.Component { - props: Props; - state: State; - static defaultProps: DefaultProps; - - is_mounted: boolean; - - static bar(): void {} - - qux(): void { - var _: string = this.props.x; - } - - constructor(props) { - super(props); - this.state = { y: "" }; - } - - setState(o: { y_: string }): void { } - - componentDidMount(): void { - this.is_mounted = true; - } - - componentWillReceiveProps( - nextProps: Object, - nextContext: any - ): void { - this.qux(); - } - -} - -Foo.defaultProps = 0; -var foo: $jsx = ; - -Foo.bar(); - -var FooLegacy = React.createClass({ - is_mounted: (undefined: ?boolean), - - propTypes: { - x: React.PropTypes.number.isRequired - }, - - getDefaultProps(): DefaultProps { return {} }, - - statics: { - bar(): void {} - }, - - qux(): void { - var _: string = this.props.x; - }, - - getInitialState(): { y: string } { - return { y: "" }; - }, - - setState(o: { y_: string }): void { }, - - componentDidMount(): void { - this.is_mounted = true; - }, - - componentWillReceiveProps( - nextProps: Object, - nextContext: any - ): void { - this.qux(); - }, -}); - -FooLegacy.defaultProps = 0; // TODO: should be error -var foo_legacy: $jsx = ; - -FooLegacy.bar(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// TODO: should be error -var React = require("React"); -type DefaultProps = {}; -type Props = { x: number }; -type State = { y: number }; -class Foo extends React.Component { - props: Props; - state: State; - static defaultProps: DefaultProps; - is_mounted: boolean; - static bar(): void { - - } - qux(): void { - var _: string = this.props.x; - } - constructor(props) { - super(props); - this.state = { y: "" }; - } - setState(o: { y_: string }): void { - - } - componentDidMount(): void { - this.is_mounted = true; - } - componentWillReceiveProps(nextProps: Object, nextContext: any): void { - this.qux(); - } -} -Foo.defaultProps = 0; -var foo: $jsx = ; -Foo.bar(); -var FooLegacy = React.createClass({ - is_mounted: (undefined: ?boolean), - propTypes: { x: React.PropTypes.number.isRequired }, - getDefaultProps(): DefaultProps { - return {}; - }, - statics: { - bar(): void { - - } - }, - qux(): void { - var _: string = this.props.x; - }, - getInitialState(): { y: string } { - return { y: "" }; - }, - setState(o: { y_: string }): void { - - }, - componentDidMount(): void { - this.is_mounted = true; - }, - componentWillReceiveProps(nextProps: Object, nextContext: any): void { - this.qux(); - } -}); -FooLegacy.defaultProps = 0; -var foo_legacy: $jsx = ; -FooLegacy.bar(); -" -`; - -exports[`test import-react.js 1`] = ` -"/* @flow */ - -// Testing local binding of React in all kinds of ways. The only reason this -// might even be an issue is that internally, the use of JSX triggers an -// implicit require('react'), so any bugs in (1) interop of CJS require and ES6 -// import (2) module re-export, as used to redirect the module name 'React' to -// 'react' might show up here. - -import React from "react"; -//import React from "React"; -//var React = require("react"); -//var React = require("React"); - -class HelloMessage extends React.Component { - props: { name: string }; -} - -; // number ~/~> string error -; // ok -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -// Testing local binding of React in all kinds of ways. The only reason this -// might even be an issue is that internally, the use of JSX triggers an -// implicit require('react'), so any bugs in (1) interop of CJS require and ES6 -// import (2) module re-export, as used to redirect the module name 'React' to -// 'react' might show up here. -//import React from "React"; -//var React = require("react"); -//var React = require("React"); -/* number ~/~> string error*/ -// ok -import React from "react"; -class HelloMessage extends React.Component { - props: { name: string }; -} -; -; -" -`; - -exports[`test new_react.js 1`] = ` -"var React = require('react'); -var Mixin = require('Mixin'); -var C = React.createClass({ - mixins: [Mixin], - propTypes: { - x: React.PropTypes.string.isRequired, - y: React.PropTypes.array, - z: React.PropTypes.number - }, - replaceProps(props: { }) { }, - - getDefaultProps(): { z: number } { - return { z: 0 }; - }, - getInitialState() { return 4; }, - render() { - var foo: string = this.state; - var bar: string = this.props; - var qux: string = this.props.z; - var w:number = this.props.x; - this.props.y[0]; - var len:number = this.props.x.length; - this.success(); - return
; - } - -}) - -var element = ; -var element_ = ; - -var x: number = C.displayName; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require("react"); -var Mixin = require("Mixin"); -var C = React.createClass({ - mixins: [ Mixin ], - propTypes: { - x: React.PropTypes.string.isRequired, - y: React.PropTypes.array, - z: React.PropTypes.number - }, - replaceProps(props: {}) { - - }, - getDefaultProps(): { z: number } { - return { z: 0 }; - }, - getInitialState() { - return 4; - }, - render() { - var foo: string = this.state; - var bar: string = this.props; - var qux: string = this.props.z; - var w: number = this.props.x; - this.props.y[0]; - var len: number = this.props.x.length; - this.success(); - return
; - } -}); -var element = ; -var element_ = ; -var x: number = C.displayName; -" -`; - -exports[`test propTypes.js 1`] = ` -"var React = require('react'); -var PropTypes = React.PropTypes; - -var C = React.createClass({ - propTypes: { - statistics: PropTypes.arrayOf(PropTypes.shape({ - label: PropTypes.string.isRequired, - value: PropTypes.number, - })).isRequired, - } -}); - -; // error (label is required, value not required) - -var props: Array<{label: string, value?: number}> = [ - {}, - {label:"",value:undefined}, -]; // error (same as ^) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// error (label is required, value not required) -// error (same as ^) -var React = require("react"); -var PropTypes = React.PropTypes; -var C = React.createClass({ - propTypes: { - statistics: PropTypes.arrayOf( - PropTypes.shape({ - label: PropTypes.string.isRequired, - value: PropTypes.number - }) - ).isRequired - } -}); -; -var props: Array<{ label: string; value?: number }> = [ - {}, - { label: "", value: undefined } -]; -" -`; - -exports[`test props.js 1`] = ` -"var React = require('react'); -var TestProps = React.createClass({ - - propTypes: { - x: React.PropTypes.string, - z: React.PropTypes.number - }, - - getDefaultProps: function() { - return {x: '', y: 0} - }, - - test: function() { - var a: number = this.props.x; // error - var b: string = this.props.y; // error - var c: string = this.props.z; // error - } -}); - -var element = ; // 3 errors - -(element: $jsx<*>); -(element: $jsx); -var FooProps = React.createClass({ - propTypes: { w: React.PropTypes.string.isRequired } -}); -(element: $jsx); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// error -// error -// error -// 3 errors -var React = require("react"); -var TestProps = React.createClass({ - propTypes: { x: React.PropTypes.string, z: React.PropTypes.number }, - getDefaultProps: function() { - return { x: "", y: 0 }; - }, - test: function() { - var a: number = this.props.x; - var b: string = this.props.y; - var c: string = this.props.z; - } -}); -var element = ; -(element: $jsx<*>); -(element: $jsx); -var FooProps = React.createClass({ - propTypes: { w: React.PropTypes.string.isRequired } -}); -(element: $jsx); -" -`; - -exports[`test props2.js 1`] = ` -"var React = require('react'); -var C = React.createClass({ - propTypes: { - foo: React.PropTypes.string.isRequired, - bar: React.PropTypes.string.isRequired, - } -}); -var D = React.createClass({ - getInitialState: function(): { bar: number } { - return { bar: 0 }; - }, - render: function() { - var obj = { bar: 0 }; - var s: string = this.state.bar; - return ; - } -}); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require("react"); -var C = React.createClass({ - propTypes: { - foo: React.PropTypes.string.isRequired, - bar: React.PropTypes.string.isRequired - } -}); -var D = React.createClass({ - getInitialState: function(): { bar: number } { - return { bar: 0 }; - }, - render: function() { - var obj = { bar: 0 }; - var s: string = this.state.bar; - return ; - } -}); -" -`; - -exports[`test props3.js 1`] = ` -"var React = require('react'); -var TestProps = React.createClass({ - // Do something illegal inside of propTypes and make sure Flow notices - propTypes: { - arr: React.PropTypes.array, - arr_rec: React.PropTypes.array.isRequired, - bool: React.PropTypes.bool, - bool_rec: React.PropTypes.bool.isRequired, - func: React.PropTypes.func, - func_rec: React.PropTypes.func.isRequired, - number: React.PropTypes.number, - number_rec: React.PropTypes.number.isRequired, - object: React.PropTypes.object, - object_rec: React.PropTypes.object.isRequired, - string: React.PropTypes.string, - string_rec: React.PropTypes.string.isRequired, - - any: React.PropTypes.any, - any_rec: React.PropTypes.any.isRequired, - element: React.PropTypes.element, - element_rec: React.PropTypes.element.isRequired, - node: React.PropTypes.node, - node_rec: React.PropTypes.node.isRequired, - - arrayOf: React.PropTypes.arrayOf(React.PropTypes.string), - arrayOf_rec: React.PropTypes.arrayOf(React.PropTypes.string).isRequired, - instanceOf: React.PropTypes.instanceOf(Object), - instanceOf_rec: React.PropTypes.instanceOf(Object).isRequired, - objectOf: React.PropTypes.objectOf(React.PropTypes.string), - objectOf_rec: React.PropTypes.objectOf(React.PropTypes.string).isRequired, - oneOf: React.PropTypes.oneOf(["yes", "no"]), - oneOf_rec: React.PropTypes.oneOf(["yes", "no"]).isRequired, - oneOfType: React.PropTypes.oneOfType( - [React.PropTypes.string, React.PropTypes.number] - ), - oneOfType_rec: React.PropTypes.oneOfType( - [React.PropTypes.string, React.PropTypes.number] - ).isRequired, - shape: React.PropTypes.shape({ - foo: React.PropTypes.string, - bar: React.PropTypes.number, - }), - shape_rec: React.PropTypes.shape({ - foo: React.PropTypes.string, - bar: React.PropTypes.number, - }).isRequired, - - // And do something bad here - bad_one: React.PropTypes.imaginaryType, - bad_two: React.PropTypes.string.inRequired, - }, -}); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Do something illegal inside of propTypes and make sure Flow notices -// And do something bad here -var React = require("react"); -var TestProps = React.createClass({ - propTypes: { - arr: React.PropTypes.array, - arr_rec: React.PropTypes.array.isRequired, - bool: React.PropTypes.bool, - bool_rec: React.PropTypes.bool.isRequired, - func: React.PropTypes.func, - func_rec: React.PropTypes.func.isRequired, - number: React.PropTypes.number, - number_rec: React.PropTypes.number.isRequired, - object: React.PropTypes.object, - object_rec: React.PropTypes.object.isRequired, - string: React.PropTypes.string, - string_rec: React.PropTypes.string.isRequired, - any: React.PropTypes.any, - any_rec: React.PropTypes.any.isRequired, - element: React.PropTypes.element, - element_rec: React.PropTypes.element.isRequired, - node: React.PropTypes.node, - node_rec: React.PropTypes.node.isRequired, - arrayOf: React.PropTypes.arrayOf(React.PropTypes.string), - arrayOf_rec: React.PropTypes.arrayOf(React.PropTypes.string).isRequired, - instanceOf: React.PropTypes.instanceOf(Object), - instanceOf_rec: React.PropTypes.instanceOf(Object).isRequired, - objectOf: React.PropTypes.objectOf(React.PropTypes.string), - objectOf_rec: React.PropTypes.objectOf(React.PropTypes.string).isRequired, - oneOf: React.PropTypes.oneOf([ "yes", "no" ]), - oneOf_rec: React.PropTypes.oneOf([ "yes", "no" ]).isRequired, - oneOfType: React.PropTypes.oneOfType( - [ React.PropTypes.string, React.PropTypes.number ] - ), - oneOfType_rec: React.PropTypes.oneOfType( - [ React.PropTypes.string, React.PropTypes.number ] - ).isRequired, - shape: React.PropTypes.shape({ - foo: React.PropTypes.string, - bar: React.PropTypes.number - }), - shape_rec: React.PropTypes.shape({ - foo: React.PropTypes.string, - bar: React.PropTypes.number - }).isRequired, - bad_one: React.PropTypes.imaginaryType, - bad_two: React.PropTypes.string.inRequired - } -}); -" -`; - -exports[`test props4.js 1`] = ` -"// @flow - -import React from "React"; - -class JDiv extends React.Component { - // static defaultProps: { }; - props: { - id: string - }; -} - -// Should be a type error ('id' takes a string, not a number..) -; - -class Example extends React.Component { - props: { bar: string }; - - render() { - return
{this.props.bar}
- } -} - -React.render( - , - document.body -); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -// static defaultProps: { }; -/* Should be a type error ('id' takes a string, not a number..)*/ -import React from "React"; -class JDiv extends React.Component { - props: { id: string }; -} -; -class Example extends React.Component { - props: { bar: string }; - render() { - return
{this.props.bar}
; - } -} -React.render(, document.body); -" -`; - -exports[`test props5.js 1`] = ` -"var React = require('React'); - -var C = React.createClass({ - getDefaultProps: function() { - return { x: 0 }; - } -}); - -module.exports = C; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require("React"); -var C = React.createClass({ - getDefaultProps: function() { - return { x: 0 }; - } -}); -module.exports = C; -" -`; - -exports[`test state.js 1`] = ` -"/* @flow */ - -var React = require('react'); - -type State = { - bar: ?{ qux: string; }; -}; - -var ReactClass = React.createClass({ - getInitialState: function():State { - return { bar: null }; - }, - - render: function(): any { - // Any state access here seems to make state any - this.state; - return ( -
- {this.state.bar.qux} -
- ); - } -}); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -// Any state access here seems to make state any -var React = require("react"); -type State = { bar: ?{ qux: string } }; -var ReactClass = React.createClass({ - getInitialState: function(): State { - return { bar: null }; - }, - render: function(): any { - this.state; - return ( -
- {this.state.bar.qux} -
- ); - } -}); -" -`; - -exports[`test state2.js 1`] = ` -"// @flow - -var React = require('react'); - -type FooState = { - key: ?Object; -}; - -var Comp = React.createClass({ - getInitialState: function(): FooState { - return { - key: null, // this used to cause a missing annotation error - }; - } -}); - -module.exports = Comp; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -// this used to cause a missing annotation error -var React = require("react"); -type FooState = { key: ?Object }; -var Comp = React.createClass({ - getInitialState: function(): FooState { - return { key: null }; - } -}); -module.exports = Comp; -" -`; - -exports[`test state3.js 1`] = ` -"var React = require('react'); -var TestState = React.createClass({ - - getInitialState: function(): { x: string; } { - return { - x: '' - } - }, - - test: function() { - var a: number = this.state.x; // error - - this.setState({ - x: false // error - }) - } - -}); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// error -// error -var React = require("react"); -var TestState = React.createClass({ - getInitialState: function(): { x: string } { - return { x: "" }; - }, - test: function() { - var a: number = this.state.x; - this.setState({ x: false }); - } -}); -" -`; - -exports[`test state4.js 1`] = ` -"var React = require('React'); - -var C = React.createClass({ - getInitialState: function() { - return { x: 0 }; - }, - - render() { - this.setState({ y: 0 }); - return
{this.state.z}
- } - -}); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require("React"); -var C = React.createClass({ - getInitialState: function() { - return { x: 0 }; - }, - render() { - this.setState({ y: 0 }); - return
{this.state.z}
; - } -}); -" -`; - -exports[`test state5.js 1`] = ` -"var React = require('React'); - -class C extends React.Component { - foo(): number { - return this.state.x; // error: need to declare type of state - } -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// error: need to declare type of state -var React = require("React"); -class C extends React.Component { - foo(): number { - return this.state.x; - } -} -" -`; diff --git a/tests/new_react/fakelib/__snapshots__/jsfmt.spec.js.snap b/tests/new_react/fakelib/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 50297374..00000000 --- a/tests/new_react/fakelib/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,17 +0,0 @@ -exports[`test type_aliases.js 1`] = ` -"declare var $React: $Exports<'react'>; // fake import -// Strawman: revised definition of $jsx (alternatively, React.Element). -// Using bounded poly to specify a constraint on a type parameter, and -// existentials to elide type arguments. -type _ReactElement, C: $React.Component> = $React.Element; -type $jsx = _ReactElement<*, *, *, C>; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// fake import -// Strawman: revised definition of $jsx (alternatively, React.Element). -// Using bounded poly to specify a constraint on a type parameter, and -// existentials to elide type arguments. -declare var $React: $Exports<"react">; -type _ReactElement, C: $React.Component> = $React.Element; -type $jsx = _ReactElement<*, *, *, C>; -" -`; diff --git a/tests/node_haste/__snapshots__/jsfmt.spec.js.snap b/tests/node_haste/__snapshots__/jsfmt.spec.js.snap index dfbf8293..fc391296 100644 --- a/tests/node_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_haste/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test client.js 1`] = ` -"var md5 = require('./md5'); +"var md5 = require(\'./md5\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var md5 = require("./md5"); +var md5 = require(\"./md5\"); " `; diff --git a/tests/node_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap b/tests/node_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap index 0736491b..c271ad79 100644 --- a/tests/node_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ exports[`test client.js 1`] = ` -"var docblock = require('qux/docblock'); -var min = require('d3/min.js'); -var corge = require('qux/corge'); +"var docblock = require(\'qux/docblock\'); +var min = require(\'d3/min.js\'); +var corge = require(\'qux/corge\'); -// make sure we don't pick up non-header @providesModule +// make sure we don\'t pick up non-header @providesModule // annotations - see node_modules/qux/docblock.js -var unreachable = require('annotation'); +var unreachable = require(\'annotation\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// make sure we don't pick up non-header @providesModule +// make sure we don\'t pick up non-header @providesModule // annotations - see node_modules/qux/docblock.js -var docblock = require("qux/docblock"); -var min = require("d3/min.js"); -var corge = require("qux/corge"); -var unreachable = require("annotation"); +var docblock = require(\"qux/docblock\"); +var min = require(\"d3/min.js\"); +var corge = require(\"qux/corge\"); +var unreachable = require(\"annotation\"); " `; diff --git a/tests/node_haste/ws/test/__snapshots__/jsfmt.spec.js.snap b/tests/node_haste/ws/test/__snapshots__/jsfmt.spec.js.snap index f283b764..188da262 100644 --- a/tests/node_haste/ws/test/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_haste/ws/test/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ exports[`test client.js 1`] = ` -"var ws = require('../'); +"var ws = require(\'../\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var ws = require("../"); +var ws = require(\"../\"); " `; diff --git a/tests/node_modules_with_symlinks/root/__snapshots__/jsfmt.spec.js.snap b/tests/node_modules_with_symlinks/root/__snapshots__/jsfmt.spec.js.snap index 9cdbe594..20acb26b 100644 --- a/tests/node_modules_with_symlinks/root/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_modules_with_symlinks/root/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ exports[`test foo.js 1`] = ` -"var x = require('symlink_lib'); -var y = require('symlink_lib_outside_root'); +"var x = require(\'symlink_lib\'); +var y = require(\'symlink_lib_outside_root\'); console.log(x); console.log(y); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require("symlink_lib"); -var y = require("symlink_lib_outside_root"); +var x = require(\"symlink_lib\"); +var y = require(\"symlink_lib_outside_root\"); console.log(x); console.log(y); " diff --git a/tests/node_modules_with_symlinks/root/symlink_lib/__snapshots__/jsfmt.spec.js.snap b/tests/node_modules_with_symlinks/root/symlink_lib/__snapshots__/jsfmt.spec.js.snap index ac6e0313..24978404 100644 --- a/tests/node_modules_with_symlinks/root/symlink_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_modules_with_symlinks/root/symlink_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ exports[`test index.js 1`] = ` -"module.exports = { bar: "bar" }; +"module.exports = { bar: \"bar\" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = { bar: "bar" }; +module.exports = { bar: \"bar\" }; " `; diff --git a/tests/node_modules_with_symlinks/symlink_lib_outside_root/__snapshots__/jsfmt.spec.js.snap b/tests/node_modules_with_symlinks/symlink_lib_outside_root/__snapshots__/jsfmt.spec.js.snap index ac6e0313..24978404 100644 --- a/tests/node_modules_with_symlinks/symlink_lib_outside_root/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_modules_with_symlinks/symlink_lib_outside_root/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ exports[`test index.js 1`] = ` -"module.exports = { bar: "bar" }; +"module.exports = { bar: \"bar\" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = { bar: "bar" }; +module.exports = { bar: \"bar\" }; " `; diff --git a/tests/node_modules_without_json/__snapshots__/jsfmt.spec.js.snap b/tests/node_modules_without_json/__snapshots__/jsfmt.spec.js.snap index 7977d7f8..5c5b5b4d 100644 --- a/tests/node_modules_without_json/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_modules_without_json/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test test.js 1`] = ` "// @flow -let foo = require('foo'); +let foo = require(\'foo\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -let foo = require("foo"); +let foo = require(\"foo\"); " `; diff --git a/tests/node_tests/assert/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/assert/__snapshots__/jsfmt.spec.js.snap index d3605fe9..35b84c3b 100644 --- a/tests/node_tests/assert/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/assert/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test assert.js 1`] = ` "/* @flow */ -var assert = require("assert") +var assert = require(\"assert\") assert(true) // ok assert.ok(true) // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // ok // ok -var assert = require("assert"); +var assert = require(\"assert\"); assert(true); assert.ok(true); " diff --git a/tests/node_tests/basic/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/basic/__snapshots__/jsfmt.spec.js.snap index 65890dba..da8e1cb6 100644 --- a/tests/node_tests/basic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/basic/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ exports[`test bar.js 1`] = ` -"module.exports = "bar"; +"module.exports = \"bar\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = "bar"; +module.exports = \"bar\"; " `; exports[`test foo.js 1`] = ` -"var x = require('./bar.js'); +"var x = require(\'./bar.js\'); console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require("./bar.js"); +var x = require(\"./bar.js\"); console.log(x); " `; diff --git a/tests/node_tests/basic_file/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/basic_file/__snapshots__/jsfmt.spec.js.snap index a62e2bb4..d1b67587 100644 --- a/tests/node_tests/basic_file/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/basic_file/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ exports[`test bar.js 1`] = ` -"module.exports = "bar"; +"module.exports = \"bar\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = "bar"; +module.exports = \"bar\"; " `; exports[`test foo.js 1`] = ` -"var x = require('./bar'); // bar.js does not work +"var x = require(\'./bar\'); // bar.js does not work console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // bar.js does not work -var x = require("./bar"); +var x = require(\"./bar\"); console.log(x); " `; diff --git a/tests/node_tests/basic_node_modules/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/basic_node_modules/__snapshots__/jsfmt.spec.js.snap index 6f10023c..4caf098a 100644 --- a/tests/node_tests/basic_node_modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/basic_node_modules/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test foo.js 1`] = ` -"var x = require('bar.js'); +"var x = require(\'bar.js\'); console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require("bar.js"); +var x = require(\"bar.js\"); console.log(x); " `; diff --git a/tests/node_tests/basic_node_modules_with_path/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/basic_node_modules_with_path/__snapshots__/jsfmt.spec.js.snap index d35da5b2..68209ae1 100644 --- a/tests/node_tests/basic_node_modules_with_path/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/basic_node_modules_with_path/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test foo.js 1`] = ` -"var x = require('bar_lib/bar'); +"var x = require(\'bar_lib/bar\'); console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require("bar_lib/bar"); +var x = require(\"bar_lib/bar\"); console.log(x); " `; diff --git a/tests/node_tests/basic_package/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/basic_package/__snapshots__/jsfmt.spec.js.snap index 47fcc103..bdc2306d 100644 --- a/tests/node_tests/basic_package/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/basic_package/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test foo.js 1`] = ` -"var x = require('./bar_lib'); // 'bar_lib' does not work! +"var x = require(\'./bar_lib\'); // \'bar_lib\' does not work! console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// 'bar_lib' does not work! -var x = require("./bar_lib"); +// \'bar_lib\' does not work! +var x = require(\"./bar_lib\"); console.log(x); " `; diff --git a/tests/node_tests/basic_package/bar_lib/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/basic_package/bar_lib/__snapshots__/jsfmt.spec.js.snap index 4b12068f..f8677ae2 100644 --- a/tests/node_tests/basic_package/bar_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/basic_package/bar_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ exports[`test bar.js 1`] = ` -"module.exports = "bar"; +"module.exports = \"bar\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = "bar"; +module.exports = \"bar\"; " `; diff --git a/tests/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap index b67ac591..7b7760ba 100644 --- a/tests/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap @@ -1,39 +1,39 @@ exports[`test crypto.js 1`] = ` "/* @flow */ -const crypto = require('crypto'); +const crypto = require(\'crypto\'); let tests = [ // Hmac is a duplex stream function() { - const hmac = crypto.createHmac('sha256', 'a secret'); + const hmac = crypto.createHmac(\'sha256\', \'a secret\'); - hmac.on('readable', () => { + hmac.on(\'readable\', () => { (hmac.read(): ?(string | Buffer)); (hmac.read(): number); // 4 errors: null, void, string, Buffer }); - hmac.write('some data to hash'); + hmac.write(\'some data to hash\'); hmac.write(123); // 2 errors: not a string or a Buffer hmac.end(); }, // Hmac supports update and digest functions too function(buf: Buffer) { - const hmac = crypto.createHmac('sha256', 'a secret'); + const hmac = crypto.createHmac(\'sha256\', \'a secret\'); - hmac.update('some data to hash'); - hmac.update('foo', 'utf8'); - hmac.update('foo', 'bogus'); // 1 error + hmac.update(\'some data to hash\'); + hmac.update(\'foo\', \'utf8\'); + hmac.update(\'foo\', \'bogus\'); // 1 error hmac.update(buf); - hmac.update(buf, 'utf8'); // 1 error: no encoding when passing a buffer + hmac.update(buf, \'utf8\'); // 1 error: no encoding when passing a buffer - // it's also chainable - (hmac.update('some data to hash').update(buf).digest(): Buffer); + // it\'s also chainable + (hmac.update(\'some data to hash\').update(buf).digest(): Buffer); - (hmac.digest('hex'): string); + (hmac.digest(\'hex\'): string); (hmac.digest(): Buffer); - (hmac.digest('hex'): void); // 1 error + (hmac.digest(\'hex\'): void); // 1 error (hmac.digest(): void); // 1 error } ] @@ -45,35 +45,35 @@ let tests = [ // Hmac supports update and digest functions too // 1 error // 1 error: no encoding when passing a buffer -// it's also chainable +// it\'s also chainable // 1 error // 1 error -const crypto = require("crypto"); +const crypto = require(\"crypto\"); let tests = [ function() { - const hmac = crypto.createHmac("sha256", "a secret"); + const hmac = crypto.createHmac(\"sha256\", \"a secret\"); hmac.on( - "readable", + \"readable\", () => { (hmac.read(): ?(string | Buffer)); (hmac.read(): number); } ); - hmac.write("some data to hash"); + hmac.write(\"some data to hash\"); hmac.write(123); hmac.end(); }, function(buf: Buffer) { - const hmac = crypto.createHmac("sha256", "a secret"); - hmac.update("some data to hash"); - hmac.update("foo", "utf8"); - hmac.update("foo", "bogus"); + const hmac = crypto.createHmac(\"sha256\", \"a secret\"); + hmac.update(\"some data to hash\"); + hmac.update(\"foo\", \"utf8\"); + hmac.update(\"foo\", \"bogus\"); hmac.update(buf); - hmac.update(buf, "utf8"); - (hmac.update("some data to hash").update(buf).digest(): Buffer); - (hmac.digest("hex"): string); + hmac.update(buf, \"utf8\"); + (hmac.update(\"some data to hash\").update(buf).digest(): Buffer); + (hmac.digest(\"hex\"): string); (hmac.digest(): Buffer); - (hmac.digest("hex"): void); + (hmac.digest(\"hex\"): void); (hmac.digest(): void); } ]; diff --git a/tests/node_tests/fs/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/fs/__snapshots__/jsfmt.spec.js.snap index 72db2862..def77bd1 100644 --- a/tests/node_tests/fs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/fs/__snapshots__/jsfmt.spec.js.snap @@ -1,37 +1,37 @@ exports[`test fs.js 1`] = ` -"var fs = require("fs"); +"var fs = require(\"fs\"); /* readFile */ -fs.readFile("file.exp", (_, data) => { +fs.readFile(\"file.exp\", (_, data) => { (data : Buffer); }); -fs.readFile("file.exp", "blah", (_, data) => { +fs.readFile(\"file.exp\", \"blah\", (_, data) => { (data : string); }); -fs.readFile("file.exp", { encoding: "blah" }, (_, data) => { +fs.readFile(\"file.exp\", { encoding: \"blah\" }, (_, data) => { (data : string); }); -fs.readFile("file.exp", {}, (_, data) => { +fs.readFile(\"file.exp\", {}, (_, data) => { (data : Buffer); }); /* readFileSync */ -(fs.readFileSync("file.exp") : Buffer); -(fs.readFileSync("file.exp") : string); // error +(fs.readFileSync(\"file.exp\") : Buffer); +(fs.readFileSync(\"file.exp\") : string); // error -(fs.readFileSync("file.exp", "blah") : string); -(fs.readFileSync("file.exp", "blah") : Buffer); // error +(fs.readFileSync(\"file.exp\", \"blah\") : string); +(fs.readFileSync(\"file.exp\", \"blah\") : Buffer); // error -(fs.readFileSync("file.exp", { encoding: "blah" }) : string); -(fs.readFileSync("file.exp", { encoding: "blah" }) : Buffer); // error +(fs.readFileSync(\"file.exp\", { encoding: \"blah\" }) : string); +(fs.readFileSync(\"file.exp\", { encoding: \"blah\" }) : Buffer); // error -(fs.readFileSync("file.exp", {}) : Buffer); -(fs.readFileSync("file.exp", {}) : string); // error +(fs.readFileSync(\"file.exp\", {}) : Buffer); +(fs.readFileSync(\"file.exp\", {}) : string); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* readFile */ /* readFileSync */ @@ -39,41 +39,41 @@ fs.readFile("file.exp", {}, (_, data) => { // error // error // error -var fs = require("fs"); +var fs = require(\"fs\"); fs.readFile( - "file.exp", + \"file.exp\", (_, data) => { (data: Buffer); } ); fs.readFile( - "file.exp", - "blah", + \"file.exp\", + \"blah\", (_, data) => { (data: string); } ); fs.readFile( - "file.exp", - { encoding: "blah" }, + \"file.exp\", + { encoding: \"blah\" }, (_, data) => { (data: string); } ); fs.readFile( - "file.exp", + \"file.exp\", {}, (_, data) => { (data: Buffer); } ); -(fs.readFileSync("file.exp"): Buffer); -(fs.readFileSync("file.exp"): string); -(fs.readFileSync("file.exp", "blah"): string); -(fs.readFileSync("file.exp", "blah"): Buffer); -(fs.readFileSync("file.exp", { encoding: "blah" }): string); -(fs.readFileSync("file.exp", { encoding: "blah" }): Buffer); -(fs.readFileSync("file.exp", {}): Buffer); -(fs.readFileSync("file.exp", {}): string); +(fs.readFileSync(\"file.exp\"): Buffer); +(fs.readFileSync(\"file.exp\"): string); +(fs.readFileSync(\"file.exp\", \"blah\"): string); +(fs.readFileSync(\"file.exp\", \"blah\"): Buffer); +(fs.readFileSync(\"file.exp\", { encoding: \"blah\" }): string); +(fs.readFileSync(\"file.exp\", { encoding: \"blah\" }): Buffer); +(fs.readFileSync(\"file.exp\", {}): Buffer); +(fs.readFileSync(\"file.exp\", {}): string); " `; diff --git a/tests/node_tests/json_file/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/json_file/__snapshots__/jsfmt.spec.js.snap index 624b7f30..722a7156 100644 --- a/tests/node_tests/json_file/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/json_file/__snapshots__/jsfmt.spec.js.snap @@ -1,27 +1,27 @@ exports[`test test.js 1`] = ` "// @flow -let data = require('./package/index.json'); +let data = require(\'./package/index.json\'); (data.foo: void); // error, should be object literal (data.foo.bar: void); // error, should be boolean (data.abc: boolean); // error, should be ?string -let data2 = require('./package'); +let data2 = require(\'./package\'); (data2.baz: void); // error, should be string -let data3 = require('./package2'); +let data3 = require(\'./package2\'); (data3.foo: void); // error, should be number (not string! index.js wins) -let data4 = require('./json_array'); +let data4 = require(\'./json_array\'); (data4: Array); (data4: void); // error, should be Array -(require('./json_string'): void); // error, should be string -(require('./json_number'): void); // error, should be number -(require('./json_true'): void); // error, should be true -(require('./json_false'): void); // error, should be false -(require('./json_null'): void); // error, should be null -(require('./json_negative_number'): -1); // ok +(require(\'./json_string\'): void); // error, should be string +(require(\'./json_number\'): void); // error, should be number +(require(\'./json_true\'): void); // error, should be true +(require(\'./json_false\'): void); // error, should be false +(require(\'./json_null\'): void); // error, should be null +(require(\'./json_negative_number\'): -1); // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // error, should be object literal @@ -36,22 +36,22 @@ let data4 = require('./json_array'); // error, should be false // error, should be null // ok -let data = require("./package/index.json"); +let data = require(\"./package/index.json\"); (data.foo: void); (data.foo.bar: void); (data.abc: boolean); -let data2 = require("./package"); +let data2 = require(\"./package\"); (data2.baz: void); -let data3 = require("./package2"); +let data3 = require(\"./package2\"); (data3.foo: void); -let data4 = require("./json_array"); +let data4 = require(\"./json_array\"); (data4: Array); (data4: void); -(require("./json_string"): void); -(require("./json_number"): void); -(require("./json_true"): void); -(require("./json_false"): void); -(require("./json_null"): void); -(require("./json_negative_number"): -1); +(require(\"./json_string\"): void); +(require(\"./json_number\"): void); +(require(\"./json_true\"): void); +(require(\"./json_false\"): void); +(require(\"./json_null\"): void); +(require(\"./json_negative_number\"): -1); " `; diff --git a/tests/node_tests/os/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/os/__snapshots__/jsfmt.spec.js.snap index 29552e27..bccf9dff 100644 --- a/tests/node_tests/os/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/os/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ exports[`test userInfo.js 1`] = ` "/* @flow */ -var os = require('os'); +var os = require(\'os\'); var u1 = os.userInfo(); (u1.username: string); (u1.username: Buffer); // error -var u2 = os.userInfo({encoding: 'utf8'}); +var u2 = os.userInfo({encoding: \'utf8\'}); (u2.username: string); (u2.username: Buffer); // error -var u3 = os.userInfo({encoding: 'buffer'}); +var u3 = os.userInfo({encoding: \'buffer\'}); (u3.username: string); // error (u3.username: Buffer); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -19,14 +19,14 @@ var u3 = os.userInfo({encoding: 'buffer'}); // error // error // error -var os = require("os"); +var os = require(\"os\"); var u1 = os.userInfo(); (u1.username: string); (u1.username: Buffer); -var u2 = os.userInfo({ encoding: "utf8" }); +var u2 = os.userInfo({ encoding: \"utf8\" }); (u2.username: string); (u2.username: Buffer); -var u3 = os.userInfo({ encoding: "buffer" }); +var u3 = os.userInfo({ encoding: \"buffer\" }); (u3.username: string); (u3.username: Buffer); " diff --git a/tests/node_tests/package_file/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/package_file/__snapshots__/jsfmt.spec.js.snap index d96ba1af..b71f83ab 100644 --- a/tests/node_tests/package_file/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/package_file/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ exports[`test bar_lib.js 1`] = ` -"module.exports = "bar_lib"; +"module.exports = \"bar_lib\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = "bar_lib"; +module.exports = \"bar_lib\"; " `; exports[`test foo.js 1`] = ` -"var x: string = require('./bar_lib'); // 'bar_lib' does not work! +"var x: string = require(\'./bar_lib\'); // \'bar_lib\' does not work! console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// 'bar_lib' does not work! -var x: string = require("./bar_lib"); +// \'bar_lib\' does not work! +var x: string = require(\"./bar_lib\"); console.log(x); " `; diff --git a/tests/node_tests/package_file_node_modules/foo/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/package_file_node_modules/foo/__snapshots__/jsfmt.spec.js.snap index 1cf5db4c..5604ee51 100644 --- a/tests/node_tests/package_file_node_modules/foo/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/package_file_node_modules/foo/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test foo.js 1`] = ` -"var x: string = require('bar_lib'); // 'bar_lib' does not work! +"var x: string = require(\'bar_lib\'); // \'bar_lib\' does not work! console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// 'bar_lib' does not work! -var x: string = require("bar_lib"); +// \'bar_lib\' does not work! +var x: string = require(\"bar_lib\"); console.log(x); " `; diff --git a/tests/node_tests/path_node_modules/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/path_node_modules/__snapshots__/jsfmt.spec.js.snap index f577704b..51bc929a 100644 --- a/tests/node_tests/path_node_modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/path_node_modules/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test foo.js 1`] = ` -"var x = require('bar_lib/src/lib/bar'); +"var x = require(\'bar_lib/src/lib/bar\'); console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require("bar_lib/src/lib/bar"); +var x = require(\"bar_lib/src/lib/bar\"); console.log(x); " `; diff --git a/tests/node_tests/path_node_modules_with_short_main/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/path_node_modules_with_short_main/__snapshots__/jsfmt.spec.js.snap index adfdd7f3..d2e4c58f 100644 --- a/tests/node_tests/path_node_modules_with_short_main/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/path_node_modules_with_short_main/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test foo.js 1`] = ` -"var x = require('bar_lib'); +"var x = require(\'bar_lib\'); console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require("bar_lib"); +var x = require(\"bar_lib\"); console.log(x); " `; diff --git a/tests/node_tests/path_node_modules_without_main/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/path_node_modules_without_main/__snapshots__/jsfmt.spec.js.snap index adfdd7f3..d2e4c58f 100644 --- a/tests/node_tests/path_node_modules_without_main/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/path_node_modules_without_main/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test foo.js 1`] = ` -"var x = require('bar_lib'); +"var x = require(\'bar_lib\'); console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require("bar_lib"); +var x = require(\"bar_lib\"); console.log(x); " `; diff --git a/tests/node_tests/path_package/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/path_package/__snapshots__/jsfmt.spec.js.snap index e637a983..e77df483 100644 --- a/tests/node_tests/path_package/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/path_package/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test foo.js 1`] = ` -"var x = require('bar_lib/src/lib'); +"var x = require(\'bar_lib/src/lib\'); console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require("bar_lib/src/lib"); +var x = require(\"bar_lib/src/lib\"); console.log(x); " `; diff --git a/tests/node_tests/stream/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/stream/__snapshots__/jsfmt.spec.js.snap index f8e90a7d..e510e6e3 100644 --- a/tests/node_tests/stream/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/stream/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ exports[`test stream.js 1`] = ` "/* @flow */ -var child_process = require('child_process'); -var fs = require('fs'); -var stream = require('stream'); -var ls = child_process.spawn('ls'); +var child_process = require(\'child_process\'); +var fs = require(\'fs\'); +var stream = require(\'stream\'); +var ls = child_process.spawn(\'ls\'); -var data = "foo"; +var data = \"foo\"; ls.stdin.write(data); -ls.stdin.write(data, "utf-8"); +ls.stdin.write(data, \"utf-8\"); ls.stdin.write(data, () => {}); -ls.stdin.write(data, "utf-8", () => {}); +ls.stdin.write(data, \"utf-8\", () => {}); ls.stdin.end(); ls.stdin.end(data); -ls.stdin.end(data, "utf-8"); +ls.stdin.end(data, \"utf-8\"); ls.stdin.end(data, () => {}); -ls.stdin.end(data, "utf-8", () => {}); +ls.stdin.end(data, \"utf-8\", () => {}); -var ws = fs.createWriteStream('/dev/null'); +var ws = fs.createWriteStream(\'/dev/null\'); ls.stdout.pipe(ws).end(); class MyReadStream extends stream.Readable {} @@ -34,13 +34,13 @@ new MyReadStream() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var child_process = require("child_process"); -var fs = require("fs"); -var stream = require("stream"); -var ls = child_process.spawn("ls"); -var data = "foo"; +var child_process = require(\"child_process\"); +var fs = require(\"fs\"); +var stream = require(\"stream\"); +var ls = child_process.spawn(\"ls\"); +var data = \"foo\"; ls.stdin.write(data); -ls.stdin.write(data, "utf-8"); +ls.stdin.write(data, \"utf-8\"); ls.stdin.write( data, () => { @@ -49,14 +49,14 @@ ls.stdin.write( ); ls.stdin.write( data, - "utf-8", + \"utf-8\", () => { } ); ls.stdin.end(); ls.stdin.end(data); -ls.stdin.end(data, "utf-8"); +ls.stdin.end(data, \"utf-8\"); ls.stdin.end( data, () => { @@ -65,12 +65,12 @@ ls.stdin.end( ); ls.stdin.end( data, - "utf-8", + \"utf-8\", () => { } ); -var ws = fs.createWriteStream("/dev/null"); +var ws = fs.createWriteStream(\"/dev/null\"); ls.stdout.pipe(ws).end(); class MyReadStream extends stream.Readable {} class MyWriteStream extends stream.Writable {} diff --git a/tests/node_tests/url/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/url/__snapshots__/jsfmt.spec.js.snap index c69e44cd..f335f9ef 100644 --- a/tests/node_tests/url/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/url/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test url.js 1`] = ` -"const url = require('url'); -url.format(url.parse('https://example.com/foo')); +"const url = require(\'url\'); +url.format(url.parse(\'https://example.com/foo\')); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -const url = require("url"); -url.format(url.parse("https://example.com/foo")); +const url = require(\"url\"); +url.format(url.parse(\"https://example.com/foo\")); " `; diff --git a/tests/nullable/__snapshots__/jsfmt.spec.js.snap b/tests/nullable/__snapshots__/jsfmt.spec.js.snap index 3bd5fb13..c1a757cf 100644 --- a/tests/nullable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/nullable/__snapshots__/jsfmt.spec.js.snap @@ -2,14 +2,14 @@ exports[`test maybe.js 1`] = ` "// @flow // unwrapping nested maybes should work -(('foo': ?(?string)): ?string); // ok +((\'foo\': ?(?string)): ?string); // ok ((123: ?(?number)): ?string); // error (only num ~> string) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // unwrapping nested maybes should work // ok // error (only num ~> string) -(("foo": ??string): ?string); +((\"foo\": ??string): ?string); ((123: ??number): ?string); " `; @@ -68,11 +68,11 @@ var array_of_nullable: Array = [ null, 3 ]; exports[`test simple_nullable.js 1`] = ` "function foo(x:?string) {} function bar(x:?number) {} -foo('hmm'); -bar('hmm'); +foo(\'hmm\'); +bar(\'hmm\'); function fn(data: ?{}) {} -fn({some: 'literal'}); +fn({some: \'literal\'}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: ?string) { @@ -80,11 +80,11 @@ function foo(x: ?string) { function bar(x: ?number) { } -foo("hmm"); -bar("hmm"); +foo(\"hmm\"); +bar(\"hmm\"); function fn(data: ?{}) { } -fn({ some: "literal" }); +fn({ some: \"literal\" }); " `; diff --git a/tests/object_assign/__snapshots__/jsfmt.spec.js.snap b/tests/object_assign/__snapshots__/jsfmt.spec.js.snap index d1295a18..a6af5708 100644 --- a/tests/object_assign/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object_assign/__snapshots__/jsfmt.spec.js.snap @@ -3,22 +3,22 @@ exports[`test A.js 1`] = ` * @flow */ -var EventEmitter = require('events').EventEmitter; +var EventEmitter = require(\'events\').EventEmitter; // This pattern seems to cause the trouble. var Bad = Object.assign({}, EventEmitter.prototype, { - foo: function(): string { return 'hi'; } + foo: function(): string { return \'hi\'; } }); -// Calling Bad.foo() in the same file doesn't error +// Calling Bad.foo() in the same file doesn\'t error var bad: number = Bad.foo(); -// Doesn't repro if I extend the class myself +// Doesn\'t repro if I extend the class myself class MyEventEmitter extends events$EventEmitter {} var Good = Object.assign({}, MyEventEmitter.prototype, { - foo: function(): string { return 'hi'; } + foo: function(): string { return \'hi\'; } }); -// Calling Good.foo() in the same file doesn't error +// Calling Good.foo() in the same file doesn\'t error var good: number = Good.foo(); module.exports = { @@ -30,16 +30,16 @@ module.exports = { * @flow */ // This pattern seems to cause the trouble. -// Calling Bad.foo() in the same file doesn't error -// Doesn't repro if I extend the class myself -// Calling Good.foo() in the same file doesn't error -var EventEmitter = require("events").EventEmitter; +// Calling Bad.foo() in the same file doesn\'t error +// Doesn\'t repro if I extend the class myself +// Calling Good.foo() in the same file doesn\'t error +var EventEmitter = require(\"events\").EventEmitter; var Bad = Object.assign( {}, EventEmitter.prototype, { foo: function(): string { - return "hi"; + return \"hi\"; } } ); @@ -50,7 +50,7 @@ var Good = Object.assign( MyEventEmitter.prototype, { foo: function(): string { - return "hi"; + return \"hi\"; } } ); @@ -64,7 +64,7 @@ exports[`test B.js 1`] = ` * @flow */ -var A = require('./A.js'); +var A = require(\'./A.js\'); var good: number = A.Good.foo(); @@ -89,7 +89,7 @@ B.js|12 col 1 error| call of method foo || Property not found in A.js|8 col 23 error| object literal */ -var A = require("./A.js"); +var A = require(\"./A.js\"); var good: number = A.Good.foo(); var f = A.Bad.foo; var bad_: number = f(); @@ -100,36 +100,36 @@ var bad: number = A.Bad.foo(); exports[`test apply.js 1`] = ` "// @flow -(Object.assign.apply(null, [{}, {a: 1}, {b: 'foo'}]): {a: number, b: string}); -(Object.assign({}, ...[{a: 1}, {b: 'foo'}]): {a: number, b: string}); +(Object.assign.apply(null, [{}, {a: 1}, {b: \'foo\'}]): {a: number, b: string}); +(Object.assign({}, ...[{a: 1}, {b: \'foo\'}]): {a: number, b: string}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -(Object.assign.apply(null, [ {}, { a: 1 }, { b: "foo" } ]): { +(Object.assign.apply(null, [ {}, { a: 1 }, { b: \"foo\" } ]): { a: number; b: string }); -(Object.assign({}, ...[ { a: 1 }, { b: "foo" } ]): { a: number; b: string }); +(Object.assign({}, ...[ { a: 1 }, { b: \"foo\" } ]): { a: number; b: string }); " `; exports[`test non_objects.js 1`] = ` "/* @flow */ -Object.assign("123", {a: "foo"}); -Object.assign(123, {a: "foo"}); -Object.assign({a: "foo"}, 123); +Object.assign(\"123\", {a: \"foo\"}); +Object.assign(123, {a: \"foo\"}); +Object.assign({a: \"foo\"}, 123); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -Object.assign("123", { a: "foo" }); -Object.assign(123, { a: "foo" }); -Object.assign({ a: "foo" }, 123); +Object.assign(\"123\", { a: \"foo\" }); +Object.assign(123, { a: \"foo\" }); +Object.assign({ a: \"foo\" }, 123); " `; exports[`test undefined.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); type DefaultProps = { foo: number, @@ -151,7 +151,7 @@ class MyReactThing extends React.Component { /* @flow */ /* works*/ // also works -var React = require("react"); +var React = require(\"react\"); type DefaultProps = { foo: number }; type Props = { foo: number }; class MyReactThing extends React.Component { diff --git a/tests/object_freeze/__snapshots__/jsfmt.spec.js.snap b/tests/object_freeze/__snapshots__/jsfmt.spec.js.snap index 5822aaa4..ded3b2c4 100644 --- a/tests/object_freeze/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object_freeze/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test object_freeze.js 1`] = ` "/* @flow */ -var foo = Object.freeze({bar: '12345'}); -foo.bar = '23456'; // error +var foo = Object.freeze({bar: \'12345\'}); +foo.bar = \'23456\'; // error -Object.assign(foo, {bar: '12345'}); // error +Object.assign(foo, {bar: \'12345\'}); // error var baz = {baz: 12345}; -var bliffl = Object.freeze({bar: '12345', ...baz}); -bliffl.bar = '23456'; // error +var bliffl = Object.freeze({bar: \'12345\', ...baz}); +bliffl.bar = \'23456\'; // error bliffl.baz = 3456; // error bliffl.corge; // error bliffl.constructor = baz; // error @@ -18,7 +18,7 @@ baz.baz = 0; var x : number = Object.freeze(123); -var xx : { x: number } = Object.freeze({ x: "error" }) +var xx : { x: number } = Object.freeze({ x: \"error\" }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // error @@ -28,12 +28,12 @@ var xx : { x: number } = Object.freeze({ x: "error" }) // error // error // error -var foo = Object.freeze({ bar: "12345" }); -foo.bar = "23456"; -Object.assign(foo, { bar: "12345" }); +var foo = Object.freeze({ bar: \"12345\" }); +foo.bar = \"23456\"; +Object.assign(foo, { bar: \"12345\" }); var baz = { baz: 12345 }; -var bliffl = Object.freeze({ bar: "12345", ...baz }); -bliffl.bar = "23456"; +var bliffl = Object.freeze({ bar: \"12345\", ...baz }); +bliffl.bar = \"23456\"; bliffl.baz = 3456; bliffl.corge; bliffl.constructor = baz; @@ -42,6 +42,6 @@ bliffl.toString = function() { }; baz.baz = 0; var x: number = Object.freeze(123); -var xx: { x: number } = Object.freeze({ x: "error" }); +var xx: { x: number } = Object.freeze({ x: \"error\" }); " `; diff --git a/tests/object_is/__snapshots__/jsfmt.spec.js.snap b/tests/object_is/__snapshots__/jsfmt.spec.js.snap index 8c488374..8bc88aaa 100644 --- a/tests/object_is/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object_is/__snapshots__/jsfmt.spec.js.snap @@ -17,10 +17,10 @@ Object.is(emptyObject, emptyArray); var squared = x => x * x; Object.is(squared, squared); -var a: boolean = Object.is('a', 'a'); -var b: string = Object.is('a', 'a'); -var c: boolean = Object.is('a'); -var d: boolean = Object.is('a', 'b', 'c'); +var a: boolean = Object.is(\'a\', \'a\'); +var b: string = Object.is(\'a\', \'a\'); +var c: boolean = Object.is(\'a\'); +var d: boolean = Object.is(\'a\', \'b\', \'c\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Object.is(1, 1); Object.is(1, 2); @@ -37,9 +37,9 @@ Object.is(emptyArray, emptyArray); Object.is(emptyObject, emptyArray); var squared = x => x * x; Object.is(squared, squared); -var a: boolean = Object.is("a", "a"); -var b: string = Object.is("a", "a"); -var c: boolean = Object.is("a"); -var d: boolean = Object.is("a", "b", "c"); +var a: boolean = Object.is(\"a\", \"a\"); +var b: string = Object.is(\"a\", \"a\"); +var c: boolean = Object.is(\"a\"); +var d: boolean = Object.is(\"a\", \"b\", \"c\"); " `; diff --git a/tests/objects/__snapshots__/jsfmt.spec.js.snap b/tests/objects/__snapshots__/jsfmt.spec.js.snap index b6907d59..a322f6db 100644 --- a/tests/objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/objects/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test conversion.js 1`] = ` "/* @flow */ -(Object({foo: 'bar'}): {foo: string}); -(Object("123"): String); +(Object({foo: \'bar\'}): {foo: string}); +(Object(\"123\"): String); (Object(123): Number); (Object(true): Boolean); (Object(null): {}); @@ -11,9 +11,9 @@ exports[`test conversion.js 1`] = ` (Object(undefined): Number); // error var x = Object(null); -x.foo = "bar"; +x.foo = \"bar\"; -var y = Object("123"); +var y = Object(\"123\"); (y.charAt(0): string); var z = Object(123); // error (next line makes this not match any signatures) @@ -22,8 +22,8 @@ var z = Object(123); // error (next line makes this not match any signatures) /* @flow */ // error // error (next line makes this not match any signatures) -(Object({ foo: "bar" }): { foo: string }); -(Object("123"): String); +(Object({ foo: \"bar\" }): { foo: string }); +(Object(\"123\"): String); (Object(123): Number); (Object(true): Boolean); (Object(null): {}); @@ -31,8 +31,8 @@ var z = Object(123); // error (next line makes this not match any signatures) (Object(void 0): {}); (Object(undefined): Number); var x = Object(null); -x.foo = "bar"; -var y = Object("123"); +x.foo = \"bar\"; +var y = Object(\"123\"); (y.charAt(0): string); var z = Object(123); (z.charAt(0): string); @@ -42,50 +42,50 @@ var z = Object(123); exports[`test objects.js 1`] = ` "/* @flow */ -var x : {'123': string, bar: string} = {'123': 'val', bar: 'bar'}; -(x.foo : string); // error, key doesn't exist -(x['foo'] : string); // error, key doesn't exist -(x[123] : boolean); // TODO: use the number's value to error here +var x : {\'123\': string, bar: string} = {\'123\': \'val\', bar: \'bar\'}; +(x.foo : string); // error, key doesn\'t exist +(x[\'foo\'] : string); // error, key doesn\'t exist +(x[123] : boolean); // TODO: use the number\'s value to error here (x.bar: boolean); // error, string !~> boolean -(x['123'] : boolean); // error, string !~> boolean -x['123'] = false; // error, boolean !~> string -x[123] = false; // TODO: use the number's value to error here -x['foo'+'bar'] = 'derp'; // ok since we can't tell -(x[\`foo\`]: string); // error, key doesn't exist +(x[\'123\'] : boolean); // error, string !~> boolean +x[\'123\'] = false; // error, boolean !~> string +x[123] = false; // TODO: use the number\'s value to error here +x[\'foo\'+\'bar\'] = \'derp\'; // ok since we can\'t tell +(x[\`foo\`]: string); // error, key doesn\'t exist -var y : {foo: string} = {foo: 'bar'}; -y['foo'] = 123; // error, number !~> string -y['bar'] = 'abc'; // error, property not found +var y : {foo: string} = {foo: \'bar\'}; +y[\'foo\'] = 123; // error, number !~> string +y[\'bar\'] = \'abc\'; // error, property not found -(y['hasOwnProperty']: string); // error, prototype method is not a string +(y[\'hasOwnProperty\']: string); // error, prototype method is not a string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -// error, key doesn't exist -// error, key doesn't exist -// TODO: use the number's value to error here +// error, key doesn\'t exist +// error, key doesn\'t exist +// TODO: use the number\'s value to error here // error, string !~> boolean // error, string !~> boolean // error, boolean !~> string -// TODO: use the number's value to error here -// ok since we can't tell -// error, key doesn't exist +// TODO: use the number\'s value to error here +// ok since we can\'t tell +// error, key doesn\'t exist // error, number !~> string // error, property not found // error, prototype method is not a string -var x: { "123": string; bar: string } = { "123": "val", bar: "bar" }; +var x: { \"123\": string; bar: string } = { \"123\": \"val\", bar: \"bar\" }; (x.foo: string); -(x["foo"]: string); +(x[\"foo\"]: string); (x[123]: boolean); (x.bar: boolean); -(x["123"]: boolean); -x["123"] = false; +(x[\"123\"]: boolean); +x[\"123\"] = false; x[123] = false; -x["foo" + "bar"] = "derp"; +x[\"foo\" + \"bar\"] = \"derp\"; (x[\`foo\`]: string); -var y: { foo: string } = { foo: "bar" }; -y["foo"] = 123; -y["bar"] = "abc"; -(y["hasOwnProperty"]: string); +var y: { foo: string } = { foo: \"bar\" }; +y[\"foo\"] = 123; +y[\"bar\"] = \"abc\"; +(y[\"hasOwnProperty\"]: string); " `; @@ -94,7 +94,7 @@ exports[`test unaliased_assign.js 1`] = ` * test handling of unaliased value assignment. * * An unaliased object rvalue may be assigned to a supertype lvalue, - * because later widening mutations on the rvalue can't break assumptions + * because later widening mutations on the rvalue can\'t break assumptions * made by other lvalues. * * However, upon assignment the rvalue must take on the type of the @@ -104,25 +104,25 @@ exports[`test unaliased_assign.js 1`] = ` * @flow */ -var glob: { x: string } = { x: "hey" }; +var glob: { x: string } = { x: \"hey\" }; function assign_then_alias() { var obj: { x: string | number }; - obj = { x: "hey" }; + obj = { x: \"hey\" }; glob = obj; // error: subsequent assignment might make glob.x a number } function assign_then_widen() { var obj: { x: string | number }; - obj = { x: "hey" }; - obj.x = 10; // ok, by lvalue's given type + obj = { x: \"hey\" }; + obj.x = 10; // ok, by lvalue\'s given type } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * test handling of unaliased value assignment. * * An unaliased object rvalue may be assigned to a supertype lvalue, - * because later widening mutations on the rvalue can't break assumptions + * because later widening mutations on the rvalue can\'t break assumptions * made by other lvalues. * * However, upon assignment the rvalue must take on the type of the @@ -132,16 +132,16 @@ function assign_then_widen() { * @flow */ // error: subsequent assignment might make glob.x a number -// ok, by lvalue's given type -var glob: { x: string } = { x: "hey" }; +// ok, by lvalue\'s given type +var glob: { x: string } = { x: \"hey\" }; function assign_then_alias() { var obj: { x: string | number }; - obj = { x: "hey" }; + obj = { x: \"hey\" }; glob = obj; } function assign_then_widen() { var obj: { x: string | number }; - obj = { x: "hey" }; + obj = { x: \"hey\" }; obj.x = 10; } " diff --git a/tests/optional_props/__snapshots__/jsfmt.spec.js.snap b/tests/optional_props/__snapshots__/jsfmt.spec.js.snap index d06ac792..1b3ee083 100644 --- a/tests/optional_props/__snapshots__/jsfmt.spec.js.snap +++ b/tests/optional_props/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test test.js 1`] = ` "var x: { } = { foo: 0 }; var y: { foo?: string } = x; // OK in TypeScript, not OK in Flow -var z: string = y.foo || ""; +var z: string = y.foo || \"\"; var o = { }; y = o; // OK; we know that narrowing could not have happened @@ -10,14 +10,14 @@ o.foo = 0; // future widening is constrained function bar(config: { foo?: number }) {} bar({}); -bar({foo: ""}); +bar({foo: \"\"}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // OK in TypeScript, not OK in Flow // OK; we know that narrowing could not have happened // future widening is constrained var x: {} = { foo: 0 }; var y: { foo?: string } = x; -var z: string = y.foo || ""; +var z: string = y.foo || \"\"; var o = {}; y = o; o.foo = 0; @@ -25,7 +25,7 @@ function bar(config: { foo?: number }) { } bar({}); -bar({ foo: "" }); +bar({ foo: \"\" }); " `; @@ -70,7 +70,7 @@ exports[`test test3.js 1`] = ` /* object literals are sealed. this is simply a heuristic - decision: most of the time, the rule gives the 'right' + decision: most of the time, the rule gives the \'right\' errors. an exception is when a literal is used as an initializer @@ -79,7 +79,7 @@ exports[`test test3.js 1`] = ` the problem becomes visible when a property assignment is then used to (legitimately) extend the object with an - optional property - the variable's specific (path- + optional property - the variable\'s specific (path- dependent) type has become that of the literal which. without adjustment, will reject the property addition. @@ -91,15 +91,15 @@ exports[`test test3.js 1`] = ` // x has optional property b. // (note that the initializer here does not play into -// the problem, it's just a placeholder. initializers +// the problem, it\'s just a placeholder. initializers // do not narrow the types of annotated variables as do // subsequent assignments.) // var x: { a: number, b?: number } = { a: 0 }; // now assign an object literal lacking property b. -// the literal's type is sealed and has only a at creation. -// but it then flows, specific ~> general, to x's annotation +// the literal\'s type is sealed and has only a at creation. +// but it then flows, specific ~> general, to x\'s annotation // type. at that point, it acquires b as an optional property. // x = { a: 0 }; @@ -111,7 +111,7 @@ x.b = 1; class A { x: { a: number, b?: string }; foo() { - // Something similar should happen here, but doesn't: the problem is + // Something similar should happen here, but doesn\'t: the problem is // made explicit by adding generics (see test3_failure.js introduced by // D2747512). There is a race between writing b on the object literal // type and adding b as an optional property to it, since in general we @@ -119,14 +119,14 @@ class A { // annotation will be processed before the flow involving the // access. Here we lose the race and get an error on the write. this.x = { a: 123 }; - this.x.b = 'hello'; + this.x.b = \'hello\'; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow /* object literals are sealed. this is simply a heuristic - decision: most of the time, the rule gives the 'right' + decision: most of the time, the rule gives the \'right\' errors. an exception is when a literal is used as an initializer @@ -135,7 +135,7 @@ class A { the problem becomes visible when a property assignment is then used to (legitimately) extend the object with an - optional property - the variable's specific (path- + optional property - the variable\'s specific (path- dependent) type has become that of the literal which. without adjustment, will reject the property addition. @@ -146,18 +146,18 @@ class A { */ // x has optional property b. // (note that the initializer here does not play into -// the problem, it's just a placeholder. initializers +// the problem, it\'s just a placeholder. initializers // do not narrow the types of annotated variables as do // subsequent assignments.) // // now assign an object literal lacking property b. -// the literal's type is sealed and has only a at creation. -// but it then flows, specific ~> general, to x's annotation +// the literal\'s type is sealed and has only a at creation. +// but it then flows, specific ~> general, to x\'s annotation // type. at that point, it acquires b as an optional property. // // ...which allows this assignment to take place. // T7810506 -// Something similar should happen here, but doesn't: the problem is +// Something similar should happen here, but doesn\'t: the problem is // made explicit by adding generics (see test3_failure.js introduced by // D2747512). There is a race between writing b on the object literal // type and adding b as an optional property to it, since in general we @@ -171,7 +171,7 @@ class A { x: { a: number; b?: string }; foo() { this.x = { a: 123 }; - this.x.b = "hello"; + this.x.b = \"hello\"; } } " @@ -184,7 +184,7 @@ class A { o: O; foo() { this.o.x = { a: 123 }; - this.o.x.b = 'hello'; // this is a spurious error (see test3.js for details) + this.o.x.b = \'hello\'; // this is a spurious error (see test3.js for details) } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -194,7 +194,7 @@ class A { o: O; foo() { this.o.x = { a: 123 }; - this.o.x.b = "hello"; + this.o.x.b = \"hello\"; } } " diff --git a/tests/overload/__snapshots__/jsfmt.spec.js.snap b/tests/overload/__snapshots__/jsfmt.spec.js.snap index 16b0fd7c..0df61d1d 100644 --- a/tests/overload/__snapshots__/jsfmt.spec.js.snap +++ b/tests/overload/__snapshots__/jsfmt.spec.js.snap @@ -5,10 +5,10 @@ exports[`test overload.js 1`] = ` * @flow */ -var x1: number = "".match(0)[0]; -var x2: number = "".match(/pattern/)[0]; -var x3: string = "".replace(/pattern/,"..."); -var x4: number = "".split(/pattern/)[0]; +var x1: number = \"\".match(0)[0]; +var x2: number = \"\".match(/pattern/)[0]; +var x3: string = \"\".replace(/pattern/,\"...\"); +var x4: number = \"\".split(/pattern/)[0]; declare class C { foo(x:number): number; @@ -21,11 +21,11 @@ declare class C { var a = new C(); a.foo(0); // ok -a.foo("hey"); // ok +a.foo(\"hey\"); // ok a.foo(true); // error, function cannot be called on intersection type a.bar({ a: 0 }); // ok -a.bar({ a: "hey" }); // ok +a.bar({ a: \"hey\" }); // ok a.bar({ a: true }); // error, function cannot be called on intersection type declare var x: { a: boolean; } & { b: string }; @@ -47,7 +47,7 @@ var y:number = new Dummy().dumb(foo); function bar1(x:number):Array { return []; } var z1:number = new Dummy().dumber(bar1); -function bar2(x:number):string { return "..."; } +function bar2(x:number):string { return \"...\"; } var z2:Array = new Dummy().dumber(bar2); */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -78,13 +78,13 @@ var y:number = new Dummy().dumb(foo); function bar1(x:number):Array { return []; } var z1:number = new Dummy().dumber(bar1); -function bar2(x:number):string { return "..."; } +function bar2(x:number):string { return \"...\"; } var z2:Array = new Dummy().dumber(bar2); */ -var x1: number = "".match(0)[0]; -var x2: number = "".match(/pattern/)[0]; -var x3: string = "".replace(/pattern/, "..."); -var x4: number = "".split(/pattern/)[0]; +var x1: number = \"\".match(0)[0]; +var x2: number = \"\".match(/pattern/)[0]; +var x3: string = \"\".replace(/pattern/, \"...\"); +var x4: number = \"\".split(/pattern/)[0]; declare class C { foo(x: number): number; foo(x: string): string; @@ -93,10 +93,10 @@ declare class C { } var a = new C(); a.foo(0); -a.foo("hey"); +a.foo(\"hey\"); a.foo(true); a.bar({ a: 0 }); -a.bar({ a: "hey" }); +a.bar({ a: \"hey\" }); a.bar({ a: true }); declare var x: { a: boolean } & { b: string }; a.bar(x); @@ -119,19 +119,19 @@ function foo() { exports[`test test2.js 1`] = ` "declare class Foo { - bar(x: 'hmm'): number; + bar(x: \'hmm\'): number; bar(x: string): string; } var foo = new Foo; -(foo.bar('hmm'): number); // OK -(foo.bar('hmmm'): number); // error +(foo.bar(\'hmm\'): number); // OK +(foo.bar(\'hmmm\'): number); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // OK // error -declare class Foo { bar(x: "hmm"): number; bar(x: string): string } +declare class Foo { bar(x: \"hmm\"): number; bar(x: string): string } var foo = new Foo(); -(foo.bar("hmm"): number); -(foo.bar("hmmm"): number); +(foo.bar(\"hmm\"): number); +(foo.bar(\"hmmm\"): number); " `; @@ -186,12 +186,12 @@ exports[`test union.js 1`] = ` "function foo (x: $Either,U>): Array { return []; } var x1:number = foo(0)[0]; -var x2:string = foo([""])[0]; +var x2:string = foo([\"\"])[0]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: $Either, U>): Array { return [ ]; } var x1: number = foo(0)[0]; -var x2: string = foo([ "" ])[0]; +var x2: string = foo([ \"\" ])[0]; " `; diff --git a/tests/path/__snapshots__/jsfmt.spec.js.snap b/tests/path/__snapshots__/jsfmt.spec.js.snap index d933c302..2de635b6 100644 --- a/tests/path/__snapshots__/jsfmt.spec.js.snap +++ b/tests/path/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ exports[`test while.js 1`] = ` "var x = 1; -while(typeof x == "number" || typeof x == "string") { +while(typeof x == \"number\" || typeof x == \"string\") { x = x + 1; - if (true) x = ""; + if (true) x = \"\"; } var z:number = x; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var x = 1; -while (typeof x == "number" || typeof x == "string") { +while (typeof x == \"number\" || typeof x == \"string\") { x = x + 1; if (true) - x = ""; + x = \"\"; } var z: number = x; " diff --git a/tests/plsummit/__snapshots__/jsfmt.spec.js.snap b/tests/plsummit/__snapshots__/jsfmt.spec.js.snap index aca8305e..a20611cb 100644 --- a/tests/plsummit/__snapshots__/jsfmt.spec.js.snap +++ b/tests/plsummit/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ exports[`test arrays.js 1`] = ` -"function foo(x) { return [x, x > 0, "number " + x]; } +"function foo(x) { return [x, x > 0, \"number \" + x]; } var [n, b, s] = foo(42); n * s.length; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x) { - return [ x, x > 0, "number " + x ]; + return [ x, x > 0, \"number \" + x ]; } var [ n, b, s ] = foo(42); n * s.length; @@ -46,12 +46,12 @@ function foo(x: X): X { `; exports[`test import_class.js 1`] = ` -"var C = require('./export_class'); +"var C = require(\'./export_class\'); -var c = new C(""); +var c = new C(\"\"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var C = require("./export_class"); -var c = new C(""); +var C = require(\"./export_class\"); +var c = new C(\"\"); " `; @@ -64,7 +64,7 @@ function foo() { } function bar(x: ?string): number { - if (x == null) x = ""; + if (x == null) x = \"\"; return x.length; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -75,7 +75,7 @@ function foo() { } function bar(x: ?string): number { if (x == null) - x = ""; + x = \"\"; return x.length; } " @@ -90,7 +90,7 @@ var x: string = c.foo(); function foo() { return this.y; } function bar() { return this.foo(); } -var o = { y: "", foo: foo, bar: bar }; +var o = { y: \"\", foo: foo, bar: bar }; var o2 = { y: 0, foo: foo, bar: bar }; o.bar(); @@ -110,7 +110,7 @@ function foo() { function bar() { return this.foo(); } -var o = { y: "", foo: foo, bar: bar }; +var o = { y: \"\", foo: foo, bar: bar }; var o2 = { y: 0, foo: foo, bar: bar }; o.bar(); var y: number = o2.bar(); diff --git a/tests/poly_class_export/__snapshots__/jsfmt.spec.js.snap b/tests/poly_class_export/__snapshots__/jsfmt.spec.js.snap index 6c71edde..a34a5433 100644 --- a/tests/poly_class_export/__snapshots__/jsfmt.spec.js.snap +++ b/tests/poly_class_export/__snapshots__/jsfmt.spec.js.snap @@ -18,7 +18,7 @@ module.exports = A; exports[`test B.js 1`] = ` "// @flow -let A = require('./A'); +let A = require(\'./A\'); class B extends A { constructor() { @@ -29,7 +29,7 @@ class B extends A { module.exports = new B(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -let A = require("./A"); +let A = require(\"./A\"); class B extends A { constructor() { super(); @@ -42,7 +42,7 @@ module.exports = new B(); exports[`test C.js 1`] = ` "// @flow -// This test exports a function whose return type is the class's \`this\` type. +// This test exports a function whose return type is the class\'s \`this\` type. // It should be inferred (no annotation required). class Foo { @@ -56,7 +56,7 @@ export function f(x: Foo) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -// This test exports a function whose return type is the class's \`this\` type. +// This test exports a function whose return type is the class\'s \`this\` type. // It should be inferred (no annotation required). class Foo { foo(): this { diff --git a/tests/private/__snapshots__/jsfmt.spec.js.snap b/tests/private/__snapshots__/jsfmt.spec.js.snap index 3b7bea1e..fbef504c 100644 --- a/tests/private/__snapshots__/jsfmt.spec.js.snap +++ b/tests/private/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test private.js 1`] = ` x: number; _x: string; __x: number; - constructor() { this.x = 0; this._x = ""; this.__x = 0; } + constructor() { this.x = 0; this._x = \"\"; this.__x = 0; } } class B extends A { @@ -20,7 +20,7 @@ class A { __x: number; constructor() { this.x = 0; - this._x = ""; + this._x = \"\"; this.__x = 0; } } diff --git a/tests/promises/__snapshots__/jsfmt.spec.js.snap b/tests/promises/__snapshots__/jsfmt.spec.js.snap index 37b09bbf..9354e0c7 100644 --- a/tests/promises/__snapshots__/jsfmt.spec.js.snap +++ b/tests/promises/__snapshots__/jsfmt.spec.js.snap @@ -85,7 +85,7 @@ exports[`test covariance.js 1`] = ` async function testAll() { /* This is a test case from https://github.com/facebook/flow/issues/1143 - * which was previously an error due to Array's invariance and an improper + * which was previously an error due to Array\'s invariance and an improper * definition of Promise.all */ const x: Array> = []; const y: Promise> = Promise.all(x); @@ -100,7 +100,7 @@ async function testRace() { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ /* This is a test case from https://github.com/facebook/flow/issues/1143 - * which was previously an error due to Array's invariance and an improper + * which was previously an error due to Array\'s invariance and an improper * definition of Promise.all */ async function testAll() { const x: Array> = [ ]; @@ -170,10 +170,10 @@ new Promise(function(resolve, reject) { if (Math.random()) { resolve(42); } else { - resolve('str'); + resolve(\'str\'); } }).then(function(numOrStr) { - if (typeof numOrStr === 'string') { + if (typeof numOrStr === \'string\') { var a: string = numOrStr; } else { var b: number = numOrStr; @@ -212,10 +212,10 @@ new Promise(function(resolve, reject) { if (Math.random()) { reject(42); } else { - reject('str'); + reject(\'str\'); } }).catch(function(numOrStr) { - if (typeof numOrStr === 'string') { + if (typeof numOrStr === \'string\') { var a: string = numOrStr; } else { var b: number = numOrStr; @@ -273,7 +273,7 @@ Promise.reject(Promise.resolve(0)).then(function(num) { // resolvedPromise.then():T -> then(T) Promise.resolve(0) - .then(function(num) { return 'asdf'; }) + .then(function(num) { return \'asdf\'; }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -281,7 +281,7 @@ Promise.resolve(0) // resolvedPromise.then():Promise -> then(T) Promise.resolve(0) - .then(function(num) { return Promise.resolve('asdf'); }) + .then(function(num) { return Promise.resolve(\'asdf\'); }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -289,7 +289,7 @@ Promise.resolve(0) // resolvedPromise.then():Promise> -> then(T) Promise.resolve(0) - .then(function(num) { return Promise.resolve(Promise.resolve('asdf')); }) + .then(function(num) { return Promise.resolve(Promise.resolve(\'asdf\')); }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -298,7 +298,7 @@ Promise.resolve(0) // TODO: resolvedPromise.then() -> catch(T) Promise.resolve(0) .then(function(num) { - throw 'str'; + throw \'str\'; }) .catch(function(str) { var a: string = str; @@ -313,7 +313,7 @@ Promise.resolve(0) // rejectedPromise.catch():U -> then(U) Promise.reject(0) - .catch(function(num) { return 'asdf'; }) + .catch(function(num) { return \'asdf\'; }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -321,7 +321,7 @@ Promise.reject(0) // rejectedPromise.catch():Promise -> then(U) Promise.reject(0) - .catch(function(num) { return Promise.resolve('asdf'); }) + .catch(function(num) { return Promise.resolve(\'asdf\'); }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -329,7 +329,7 @@ Promise.reject(0) // rejectedPromise.catch():Promise> -> then(U) Promise.reject(0) - .catch(function(num) { return Promise.resolve(Promise.resolve('asdf')); }) + .catch(function(num) { return Promise.resolve(Promise.resolve(\'asdf\')); }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -476,12 +476,12 @@ new Promise( if (Math.random()) { resolve(42); } else { - resolve("str"); + resolve(\"str\"); } } ).then( function(numOrStr) { - if (typeof numOrStr === "string") { + if (typeof numOrStr === \"string\") { var a: string = numOrStr; } else { var b: number = numOrStr; @@ -520,12 +520,12 @@ new Promise( if (Math.random()) { reject(42); } else { - reject("str"); + reject(\"str\"); } } ).catch( function(numOrStr) { - if (typeof numOrStr === "string") { + if (typeof numOrStr === \"string\") { var a: string = numOrStr; } else { var b: number = numOrStr; @@ -565,7 +565,7 @@ Promise.reject(Promise.resolve(0)).then( ); Promise.resolve(0).then( function(num) { - return "asdf"; + return \"asdf\"; } ).then( function(str) { @@ -575,7 +575,7 @@ Promise.resolve(0).then( ); Promise.resolve(0).then( function(num) { - return Promise.resolve("asdf"); + return Promise.resolve(\"asdf\"); } ).then( function(str) { @@ -585,7 +585,7 @@ Promise.resolve(0).then( ); Promise.resolve(0).then( function(num) { - return Promise.resolve(Promise.resolve("asdf")); + return Promise.resolve(Promise.resolve(\"asdf\")); } ).then( function(str) { @@ -595,7 +595,7 @@ Promise.resolve(0).then( ); Promise.resolve(0).then( function(num) { - throw "str"; + throw \"str\"; } ).catch( function(str) { @@ -605,7 +605,7 @@ Promise.resolve(0).then( ); Promise.reject(0).catch( function(num) { - return "asdf"; + return \"asdf\"; } ).then( function(str) { @@ -615,7 +615,7 @@ Promise.reject(0).catch( ); Promise.reject(0).catch( function(num) { - return Promise.resolve("asdf"); + return Promise.resolve(\"asdf\"); } ).then( function(str) { @@ -625,7 +625,7 @@ Promise.reject(0).catch( ); Promise.reject(0).catch( function(num) { - return Promise.resolve(Promise.resolve("asdf")); + return Promise.resolve(Promise.resolve(\"asdf\")); } ).then( function(str) { @@ -662,7 +662,7 @@ class Promise {} */ async function foo(x: boolean) { if (x) { - return {bar: 'baz'}; + return {bar: \'baz\'}; } else { return null; } @@ -708,7 +708,7 @@ async function baz(): Promise { class Promise {} async function foo(x: boolean) { if (x) { - return { bar: "baz" }; + return { bar: \"baz\" }; } else { return null; } diff --git a/tests/pure_component/__snapshots__/jsfmt.spec.js.snap b/tests/pure_component/__snapshots__/jsfmt.spec.js.snap index 1f70adb7..8c898746 100644 --- a/tests/pure_component/__snapshots__/jsfmt.spec.js.snap +++ b/tests/pure_component/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,5 @@ exports[`test test.js 1`] = ` -"var React = require('react'); +"var React = require(\'react\'); class C extends React.PureComponent { props: { x: number }; @@ -7,7 +7,7 @@ class C extends React.PureComponent { (); // error (\`x\` is a required prop) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error (\`x\` is a required prop) -var React = require("react"); +var React = require(\"react\"); class C extends React.PureComponent { props: { x: number }; } diff --git a/tests/qualified/__snapshots__/jsfmt.spec.js.snap b/tests/qualified/__snapshots__/jsfmt.spec.js.snap index 2a2c27c6..f43caef8 100644 --- a/tests/qualified/__snapshots__/jsfmt.spec.js.snap +++ b/tests/qualified/__snapshots__/jsfmt.spec.js.snap @@ -10,7 +10,7 @@ declare var of_type_foo: foo; type bar = typeof of_type_foo.bar; var a: bar = 42; -var b: bar = 'asdf'; // Error: string ~> number +var b: bar = \'asdf\'; // Error: string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Error: string ~> number class C {} @@ -20,6 +20,6 @@ type foo = { bar: number }; declare var of_type_foo: foo; type bar = typeof of_type_foo.bar; var a: bar = 42; -var b: bar = "asdf"; +var b: bar = \"asdf\"; " `; diff --git a/tests/react/__snapshots__/jsfmt.spec.js.snap b/tests/react/__snapshots__/jsfmt.spec.js.snap index 86e909c1..c3db9f23 100644 --- a/tests/react/__snapshots__/jsfmt.spec.js.snap +++ b/tests/react/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test ArityError.react.js 1`] = ` "/** * @providesModule ArityError.react */ -var React = require('react'); +var React = require(\'react\'); var AudienceInsightsContainer = React.createClass({ renderComponent(AudienceInsights: ReactClass<*>) { return ; @@ -14,7 +14,7 @@ module.exports = AudienceInsightsContainer; /** * @providesModule ArityError.react */ -var React = require("react"); +var React = require(\"react\"); var AudienceInsightsContainer = React.createClass({ renderComponent(AudienceInsights: ReactClass<*>) { return ; @@ -26,23 +26,23 @@ module.exports = AudienceInsightsContainer; exports[`test createElement_string.js 1`] = ` "// @flow -import React from 'react'; +import React from \'react\'; class Bar extends React.Component {} class Foo extends React.Component { render() { - const Cmp = Math.random() < 0.5 ? 'div' : Bar; + const Cmp = Math.random() < 0.5 ? \'div\' : Bar; return (); } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import React from "react"; +import React from \"react\"; class Bar extends React.Component {} class Foo extends React.Component { render() { - const Cmp = (Math.random() < 0.5 ? "div" : Bar); + const Cmp = (Math.random() < 0.5 ? \"div\" : Bar); return ; } } @@ -51,7 +51,7 @@ class Foo extends React.Component { exports[`test createElementRequiredProp_string.js 1`] = ` "// @flow -import React from 'react'; +import React from \'react\'; class Bar extends React.Component { props: { @@ -68,13 +68,13 @@ class Bar extends React.Component { class Foo extends React.Component { render() { - const Cmp = Math.random() < 0.5 ? 'div' : Bar; + const Cmp = Math.random() < 0.5 ? \'div\' : Bar; return (); } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import React from "react"; +import React from \"react\"; class Bar extends React.Component { props: { test: number }; render() { @@ -87,7 +87,7 @@ class Bar extends React.Component { } class Foo extends React.Component { render() { - const Cmp = (Math.random() < 0.5 ? "div" : Bar); + const Cmp = (Math.random() < 0.5 ? \"div\" : Bar); return ; } } @@ -97,16 +97,16 @@ class Foo extends React.Component { exports[`test import_react.js 1`] = ` "/* @flow */ -import react from "react"; -import {Component} from "react"; +import react from \"react\"; +import {Component} from \"react\"; var a: Component<*,*,*> = new react.Component(); var b: number = new react.Component(); // Error: ReactComponent ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Error: ReactComponent ~> number -import react from "react"; -import { Component } from "react"; +import react from \"react\"; +import { Component } from \"react\"; var a: Component<*, *, *> = new react.Component(); var b: number = new react.Component(); " @@ -115,7 +115,7 @@ var b: number = new react.Component(); exports[`test jsx_spread.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); var Foo = React.createClass({ propTypes: { bar: React.PropTypes.string.isRequired, @@ -127,7 +127,7 @@ var blah = ; // error bar, number given string expected ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // error bar, number given string expected -var React = require("react"); +var React = require(\"react\"); var Foo = React.createClass({ propTypes: { bar: React.PropTypes.string.isRequired } }); @@ -139,7 +139,7 @@ var blah = ; exports[`test proptype_arrayOf.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); var Example = React.createClass({ propTypes: { arr: React.PropTypes.arrayOf(React.PropTypes.number).isRequired @@ -150,24 +150,24 @@ var ok_empty = var ok_numbers = var fail_not_array = -var fail_mistyped_elems = +var fail_mistyped_elems = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require("react"); +var React = require(\"react\"); var Example = React.createClass({ propTypes: { arr: React.PropTypes.arrayOf(React.PropTypes.number).isRequired } }); var ok_empty = ; var ok_numbers = ; var fail_not_array = ; -var fail_mistyped_elems = ; +var fail_mistyped_elems = ; " `; exports[`test proptype_func.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); var Example = React.createClass({ propTypes: { func: React.PropTypes.func.isRequired @@ -181,7 +181,7 @@ var ok_retval = 1} /> var fail_mistyped = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require("react"); +var React = require(\"react\"); var Example = React.createClass({ propTypes: { func: React.PropTypes.func.isRequired } }); @@ -199,10 +199,10 @@ var fail_mistyped = ; exports[`test proptype_missing.js 1`] = ` "/* @flow */ -/* If you create a react component with createClass() but don't specify the +/* If you create a react component with createClass() but don\'t specify the * propTypes, what should the type of props be? * - * It used to be an empty object, but we didn't enforce that correctly, so + * It used to be an empty object, but we didn\'t enforce that correctly, so * people could do whatever they wanted with this.props. * * As of 0.21.0 it started to be an error when people used this.props in a @@ -210,15 +210,15 @@ exports[`test proptype_missing.js 1`] = ` * enforced, so glevi changed this.props to be Object by default. * * We may change this back to the empty object at some point and fix the - * situations where it didn't used to error + * situations where it didn\'t used to error */ var React = React.createClass({ getID(): string { - // So this would have been an error in 0.21.0 if we didn't make this.props + // So this would have been an error in 0.21.0 if we didn\'t make this.props // Object switch (this.props.name) { - case 'a': return 'Bob'; - default: return 'Alice'; + case \'a\': return \'Bob\'; + default: return \'Alice\'; } }, @@ -229,10 +229,10 @@ var React = React.createClass({ }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -/* If you create a react component with createClass() but don't specify the +/* If you create a react component with createClass() but don\'t specify the * propTypes, what should the type of props be? * - * It used to be an empty object, but we didn't enforce that correctly, so + * It used to be an empty object, but we didn\'t enforce that correctly, so * people could do whatever they wanted with this.props. * * As of 0.21.0 it started to be an error when people used this.props in a @@ -240,18 +240,18 @@ var React = React.createClass({ * enforced, so glevi changed this.props to be Object by default. * * We may change this back to the empty object at some point and fix the - * situations where it didn't used to error + * situations where it didn\'t used to error */ -// So this would have been an error in 0.21.0 if we didn't make this.props +// So this would have been an error in 0.21.0 if we didn\'t make this.props // Object // But this never errored var React = React.createClass({ getID(): string { switch (this.props.name) { - case "a": - return "Bob"; + case \"a\": + return \"Bob\"; default: - return "Alice"; + return \"Alice\"; } }, render() { @@ -264,7 +264,7 @@ var React = React.createClass({ exports[`test proptype_object.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); var Example = React.createClass({ propTypes: { object: React.PropTypes.object.isRequired @@ -272,17 +272,17 @@ var Example = React.createClass({ }); var ok_empty = ; -var ok_props = ; +var ok_props = ; var fail_mistyped = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require("react"); +var React = require(\"react\"); var Example = React.createClass({ propTypes: { object: React.PropTypes.object.isRequired } }); var ok_empty = ; -var ok_props = ; +var ok_props = ; var fail_mistyped = ; " `; @@ -290,7 +290,7 @@ var fail_mistyped = ; exports[`test proptype_objectOf.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); var Example = React.createClass({ propTypes: { obj: React.PropTypes.objectOf(React.PropTypes.number).isRequired @@ -301,10 +301,10 @@ var ok_empty = var ok_numbers = var fail_not_object = -var fail_mistyped_props = +var fail_mistyped_props = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require("react"); +var React = require(\"react\"); var Example = React.createClass({ propTypes: { obj: React.PropTypes.objectOf(React.PropTypes.number).isRequired @@ -313,37 +313,37 @@ var Example = React.createClass({ var ok_empty = ; var ok_numbers = ; var fail_not_object = ; -var fail_mistyped_props = ; +var fail_mistyped_props = ; " `; exports[`test proptype_oneOf.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); var Example = React.createClass({ propTypes: { - literal: React.PropTypes.oneOf(["foo"]).isRequired + literal: React.PropTypes.oneOf([\"foo\"]).isRequired }, }); -var ex1 = ; -var ex2 = ; +var ex1 = ; +var ex2 = ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require("react"); +var React = require(\"react\"); var Example = React.createClass({ - propTypes: { literal: React.PropTypes.oneOf([ "foo" ]).isRequired } + propTypes: { literal: React.PropTypes.oneOf([ \"foo\" ]).isRequired } }); -var ex1 = ; -var ex2 = ; +var ex1 = ; +var ex2 = ; " `; exports[`test proptype_oneOfType.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); var Example = React.createClass({ propTypes: { prop: React.PropTypes.oneOfType([ @@ -352,7 +352,7 @@ var Example = React.createClass({ ]).isRequired }, render() { - if (typeof this.props.prop === "string") { + if (typeof this.props.prop === \"string\") { return
{this.props.prop}
} else { return
{this.props.prop.toFixed(2)}
@@ -361,12 +361,12 @@ var Example = React.createClass({ }); var ok_number = ; -var ok_string = ; +var ok_string = ; var fail_bool = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require("react"); +var React = require(\"react\"); var Example = React.createClass({ propTypes: { prop: React.PropTypes.oneOfType( @@ -374,7 +374,7 @@ var Example = React.createClass({ ).isRequired }, render() { - if (typeof this.props.prop === "string") { + if (typeof this.props.prop === \"string\") { return
{this.props.prop}
; } else { return
{this.props.prop.toFixed(2)}
; @@ -382,7 +382,7 @@ var Example = React.createClass({ } }); var ok_number = ; -var ok_string = ; +var ok_string = ; var fail_bool = ; " `; diff --git a/tests/react_functional/__snapshots__/jsfmt.spec.js.snap b/tests/react_functional/__snapshots__/jsfmt.spec.js.snap index b9e197b8..6d48d7f6 100644 --- a/tests/react_functional/__snapshots__/jsfmt.spec.js.snap +++ b/tests/react_functional/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test test.js 1`] = ` -"import React from "react"; +"import React from \"react\"; function F(props: { foo: string }) {} ; // error: missing \`foo\` ; // error: number ~> string -; // ok +; // ok // props subtyping is property-wise covariant function G(props: { foo: string|numner }) {} -; // ok +; // ok var Z = 0; ; // error, expected React component @@ -19,17 +19,17 @@ var Z = 0; // props subtyping is property-wise covariant // ok // error, expected React component -import React from "react"; +import React from \"react\"; function F(props: { foo: string }) { } ; ; -; +; function G(props: { foo: string | numner }) { } -; +; var Z = 0; ; " diff --git a/tests/recheck-haste/__snapshots__/jsfmt.spec.js.snap b/tests/recheck-haste/__snapshots__/jsfmt.spec.js.snap index ff641bf3..e00e3195 100644 --- a/tests/recheck-haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck-haste/__snapshots__/jsfmt.spec.js.snap @@ -15,9 +15,9 @@ exports[`test A1.js 1`] = ` exports[`test A3.js 1`] = ` "// @flow -require('A'); +require(\'A\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -require("A"); +require(\"A\"); " `; diff --git a/tests/recheck-haste/tmp2A/__snapshots__/jsfmt.spec.js.snap b/tests/recheck-haste/tmp2A/__snapshots__/jsfmt.spec.js.snap index 2748fe9b..f3ce6d56 100644 --- a/tests/recheck-haste/tmp2A/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck-haste/tmp2A/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ exports[`test A3.js 1`] = ` "// @flow -require('B'); +require(\'B\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -require("B"); +require(\"B\"); " `; diff --git a/tests/recheck/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/__snapshots__/jsfmt.spec.js.snap index 26dbe459..2a556a58 100644 --- a/tests/recheck/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/__snapshots__/jsfmt.spec.js.snap @@ -19,25 +19,25 @@ module.exports = foo; exports[`test a2.js 1`] = ` "// @flow -const foo = require('./a1'); +const foo = require(\'./a1\'); -module.exports = foo(""); +module.exports = foo(\"\"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const foo = require("./a1"); -module.exports = foo(""); +const foo = require(\"./a1\"); +module.exports = foo(\"\"); " `; exports[`test a3.js 1`] = ` "// @flow -const five = require('./a2'); +const five = require(\'./a2\'); (five + five: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const five = require("./a2"); +const five = require(\"./a2\"); (five + five: string); " `; @@ -64,7 +64,7 @@ module.exports = { C, E }; exports[`test b1.js 1`] = ` "// @flow -import { C, E } from "./b0"; +import { C, E } from \"./b0\"; function foo() { return C; } function bar() { return E; } let X = foo(); @@ -73,7 +73,7 @@ class D extends F { } module.exports = { C, D }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C, E } from "./b0"; +import { C, E } from \"./b0\"; function foo() { return C; } @@ -90,22 +90,22 @@ module.exports = { C, D }; exports[`test b2.js 1`] = ` "// @flow -module.exports = require("./b1"); +module.exports = require(\"./b1\"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -module.exports = require("./b1"); +module.exports = require(\"./b1\"); " `; exports[`test b3.js 1`] = ` "// @flow -import { C, D } from "./b2"; +import { C, D } from \"./b2\"; (new D: C); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C, D } from "./b2"; +import { C, D } from \"./b2\"; (new D(): C); " `; @@ -125,14 +125,14 @@ export function foo(props: { x: number }) { exports[`test c2.js 1`] = ` "// @flow -import { foo } from "./c1"; +import { foo } from \"./c1\"; export function bar(props: { x: number }) { foo({ x: 0 }); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { foo } from "./c1"; +import { foo } from \"./c1\"; export function bar(props: { x: number }) { foo({ x: 0 }); } @@ -142,12 +142,12 @@ export function bar(props: { x: number }) { exports[`test c3.js 1`] = ` "// @flow -import { bar } from "./c2"; +import { bar } from \"./c2\"; bar({ x: 0 }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { bar } from "./c2"; +import { bar } from \"./c2\"; bar({ x: 0 }); " `; @@ -169,11 +169,11 @@ export var x = new A(); exports[`test d2.js 1`] = ` "// @flow -import {A, x} from "./d1"; +import {A, x} from \"./d1\"; export var y: A = x; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { A, x } from "./d1"; +import { A, x } from \"./d1\"; export var y: A = x; " `; @@ -182,14 +182,14 @@ exports[`test e1.js 1`] = ` "// @flow export type Action = - | { type: 'FOO' } - | { type: 'BAR' } + | { type: \'FOO\' } + | { type: \'BAR\' } ; export const LIFE = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export type Action = { type: "FOO" } | { type: "BAR" }; +export type Action = { type: \"FOO\" } | { type: \"BAR\" }; export const LIFE = 42; " `; @@ -197,22 +197,22 @@ export const LIFE = 42; exports[`test e2.js 1`] = ` "// @flow -import type { Action } from './e1'; +import type { Action } from \'./e1\'; const f = (): Action => { - return { type: 'FOO' }; + return { type: \'FOO\' }; } -import { LIFE } from './e1'; +import { LIFE } from \'./e1\'; (LIFE: 42); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import type { Action } from "./e1"; +import type { Action } from \"./e1\"; const f = (): Action => { - return { type: "FOO" }; + return { type: \"FOO\" }; }; -import { LIFE } from "./e1"; +import { LIFE } from \"./e1\"; (LIFE: 42); " `; @@ -242,11 +242,11 @@ module.exports = { a, b, c }; exports[`test f2.js 1`] = ` "// @flow -var { a, b, c } = require('./f1'); +var { a, b, c } = require(\'./f1\'); (c: { x: number }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var { a, b, c } = require("./f1"); +var { a, b, c } = require(\"./f1\"); (c: { x: number }); " `; @@ -264,14 +264,14 @@ export class C {} exports[`test g2.js 1`] = ` "// @flow -import { C } from './g1'; +import { C } from \'./g1\'; class D extends C { } module.exports = { D }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C } from "./g1"; +import { C } from \"./g1\"; class D extends C {} module.exports = { D }; " @@ -280,14 +280,14 @@ module.exports = { D }; exports[`test g3.js 1`] = ` "// @flow -import { C } from './g1'; -import { D } from './g2'; +import { C } from \'./g1\'; +import { D } from \'./g2\'; (new D: C) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C } from "./g1"; -import { D } from "./g2"; +import { C } from \"./g1\"; +import { D } from \"./g2\"; (new D(): C); " `; @@ -305,9 +305,9 @@ export type Foo = number; exports[`test h2.js 1`] = ` "// @flow -import type { Foo } from './h1'; +import type { Foo } from \'./h1\'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import type { Foo } from "./h1"; +import type { Foo } from \"./h1\"; " `; diff --git a/tests/recheck/tmp1b/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp1b/__snapshots__/jsfmt.spec.js.snap index 8d646df4..58834809 100644 --- a/tests/recheck/tmp1b/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp1b/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test b1.js 1`] = ` "// @flow -import { C, E } from "./b0"; +import { C, E } from \"./b0\"; function foo() { return C; } function bar() { return E; } let X = bar(); @@ -10,7 +10,7 @@ class D extends F { } module.exports = { C, D }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C, E } from "./b0"; +import { C, E } from \"./b0\"; function foo() { return C; } diff --git a/tests/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap index 95b484be..3563bd41 100644 --- a/tests/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test c2.js 1`] = ` "// @flow -import { foo } from "./c1"; +import { foo } from \"./c1\"; export function bar(props: { y: number }) { foo({ y: 0 }); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { foo } from "./c1"; +import { foo } from \"./c1\"; export function bar(props: { y: number }) { foo({ y: 0 }); } diff --git a/tests/recheck/tmp1e/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp1e/__snapshots__/jsfmt.spec.js.snap index 0f2f3e97..6c3f470b 100644 --- a/tests/recheck/tmp1e/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp1e/__snapshots__/jsfmt.spec.js.snap @@ -1,22 +1,22 @@ exports[`test e2.js 1`] = ` "// @flow -import type { Action } from './e1'; +import type { Action } from \'./e1\'; const f = (): Action => { - return { type: 'QUX' }; + return { type: \'QUX\' }; } -import { LIFE } from './e1'; +import { LIFE } from \'./e1\'; (LIFE: 42); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import type { Action } from "./e1"; +import type { Action } from \"./e1\"; const f = (): Action => { - return { type: "QUX" }; + return { type: \"QUX\" }; }; -import { LIFE } from "./e1"; +import { LIFE } from \"./e1\"; (LIFE: 42); " `; diff --git a/tests/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap index 15812cf6..53e7ab99 100644 --- a/tests/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test a1.js 1`] = ` function foo(x: number): number { return 5; } -foo(""); +foo(\"\"); module.exports = foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -11,7 +11,7 @@ module.exports = foo; function foo(x: number): number { return 5; } -foo(""); +foo(\"\"); module.exports = foo; " `; diff --git a/tests/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap index 736b343a..297c96fb 100644 --- a/tests/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap @@ -2,14 +2,14 @@ exports[`test e1.js 1`] = ` "// @flow export type Action = - | { type: 'QUX' } - | { type: 'BAR' } + | { type: \'QUX\' } + | { type: \'BAR\' } ; export const LIFE = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export type Action = { type: "QUX" } | { type: "BAR" }; +export type Action = { type: \"QUX\" } | { type: \"BAR\" }; export const LIFE = 42; " `; diff --git a/tests/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap index 77244f15..390a9faf 100644 --- a/tests/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap @@ -2,14 +2,14 @@ exports[`test e1.js 1`] = ` "// @flow export type Action = - | { type: 'QUX' } - | { type: 'BAR' } + | { type: \'QUX\' } + | { type: \'BAR\' } ; export const LIFE = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export type Action = { type: "QUX" } | { type: "BAR" }; +export type Action = { type: \"QUX\" } | { type: \"BAR\" }; export const LIFE = 0; " `; @@ -17,22 +17,22 @@ export const LIFE = 0; exports[`test e2.js 1`] = ` "// @flow -import type { Action } from './e1'; +import type { Action } from \'./e1\'; const f = (): Action => { - return { type: 'QUX' }; + return { type: \'QUX\' }; } -import { LIFE } from './e1'; +import { LIFE } from \'./e1\'; (LIFE: 0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import type { Action } from "./e1"; +import type { Action } from \"./e1\"; const f = (): Action => { - return { type: "QUX" }; + return { type: \"QUX\" }; }; -import { LIFE } from "./e1"; +import { LIFE } from \"./e1\"; (LIFE: 0); " `; diff --git a/tests/record/__snapshots__/jsfmt.spec.js.snap b/tests/record/__snapshots__/jsfmt.spec.js.snap index ba3c22ff..24ac7b51 100644 --- a/tests/record/__snapshots__/jsfmt.spec.js.snap +++ b/tests/record/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test test.js 1`] = ` -"type Key1 = 'foo' | 'bar'; // make an enum type with known key set +"type Key1 = \'foo\' | \'bar\'; // make an enum type with known key set var o1: {[key: Key1]: number} = { foo: 0, - bar: "", // error: string ~/~ number + bar: \"\", // error: string ~/~ number }; o1.foo; // OK o1.qux; // error: qux not found @@ -15,7 +15,7 @@ o2.bar; // OK to access bar o2.qux; // error: qux not found class C { - x: $Subtype<{[key: $Keys]: any}>; // object with larger key set than X's + x: $Subtype<{[key: $Keys]: any}>; // object with larger key set than X\'s } class D extends C<{foo: number, bar: string}> { x: { foo: number, qux: boolean }; // error: qux not found @@ -33,10 +33,10 @@ var o3: {[key: AnyKey]: number} = { foo: 0 }; // OK to leave out bar // OK to access bar // error: qux not found -// object with larger key set than X's +// object with larger key set than X\'s // error: qux not found -type Key1 = "foo" | "bar"; -var o1: { [key: Key1]: number } = { foo: 0, bar: "" }; +type Key1 = \"foo\" | \"bar\"; +var o1: { [key: Key1]: number } = { foo: 0, bar: \"\" }; o1.foo; o1.qux; o1.toString(); diff --git a/tests/refi/__snapshots__/jsfmt.spec.js.snap b/tests/refi/__snapshots__/jsfmt.spec.js.snap index f925c3e2..2c362b85 100644 --- a/tests/refi/__snapshots__/jsfmt.spec.js.snap +++ b/tests/refi/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test bound.js 1`] = ` "// refinements of bound vars (closed-over locals) // should have the same lifetimes as heap objects. -var x : ?string = "xxx"; +var x : ?string = \"xxx\"; var tests = [ @@ -38,7 +38,7 @@ var tests = // requires further remedial work in Env function() { if (x != null) { - alert(""); + alert(\"\"); var y : string = x; // not ok } }, @@ -56,11 +56,11 @@ var tests = }, function() { - var y : string = x != null ? x : ""; // ok + var y : string = x != null ? x : \"\"; // ok }, function() { - var y : string = x || ""; // ok + var y : string = x || \"\"; // ok }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -75,7 +75,7 @@ var tests = // requires further remedial work in Env function() { if (x != null) { - alert(""); + alert(\"\"); var y : string = x; // not ok } }, @@ -84,7 +84,7 @@ var tests = // not ok // ok // ok -var x: ?string = "xxx"; +var x: ?string = \"xxx\"; var tests = [ function() { var y: string = x; @@ -127,10 +127,10 @@ var tests = [ } }, function() { - var y: string = (x != null ? x : ""); + var y: string = (x != null ? x : \"\"); }, function() { - var y: string = x || ""; + var y: string = x || \"\"; } ]; " @@ -140,48 +140,48 @@ exports[`test heap.js 1`] = ` "var tests = [ function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; var y : string = x.p; // not ok }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p != null) { var y : string = x.p; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p == null) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p == null) return; var y : string = x.p; // ok }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (!(x.p != null)) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p != null) { - alert(""); + alert(\"\"); var y : string = x.p; // not ok } }, function () { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p != null) { x.p = null; var y : string = x.p; // not ok @@ -189,13 +189,13 @@ exports[`test heap.js 1`] = ` }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p != null) {} var y : string = x.p; // not ok }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p != null) { } else { var y : string = x.p; // not ok @@ -203,17 +203,17 @@ exports[`test heap.js 1`] = ` }, function() { - var x : {p:?string} = {p:"xxx"}; - var y : string = x.p != null ? x.p : ""; // ok + var x : {p:?string} = {p:\"xxx\"}; + var y : string = x.p != null ? x.p : \"\"; // ok }, function() { - var x : {p:?string} = {p:"xxx"}; - var y : string = x.p || ""; // ok + var x : {p:?string} = {p:\"xxx\"}; + var y : string = x.p || \"\"; // ok }, function() { - var x : {p:string | string[]} = {p:["xxx"]}; + var x : {p:string | string[]} = {p:[\"xxx\"]}; if (Array.isArray(x.p)) { var y : string[] = x.p; // ok } else { @@ -224,7 +224,7 @@ exports[`test heap.js 1`] = ` function() { var x : {y: ?string} = {y: null}; if (!x.y) { - x.y = "foo"; + x.y = \"foo\"; } (x.y: string); }, @@ -233,7 +233,7 @@ exports[`test heap.js 1`] = ` var x : {y: ?string} = {y: null}; if (x.y) { } else { - x.y = "foo"; + x.y = \"foo\"; } (x.y: string); }, @@ -249,27 +249,27 @@ exports[`test heap.js 1`] = ` function() { var x : {y: ?string} = {y: null}; if (x.y) { - x.y = "foo"; + x.y = \"foo\"; } else { - x.y = "bar"; + x.y = \"bar\"; } (x.y : string); }, function() { var x : {y: string | number | boolean} = {y: false}; - if (typeof x.y == "number") { - x.y = "foo"; + if (typeof x.y == \"number\") { + x.y = \"foo\"; } (x.y : string); // error, could also be boolean }, function() { var x : {y: string | number | boolean} = {y: false}; - if (typeof x.y == "number") { - x.y = "foo"; - } else if (typeof x.y == "boolean") { - x.y = "bar"; + if (typeof x.y == \"number\") { + x.y = \"foo\"; + } else if (typeof x.y == \"boolean\") { + x.y = \"bar\"; } (x.y : boolean); // error, string }, @@ -277,7 +277,7 @@ exports[`test heap.js 1`] = ` function() { var x : {y: ?string} = {y: null}; if (!x.y) { - x.y = "foo"; + x.y = \"foo\"; } if (x.y) { x.y = null; @@ -287,11 +287,11 @@ exports[`test heap.js 1`] = ` function() { var x : {y: string | number | boolean} = {y: false}; - if (typeof x.y == "number") { - x.y = "foo"; + if (typeof x.y == \"number\") { + x.y = \"foo\"; } // now x.y can is string | boolean - if (typeof x.y == "string") { + if (typeof x.y == \"string\") { x.y = false; } // now x.y is only boolean @@ -300,11 +300,11 @@ exports[`test heap.js 1`] = ` function() { var x : {y: string | number | boolean} = {y: false}; - if (typeof x.y == "number") { - x.y = "foo"; + if (typeof x.y == \"number\") { + x.y = \"foo\"; } // now x.y can is string | boolean - if (typeof x.y == "string") { + if (typeof x.y == \"string\") { x.y = 123; } // now x.y is number | boolean @@ -313,7 +313,7 @@ exports[`test heap.js 1`] = ` function() { var x : {y: ?string} = {y: null}; - var z : string = "foo"; + var z : string = \"foo\"; if (x.y) { x.y = z; } else { @@ -323,12 +323,12 @@ exports[`test heap.js 1`] = ` }, function(x: string) { - if (x === 'a') {} - (x: 'b'); // error (but only once, string !~> 'b'; 'a' is irrelevant) + if (x === \'a\') {} + (x: \'b\'); // error (but only once, string !~> \'b\'; \'a\' is irrelevant) }, function(x: mixed) { - if (typeof x.bar === 'string') {} // error, so \`x.bar\` refinement is empty + if (typeof x.bar === \'string\') {} // error, so \`x.bar\` refinement is empty (x: string & number); }, @@ -343,7 +343,7 @@ exports[`test heap.js 1`] = ` let x: { foo: ?string } = { foo: null }; if (!x.foo) { if (false) {} - x.foo = "foo"; + x.foo = \"foo\"; } (x.foo: string); }, @@ -352,7 +352,7 @@ exports[`test heap.js 1`] = ` let x: { foo: ?string } = { foo: null }; if (!x.foo) { while(false) {} - x.foo = "foo"; + x.foo = \"foo\"; } (x.foo: string); }, @@ -361,13 +361,13 @@ exports[`test heap.js 1`] = ` let x: { foo: ?string } = { foo: null }; if (!x.foo) { for (var i = 0; i < 0; i++) {} - x.foo = "foo"; + x.foo = \"foo\"; } (x.foo: string); }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p != null) { var {p} = x; // TODO: annot checked against type of x (p : string); // ok @@ -399,7 +399,7 @@ exports[`test heap.js 1`] = ` // now x.y can is string | boolean // now x.y is number | boolean // error -// error (but only once, string !~> 'b'; 'a' is irrelevant) +// error (but only once, string !~> \'b\'; \'a\' is irrelevant) // error, so \`x.bar\` refinement is empty // --- nested conditionals --- // after a branch, the current scope may have changed. this causes the @@ -411,17 +411,17 @@ exports[`test heap.js 1`] = ` // ok var tests = [ function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; var y: string = x.p; }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p != null) { var y: string = x.p; } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p == null) { } else { @@ -429,13 +429,13 @@ var tests = [ } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p == null) return; var y: string = x.p; }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (!(x.p != null)) { } else { @@ -443,28 +443,28 @@ var tests = [ } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p != null) { - alert(""); + alert(\"\"); var y: string = x.p; } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p != null) { x.p = null; var y: string = x.p; } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p != null) { } var y: string = x.p; }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p != null) { } else { @@ -472,15 +472,15 @@ var tests = [ } }, function() { - var x: { p: ?string } = { p: "xxx" }; - var y: string = (x.p != null ? x.p : ""); + var x: { p: ?string } = { p: \"xxx\" }; + var y: string = (x.p != null ? x.p : \"\"); }, function() { - var x: { p: ?string } = { p: "xxx" }; - var y: string = x.p || ""; + var x: { p: ?string } = { p: \"xxx\" }; + var y: string = x.p || \"\"; }, function() { - var x: { p: string | string[] } = { p: [ "xxx" ] }; + var x: { p: string | string[] } = { p: [ \"xxx\" ] }; if (Array.isArray(x.p)) { var y: string[] = x.p; } else { @@ -490,7 +490,7 @@ var tests = [ function() { var x: { y: ?string } = { y: null }; if (!x.y) { - x.y = "foo"; + x.y = \"foo\"; } (x.y: string); }, @@ -499,7 +499,7 @@ var tests = [ if (x.y) { } else { - x.y = "foo"; + x.y = \"foo\"; } (x.y: string); }, @@ -513,33 +513,33 @@ var tests = [ function() { var x: { y: ?string } = { y: null }; if (x.y) { - x.y = "foo"; + x.y = \"foo\"; } else { - x.y = "bar"; + x.y = \"bar\"; } (x.y: string); }, function() { var x: { y: string | number | boolean } = { y: false }; - if (typeof x.y == "number") { - x.y = "foo"; + if (typeof x.y == \"number\") { + x.y = \"foo\"; } (x.y: string); }, function() { var x: { y: string | number | boolean } = { y: false }; - if (typeof x.y == "number") { - x.y = "foo"; + if (typeof x.y == \"number\") { + x.y = \"foo\"; } else - if (typeof x.y == "boolean") { - x.y = "bar"; + if (typeof x.y == \"boolean\") { + x.y = \"bar\"; } (x.y: boolean); }, function() { var x: { y: ?string } = { y: null }; if (!x.y) { - x.y = "foo"; + x.y = \"foo\"; } if (x.y) { x.y = null; @@ -548,27 +548,27 @@ var tests = [ }, function() { var x: { y: string | number | boolean } = { y: false }; - if (typeof x.y == "number") { - x.y = "foo"; + if (typeof x.y == \"number\") { + x.y = \"foo\"; } - if (typeof x.y == "string") { + if (typeof x.y == \"string\") { x.y = false; } (x.y: string); }, function() { var x: { y: string | number | boolean } = { y: false }; - if (typeof x.y == "number") { - x.y = "foo"; + if (typeof x.y == \"number\") { + x.y = \"foo\"; } - if (typeof x.y == "string") { + if (typeof x.y == \"string\") { x.y = 123; } (x.y: string); }, function() { var x: { y: ?string } = { y: null }; - var z: string = "foo"; + var z: string = \"foo\"; if (x.y) { x.y = z; } else { @@ -577,13 +577,13 @@ var tests = [ (x.y: string); }, function(x: string) { - if (x === "a") { + if (x === \"a\") { } - (x: "b"); + (x: \"b\"); }, function(x: mixed) { - if (typeof x.bar === "string") { + if (typeof x.bar === \"string\") { } (x: string & number); @@ -594,7 +594,7 @@ var tests = [ if (false) { } - x.foo = "foo"; + x.foo = \"foo\"; } (x.foo: string); }, @@ -604,7 +604,7 @@ var tests = [ while (false) { } - x.foo = "foo"; + x.foo = \"foo\"; } (x.foo: string); }, @@ -614,12 +614,12 @@ var tests = [ for (var i = 0; i < 0; i++) { } - x.foo = "foo"; + x.foo = \"foo\"; } (x.foo: string); }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p != null) { var { p } = x; (p: string); @@ -633,7 +633,7 @@ exports[`test lex.js 1`] = ` "function block_scope(x: string | number) { { let x; - x = ""; // doesn't refine outer x + x = \"\"; // doesn\'t refine outer x } (x : string); // error: number ~> string } @@ -642,7 +642,7 @@ function switch_scope(x: string | number) { switch (x) { default: let x; - x = ""; // doesn't refine outer x + x = \"\"; // doesn\'t refine outer x } (x : string); // error: number ~> string } @@ -650,37 +650,37 @@ function switch_scope(x: string | number) { function try_scope(x: string | number) { try { let x; - x = ""; // doesn't refine outer x + x = \"\"; // doesn\'t refine outer x } catch (e) { - x = ""; // refinement would only escape if both sides refined + x = \"\"; // refinement would only escape if both sides refined } (x : string); // error: number ~> string } function try_scope_catch(x: string | number) { try { - x = ""; // refinement would only escape if both sides refined + x = \"\"; // refinement would only escape if both sides refined } catch (e) { let x; - x = ""; // doesn't refine outer x + x = \"\"; // doesn\'t refine outer x } (x : string); // error: number ~> string } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// doesn't refine outer x +// doesn\'t refine outer x // error: number ~> string -// doesn't refine outer x +// doesn\'t refine outer x // error: number ~> string -// doesn't refine outer x +// doesn\'t refine outer x // refinement would only escape if both sides refined // error: number ~> string // refinement would only escape if both sides refined -// doesn't refine outer x +// doesn\'t refine outer x // error: number ~> string function block_scope(x: string | number) { { let x; - x = ""; + x = \"\"; } (x: string); } @@ -688,25 +688,25 @@ function switch_scope(x: string | number) { switch (x) { default: let x; - x = ""; + x = \"\"; } (x: string); } function try_scope(x: string | number) { try { let x; - x = ""; + x = \"\"; } catch (e) { - x = ""; + x = \"\"; } (x: string); } function try_scope_catch(x: string | number) { try { - x = ""; + x = \"\"; } catch (e) { let x; - x = ""; + x = \"\"; } (x: string); } @@ -717,54 +717,54 @@ exports[`test local.js 1`] = ` "var paths = [ function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; var y : string = x; // not ok }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x != null) { var y : string = x; // ok } }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x == null) {} else { var y : string = x; // ok } }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x == null) return; var y : string = x; // ok }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (!(x != null)) {} else { var y : string = x; // ok } }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x != null) { - alert(""); + alert(\"\"); var y : string = x; // ok } }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x != null) {} var y : string = x; // not ok }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x != null) { } else { var y : string = x; // not ok @@ -772,17 +772,17 @@ exports[`test local.js 1`] = ` }, function() { - var x : ?string = "xxx"; - var y : string = x != null ? x : ""; // ok + var x : ?string = \"xxx\"; + var y : string = x != null ? x : \"\"; // ok }, function() { - var x : ?string = "xxx"; - var y : string = x || ""; // ok + var x : ?string = \"xxx\"; + var y : string = x || \"\"; // ok }, function() { - var x : string | string[] = ["xxx"]; + var x : string | string[] = [\"xxx\"]; if (Array.isArray(x)) { var y : string[] = x; // ok } else { @@ -793,7 +793,7 @@ exports[`test local.js 1`] = ` function() { var x : ?string = null; if (!x) { - x = "xxx"; + x = \"xxx\"; } var y : string = x; }, @@ -813,17 +813,17 @@ exports[`test local.js 1`] = ` // ok var paths = [ function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; var y: string = x; }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x != null) { var y: string = x; } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x == null) { } else { @@ -831,13 +831,13 @@ var paths = [ } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x == null) return; var y: string = x; }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (!(x != null)) { } else { @@ -845,21 +845,21 @@ var paths = [ } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x != null) { - alert(""); + alert(\"\"); var y: string = x; } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x != null) { } var y: string = x; }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x != null) { } else { @@ -867,15 +867,15 @@ var paths = [ } }, function() { - var x: ?string = "xxx"; - var y: string = (x != null ? x : ""); + var x: ?string = \"xxx\"; + var y: string = (x != null ? x : \"\"); }, function() { - var x: ?string = "xxx"; - var y: string = x || ""; + var x: ?string = \"xxx\"; + var y: string = x || \"\"; }, function() { - var x: string | string[] = [ "xxx" ]; + var x: string | string[] = [ \"xxx\" ]; if (Array.isArray(x)) { var y: string[] = x; } else { @@ -885,7 +885,7 @@ var paths = [ function() { var x: ?string = null; if (!x) { - x = "xxx"; + x = \"xxx\"; } var y: string = x; } @@ -898,28 +898,28 @@ exports[`test null_tests.js 1`] = ` [ // expr != null function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x != null) { var y : string = x; // ok } }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (null != x) { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p != null) { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; if (x.p.q != null) { var y : string = x.p.q; // ok } @@ -927,21 +927,21 @@ exports[`test null_tests.js 1`] = ` // expr == null function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x == null) {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p == null) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; if (x.p.q == null) {} else { var y : string = x.p.q; // ok } @@ -949,21 +949,21 @@ exports[`test null_tests.js 1`] = ` // expr !== null function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x !== null) { var y : string | void = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p !== null) { var y : string | void = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; if (x.p.q !== null) { var y : string | void = x.p.q; // ok } @@ -971,21 +971,21 @@ exports[`test null_tests.js 1`] = ` // expr === null function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x === null) {} else { var y : string | void = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p === null) {} else { var y : string | void = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; if (x.p.q === null) {} else { var y : string | void = x.p.q; // ok } @@ -1000,12 +1000,12 @@ class C { if (this.p != null) return this.p; else - return ""; + return \"\"; } ensure1(): string { if (this.p == null) - return ""; + return \"\"; return this.p; } @@ -1013,12 +1013,12 @@ class C { if (this.p !== null) return this.p; else - return ""; + return \"\"; } ensure3(): string | void { if (this.p === null) - return ""; + return \"\"; return this.p; } } @@ -1030,22 +1030,22 @@ class D extends C { if (super.p != null) return super.p; else - return ""; + return \"\"; } ensure101(): string { if (super.p == null) - return ""; + return \"\"; else return super.p; } ensure103(): string { if (super.p != null) { - alert(""); + alert(\"\"); return super.p; // not ok } - return ""; + return \"\"; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1071,31 +1071,31 @@ class D extends C { // not ok var null_tests = [ function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x != null) { var y: string = x; } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (null != x) { var y: string = x; } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p != null) { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; if (x.p.q != null) { var y: string = x.p.q; } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x == null) { } else { @@ -1103,7 +1103,7 @@ var null_tests = [ } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p == null) { } else { @@ -1111,7 +1111,7 @@ var null_tests = [ } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; if (x.p.q == null) { } else { @@ -1119,25 +1119,25 @@ var null_tests = [ } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x !== null) { var y: string | void = x; } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p !== null) { var y: string | void = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; if (x.p.q !== null) { var y: string | void = x.p.q; } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x === null) { } else { @@ -1145,7 +1145,7 @@ var null_tests = [ } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p === null) { } else { @@ -1153,7 +1153,7 @@ var null_tests = [ } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; if (x.p.q === null) { } else { @@ -1167,22 +1167,22 @@ class C { if (this.p != null) return this.p; else - return ""; + return \"\"; } ensure1(): string { if (this.p == null) - return ""; + return \"\"; return this.p; } ensure2(): string | void { if (this.p !== null) return this.p; else - return ""; + return \"\"; } ensure3(): string | void { if (this.p === null) - return ""; + return \"\"; return this.p; } } @@ -1191,20 +1191,20 @@ class D extends C { if (super.p != null) return super.p; else - return ""; + return \"\"; } ensure101(): string { if (super.p == null) - return ""; + return \"\"; else return super.p; } ensure103(): string { if (super.p != null) { - alert(""); + alert(\"\"); return super.p; } - return ""; + return \"\"; } } " @@ -1232,7 +1232,7 @@ function exhaustion1(x): number { foo = 3; break; default: - throw new Error('Invalid state'); + throw new Error(\'Invalid state\'); } return foo; // no error } @@ -1245,19 +1245,19 @@ function exhaustion2(x, y): number { break; // leaks uninitialized foo out of switch } /** - * TODO this shouldn't cause an error, because the path that + * TODO this shouldn\'t cause an error, because the path that * runs it will always go on to assign a number to foo. But - * we'll need true isolation in env snapshots to model this. - * Currently tvars are always shared between clones - we'd + * we\'ll need true isolation in env snapshots to model this. + * Currently tvars are always shared between clones - we\'d * have to rework envs pretty extensively to avoid it. * - foo = ""; + foo = \"\"; */ case 1: foo = 3; break; default: - throw new Error('Invalid state'); + throw new Error(\'Invalid state\'); } return foo; // error, possibly uninitialized } @@ -1270,7 +1270,7 @@ function exhaustion3(x): number { foo = 3; break; default: - throw new Error('Invalid state'); + throw new Error(\'Invalid state\'); } return foo; // no error } @@ -1283,13 +1283,13 @@ function exhaustion3(x): number { // no error // leaks uninitialized foo out of switch /** - * TODO this shouldn't cause an error, because the path that + * TODO this shouldn\'t cause an error, because the path that * runs it will always go on to assign a number to foo. But - * we'll need true isolation in env snapshots to model this. - * Currently tvars are always shared between clones - we'd + * we\'ll need true isolation in env snapshots to model this. + * Currently tvars are always shared between clones - we\'d * have to rework envs pretty extensively to avoid it. * - foo = ""; + foo = \"\"; */ // error, possibly uninitialized // falls through @@ -1311,7 +1311,7 @@ function exhaustion1(x): number { foo = 3; break; default: - throw new Error("Invalid state"); + throw new Error(\"Invalid state\"); } return foo; } @@ -1326,7 +1326,7 @@ function exhaustion2(x, y): number { foo = 3; break; default: - throw new Error("Invalid state"); + throw new Error(\"Invalid state\"); } return foo; } @@ -1338,7 +1338,7 @@ function exhaustion3(x): number { foo = 3; break; default: - throw new Error("Invalid state"); + throw new Error(\"Invalid state\"); } return foo; } @@ -1350,95 +1350,95 @@ exports[`test typeof_tests.js 1`] = ` [ // typeof expr == typename function() { - var x : ?string = "xxx"; - if (typeof x == "string") { + var x : ?string = \"xxx\"; + if (typeof x == \"string\") { var y : string = x; // ok } }, function() { - var x : ?string = "xxx"; - if ("string" == typeof x) { + var x : ?string = \"xxx\"; + if (\"string\" == typeof x) { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; - if (typeof x.p == "string") { + var x : {p:?string} = {p:\"xxx\"}; + if (typeof x.p == \"string\") { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; - if (typeof x.p.q == "string") { + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + if (typeof x.p.q == \"string\") { var y : string = x.p.q; // ok } }, // typeof expr != typename function() { - var x : ?string = "xxx"; - if (typeof x != "string") {} else { + var x : ?string = \"xxx\"; + if (typeof x != \"string\") {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; - if (typeof x.p != "string") {} else { + var x : {p:?string} = {p:\"xxx\"}; + if (typeof x.p != \"string\") {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; - if (typeof x.p.q != "string") {} else { + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + if (typeof x.p.q != \"string\") {} else { var y : string = x.p.q; // ok } }, // typeof expr === typename function() { - var x : ?string = "xxx"; - if (typeof x === "string") { + var x : ?string = \"xxx\"; + if (typeof x === \"string\") { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; - if (typeof x.p === "string") { + var x : {p:?string} = {p:\"xxx\"}; + if (typeof x.p === \"string\") { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; - if (typeof x.p.q === "string") { + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + if (typeof x.p.q === \"string\") { var y : string = x.p.q; // ok } }, // typeof expr !== typename function() { - var x : ?string = "xxx"; - if (typeof x !== "string") {} else { + var x : ?string = \"xxx\"; + if (typeof x !== \"string\") {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; - if (typeof x.p !== "string") {} else { + var x : {p:?string} = {p:\"xxx\"}; + if (typeof x.p !== \"string\") {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; - if (typeof x.p.q !== "string") {} else { + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + if (typeof x.p.q !== \"string\") {} else { var y : string = x.p.q; // ok } }, @@ -1449,29 +1449,29 @@ class A { p: ?string; ensure0(): string { - if (typeof this.p == "string") + if (typeof this.p == \"string\") return this.p; else - return ""; + return \"\"; } ensure1(): string { - if (typeof this.p != "string") - return ""; + if (typeof this.p != \"string\") + return \"\"; else return this.p; } ensure2(): string | void { - if (typeof this.p === "string") + if (typeof this.p === \"string\") return this.p; else - return ""; + return \"\"; } ensure3(): string | void { - if (typeof this.p !== "string") - return ""; + if (typeof this.p !== \"string\") + return \"\"; else return this.p; } @@ -1497,90 +1497,90 @@ class A { // typeof this.p op typename var null_tests = [ function() { - var x: ?string = "xxx"; - if (typeof x == "string") { + var x: ?string = \"xxx\"; + if (typeof x == \"string\") { var y: string = x; } }, function() { - var x: ?string = "xxx"; - if ("string" == typeof x) { + var x: ?string = \"xxx\"; + if (\"string\" == typeof x) { var y: string = x; } }, function() { - var x: { p: ?string } = { p: "xxx" }; - if (typeof x.p == "string") { + var x: { p: ?string } = { p: \"xxx\" }; + if (typeof x.p == \"string\") { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; - if (typeof x.p.q == "string") { + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + if (typeof x.p.q == \"string\") { var y: string = x.p.q; } }, function() { - var x: ?string = "xxx"; - if (typeof x != "string") { + var x: ?string = \"xxx\"; + if (typeof x != \"string\") { } else { var y: string = x; } }, function() { - var x: { p: ?string } = { p: "xxx" }; - if (typeof x.p != "string") { + var x: { p: ?string } = { p: \"xxx\" }; + if (typeof x.p != \"string\") { } else { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; - if (typeof x.p.q != "string") { + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + if (typeof x.p.q != \"string\") { } else { var y: string = x.p.q; } }, function() { - var x: ?string = "xxx"; - if (typeof x === "string") { + var x: ?string = \"xxx\"; + if (typeof x === \"string\") { var y: string = x; } }, function() { - var x: { p: ?string } = { p: "xxx" }; - if (typeof x.p === "string") { + var x: { p: ?string } = { p: \"xxx\" }; + if (typeof x.p === \"string\") { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; - if (typeof x.p.q === "string") { + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + if (typeof x.p.q === \"string\") { var y: string = x.p.q; } }, function() { - var x: ?string = "xxx"; - if (typeof x !== "string") { + var x: ?string = \"xxx\"; + if (typeof x !== \"string\") { } else { var y: string = x; } }, function() { - var x: { p: ?string } = { p: "xxx" }; - if (typeof x.p !== "string") { + var x: { p: ?string } = { p: \"xxx\" }; + if (typeof x.p !== \"string\") { } else { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; - if (typeof x.p.q !== "string") { + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + if (typeof x.p.q !== \"string\") { } else { var y: string = x.p.q; @@ -1590,26 +1590,26 @@ var null_tests = [ class A { p: ?string; ensure0(): string { - if (typeof this.p == "string") + if (typeof this.p == \"string\") return this.p; else - return ""; + return \"\"; } ensure1(): string { - if (typeof this.p != "string") - return ""; + if (typeof this.p != \"string\") + return \"\"; else return this.p; } ensure2(): string | void { - if (typeof this.p === "string") + if (typeof this.p === \"string\") return this.p; else - return ""; + return \"\"; } ensure3(): string | void { - if (typeof this.p !== "string") - return ""; + if (typeof this.p !== \"string\") + return \"\"; else return this.p; } @@ -1624,28 +1624,28 @@ exports[`test undef_tests.js 1`] = ` // expr !== undefined function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x !== undefined && x !== null) { var y : string = x; // ok } }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (undefined !== x && x !== null) { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p !== undefined && x.p !== null) { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; if (x.p.q !== undefined && x.p.q !== null) { var y : string = x.p.q; // ok } @@ -1653,21 +1653,21 @@ exports[`test undef_tests.js 1`] = ` // expr === undefined function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x === undefined || x === null) {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p === undefined || x.p === null) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; if (x.p.q === undefined || x.p.q === null) {} else { var y : string = x.p.q; // ok } @@ -1682,12 +1682,12 @@ class A { if (this.p !== undefined && this.p !== null) return this.p; else - return ""; + return \"\"; } ensure1(): string { if (this.p === undefined || this.p === null) - return ""; + return \"\"; else return this.p; } @@ -1706,31 +1706,31 @@ class A { // this.p op undefined var undef_tests = [ function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x !== undefined && x !== null) { var y: string = x; } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (undefined !== x && x !== null) { var y: string = x; } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p !== undefined && x.p !== null) { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; if (x.p.q !== undefined && x.p.q !== null) { var y: string = x.p.q; } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x === undefined || x === null) { } else { @@ -1738,7 +1738,7 @@ var undef_tests = [ } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p === undefined || x.p === null) { } else { @@ -1746,7 +1746,7 @@ var undef_tests = [ } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; if (x.p.q === undefined || x.p.q === null) { } else { @@ -1760,11 +1760,11 @@ class A { if (this.p !== undefined && this.p !== null) return this.p; else - return ""; + return \"\"; } ensure1(): string { if (this.p === undefined || this.p === null) - return ""; + return \"\"; else return this.p; } @@ -1779,28 +1779,28 @@ exports[`test void_tests.js 1`] = ` // expr !== void(...) function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x !== void(0) && x !== null) { var y : string = x; // ok } }, function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (void(0) !== x && x !== null) { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p !== void(0) && x.p !== null) { var y : string | void = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; if (x.p.q !== void(0) && x.p.q !== null) { var y : string = x.p.q; // ok } @@ -1808,21 +1808,21 @@ exports[`test void_tests.js 1`] = ` // expr === void(...) function() { - var x : ?string = "xxx"; + var x : ?string = \"xxx\"; if (x === void(0) || x === null) {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:"xxx"}; + var x : {p:?string} = {p:\"xxx\"}; if (x.p === void(0) || x.p === null) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:"xxx"}}; + var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; if (x.p.q === void(0) || x.p.q === null) {} else { var y : string = x.p.q; // ok } @@ -1837,12 +1837,12 @@ class A { if (this.p !== void(0) && this.p !== null) return this.p; else - return ""; + return \"\"; } ensure1(): string { if (this.p === void(0) || this.p === null) - return ""; + return \"\"; else return this.p; } @@ -1861,31 +1861,31 @@ class A { // this.p op void(...) var void_tests = [ function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x !== void 0 && x !== null) { var y: string = x; } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (void 0 !== x && x !== null) { var y: string = x; } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p !== void 0 && x.p !== null) { var y: string | void = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; if (x.p.q !== void 0 && x.p.q !== null) { var y: string = x.p.q; } }, function() { - var x: ?string = "xxx"; + var x: ?string = \"xxx\"; if (x === void 0 || x === null) { } else { @@ -1893,7 +1893,7 @@ var void_tests = [ } }, function() { - var x: { p: ?string } = { p: "xxx" }; + var x: { p: ?string } = { p: \"xxx\" }; if (x.p === void 0 || x.p === null) { } else { @@ -1901,7 +1901,7 @@ var void_tests = [ } }, function() { - var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; if (x.p.q === void 0 || x.p.q === null) { } else { @@ -1915,11 +1915,11 @@ class A { if (this.p !== void 0 && this.p !== null) return this.p; else - return ""; + return \"\"; } ensure1(): string { if (this.p === void 0 || this.p === null) - return ""; + return \"\"; else return this.p; } diff --git a/tests/reflection/__snapshots__/jsfmt.spec.js.snap b/tests/reflection/__snapshots__/jsfmt.spec.js.snap index 7bb59cca..adb6543e 100644 --- a/tests/reflection/__snapshots__/jsfmt.spec.js.snap +++ b/tests/reflection/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ exports[`test type.js 1`] = ` "declare var a: number; -var b: typeof a = "..."; -var c: typeof a = "..."; +var b: typeof a = \"...\"; +var c: typeof a = \"...\"; type T = number; -var x:T = "..."; +var x:T = \"...\"; // what about recursive unions? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // what about recursive unions? declare var a: number; -var b: typeof a = "..."; -var c: typeof a = "..."; +var b: typeof a = \"...\"; +var c: typeof a = \"...\"; type T = number; -var x: T = "..."; +var x: T = \"...\"; " `; diff --git a/tests/regexp/__snapshots__/jsfmt.spec.js.snap b/tests/regexp/__snapshots__/jsfmt.spec.js.snap index 9a05a535..8c701b1b 100644 --- a/tests/regexp/__snapshots__/jsfmt.spec.js.snap +++ b/tests/regexp/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test regexp.js 1`] = ` "var patt=/Hello/g -var match:number = patt.test("Hello world!"); +var match:number = patt.test(\"Hello world!\"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var patt = /Hello/g; -var match: number = patt.test("Hello world!"); +var match: number = patt.test(\"Hello world!\"); " `; diff --git a/tests/replace/__snapshots__/jsfmt.spec.js.snap b/tests/replace/__snapshots__/jsfmt.spec.js.snap index df7ef9b3..3fb9ae38 100644 --- a/tests/replace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/replace/__snapshots__/jsfmt.spec.js.snap @@ -3,12 +3,12 @@ exports[`test test.js 1`] = ` function foo(x) { } -foo(""); +foo(\"\"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var a = 0; function foo(x) { } -foo(""); +foo(\"\"); " `; diff --git a/tests/require/__snapshots__/jsfmt.spec.js.snap b/tests/require/__snapshots__/jsfmt.spec.js.snap index d5b6d030..76293e5b 100644 --- a/tests/require/__snapshots__/jsfmt.spec.js.snap +++ b/tests/require/__snapshots__/jsfmt.spec.js.snap @@ -26,14 +26,14 @@ module.exports = { numberValue: 42 }; -exports = {stringValue: ''}; +exports = {stringValue: \'\'}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Local \`exports\` var is just a ref to module.exports, so mutating the original // value will affect the exports object but re-binding it makes it useless and // does not affect the exports value. module.exports = { numberValue: 42 }; -exports = { stringValue: "" }; +exports = { stringValue: \"\" }; " `; @@ -71,13 +71,13 @@ exports[`test not_builtin_require.js 1`] = ` "// @flow function require() {} -require("not a module name"); +require(\"not a module name\"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow function require() { } -require("not a module name"); +require(\"not a module name\"); " `; @@ -100,35 +100,35 @@ function takesANumber(num: number): void {} function takesAString(str: string): void {} // @providesModule -var A = require("A"); +var A = require(\"A\"); takesANumber(A.numberValue); takesAString(A.numberValue); // File path -var B = require("./B"); +var B = require(\"./B\"); takesANumber(B.numberValue); takesAString(B.numberValue); // C.js exists, but not as a providesModule -require("C"); +require(\"C\"); // @providesModule D exists, but not as a filename -require("./D"); +require(\"./D\"); // E exports an object with a numVal property -var E = require('./E'); +var E = require(\'./E\'); var e_1: number = E.numberValue; -E.stringValue; // Error: The E exports obj has no 'stringValue' property +E.stringValue; // Error: The E exports obj has no \'stringValue\' property // We require that the param passed to require() be a string literal to support // guaranteed static extraction -var a = './E'; +var a = \'./E\'; require(a); // Error: Param must be string literal require(\`./E\`); // template literals are ok... -require(\`\${'./E'}\`); // error: but only if they have no expressions +require(\`\${\'./E\'}\`); // error: but only if they have no expressions -// require.call is allowed but circumverts Flow's static analysis -require.call(null, "DoesNotExist"); +// require.call is allowed but circumverts Flow\'s static analysis +require.call(null, \"DoesNotExist\"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // @providesModule @@ -136,34 +136,34 @@ require.call(null, "DoesNotExist"); // C.js exists, but not as a providesModule // @providesModule D exists, but not as a filename // E exports an object with a numVal property -// Error: The E exports obj has no 'stringValue' property +// Error: The E exports obj has no \'stringValue\' property // We require that the param passed to require() be a string literal to support // guaranteed static extraction // Error: Param must be string literal // template literals are ok... // error: but only if they have no expressions -// require.call is allowed but circumverts Flow's static analysis +// require.call is allowed but circumverts Flow\'s static analysis function takesANumber(num: number): void { } function takesAString(str: string): void { } -var A = require("A"); +var A = require(\"A\"); takesANumber(A.numberValue); takesAString(A.numberValue); -var B = require("./B"); +var B = require(\"./B\"); takesANumber(B.numberValue); takesAString(B.numberValue); -require("C"); -require("./D"); -var E = require("./E"); +require(\"C\"); +require(\"./D\"); +var E = require(\"./E\"); var e_1: number = E.numberValue; E.stringValue; -var a = "./E"; +var a = \"./E\"; require(a); require(\`./E\`); -require(\`\${"./E"}\`); -require.call(null, "DoesNotExist"); +require(\`\${\"./E\"}\`); +require.call(null, \"DoesNotExist\"); " `; diff --git a/tests/requireLazy/__snapshots__/jsfmt.spec.js.snap b/tests/requireLazy/__snapshots__/jsfmt.spec.js.snap index 6fc24e56..be377ae3 100644 --- a/tests/requireLazy/__snapshots__/jsfmt.spec.js.snap +++ b/tests/requireLazy/__snapshots__/jsfmt.spec.js.snap @@ -6,14 +6,14 @@ exports[`test A.js 1`] = ` module.exports = { numberValueA: 1, - stringValueA: "someString" + stringValueA: \"someString\" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule A * @flow */ -module.exports = { numberValueA: 1, stringValueA: "someString" }; +module.exports = { numberValueA: 1, stringValueA: \"someString\" }; " `; @@ -25,14 +25,14 @@ exports[`test B.js 1`] = ` module.exports = { numberValueB: 1, - stringValueB: "someString" + stringValueB: \"someString\" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule B * @flow */ -module.exports = { numberValueB: 1, stringValueB: "someString" }; +module.exports = { numberValueB: 1, stringValueB: \"someString\" }; " `; @@ -41,7 +41,7 @@ exports[`test requireLazy.js 1`] = ` * @flow */ -requireLazy(['A', 'B'], function(A, B) { +requireLazy([\'A\', \'B\'], function(A, B) { var num1: number = A.numberValueA; var str1: string = A.stringValueA; var num2: number = A.stringValueA; // Error: string ~> number @@ -58,7 +58,7 @@ var notB: Object = B; requireLazy(); // Error: No args requireLazy([nope], function() {}); // Error: Non-stringliteral args -requireLazy(['A']); // Error: No calback expression +requireLazy([\'A\']); // Error: No calback expression ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow @@ -71,7 +71,7 @@ requireLazy(['A']); // Error: No calback expression // Error: Non-stringliteral args // Error: No calback expression requireLazy( - [ "A", "B" ], + [ \"A\", \"B\" ], function(A, B) { var num1: number = A.numberValueA; var str1: string = A.stringValueA; @@ -92,6 +92,6 @@ requireLazy( } ); -requireLazy([ "A" ]); +requireLazy([ \"A\" ]); " `; diff --git a/tests/return/__snapshots__/jsfmt.spec.js.snap b/tests/return/__snapshots__/jsfmt.spec.js.snap index 4bc758e3..1d07dd80 100644 --- a/tests/return/__snapshots__/jsfmt.spec.js.snap +++ b/tests/return/__snapshots__/jsfmt.spec.js.snap @@ -83,7 +83,7 @@ function f(b) { if (b) { return undefined; } else { - return "nope"; + return \"nope\"; } } @@ -97,7 +97,7 @@ function f(b) { if (b) { return undefined; } else { - return "nope"; + return \"nope\"; } } (f(true): void); diff --git a/tests/return_new/__snapshots__/jsfmt.spec.js.snap b/tests/return_new/__snapshots__/jsfmt.spec.js.snap index 8912c488..7b2b1d62 100644 --- a/tests/return_new/__snapshots__/jsfmt.spec.js.snap +++ b/tests/return_new/__snapshots__/jsfmt.spec.js.snap @@ -43,7 +43,7 @@ exports[`test test2.js 1`] = ` } var d = new D(); -d.x = ""; // error, string ~/~ number (but property x is found) +d.x = \"\"; // error, string ~/~ number (but property x is found) (new D: D); // error, new D is an object, D not in proto chain @@ -54,7 +54,7 @@ module.exports = D; // error, new D is an object, D not in proto chain declare class D { constructor(): { x: number }; y: any } var d = new D(); -d.x = ""; +d.x = \"\"; (new D(): D); module.exports = D; " diff --git a/tests/seal/__snapshots__/jsfmt.spec.js.snap b/tests/seal/__snapshots__/jsfmt.spec.js.snap index 6ca05ed5..a6fc1d18 100644 --- a/tests/seal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/seal/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ exports[`test imp.js 1`] = ` "/* @flow */ -var imp = require('./obj_annot'); -imp({ name: "imp" }); +var imp = require(\'./obj_annot\'); +imp({ name: \"imp\" }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var imp = require("./obj_annot"); -imp({ name: "imp" }); +var imp = require(\"./obj_annot\"); +imp({ name: \"imp\" }); " `; @@ -17,7 +17,7 @@ function foo(param: { name: string; }): number { return param.id; } -foo({ name: "test" }); +foo({ name: \"test\" }); module.exports = foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -25,7 +25,7 @@ module.exports = foo; function foo(param: { name: string }): number { return param.id; } -foo({ name: "test" }); +foo({ name: \"test\" }); module.exports = foo; " `; diff --git a/tests/sealed/__snapshots__/jsfmt.spec.js.snap b/tests/sealed/__snapshots__/jsfmt.spec.js.snap index f29abf6e..95f2e939 100644 --- a/tests/sealed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/sealed/__snapshots__/jsfmt.spec.js.snap @@ -31,7 +31,7 @@ var x:number = o.x; Foo.prototype.m = function() { return this.x; } var y:number = o.m(); -o.x = "..."; +o.x = \"...\"; Foo.prototype = { m: function() { return false; } } @@ -49,7 +49,7 @@ Foo.prototype.m = function() { return this.x; }; var y: number = o.m(); -o.x = "..."; +o.x = \"...\"; Foo.prototype = { m: function() { return false; @@ -61,26 +61,26 @@ module.exports = export_o; `; exports[`test sealed.js 1`] = ` -"var o = require('./proto'); +"var o = require(\'./proto\'); o.z = 0; var x:string = o.x; -var Bar = require('./function'); +var Bar = require(\'./function\'); var a = new Bar(234); a.x = 123; -a.y = 'abc'; // error, needs to be declared in Bar's constructor +a.y = \'abc\'; // error, needs to be declared in Bar\'s constructor (a.getX(): number); (a.getY(): string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// error, needs to be declared in Bar's constructor -var o = require("./proto"); +// error, needs to be declared in Bar\'s constructor +var o = require(\"./proto\"); o.z = 0; var x: string = o.x; -var Bar = require("./function"); +var Bar = require(\"./function\"); var a = new Bar(234); a.x = 123; -a.y = "abc"; +a.y = \"abc\"; (a.getX(): number); (a.getY(): string); " diff --git a/tests/sealed_objects/__snapshots__/jsfmt.spec.js.snap b/tests/sealed_objects/__snapshots__/jsfmt.spec.js.snap index 902d0d6a..d07961ce 100644 --- a/tests/sealed_objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/sealed_objects/__snapshots__/jsfmt.spec.js.snap @@ -3,13 +3,13 @@ exports[`test test.js 1`] = ` var s1: string = o1.y; // error var o2: { x: number; y?: string; } = { x: 0 }; -var s2: string = o2.y || ""; // ok +var s2: string = o2.y || \"\"; // ok var o3: { x: number; y?: string; } = ({ x: 0, y: 0 }: { x: number; }); -var s3: string = o3.y || ""; // error +var s3: string = o3.y || \"\"; // error var o4: { x: number; y?: string; } = ({ x: 0 }: { x: number; [_:any]:any}); -var s4: string = o4.y || ""; // ok +var s4: string = o4.y || \"\"; // ok var o5 = { x: 0, ...{} }; var s5: string = o5.y; // ok (spreads make object types extensible) @@ -29,11 +29,11 @@ var o7: { x: number; y?: string; } = ({ x: 0, y: 0 }: { x: number; [_:any]:numbe var o1 = { x: 0 }; var s1: string = o1.y; var o2: { x: number; y?: string } = { x: 0 }; -var s2: string = o2.y || ""; +var s2: string = o2.y || \"\"; var o3: { x: number; y?: string } = ({ x: 0, y: 0 }: { x: number }); -var s3: string = o3.y || ""; +var s3: string = o3.y || \"\"; var o4: { x: number; y?: string } = ({ x: 0 }: { [_: any]: any; x: number }); -var s4: string = o4.y || ""; +var s4: string = o4.y || \"\"; var o5 = { x: 0, ...{} }; var s5: string = o5.y; var o6: { [_: any]: any; x: number } = { x: 0 }; diff --git a/tests/simple_arrays/__snapshots__/jsfmt.spec.js.snap b/tests/simple_arrays/__snapshots__/jsfmt.spec.js.snap index c006a945..a452a133 100644 --- a/tests/simple_arrays/__snapshots__/jsfmt.spec.js.snap +++ b/tests/simple_arrays/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test array.js 1`] = ` var a = []; for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } - else { a[i] = ''; }; + else { a[i] = \'\'; }; } // \`i\` never gets a lower bound, so the array access is stalled until the @@ -33,7 +33,7 @@ for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } else { - a[i] = ""; + a[i] = \"\"; } } function foo(i): string { @@ -54,7 +54,7 @@ exports[`test array2.js 1`] = ` var a = []; for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } - else { a[i] = ''; }; + else { a[i] = \'\'; }; } function foo(i: number): string { return a[i]; } @@ -65,7 +65,7 @@ for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } else { - a[i] = ""; + a[i] = \"\"; } } function foo(i: number): string { diff --git a/tests/strict/__snapshots__/jsfmt.spec.js.snap b/tests/strict/__snapshots__/jsfmt.spec.js.snap index 2dbc5cc3..fdc437ef 100644 --- a/tests/strict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/strict/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,5 @@ exports[`test annot.js 1`] = ` -"var A = require('./unknown_class'); +"var A = require(\'./unknown_class\'); class B extends A { foo(x:A):A { return x; } @@ -9,7 +9,7 @@ class B extends A { module.exports = B; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var A = require("./unknown_class"); +var A = require(\"./unknown_class\"); class B extends A { foo(x: A): A { return x; diff --git a/tests/strict_requires/__snapshots__/jsfmt.spec.js.snap b/tests/strict_requires/__snapshots__/jsfmt.spec.js.snap index ddec54c1..c7ecb582 100644 --- a/tests/strict_requires/__snapshots__/jsfmt.spec.js.snap +++ b/tests/strict_requires/__snapshots__/jsfmt.spec.js.snap @@ -9,36 +9,36 @@ module.exports = 0; exports[`test B.js 1`] = ` "/* @flow */ -module.exports = { foo: "" } +module.exports = { foo: \"\" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -module.exports = { foo: "" }; +module.exports = { foo: \"\" }; " `; exports[`test C.js 1`] = ` "/* @flow */ var o = { - A: require('./A'), - ...require('./B'), + A: require(\'./A\'), + ...require(\'./B\'), }; module.exports = o; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var o = { A: require("./A"), ...require("./B") }; +var o = { A: require(\"./A\"), ...require(\"./B\") }; module.exports = o; " `; exports[`test D.js 1`] = ` "/* @flow */ -var C = require('./C'); +var C = require(\'./C\'); var x: number = C.foo; var y: string = C.A; C.A = false; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var C = require("./C"); +var C = require(\"./C\"); var x: number = C.foo; var y: string = C.A; C.A = false; diff --git a/tests/structural_subtyping/__snapshots__/jsfmt.spec.js.snap b/tests/structural_subtyping/__snapshots__/jsfmt.spec.js.snap index c5a8e7cb..2cd01334 100644 --- a/tests/structural_subtyping/__snapshots__/jsfmt.spec.js.snap +++ b/tests/structural_subtyping/__snapshots__/jsfmt.spec.js.snap @@ -8,18 +8,18 @@ interface IHasLength { } var lengthTest1: IHasLength = []; -var lengthTest2: IHasLength = 'hello'; -var lengthTest3: IHasLength = 123; // number doesn't have length -var lengthTest4: IHasLength = true; // bool doesn't have length +var lengthTest2: IHasLength = \'hello\'; +var lengthTest3: IHasLength = 123; // number doesn\'t have length +var lengthTest4: IHasLength = true; // bool doesn\'t have length ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow */ -// number doesn't have length -// bool doesn't have length +// number doesn\'t have length +// bool doesn\'t have length interface IHasLength { length: number } var lengthTest1: IHasLength = [ ]; -var lengthTest2: IHasLength = "hello"; +var lengthTest2: IHasLength = \"hello\"; var lengthTest3: IHasLength = 123; var lengthTest4: IHasLength = true; " @@ -76,7 +76,7 @@ interface IHasXString { x: string; } -var propTest1: IHasXString = { x: 'hello' }; +var propTest1: IHasXString = { x: \'hello\' }; var propTest2: IHasXString = { x: 123 }; // Error string != number var propTest3: IHasXString = {}; // Property not found var propTest4: IHasXString = ({}: Object); @@ -97,7 +97,7 @@ function propTest6(y: {[key: string]: number}) { // OK // error: string != number interface IHasXString { x: string } -var propTest1: IHasXString = { x: "hello" }; +var propTest1: IHasXString = { x: \"hello\" }; var propTest2: IHasXString = { x: 123 }; var propTest3: IHasXString = {}; var propTest4: IHasXString = ({}: Object); @@ -118,18 +118,18 @@ interface HasOptional { b?: number, }; -var test1: HasOptional = { a: "hello" } +var test1: HasOptional = { a: \"hello\" } var test2: HasOptional = {}; // Error: missing property a -var test3: HasOptional = { a: "hello", b: true }; // Error: boolean ~> number +var test3: HasOptional = { a: \"hello\", b: true }; // Error: boolean ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Error: missing property a // Error: boolean ~> number interface HasOptional { a: string; b?: number } -var test1: HasOptional = { a: "hello" }; +var test1: HasOptional = { a: \"hello\" }; var test2: HasOptional = {}; -var test3: HasOptional = { a: "hello", b: true }; +var test3: HasOptional = { a: \"hello\", b: true }; " `; diff --git a/tests/suggest/__snapshots__/jsfmt.spec.js.snap b/tests/suggest/__snapshots__/jsfmt.spec.js.snap index fb70f87e..3e4009b9 100644 --- a/tests/suggest/__snapshots__/jsfmt.spec.js.snap +++ b/tests/suggest/__snapshots__/jsfmt.spec.js.snap @@ -16,21 +16,21 @@ module.exports = bar; exports[`test suggest.js 1`] = ` "/* @flow */ -var bar = require('./lib'); +var bar = require(\'./lib\'); function foo(z: number) { return bar(z); } -var array = ["foo", "bar"]; +var array = [\"foo\", \"bar\"]; array; module.exports = {foo:foo}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var bar = require("./lib"); +var bar = require(\"./lib\"); function foo(z: number) { return bar(z); } -var array = [ "foo", "bar" ]; +var array = [ \"foo\", \"bar\" ]; array; module.exports = { foo: foo }; " diff --git a/tests/suppress/__snapshots__/jsfmt.spec.js.snap b/tests/suppress/__snapshots__/jsfmt.spec.js.snap index 07e37d74..bfb65e39 100644 --- a/tests/suppress/__snapshots__/jsfmt.spec.js.snap +++ b/tests/suppress/__snapshots__/jsfmt.spec.js.snap @@ -16,7 +16,7 @@ var test3: string = getNum(); // This error should be suppressed var test4: string = 123; // This error is NOT suppressed - // $FlowFixMe Indentation shouldn't matter + // $FlowFixMe Indentation shouldn\'t matter var test5: string = 123; // This error should be suppressed /* @@ -32,7 +32,7 @@ var test6: string = 123; // This error should be suppressed // $FlowFixMe Error unused suppression // This error is NOT suppressed -// $FlowFixMe Indentation shouldn't matter +// $FlowFixMe Indentation shouldn\'t matter // This error should be suppressed /* * $FlowNewLine diff --git a/tests/suppress_traces/__snapshots__/jsfmt.spec.js.snap b/tests/suppress_traces/__snapshots__/jsfmt.spec.js.snap index db6b1cf0..ade0d0ba 100644 --- a/tests/suppress_traces/__snapshots__/jsfmt.spec.js.snap +++ b/tests/suppress_traces/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test traces.js 1`] = ` "/* * The location marked with the FlowFixMe does not show up in the original * error but shows up in the flow check --traces 10 result. This test makes - * sure that we don't suppress the error due to a location that only shows up + * sure that we don\'t suppress the error due to a location that only shows up * when --traces is turned on. */ @@ -13,12 +13,12 @@ function foo(x: string) { return bar(); } -var a: string = foo('hi'); // error number ~> string +var a: string = foo(\'hi\'); // error number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* * The location marked with the FlowFixMe does not show up in the original * error but shows up in the flow check --traces 10 result. This test makes - * sure that we don't suppress the error due to a location that only shows up + * sure that we don\'t suppress the error due to a location that only shows up * when --traces is turned on. */ // $FlowFixMe - Error unused suppression @@ -29,6 +29,6 @@ function bar(): number { function foo(x: string) { return bar(); } -var a: string = foo("hi"); +var a: string = foo(\"hi\"); " `; diff --git a/tests/switch/__snapshots__/jsfmt.spec.js.snap b/tests/switch/__snapshots__/jsfmt.spec.js.snap index 98b16993..64116faa 100644 --- a/tests/switch/__snapshots__/jsfmt.spec.js.snap +++ b/tests/switch/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ function foo(x): number { switch (x) { case 0: case 1: return 1; - default: throw new Error('hi'); + default: throw new Error(\'hi\'); } } @@ -21,7 +21,7 @@ function baz(x): number { switch (x) { case 0: break; case 1: return 1; - default: throw new Error('hi'); + default: throw new Error(\'hi\'); } return 2; } @@ -33,7 +33,7 @@ function foo(x): number { case 1: return 1; default: - throw new Error("hi"); + throw new Error(\"hi\"); } } function bar(x) { @@ -52,7 +52,7 @@ function baz(x): number { case 1: return 1; default: - throw new Error("hi"); + throw new Error(\"hi\"); } return 2; } @@ -65,16 +65,16 @@ exports[`test switch.js 1`] = ` */ function foo( ): number { - switch ('foo') { - case 'foo': + switch (\'foo\') { + case \'foo\': return 1; } return 2; } function bar() { - switch ('bar') { - case 'bar': + switch (\'bar\') { + case \'bar\': break; default: break; @@ -82,11 +82,11 @@ function bar() { } function qux(b) { - var x = b? 0: ""; - switch('qux') { - case '': + var x = b? 0: \"\"; + switch(\'qux\') { + case \'\': x = 0; - case 'qux': + case \'qux\': x = x*x; } } @@ -95,26 +95,26 @@ function qux(b) { * @flow */ function foo(): number { - switch ("foo") { - case "foo": + switch (\"foo\") { + case \"foo\": return 1; } return 2; } function bar() { - switch ("bar") { - case "bar": + switch (\"bar\") { + case \"bar\": break; default: break; } } function qux(b) { - var x = (b ? 0 : ""); - switch ("qux") { - case "": + var x = (b ? 0 : \"\"); + switch (\"qux\") { + case \"\": x = 0; - case "qux": + case \"qux\": x = x * x; } } @@ -126,11 +126,11 @@ exports[`test switch_default_fallthrough.js 1`] = ` * @flow */ function foo(x : mixed): string { - var a = ""; - var b = ""; + var a = \"\"; + var b = \"\"; switch (x) { - case "foo": + case \"foo\": a = 0; default: b = 0; @@ -146,15 +146,15 @@ function foo(x : mixed): string { } function baz(x: mixed): number { - var a = ""; - var b = ""; + var a = \"\"; + var b = \"\"; switch (x) { - case "baz": + case \"baz\": a = 0; break; - case "bar": - a = ""; + case \"bar\": + a = \"\"; default: b = 0; } @@ -187,10 +187,10 @@ function baz(x: mixed): number { // error, string | number ~/> number // error, string ~/> number function foo(x: mixed): string { - var a = ""; - var b = ""; + var a = \"\"; + var b = \"\"; switch (x) { - case "foo": + case \"foo\": a = 0; default: b = 0; @@ -201,14 +201,14 @@ function foo(x: mixed): string { return b; } function baz(x: mixed): number { - var a = ""; - var b = ""; + var a = \"\"; + var b = \"\"; switch (x) { - case "baz": + case \"baz\": a = 0; break; - case "bar": - a = ""; + case \"bar\": + a = \"\"; default: b = 0; } @@ -240,7 +240,7 @@ function f1(i) { x = -1; break; case 2: - x = "2"; + x = \"2\"; break; } @@ -281,7 +281,7 @@ function f3(i) { function foo(x): number { switch (x) { case 0: - default: throw new Error('hi'); + default: throw new Error(\'hi\'); case 1: return 1; } } @@ -297,7 +297,7 @@ function bar(x) { function baz(x): number { switch (x) { case 0: break; - default: throw new Error('hi'); + default: throw new Error(\'hi\'); case 1: return 1; } return 2; @@ -325,7 +325,7 @@ function f1(i) { x = -1; break; case 2: - x = "2"; + x = \"2\"; break; } var y: number = x; @@ -357,7 +357,7 @@ function foo(x): number { switch (x) { case 0: default: - throw new Error("hi"); + throw new Error(\"hi\"); case 1: return 1; } @@ -376,7 +376,7 @@ function baz(x): number { case 0: break; default: - throw new Error("hi"); + throw new Error(\"hi\"); case 1: return 1; } diff --git a/tests/symbol/__snapshots__/jsfmt.spec.js.snap b/tests/symbol/__snapshots__/jsfmt.spec.js.snap index 10d20082..2cdbfa06 100644 --- a/tests/symbol/__snapshots__/jsfmt.spec.js.snap +++ b/tests/symbol/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ exports[`test symbol.js 1`] = ` "var FOO = Symbol(); -var BAR = Symbol('bar'); +var BAR = Symbol(\'bar\'); // TODO: Expected error -var WAT = Symbol('foo', 'bar'); +var WAT = Symbol(\'foo\', \'bar\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // TODO: Expected error var FOO = Symbol(); -var BAR = Symbol("bar"); -var WAT = Symbol("foo", "bar"); +var BAR = Symbol(\"bar\"); +var WAT = Symbol(\"foo\", \"bar\"); " `; diff --git a/tests/symlink/__snapshots__/jsfmt.spec.js.snap b/tests/symlink/__snapshots__/jsfmt.spec.js.snap index 0b54bd9d..36cbc18c 100644 --- a/tests/symlink/__snapshots__/jsfmt.spec.js.snap +++ b/tests/symlink/__snapshots__/jsfmt.spec.js.snap @@ -13,10 +13,10 @@ export type Foo = { x: number }; `; exports[`test qux.js 1`] = ` -"import type { Foo } from './bar.js'; -({ x: "" }: Foo); +"import type { Foo } from \'./bar.js\'; +({ x: \"\" }: Foo); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import type { Foo } from "./bar.js"; -({ x: "" }: Foo); +import type { Foo } from \"./bar.js\"; +({ x: \"\" }: Foo); " `; diff --git a/tests/tagged-unions/__snapshots__/jsfmt.spec.js.snap b/tests/tagged-unions/__snapshots__/jsfmt.spec.js.snap index 426fd25f..43d39029 100644 --- a/tests/tagged-unions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/tagged-unions/__snapshots__/jsfmt.spec.js.snap @@ -2,24 +2,24 @@ exports[`test classes.js 1`] = ` "// @flow class Foo { - type: 'foo'; + type: \'foo\'; foo: string; } class Bar { - type: 'bar'; + type: \'bar\'; bar: string; } type Foobar = Foo | Bar; function foobar(x: Foobar): string { - if (x.type === 'foo') { + if (x.type === \'foo\') { return foo(x); - } else if (x.type === 'bar') { + } else if (x.type === \'bar\') { return bar(x); } else { - return 'unknown'; + return \'unknown\'; } } @@ -33,22 +33,22 @@ function bar(x: Bar): string { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow class Foo { - type: "foo"; + type: \"foo\"; foo: string; } class Bar { - type: "bar"; + type: \"bar\"; bar: string; } type Foobar = Foo | Bar; function foobar(x: Foobar): string { - if (x.type === "foo") { + if (x.type === \"foo\") { return foo(x); } else - if (x.type === "bar") { + if (x.type === \"bar\") { return bar(x); } else { - return "unknown"; + return \"unknown\"; } } function foo(x: Foo): string { @@ -69,32 +69,32 @@ declare interface IDataBase { } declare interface IUserData extends IDataBase { - kind: "user", + kind: \"user\", } declare interface ISystemData extends IDataBase { - kind: "system", + kind: \"system\", } declare type IData = IUserData | ISystemData; const data: IData = { - id: "", - name: "", - kind: "system", + id: \"\", + name: \"\", + kind: \"system\", } -if (data.kind === "user") { +if (data.kind === \"user\") { (data: ISystemData); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ interface IDataBase { id: string; name: string } -interface IUserData extends IDataBase { kind: "user" } -interface ISystemData extends IDataBase { kind: "system" } +interface IUserData extends IDataBase { kind: \"user\" } +interface ISystemData extends IDataBase { kind: \"system\" } type IData = IUserData | ISystemData; -const data: IData = { id: "", name: "", kind: "system" }; -if (data.kind === "user") { +const data: IData = { id: \"\", name: \"\", kind: \"system\" }; +if (data.kind === \"user\") { (data: ISystemData); } " @@ -109,32 +109,32 @@ declare interface IDataBase { } declare interface IUserData extends IDataBase { - kind: "user", + kind: \"user\", } declare interface ISystemData extends IDataBase { - kind: "system", + kind: \"system\", } declare type IData = IUserData | ISystemData; const data: IData = { - id: "", - name: "", - kind: "system", + id: \"\", + name: \"\", + kind: \"system\", } -if (data.kind === "system") { +if (data.kind === \"system\") { (data: ISystemData); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ interface IDataBase { id: string; name: string } -interface IUserData extends IDataBase { kind: "user" } -interface ISystemData extends IDataBase { kind: "system" } +interface IUserData extends IDataBase { kind: \"user\" } +interface ISystemData extends IDataBase { kind: \"system\" } type IData = IUserData | ISystemData; -const data: IData = { id: "", name: "", kind: "system" }; -if (data.kind === "system") { +const data: IData = { id: \"\", name: \"\", kind: \"system\" }; +if (data.kind === \"system\") { (data: ISystemData); } " @@ -151,34 +151,34 @@ type DataBase = { type UserData = { id: string, name: string, - kind: "user", + kind: \"user\", } type SystemData = { id: string, name: string, - kind: "system", + kind: \"system\", } declare type Data = UserData | SystemData; const data: Data = { - id: "", - name: "", - kind: "system", + id: \"\", + name: \"\", + kind: \"system\", } -if (data.kind === "user") { +if (data.kind === \"user\") { (data: SystemData); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ type DataBase = { id: string; name: string }; -type UserData = { id: string; name: string; kind: "user" }; -type SystemData = { id: string; name: string; kind: "system" }; +type UserData = { id: string; name: string; kind: \"user\" }; +type SystemData = { id: string; name: string; kind: \"system\" }; type Data = UserData | SystemData; -const data: Data = { id: "", name: "", kind: "system" }; -if (data.kind === "user") { +const data: Data = { id: \"\", name: \"\", kind: \"system\" }; +if (data.kind === \"user\") { (data: SystemData); } " @@ -195,34 +195,34 @@ type DataBase = { type UserData = { id: string, name: string, - kind: "user", + kind: \"user\", } type SystemData = { id: string, name: string, - kind: "system", + kind: \"system\", } declare type Data = UserData | SystemData; const data: Data = { - id: "", - name: "", - kind: "system", + id: \"\", + name: \"\", + kind: \"system\", } -if (data.kind === "system") { +if (data.kind === \"system\") { (data: SystemData); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ type DataBase = { id: string; name: string }; -type UserData = { id: string; name: string; kind: "user" }; -type SystemData = { id: string; name: string; kind: "system" }; +type UserData = { id: string; name: string; kind: \"user\" }; +type SystemData = { id: string; name: string; kind: \"system\" }; type Data = UserData | SystemData; -const data: Data = { id: "", name: "", kind: "system" }; -if (data.kind === "system") { +const data: Data = { id: \"\", name: \"\", kind: \"system\" }; +if (data.kind === \"system\") { (data: SystemData); } " diff --git a/tests/taint/__snapshots__/jsfmt.spec.js.snap b/tests/taint/__snapshots__/jsfmt.spec.js.snap index ccef2a12..15da7235 100644 --- a/tests/taint/__snapshots__/jsfmt.spec.js.snap +++ b/tests/taint/__snapshots__/jsfmt.spec.js.snap @@ -77,7 +77,7 @@ let tests = [ // getting a property function() { - let obj: Object = { foo: 'foo' }; + let obj: Object = { foo: \'foo\' }; (obj.foo: $Tainted); // ok }, @@ -107,7 +107,7 @@ let tests = [ obj[y] = x; }, function() { - let obj: Object = { foo: "foo" }; + let obj: Object = { foo: \"foo\" }; (obj.foo: $Tainted); }, function(x: $Tainted) { @@ -306,7 +306,7 @@ exports[`test taint1.js 1`] = ` */ class A { f(tainted : $Tainted) { - // This shouldn't give a warning (both are tainted) + // This shouldn\'t give a warning (both are tainted) var also_tainted : $Tainted = tainted; } } @@ -315,7 +315,7 @@ class A { * * @flow */ -// This shouldn't give a warning (both are tainted) +// This shouldn\'t give a warning (both are tainted) class A { f(tainted: $Tainted) { var also_tainted: $Tainted = tainted; @@ -384,7 +384,7 @@ exports[`test taint4.js 1`] = ` * @flow */ -var safe : string = "safe"; +var safe : string = \"safe\"; // This should be allowed. var tainted : $Tainted = safe @@ -399,7 +399,7 @@ function f(x : $Tainted) { */ // This should be allowed. // Should cause error. -var safe: string = "safe"; +var safe: string = \"safe\"; var tainted: $Tainted = safe; function f(x: $Tainted) { var y: any = x; diff --git a/tests/template/__snapshots__/jsfmt.spec.js.snap b/tests/template/__snapshots__/jsfmt.spec.js.snap index 3a3db601..e7ff9907 100644 --- a/tests/template/__snapshots__/jsfmt.spec.js.snap +++ b/tests/template/__snapshots__/jsfmt.spec.js.snap @@ -2,32 +2,32 @@ exports[`test template.js 1`] = ` "/* @flow */ (\`foo\`: string); // ok -(\`bar\`: 'bar'); // ok +(\`bar\`: \'bar\'); // ok (\`baz\`: number); // error \`foo \${123} bar\`; // ok, number can be appended to string -\`foo \${{bar: 123}} baz\`; // error, object can't be appended +\`foo \${{bar: 123}} baz\`; // error, object can\'t be appended let tests = [ function(x: string) { \`foo \${x}\`; // ok \`\${x} bar\`; // ok - \`foo \${'bar'} \${x}\`; // ok + \`foo \${\'bar\'} \${x}\`; // ok }, function(x: number) { \`foo \${x}\`; // ok \`\${x} bar\`; // ok - \`foo \${'bar'} \${x}\`; // ok + \`foo \${\'bar\'} \${x}\`; // ok }, function(x: boolean) { \`foo \${x}\`; // error \`\${x} bar\`; // error - \`foo \${'bar'} \${x}\`; // error + \`foo \${\'bar\'} \${x}\`; // error }, function(x: mixed) { \`foo \${x}\`; // error \`\${x} bar\`; // error - \`foo \${'bar'} \${x}\`; // error + \`foo \${\'bar\'} \${x}\`; // error }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -36,7 +36,7 @@ let tests = [ // ok // error // ok, number can be appended to string -// error, object can't be appended +// error, object can\'t be appended // ok // ok // ok @@ -50,7 +50,7 @@ let tests = [ // error // error (\`foo\`: string); -(\`bar\`: "bar"); +(\`bar\`: \"bar\"); (\`baz\`: number); \`foo \${123} bar\`; \`foo \${{ bar: 123 }} baz\`; @@ -58,22 +58,22 @@ let tests = [ function(x: string) { \`foo \${x}\`; \`\${x} bar\`; - \`foo \${"bar"} \${x}\`; + \`foo \${\"bar\"} \${x}\`; }, function(x: number) { \`foo \${x}\`; \`\${x} bar\`; - \`foo \${"bar"} \${x}\`; + \`foo \${\"bar\"} \${x}\`; }, function(x: boolean) { \`foo \${x}\`; \`\${x} bar\`; - \`foo \${"bar"} \${x}\`; + \`foo \${\"bar\"} \${x}\`; }, function(x: mixed) { \`foo \${x}\`; \`\${x} bar\`; - \`foo \${"bar"} \${x}\`; + \`foo \${\"bar\"} \${x}\`; } ]; " diff --git a/tests/this/__snapshots__/jsfmt.spec.js.snap b/tests/this/__snapshots__/jsfmt.spec.js.snap index 92ba158e..3de35025 100644 --- a/tests/this/__snapshots__/jsfmt.spec.js.snap +++ b/tests/this/__snapshots__/jsfmt.spec.js.snap @@ -7,17 +7,17 @@ F.prototype.m = function() { this.y = 0; } function foo(p:string) { } var o1 = new F(); // sets o1.x to 0 -o1.x = ""; +o1.x = \"\"; foo(o1.x); // ok by definite assignment var o2 = new F(); o1.y = 0; -o2.y = ""; +o2.y = \"\"; foo(o2.y); // setting o1.y to 0 has no effect on o2.y var o3 = new F(); o3.m(); // sets o3.y to 0 -o3.y = ""; +o3.y = \"\"; foo(o3.y); // ok by definite assignment foo(o2.y); // setting o3.y to 0 has no effect on o2.y @@ -32,7 +32,7 @@ function f1() : number { var f1_1 = f1.bind({x: 0})(); // ok var f1_2 : string = f1.bind({x: 0})(); // error, number -> string -var f1_3 = f1.bind({x: ""})(); // error, string -> number +var f1_3 = f1.bind({x: \"\"})(); // error, string -> number // TODO make this error blame the call site, rather than the function body var f1_4 = f1(); // error, (global object).x @@ -52,7 +52,7 @@ function f2() : number { var f2_1 = f2.bind({x: 0})(); // ok var f2_2 : string = f2.bind({x: 0})(); // error, number -> string -var f2_3 = f2.bind({x: ""})(); // error, string -> number +var f2_3 = f2.bind({x: \"\"})(); // error, string -> number // TODO make this error blame the call site, rather than the function body var f2_4 = f2(); // error, (global object).x @@ -95,15 +95,15 @@ function foo(p: string) { } var o1 = new F(); -o1.x = ""; +o1.x = \"\"; foo(o1.x); var o2 = new F(); o1.y = 0; -o2.y = ""; +o2.y = \"\"; foo(o2.y); var o3 = new F(); o3.m(); -o3.y = ""; +o3.y = \"\"; foo(o3.y); foo(o2.y); function f1(): number { @@ -111,7 +111,7 @@ function f1(): number { } var f1_1 = f1.bind({ x: 0 })(); var f1_2: string = f1.bind({ x: 0 })(); -var f1_3 = f1.bind({ x: "" })(); +var f1_3 = f1.bind({ x: \"\" })(); var f1_4 = f1(); var a1 = () => { return this.x; @@ -125,7 +125,7 @@ function f2(): number { } var f2_1 = f2.bind({ x: 0 })(); var f2_2: string = f2.bind({ x: 0 })(); -var f2_3 = f2.bind({ x: "" })(); +var f2_3 = f2.bind({ x: \"\" })(); var f2_4 = f2(); (this: void); module.exports = true; @@ -156,7 +156,7 @@ class E { class F extends E { foo() { // OK to override with generalization (() => { - super.foo(""); // find super method, error due to incorrect arg + super.foo(\"\"); // find super method, error due to incorrect arg })(); } } @@ -196,7 +196,7 @@ class E { class F extends E { foo() { (() => { - super.foo(""); + super.foo(\"\"); })(); } } diff --git a/tests/this_type/__snapshots__/jsfmt.spec.js.snap b/tests/this_type/__snapshots__/jsfmt.spec.js.snap index 3f9b1891..0c0eba6b 100644 --- a/tests/this_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/this_type/__snapshots__/jsfmt.spec.js.snap @@ -34,7 +34,7 @@ var d = new D(); (d.next: D); // sneaky class A { - foo(that: X) { } // error: can't hide contravariance using a bound + foo(that: X) { } // error: can\'t hide contravariance using a bound } class B extends A { @@ -79,7 +79,7 @@ class Misc { // error (see below for exploit): \`this\` should only appear in // covariant positions // sneaky -// error: can't hide contravariance using a bound +// error: can\'t hide contravariance using a bound // error (see above, catches hidden override) // covariance checks on this type in invariant positions // covariance checks on this type as type args @@ -213,9 +213,9 @@ class ImplicitNumber extends Implicit { exports[`test import.js 1`] = ` "// Check that imports are handled properly with this types -import { A1 } from './export'; -import type { A2 } from './export'; -import { A3 } from './export'; +import { A1 } from \'./export\'; +import type { A2 } from \'./export\'; +import { A3 } from \'./export\'; class B1 extends A1 { foo(): B1 { return new B1(); } // error @@ -243,9 +243,9 @@ class B3 extends A3 { // OK // error // error -import { A1 } from "./export"; -import type { A2 } from "./export"; -import { A3 } from "./export"; +import { A1 } from \"./export\"; +import type { A2 } from \"./export\"; +import { A3 } from \"./export\"; class B1 extends A1 { foo(): B1 { return new B1(); @@ -296,21 +296,21 @@ exports[`test lib_client.js 1`] = ` "(new DoublyLinkedList().prev(): DoublyLinkedList); (new DoublyLinkedList().next(): DoublyLinkedList) -var MiniImmutable = require("mini-immutable"); +var MiniImmutable = require(\"mini-immutable\"); class C { map: MiniImmutable.OrderedMap; update() { - this.map = this.map.set(0,""); + this.map = this.map.set(0,\"\"); } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (new DoublyLinkedList().prev(): DoublyLinkedList); (new DoublyLinkedList().next(): DoublyLinkedList); -var MiniImmutable = require("mini-immutable"); +var MiniImmutable = require(\"mini-immutable\"); class C { map: MiniImmutable.OrderedMap; update() { - this.map = this.map.set(0, ""); + this.map = this.map.set(0, \"\"); } } " @@ -321,13 +321,13 @@ exports[`test self.js 1`] = ` foo() { return this; } // return of foo is not annotated to get around // substituting this below bar(): this { return new A().foo(); } // same as returning : A, so error - qux(): this { return this.bar(); } // OK (don't cascade errors) + qux(): this { return this.bar(); } // OK (don\'t cascade errors) } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // return of foo is not annotated to get around // substituting this below // same as returning : A, so error -// OK (don't cascade errors) +// OK (don\'t cascade errors) class A { foo() { return this; diff --git a/tests/throw/__snapshots__/jsfmt.spec.js.snap b/tests/throw/__snapshots__/jsfmt.spec.js.snap index 03093c15..2ae1e197 100644 --- a/tests/throw/__snapshots__/jsfmt.spec.js.snap +++ b/tests/throw/__snapshots__/jsfmt.spec.js.snap @@ -16,7 +16,7 @@ function g(a: ?string) { function h(x: number): string { if (x) { - return 'foo'; + return \'foo\'; } else { throw new Error(); } @@ -38,7 +38,7 @@ function g(a: ?string) { } function h(x: number): string { if (x) { - return "foo"; + return \"foo\"; } else { throw new Error(); } diff --git a/tests/try/__snapshots__/jsfmt.spec.js.snap b/tests/try/__snapshots__/jsfmt.spec.js.snap index 57681570..f883eadb 100644 --- a/tests/try/__snapshots__/jsfmt.spec.js.snap +++ b/tests/try/__snapshots__/jsfmt.spec.js.snap @@ -91,7 +91,7 @@ function f() { } } -// or try/catch/finally if init doesn't dominate +// or try/catch/finally if init doesn\'t dominate function f() { try { var x:number = 0; @@ -203,7 +203,7 @@ function f(b) { // error // or catch/finally // error -// or try/catch/finally if init doesn't dominate +// or try/catch/finally if init doesn\'t dominate // error // post-use ok because init dominates here // ...but if so, suffix is not reached @@ -364,36 +364,36 @@ exports[`test return.js 1`] = ` function foo(x: ?number): string { try { } catch (e) { - return 'bar'; + return \'bar\'; } console.log(); - return 'foo'; + return \'foo\'; } function bar(): string { try { - return 'foo'; + return \'foo\'; } catch (e) { - return 'bar'; + return \'bar\'; } } function baz(): string { try { - throw new Error("foo"); + throw new Error(\"foo\"); } catch (e) { - return "foo"; + return \"foo\"; } - return "bar"; // unreachable + return \"bar\"; // unreachable } function qux(): string { try { - throw new Error("foo"); + throw new Error(\"foo\"); } catch (e) { } console.log(); - return 'bar'; + return \'bar\'; } function quux(): string { @@ -401,24 +401,24 @@ function quux(): string { return qux(); } catch (e) { } - return 'bar'; + return \'bar\'; } function bliffl(): string { try { - throw new Error("foo"); + throw new Error(\"foo\"); } catch (e) { - return "foo"; + return \"foo\"; } finally { - return "bar"; + return \"bar\"; } } function corge(): string { try { - return 'foo'; + return \'foo\'; } catch (e) { - throw new Error('bar'); + throw new Error(\'bar\'); } bar(); // unreachable } @@ -432,34 +432,34 @@ function foo(x: ?number): string { try { } catch (e) { - return "bar"; + return \"bar\"; } console.log(); - return "foo"; + return \"foo\"; } function bar(): string { try { - return "foo"; + return \"foo\"; } catch (e) { - return "bar"; + return \"bar\"; } } function baz(): string { try { - throw new Error("foo"); + throw new Error(\"foo\"); } catch (e) { - return "foo"; + return \"foo\"; } - return "bar"; + return \"bar\"; } function qux(): string { try { - throw new Error("foo"); + throw new Error(\"foo\"); } catch (e) { } console.log(); - return "bar"; + return \"bar\"; } function quux(): string { try { @@ -467,22 +467,22 @@ function quux(): string { } catch (e) { } - return "bar"; + return \"bar\"; } function bliffl(): string { try { - throw new Error("foo"); + throw new Error(\"foo\"); } catch (e) { - return "foo"; + return \"foo\"; } finally { - return "bar"; + return \"bar\"; } } function corge(): string { try { - return "foo"; + return \"foo\"; } catch (e) { - throw new Error("bar"); + throw new Error(\"bar\"); } bar(); } @@ -499,7 +499,7 @@ function foo() { var x = 0; var y; try { - x = ""; + x = \"\"; } catch(e) { x = false; throw -1; @@ -516,7 +516,7 @@ function bar(response) { try { payload = JSON.parse(response); } catch (e) { - throw new Error('...'); + throw new Error(\'...\'); } // here via [try] only. if (payload.error) { // ok @@ -548,7 +548,7 @@ function foo() { var x = 0; var y; try { - x = ""; + x = \"\"; } catch (e) { x = false; throw -1; @@ -563,7 +563,7 @@ function bar(response) { try { payload = JSON.parse(response); } catch (e) { - throw new Error("..."); + throw new Error(\"...\"); } if (payload.error) { diff --git a/tests/type-destructors/__snapshots__/jsfmt.spec.js.snap b/tests/type-destructors/__snapshots__/jsfmt.spec.js.snap index b87ff74e..2c76d0e1 100644 --- a/tests/type-destructors/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type-destructors/__snapshots__/jsfmt.spec.js.snap @@ -34,20 +34,20 @@ exports[`test property_type.js 1`] = ` "type Malformed = $PropertyType; type Obj = { x: string }; -type Obj_Prop_x = $PropertyType; +type Obj_Prop_x = $PropertyType; (42: Obj_Prop_x); -function foo(o: Obj): $PropertyType { +function foo(o: Obj): $PropertyType { if (false) return o.x; else return 0; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Malformed = $PropertyType; type Obj = { x: string }; -type Obj_Prop_x = $PropertyType; +type Obj_Prop_x = $PropertyType; (42: Obj_Prop_x); -function foo(o: Obj): $PropertyType { +function foo(o: Obj): $PropertyType { if (false) return o.x; else @@ -59,8 +59,8 @@ else exports[`test union.js 1`] = ` "var x0: $NonMaybeType = 0; // ok, number ~> number|string var x1: $NonMaybeType = true; // err, boolean ~> number|string -var x2: $PropertyType<{p:number}|{p:string},'p'> = 0; // ok, number ~> number|string -var x3: $PropertyType<{p:number}|{p:string},'p'> = true; // err, boolean ~> number|string +var x2: $PropertyType<{p:number}|{p:string},\'p\'> = 0; // ok, number ~> number|string +var x3: $PropertyType<{p:number}|{p:string},\'p\'> = true; // err, boolean ~> number|string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ok, number ~> number|string // err, boolean ~> number|string @@ -68,7 +68,7 @@ var x3: $PropertyType<{p:number}|{p:string},'p'> = true; // err, boolean ~> numb // err, boolean ~> number|string var x0: $NonMaybeType = 0; var x1: $NonMaybeType = true; -var x2: $PropertyType<{ p: number } | { p: string }, "p"> = 0; -var x3: $PropertyType<{ p: number } | { p: string }, "p"> = true; +var x2: $PropertyType<{ p: number } | { p: string }, \"p\"> = 0; +var x3: $PropertyType<{ p: number } | { p: string }, \"p\"> = true; " `; diff --git a/tests/type-printer/__snapshots__/jsfmt.spec.js.snap b/tests/type-printer/__snapshots__/jsfmt.spec.js.snap index f6f9bb65..772bb217 100644 --- a/tests/type-printer/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type-printer/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,5 @@ exports[`test printBinaryExpression.js 1`] = ` -"'use babel'; +"\'use babel\'; /* @flow */ /* @@ -10,7 +10,7 @@ exports[`test printBinaryExpression.js 1`] = ` * the root directory of this source tree. */ -import type {BinaryExpression} from './types'; +import type {BinaryExpression} from \'./types\'; function printBinaryExpression( node: BinaryExpression, @@ -28,8 +28,8 @@ module.exports = printBinaryExpression; * This source code is licensed under the license found in the LICENSE file in * the root directory of this source tree. */ -"use babel"; -import type { BinaryExpression } from "./types"; +\"use babel\"; +import type { BinaryExpression } from \"./types\"; function printBinaryExpression(node: BinaryExpression) { console.log(node); } @@ -42,7 +42,7 @@ exports[`test types.js 1`] = ` * @flow */ -'use strict'; +\'use strict\'; /* * Flow types for the Babylon AST. @@ -51,7 +51,7 @@ exports[`test types.js 1`] = ` // Abstract types. Something must extend these. export type Comment = { - type: 'CommentLine'; + type: \'CommentLine\'; _CommentLine: void; value: string; end: number; @@ -61,7 +61,7 @@ export type Comment = { }; start: number; } | { - type: 'CommentBlock'; + type: \'CommentBlock\'; _CommentBlock: void; value: string; end: number; @@ -73,7 +73,7 @@ export type Comment = { }; export type Declaration = { - type: 'ClassBody'; + type: \'ClassBody\'; _ClassBody: void; body: Array; end: number; @@ -86,7 +86,7 @@ export type Declaration = { start: number; trailingComments: ?Array; } | { - type: 'ClassDeclaration'; + type: \'ClassDeclaration\'; _ClassDeclaration: void; body: ClassBody; id: ?Identifier; @@ -104,7 +104,7 @@ export type Declaration = { start: number; trailingComments: ?Array; } | { - type: 'FunctionDeclaration'; + type: \'FunctionDeclaration\'; _FunctionDeclaration: void; body: BlockStatement; id: Identifier; @@ -126,11 +126,11 @@ export type Declaration = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration; } | { - type: 'MethodDefinition'; + type: \'MethodDefinition\'; _MethodDefinition: void; computed: boolean; key: Node; - kind: 'constructor' | 'method' | 'get' | 'set'; + kind: \'constructor\' | \'method\' | \'get\' | \'set\'; static: boolean; value: FunctionExpression; decorators: ?Array; @@ -144,10 +144,10 @@ export type Declaration = { start: number; trailingComments: ?Array; } | { - type: 'VariableDeclaration'; + type: \'VariableDeclaration\'; _VariableDeclaration: void; declarations: Array; - kind: 'var' | 'let' | 'const'; + kind: \'var\' | \'let\' | \'const\'; end: number; innerComments: ?Array; leadingComments: ?Array; @@ -158,7 +158,7 @@ export type Declaration = { start: number; trailingComments: ?Array; } | { - type: 'ClassProperty'; + type: \'ClassProperty\'; _ClassProperty: void; computed: boolean; key: Node; @@ -178,7 +178,7 @@ export type Declaration = { }; export type Expression = { - type: 'ArrayExpression'; + type: \'ArrayExpression\'; _ArrayExpression: void; elements: Array; end: number; @@ -191,7 +191,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'AssignmentExpression'; + type: \'AssignmentExpression\'; _AssignmentExpression: void; left: Pattern; operator: AssignmentOperator; @@ -206,7 +206,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'AwaitExpression'; + type: \'AwaitExpression\'; _AwaitExpression: void; all: boolean; argument: ?Expression; @@ -220,7 +220,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'BinaryExpression'; + type: \'BinaryExpression\'; _BinaryExpression: void; left: Expression; operator: BinaryOperator; @@ -235,7 +235,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'BindExpression'; + type: \'BindExpression\'; _BindExpression: void; callee: Node; object: Node; @@ -249,7 +249,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'CallExpression'; + type: \'CallExpression\'; _CallExpression: void; arguments: Array; callee: Expression; @@ -263,7 +263,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'ClassExpression'; + type: \'ClassExpression\'; _ClassExpression: void; body: ClassBody; id: ?Identifier; @@ -281,7 +281,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'ComprehensionExpression'; + type: \'ComprehensionExpression\'; _ComprehensionExpression: void; body: Expression; blocks: Array; @@ -296,7 +296,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'ConditionalExpression'; + type: \'ConditionalExpression\'; _ConditionalExpression: void; alternate: Expression; consequent: Expression; @@ -311,7 +311,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'DoExpression'; + type: \'DoExpression\'; _DoExpression: void; body: Statement; end: number; @@ -324,7 +324,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'FunctionExpression'; + type: \'FunctionExpression\'; _FunctionExpression: void; body: BlockStatement; id: ?Identifier; @@ -346,7 +346,7 @@ export type Expression = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration; } | { - type: 'Identifier'; + type: \'Identifier\'; _Identifier: void; name: string; typeAnnotation: ?TypeAnnotation; @@ -360,7 +360,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'Literal'; + type: \'Literal\'; _Literal: void; raw: string; regex: ?{pattern: string, flags: string}; @@ -375,7 +375,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'LogicalExpression'; + type: \'LogicalExpression\'; _LogicalExpression: void; left: Expression; operator: LogicalOperator; @@ -390,7 +390,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'MemberExpression'; + type: \'MemberExpression\'; _MemberExpression: void; computed: boolean; object: Expression; @@ -405,7 +405,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'NewExpression'; + type: \'NewExpression\'; _NewExpression: void; arguments: Array; callee: Expression; @@ -419,7 +419,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'ObjectExpression'; + type: \'ObjectExpression\'; _ObjectExpression: void; properties: Array; end: number; @@ -432,7 +432,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'SequenceExpression'; + type: \'SequenceExpression\'; _SequenceExpression: void; expression: Array; end: number; @@ -445,7 +445,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'TaggedTemplateExpression'; + type: \'TaggedTemplateExpression\'; _TaggedTemplateExpression: void; quasi: TemplateLiteral; tag: Expression; @@ -459,7 +459,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'TemplateLiteral'; + type: \'TemplateLiteral\'; _TemplateLiteral: void; expressions: Array; quasis: Array; @@ -473,7 +473,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'ThisExpression'; + type: \'ThisExpression\'; _ThisExpression: void; end: number; innerComments: ?Array; @@ -485,7 +485,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'UnaryExpression'; + type: \'UnaryExpression\'; _UnaryExpression: void; argument: Expression; operator: UnaryOperator; @@ -500,7 +500,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'UpdateExpression'; + type: \'UpdateExpression\'; _UpdateExpression: void; argument: Expression; operator: UpdateOperator; @@ -515,7 +515,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'YieldExpression'; + type: \'YieldExpression\'; _YieldExpression: void; argument: ?Expression; delegate: boolean; @@ -529,7 +529,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'TypeCastExpression'; + type: \'TypeCastExpression\'; _TypeCastExpression: void; expression: Expression; typeAnnotation: TypeAnnotation; @@ -543,7 +543,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'JSXElement'; + type: \'JSXElement\'; _JSXElement: void; children: Array; closingElement: ?JSXClosingElement; @@ -558,7 +558,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'JSXEmptyExpression'; + type: \'JSXEmptyExpression\'; _JSXEmptyExpression: void; end: number; innerComments: ?Array; @@ -570,7 +570,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'JSXExpressionContainer'; + type: \'JSXExpressionContainer\'; _JSXExpressionContainer: void; expression: Expression; end: number; @@ -583,7 +583,7 @@ export type Expression = { start: number; trailingComments: ?Array; } | { - type: 'JSXMemberExpression'; + type: \'JSXMemberExpression\'; _JSXMemberExpression: void; computed: boolean; object: Node; @@ -600,7 +600,7 @@ export type Expression = { }; export type Function = { - type: 'ArrowFunctionExpression'; + type: \'ArrowFunctionExpression\'; _ArrowFunctionExpression: void; body: Node; id: ?Identifier; @@ -622,7 +622,7 @@ export type Function = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration; } | { - type: 'FunctionDeclaration'; + type: \'FunctionDeclaration\'; _FunctionDeclaration: void; body: BlockStatement; id: Identifier; @@ -644,7 +644,7 @@ export type Function = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration; } | { - type: 'FunctionExpression'; + type: \'FunctionExpression\'; _FunctionExpression: void; body: BlockStatement; id: ?Identifier; @@ -668,7 +668,7 @@ export type Function = { }; export type Node = { - type: 'ArrayExpression'; + type: \'ArrayExpression\'; _ArrayExpression: void; elements: Array; end: number; @@ -681,7 +681,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ArrayPattern'; + type: \'ArrayPattern\'; _ArrayPattern: void; elements: Array; typeAnnotation: ?TypeAnnotation; @@ -695,7 +695,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ArrowFunctionExpression'; + type: \'ArrowFunctionExpression\'; _ArrowFunctionExpression: void; body: Node; id: ?Identifier; @@ -717,7 +717,7 @@ export type Node = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration; } | { - type: 'AssignmentExpression'; + type: \'AssignmentExpression\'; _AssignmentExpression: void; left: Pattern; operator: AssignmentOperator; @@ -732,7 +732,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'AssignmentPattern'; + type: \'AssignmentPattern\'; _AssignmentPattern: void; left: Pattern; right: Expression; @@ -746,7 +746,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'AwaitExpression'; + type: \'AwaitExpression\'; _AwaitExpression: void; all: boolean; argument: ?Expression; @@ -760,7 +760,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'BinaryExpression'; + type: \'BinaryExpression\'; _BinaryExpression: void; left: Expression; operator: BinaryOperator; @@ -775,7 +775,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'BindExpression'; + type: \'BindExpression\'; _BindExpression: void; callee: Node; object: Node; @@ -789,7 +789,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'BlockStatement'; + type: \'BlockStatement\'; _BlockStatement: void; body: Array; end: number; @@ -802,7 +802,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'BreakStatement'; + type: \'BreakStatement\'; _BreakStatement: void; label: ?Identifier; end: number; @@ -815,7 +815,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'CallExpression'; + type: \'CallExpression\'; _CallExpression: void; arguments: Array; callee: Expression; @@ -829,7 +829,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'CatchClause'; + type: \'CatchClause\'; _CatchClause: void; body: BlockStatement; param: Pattern; @@ -843,7 +843,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ClassBody'; + type: \'ClassBody\'; _ClassBody: void; body: Array; end: number; @@ -856,7 +856,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ClassDeclaration'; + type: \'ClassDeclaration\'; _ClassDeclaration: void; body: ClassBody; id: ?Identifier; @@ -874,7 +874,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ClassExpression'; + type: \'ClassExpression\'; _ClassExpression: void; body: ClassBody; id: ?Identifier; @@ -892,7 +892,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ComprehensionBlock'; + type: \'ComprehensionBlock\'; _ComprehensionBlock: void; each: boolean; left: Pattern; @@ -907,7 +907,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ComprehensionExpression'; + type: \'ComprehensionExpression\'; _ComprehensionExpression: void; body: Expression; blocks: Array; @@ -922,7 +922,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ConditionalExpression'; + type: \'ConditionalExpression\'; _ConditionalExpression: void; alternate: Expression; consequent: Expression; @@ -937,7 +937,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ContinueStatement'; + type: \'ContinueStatement\'; _ContinueStatement: void; label: ?Identifier; end: number; @@ -950,7 +950,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'Decorator'; + type: \'Decorator\'; _Decorator: void; expression: Expression; end: number; @@ -963,7 +963,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'DebuggerStatement'; + type: \'DebuggerStatement\'; _DebuggerStatement: void; end: number; innerComments: ?Array; @@ -975,7 +975,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'DoWhileStatement'; + type: \'DoWhileStatement\'; _DoWhileStatement: void; body: Statement; test: Expression; @@ -989,7 +989,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'DoExpression'; + type: \'DoExpression\'; _DoExpression: void; body: Statement; end: number; @@ -1002,7 +1002,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'EmptyStatement'; + type: \'EmptyStatement\'; _EmptyStatement: void; end: number; innerComments: ?Array; @@ -1014,7 +1014,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ExpressionStatement'; + type: \'ExpressionStatement\'; _ExpressionStatement: void; expression: Expression; end: number; @@ -1027,7 +1027,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'File'; + type: \'File\'; _File: void; program: Program; end: number; @@ -1040,7 +1040,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ForInStatement'; + type: \'ForInStatement\'; _ForInStatement: void; body: Statement; left: Node; @@ -1055,7 +1055,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ForOfStatement'; + type: \'ForOfStatement\'; _ForOfStatement: void; body: Statement; left: Node; @@ -1070,7 +1070,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ForStatement'; + type: \'ForStatement\'; _ForStatement: void; init: ?Node; test: ?Expression; @@ -1086,7 +1086,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'FunctionDeclaration'; + type: \'FunctionDeclaration\'; _FunctionDeclaration: void; body: BlockStatement; id: Identifier; @@ -1108,7 +1108,7 @@ export type Node = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration; } | { - type: 'FunctionExpression'; + type: \'FunctionExpression\'; _FunctionExpression: void; body: BlockStatement; id: ?Identifier; @@ -1130,7 +1130,7 @@ export type Node = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration; } | { - type: 'Identifier'; + type: \'Identifier\'; _Identifier: void; name: string; typeAnnotation: ?TypeAnnotation; @@ -1144,7 +1144,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'IfStatement'; + type: \'IfStatement\'; _IfStatement: void; alternate: ?Statement; consequent: Statement; @@ -1159,7 +1159,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ImportDefaultSpecifier'; + type: \'ImportDefaultSpecifier\'; _ImportDefaultSpecifier: void; local: Node; end: number; @@ -1172,7 +1172,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ImportNamespaceSpecifier'; + type: \'ImportNamespaceSpecifier\'; _ImportNamespaceSpecifier: void; local: Node; end: number; @@ -1185,7 +1185,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ImportDeclaration'; + type: \'ImportDeclaration\'; _ImportDeclaration: void; specifiers: Array; source: Literal; @@ -1199,7 +1199,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ImportSpecifier'; + type: \'ImportSpecifier\'; _ImportSpecifier: void; imported: Node; local: Node; @@ -1213,7 +1213,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'LabeledStatement'; + type: \'LabeledStatement\'; _LabeledStatement: void; body: Statement; label: Identifier; @@ -1227,7 +1227,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'Literal'; + type: \'Literal\'; _Literal: void; raw: string; regex: ?{pattern: string, flags: string}; @@ -1242,7 +1242,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'LogicalExpression'; + type: \'LogicalExpression\'; _LogicalExpression: void; left: Expression; operator: LogicalOperator; @@ -1257,7 +1257,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'MemberExpression'; + type: \'MemberExpression\'; _MemberExpression: void; computed: boolean; object: Expression; @@ -1272,7 +1272,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'MetaProperty'; + type: \'MetaProperty\'; _MetaProperty: void; meta: Node; property: Node; @@ -1286,11 +1286,11 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'MethodDefinition'; + type: \'MethodDefinition\'; _MethodDefinition: void; computed: boolean; key: Node; - kind: 'constructor' | 'method' | 'get' | 'set'; + kind: \'constructor\' | \'method\' | \'get\' | \'set\'; static: boolean; value: FunctionExpression; decorators: ?Array; @@ -1304,7 +1304,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'NewExpression'; + type: \'NewExpression\'; _NewExpression: void; arguments: Array; callee: Expression; @@ -1318,7 +1318,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'Noop'; + type: \'Noop\'; _Noop: void; end: number; innerComments: ?Array; @@ -1330,7 +1330,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ObjectExpression'; + type: \'ObjectExpression\'; _ObjectExpression: void; properties: Array; end: number; @@ -1343,7 +1343,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ObjectPattern'; + type: \'ObjectPattern\'; _ObjectPattern: void; properties: Array; typeAnnotation: ?TypeAnnotation; @@ -1357,7 +1357,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'Program'; + type: \'Program\'; _Program: void; body: Array; end: number; @@ -1370,11 +1370,11 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'Property'; + type: \'Property\'; _Property: void; computed: boolean; key: Node; - kind: 'init' | 'get' | 'set'; + kind: \'init\' | \'get\' | \'set\'; method: boolean; shorthand: boolean; value: Node; @@ -1389,7 +1389,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'RestElement'; + type: \'RestElement\'; _RestElement: void; argument: Pattern; typeAnnotation: ?TypeAnnotation; @@ -1403,7 +1403,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ReturnStatement'; + type: \'ReturnStatement\'; _ReturnStatement: void; argument: ?Expression; end: number; @@ -1416,7 +1416,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'SequenceExpression'; + type: \'SequenceExpression\'; _SequenceExpression: void; expression: Array; end: number; @@ -1429,7 +1429,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'SpreadElement'; + type: \'SpreadElement\'; _SpreadElement: void; argument: Expression; end: number; @@ -1442,7 +1442,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'SpreadProperty'; + type: \'SpreadProperty\'; _SpreadProperty: void; argument: Expression; end: number; @@ -1455,7 +1455,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'Super'; + type: \'Super\'; _Super: void; end: number; innerComments: ?Array; @@ -1467,7 +1467,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'SwitchCase'; + type: \'SwitchCase\'; _SwitchCase: void; consequent: Array; test: ?Expression; @@ -1481,7 +1481,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'SwitchStatement'; + type: \'SwitchStatement\'; _SwitchStatement: void; cases: Array; discriminant: Expression; @@ -1496,7 +1496,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TaggedTemplateExpression'; + type: \'TaggedTemplateExpression\'; _TaggedTemplateExpression: void; quasi: TemplateLiteral; tag: Expression; @@ -1510,7 +1510,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TemplateElement'; + type: \'TemplateElement\'; _TemplateElement: void; tail: boolean; value: {cooked: string, raw: string}; @@ -1524,7 +1524,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TemplateLiteral'; + type: \'TemplateLiteral\'; _TemplateLiteral: void; expressions: Array; quasis: Array; @@ -1538,7 +1538,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ThisExpression'; + type: \'ThisExpression\'; _ThisExpression: void; end: number; innerComments: ?Array; @@ -1550,7 +1550,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ThrowStatement'; + type: \'ThrowStatement\'; _ThrowStatement: void; argument: Expression; end: number; @@ -1563,7 +1563,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TryStatement'; + type: \'TryStatement\'; _TryStatement: void; block: BlockStatement; finalizer: ?BlockStatement; @@ -1580,7 +1580,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'UnaryExpression'; + type: \'UnaryExpression\'; _UnaryExpression: void; argument: Expression; operator: UnaryOperator; @@ -1595,7 +1595,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'UpdateExpression'; + type: \'UpdateExpression\'; _UpdateExpression: void; argument: Expression; operator: UpdateOperator; @@ -1610,10 +1610,10 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'VariableDeclaration'; + type: \'VariableDeclaration\'; _VariableDeclaration: void; declarations: Array; - kind: 'var' | 'let' | 'const'; + kind: \'var\' | \'let\' | \'const\'; end: number; innerComments: ?Array; leadingComments: ?Array; @@ -1624,7 +1624,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'VariableDeclarator'; + type: \'VariableDeclarator\'; _VariableDeclarator: void; id: Pattern; init: ?Expression; @@ -1638,7 +1638,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'WhileStatement'; + type: \'WhileStatement\'; _WhileStatement: void; body: Statement; test: Expression; @@ -1652,7 +1652,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'WithStatement'; + type: \'WithStatement\'; _WithStatement: void; body: Statement; object: Expression; @@ -1666,7 +1666,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'YieldExpression'; + type: \'YieldExpression\'; _YieldExpression: void; argument: ?Expression; delegate: boolean; @@ -1680,7 +1680,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ExportAllDeclaration'; + type: \'ExportAllDeclaration\'; _ExportAllDeclaration: void; exported: Node; source: Node; @@ -1694,7 +1694,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ExportDefaultDeclaration'; + type: \'ExportDefaultDeclaration\'; _ExportDefaultDeclaration: void; declaration: Node; end: number; @@ -1707,7 +1707,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ExportNamedDeclaration'; + type: \'ExportNamedDeclaration\'; _ExportNamedDeclaration: void; declaration: Node; source: Literal; @@ -1722,7 +1722,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ExportDefaultSpecifier'; + type: \'ExportDefaultSpecifier\'; _ExportDefaultSpecifier: void; exported: Node; end: number; @@ -1735,7 +1735,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ExportNamespaceSpecifier'; + type: \'ExportNamespaceSpecifier\'; _ExportNamespaceSpecifier: void; exported: Node; end: number; @@ -1748,7 +1748,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ExportSpecifier'; + type: \'ExportSpecifier\'; _ExportSpecifier: void; local: Node; exported: Node; @@ -1762,7 +1762,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'AnyTypeAnnotation'; + type: \'AnyTypeAnnotation\'; _AnyTypeAnnotation: void; end: number; innerComments: ?Array; @@ -1774,7 +1774,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ArrayTypeAnnotation'; + type: \'ArrayTypeAnnotation\'; _ArrayTypeAnnotation: void; elementType: Type; end: number; @@ -1787,7 +1787,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'BooleanLiteralTypeAnnotation'; + type: \'BooleanLiteralTypeAnnotation\'; _BooleanLiteralTypeAnnotation: void; raw: string; value: boolean; @@ -1801,7 +1801,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'BooleanTypeAnnotation'; + type: \'BooleanTypeAnnotation\'; _BooleanTypeAnnotation: void; end: number; innerComments: ?Array; @@ -1813,7 +1813,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ClassImplements'; + type: \'ClassImplements\'; _ClassImplements: void; id: Identifier; typeParameters: ?TypeParameterInstantiation; @@ -1828,7 +1828,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ClassProperty'; + type: \'ClassProperty\'; _ClassProperty: void; computed: boolean; key: Node; @@ -1846,7 +1846,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'DeclareClass'; + type: \'DeclareClass\'; _DeclareClass: void; body: ObjectTypeAnnotation; extends: Array; @@ -1862,7 +1862,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'DeclareFunction'; + type: \'DeclareFunction\'; _DeclareFunction: void; id: Identifier; end: number; @@ -1875,7 +1875,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'DeclareModule'; + type: \'DeclareModule\'; _DeclareModule: void; body: BlockStatement; id: Node; @@ -1889,7 +1889,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'DeclareVariable'; + type: \'DeclareVariable\'; _DeclareVariable: void; id: Identifier; end: number; @@ -1902,7 +1902,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'FunctionTypeAnnotation'; + type: \'FunctionTypeAnnotation\'; _FunctionTypeAnnotation: void; params: Array; rest: ?FunctionTypeParam; @@ -1918,7 +1918,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'FunctionTypeParam'; + type: \'FunctionTypeParam\'; _FunctionTypeParam: void; name: Identifier; optional: boolean; @@ -1933,7 +1933,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'GenericTypeAnnotation'; + type: \'GenericTypeAnnotation\'; _GenericTypeAnnotation: void; id: Node; typeParameters: ?TypeParameterInstantiation; @@ -1947,7 +1947,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'InterfaceExtends'; + type: \'InterfaceExtends\'; _InterfaceExtends: void; id: Identifier; typeParameters: ?TypeParameterInstantiation; @@ -1961,7 +1961,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'InterfaceDeclaration'; + type: \'InterfaceDeclaration\'; _InterfaceDeclaration: void; body: ObjectTypeAnnotation; extends: Array; @@ -1977,7 +1977,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'IntersectionTypeAnnotation'; + type: \'IntersectionTypeAnnotation\'; _IntersectionTypeAnnotation: void; types: Array; end: number; @@ -1990,7 +1990,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'MixedTypeAnnotation'; + type: \'MixedTypeAnnotation\'; _MixedTypeAnnotation: void; end: number; innerComments: ?Array; @@ -2002,7 +2002,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'NullableTypeAnnotation'; + type: \'NullableTypeAnnotation\'; _NullableTypeAnnotation: void; typeAnnotation: Type; end: number; @@ -2015,7 +2015,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'NumberLiteralTypeAnnotation'; + type: \'NumberLiteralTypeAnnotation\'; _NumberLiteralTypeAnnotation: void; raw: string; value: number; @@ -2029,7 +2029,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'NumberTypeAnnotation'; + type: \'NumberTypeAnnotation\'; _NumberTypeAnnotation: void; end: number; innerComments: ?Array; @@ -2041,7 +2041,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'StringLiteralTypeAnnotation'; + type: \'StringLiteralTypeAnnotation\'; _StringLiteralTypeAnnotation: void; raw: string; value: string; @@ -2055,7 +2055,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'StringTypeAnnotation'; + type: \'StringTypeAnnotation\'; _StringTypeAnnotation: void; end: number; innerComments: ?Array; @@ -2067,7 +2067,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TupleTypeAnnotation'; + type: \'TupleTypeAnnotation\'; _TupleTypeAnnotation: void; types: Array; end: number; @@ -2080,7 +2080,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TypeofTypeAnnotation'; + type: \'TypeofTypeAnnotation\'; _TypeofTypeAnnotation: void; argument: Type; end: number; @@ -2093,7 +2093,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TypeAlias'; + type: \'TypeAlias\'; _TypeAlias: void; id: Identifier; right: Type; @@ -2108,7 +2108,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TypeAnnotation'; + type: \'TypeAnnotation\'; _TypeAnnotation: void; typeAnnotation: Type; end: number; @@ -2121,7 +2121,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TypeCastExpression'; + type: \'TypeCastExpression\'; _TypeCastExpression: void; expression: Expression; typeAnnotation: TypeAnnotation; @@ -2135,7 +2135,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TypeParameterDeclaration'; + type: \'TypeParameterDeclaration\'; _TypeParameterDeclaration: void; params: Array; end: number; @@ -2148,7 +2148,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'TypeParameterInstantiation'; + type: \'TypeParameterInstantiation\'; _TypeParameterInstantiation: void; params: Array; end: number; @@ -2161,7 +2161,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ObjectTypeAnnotation'; + type: \'ObjectTypeAnnotation\'; _ObjectTypeAnnotation: void; callProperties: Array; indexers: Array; @@ -2176,7 +2176,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ObjectTypeCallProperty'; + type: \'ObjectTypeCallProperty\'; _ObjectTypeCallProperty: void; static: boolean; value: FunctionTypeAnnotation; @@ -2190,7 +2190,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ObjectTypeIndexer'; + type: \'ObjectTypeIndexer\'; _ObjectTypeIndexer: void; id: Identifier; key: Type; @@ -2205,7 +2205,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'ObjectTypeProperty'; + type: \'ObjectTypeProperty\'; _ObjectTypeProperty: void; key: Node; optional: boolean; @@ -2220,7 +2220,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'QualifiedTypeIdentifier'; + type: \'QualifiedTypeIdentifier\'; _QualifiedTypeIdentifier: void; id: Identifier; qualification: Node; @@ -2234,7 +2234,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'UnionTypeAnnotation'; + type: \'UnionTypeAnnotation\'; _UnionTypeAnnotation: void; types: Array; end: number; @@ -2247,7 +2247,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'VoidTypeAnnotation'; + type: \'VoidTypeAnnotation\'; _VoidTypeAnnotation: void; end: number; innerComments: ?Array; @@ -2259,7 +2259,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXAttribute'; + type: \'JSXAttribute\'; _JSXAttribute: void; name: Node; value: ?Node; @@ -2273,7 +2273,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXClosingElement'; + type: \'JSXClosingElement\'; _JSXClosingElement: void; name: Node; end: number; @@ -2286,7 +2286,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXElement'; + type: \'JSXElement\'; _JSXElement: void; children: Array; closingElement: ?JSXClosingElement; @@ -2301,7 +2301,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXEmptyExpression'; + type: \'JSXEmptyExpression\'; _JSXEmptyExpression: void; end: number; innerComments: ?Array; @@ -2313,7 +2313,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXExpressionContainer'; + type: \'JSXExpressionContainer\'; _JSXExpressionContainer: void; expression: Expression; end: number; @@ -2326,7 +2326,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXIdentifier'; + type: \'JSXIdentifier\'; _JSXIdentifier: void; name: string; end: number; @@ -2339,7 +2339,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXMemberExpression'; + type: \'JSXMemberExpression\'; _JSXMemberExpression: void; computed: boolean; object: Node; @@ -2354,7 +2354,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXNamespacedName'; + type: \'JSXNamespacedName\'; _JSXNamespacedName: void; name: JSXIdentifier; namespace: JSXIdentifier; @@ -2368,7 +2368,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXOpeningElement'; + type: \'JSXOpeningElement\'; _JSXOpeningElement: void; attributes: Array; name: Array; @@ -2383,7 +2383,7 @@ export type Node = { start: number; trailingComments: ?Array; } | { - type: 'JSXSpreadAttribute'; + type: \'JSXSpreadAttribute\'; _JSXSpreadAttribute: void; argument: Expression; end: number; @@ -2398,7 +2398,7 @@ export type Node = { }; export type Pattern = { - type: 'ArrayPattern'; + type: \'ArrayPattern\'; _ArrayPattern: void; elements: Array; typeAnnotation: ?TypeAnnotation; @@ -2412,7 +2412,7 @@ export type Pattern = { start: number; trailingComments: ?Array; } | { - type: 'AssignmentPattern'; + type: \'AssignmentPattern\'; _AssignmentPattern: void; left: Pattern; right: Expression; @@ -2426,7 +2426,7 @@ export type Pattern = { start: number; trailingComments: ?Array; } | { - type: 'Identifier'; + type: \'Identifier\'; _Identifier: void; name: string; typeAnnotation: ?TypeAnnotation; @@ -2440,7 +2440,7 @@ export type Pattern = { start: number; trailingComments: ?Array; } | { - type: 'ObjectPattern'; + type: \'ObjectPattern\'; _ObjectPattern: void; properties: Array; typeAnnotation: ?TypeAnnotation; @@ -2454,7 +2454,7 @@ export type Pattern = { start: number; trailingComments: ?Array; } | { - type: 'RestElement'; + type: \'RestElement\'; _RestElement: void; argument: Pattern; typeAnnotation: ?TypeAnnotation; @@ -2470,7 +2470,7 @@ export type Pattern = { }; export type Statement = { - type: 'BlockStatement'; + type: \'BlockStatement\'; _BlockStatement: void; body: Array; end: number; @@ -2483,7 +2483,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'BreakStatement'; + type: \'BreakStatement\'; _BreakStatement: void; label: ?Identifier; end: number; @@ -2496,7 +2496,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'ContinueStatement'; + type: \'ContinueStatement\'; _ContinueStatement: void; label: ?Identifier; end: number; @@ -2509,7 +2509,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'DoWhileStatement'; + type: \'DoWhileStatement\'; _DoWhileStatement: void; body: Statement; test: Expression; @@ -2523,7 +2523,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'EmptyStatement'; + type: \'EmptyStatement\'; _EmptyStatement: void; end: number; innerComments: ?Array; @@ -2535,7 +2535,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'ExpressionStatement'; + type: \'ExpressionStatement\'; _ExpressionStatement: void; expression: Expression; end: number; @@ -2548,7 +2548,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'ForInStatement'; + type: \'ForInStatement\'; _ForInStatement: void; body: Statement; left: Node; @@ -2563,7 +2563,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'ForOfStatement'; + type: \'ForOfStatement\'; _ForOfStatement: void; body: Statement; left: Node; @@ -2578,7 +2578,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'ForStatement'; + type: \'ForStatement\'; _ForStatement: void; init: ?Node; test: ?Expression; @@ -2594,7 +2594,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'IfStatement'; + type: \'IfStatement\'; _IfStatement: void; alternate: ?Statement; consequent: Statement; @@ -2609,7 +2609,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'LabeledStatement'; + type: \'LabeledStatement\'; _LabeledStatement: void; body: Statement; label: Identifier; @@ -2623,7 +2623,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'ReturnStatement'; + type: \'ReturnStatement\'; _ReturnStatement: void; argument: ?Expression; end: number; @@ -2636,7 +2636,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'SwitchStatement'; + type: \'SwitchStatement\'; _SwitchStatement: void; cases: Array; discriminant: Expression; @@ -2651,7 +2651,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'ThrowStatement'; + type: \'ThrowStatement\'; _ThrowStatement: void; argument: Expression; end: number; @@ -2664,7 +2664,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'TryStatement'; + type: \'TryStatement\'; _TryStatement: void; block: BlockStatement; finalizer: ?BlockStatement; @@ -2681,7 +2681,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'WhileStatement'; + type: \'WhileStatement\'; _WhileStatement: void; body: Statement; test: Expression; @@ -2695,7 +2695,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'WithStatement'; + type: \'WithStatement\'; _WithStatement: void; body: Statement; object: Expression; @@ -2709,7 +2709,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'DeclareClass'; + type: \'DeclareClass\'; _DeclareClass: void; body: ObjectTypeAnnotation; extends: Array; @@ -2725,7 +2725,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'DeclareFunction'; + type: \'DeclareFunction\'; _DeclareFunction: void; id: Identifier; end: number; @@ -2738,7 +2738,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'DeclareModule'; + type: \'DeclareModule\'; _DeclareModule: void; body: BlockStatement; id: Node; @@ -2752,7 +2752,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'DeclareVariable'; + type: \'DeclareVariable\'; _DeclareVariable: void; id: Identifier; end: number; @@ -2765,7 +2765,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'InterfaceDeclaration'; + type: \'InterfaceDeclaration\'; _InterfaceDeclaration: void; body: ObjectTypeAnnotation; extends: Array; @@ -2781,7 +2781,7 @@ export type Statement = { start: number; trailingComments: ?Array; } | { - type: 'TypeAlias'; + type: \'TypeAlias\'; _TypeAlias: void; id: Identifier; right: Type; @@ -2798,7 +2798,7 @@ export type Statement = { }; export type Type = { - type: 'AnyTypeAnnotation'; + type: \'AnyTypeAnnotation\'; _AnyTypeAnnotation: void; end: number; innerComments: ?Array; @@ -2810,7 +2810,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'ArrayTypeAnnotation'; + type: \'ArrayTypeAnnotation\'; _ArrayTypeAnnotation: void; elementType: Type; end: number; @@ -2823,7 +2823,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'BooleanLiteralTypeAnnotation'; + type: \'BooleanLiteralTypeAnnotation\'; _BooleanLiteralTypeAnnotation: void; raw: string; value: boolean; @@ -2837,7 +2837,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'BooleanTypeAnnotation'; + type: \'BooleanTypeAnnotation\'; _BooleanTypeAnnotation: void; end: number; innerComments: ?Array; @@ -2849,7 +2849,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'FunctionTypeAnnotation'; + type: \'FunctionTypeAnnotation\'; _FunctionTypeAnnotation: void; params: Array; rest: ?FunctionTypeParam; @@ -2865,7 +2865,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'GenericTypeAnnotation'; + type: \'GenericTypeAnnotation\'; _GenericTypeAnnotation: void; id: Node; typeParameters: ?TypeParameterInstantiation; @@ -2879,7 +2879,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'IntersectionTypeAnnotation'; + type: \'IntersectionTypeAnnotation\'; _IntersectionTypeAnnotation: void; types: Array; end: number; @@ -2892,7 +2892,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'MixedTypeAnnotation'; + type: \'MixedTypeAnnotation\'; _MixedTypeAnnotation: void; end: number; innerComments: ?Array; @@ -2904,7 +2904,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'NullableTypeAnnotation'; + type: \'NullableTypeAnnotation\'; _NullableTypeAnnotation: void; typeAnnotation: Type; end: number; @@ -2917,7 +2917,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'NumberLiteralTypeAnnotation'; + type: \'NumberLiteralTypeAnnotation\'; _NumberLiteralTypeAnnotation: void; raw: string; value: number; @@ -2931,7 +2931,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'NumberTypeAnnotation'; + type: \'NumberTypeAnnotation\'; _NumberTypeAnnotation: void; end: number; innerComments: ?Array; @@ -2943,7 +2943,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'StringLiteralTypeAnnotation'; + type: \'StringLiteralTypeAnnotation\'; _StringLiteralTypeAnnotation: void; raw: string; value: string; @@ -2957,7 +2957,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'StringTypeAnnotation'; + type: \'StringTypeAnnotation\'; _StringTypeAnnotation: void; end: number; innerComments: ?Array; @@ -2969,7 +2969,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'TupleTypeAnnotation'; + type: \'TupleTypeAnnotation\'; _TupleTypeAnnotation: void; types: Array; end: number; @@ -2982,7 +2982,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'ObjectTypeAnnotation'; + type: \'ObjectTypeAnnotation\'; _ObjectTypeAnnotation: void; callProperties: Array; indexers: Array; @@ -2997,7 +2997,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'UnionTypeAnnotation'; + type: \'UnionTypeAnnotation\'; _UnionTypeAnnotation: void; types: Array; end: number; @@ -3010,7 +3010,7 @@ export type Type = { start: number; trailingComments: ?Array; } | { - type: 'VoidTypeAnnotation'; + type: \'VoidTypeAnnotation\'; _VoidTypeAnnotation: void; end: number; innerComments: ?Array; @@ -3026,7 +3026,7 @@ export type Type = { // Concrete Types. Nothing can extend these. export type CommentLine = { - type: 'CommentLine'; + type: \'CommentLine\'; _CommentLine: void; value: string; end: number; @@ -3038,7 +3038,7 @@ export type CommentLine = { }; export type CommentBlock = { - type: 'CommentBlock'; + type: \'CommentBlock\'; _CommentBlock: void; value: string; end: number; @@ -3052,7 +3052,7 @@ export type CommentBlock = { // Babel concrete types. export type ArrayExpression = { - type: 'ArrayExpression'; + type: \'ArrayExpression\'; _ArrayExpression: void; elements: Array; end: number; @@ -3067,7 +3067,7 @@ export type ArrayExpression = { }; export type ArrayPattern = { - type: 'ArrayPattern'; + type: \'ArrayPattern\'; _ArrayPattern: void; elements: Array; typeAnnotation: ?TypeAnnotation; @@ -3083,7 +3083,7 @@ export type ArrayPattern = { }; export type ArrowFunctionExpression = { - type: 'ArrowFunctionExpression'; + type: \'ArrowFunctionExpression\'; _ArrowFunctionExpression: void; body: Node; id: ?Identifier; @@ -3107,21 +3107,21 @@ export type ArrowFunctionExpression = { }; type AssignmentOperator = - '=' | - '+=' | - '-=' | - '*=' | - '/=' | - '%=' | - '<<=' | - '>>=' | - '>>>=' | - '|=' | - '^=' | - '&='; + \'=\' | + \'+=\' | + \'-=\' | + \'*=\' | + \'/=\' | + \'%=\' | + \'<<=\' | + \'>>=\' | + \'>>>=\' | + \'|=\' | + \'^=\' | + \'&=\'; export type AssignmentExpression = { - type: 'AssignmentExpression'; + type: \'AssignmentExpression\'; _AssignmentExpression: void; left: Pattern; operator: AssignmentOperator; @@ -3138,7 +3138,7 @@ export type AssignmentExpression = { }; export type AssignmentPattern = { - type: 'AssignmentPattern'; + type: \'AssignmentPattern\'; _AssignmentPattern: void; left: Pattern; right: Expression; @@ -3154,7 +3154,7 @@ export type AssignmentPattern = { }; export type AwaitExpression = { - type: 'AwaitExpression'; + type: \'AwaitExpression\'; _AwaitExpression: void; all: boolean; argument: ?Expression; @@ -3170,31 +3170,31 @@ export type AwaitExpression = { }; type BinaryOperator = - '==' | - '!=' | - '===' | - '!==' | - '<' | - '<=' | - '>' | - '>=' | - '<<' | - '>>' | - '>>>' | - '+' | - '-' | - '*' | - '/' | - '%' | - '&' | - '|' | - '^' | - 'in' | - 'instanceof' | - '..'; + \'==\' | + \'!=\' | + \'===\' | + \'!==\' | + \'<\' | + \'<=\' | + \'>\' | + \'>=\' | + \'<<\' | + \'>>\' | + \'>>>\' | + \'+\' | + \'-\' | + \'*\' | + \'/\' | + \'%\' | + \'&\' | + \'|\' | + \'^\' | + \'in\' | + \'instanceof\' | + \'..\'; export type BinaryExpression = { - type: 'BinaryExpression'; + type: \'BinaryExpression\'; _BinaryExpression: void; left: Expression; operator: BinaryOperator; @@ -3212,7 +3212,7 @@ export type BinaryExpression = { // TODO: What is this? export type BindExpression = { - type: 'BindExpression'; + type: \'BindExpression\'; _BindExpression: void; callee: Node; object: Node; @@ -3228,7 +3228,7 @@ export type BindExpression = { }; export type BlockStatement = { - type: 'BlockStatement'; + type: \'BlockStatement\'; _BlockStatement: void; body: Array; end: number; @@ -3243,7 +3243,7 @@ export type BlockStatement = { }; export type BreakStatement = { - type: 'BreakStatement'; + type: \'BreakStatement\'; _BreakStatement: void; label: ?Identifier; end: number; @@ -3258,7 +3258,7 @@ export type BreakStatement = { }; export type CallExpression = { - type: 'CallExpression'; + type: \'CallExpression\'; _CallExpression: void; arguments: Array; callee: Expression; @@ -3274,7 +3274,7 @@ export type CallExpression = { }; export type CatchClause = { - type: 'CatchClause'; + type: \'CatchClause\'; _CatchClause: void; body: BlockStatement; param: Pattern; @@ -3290,7 +3290,7 @@ export type CatchClause = { }; export type ClassBody = { - type: 'ClassBody'; + type: \'ClassBody\'; _ClassBody: void; body: Array; end: number; @@ -3305,7 +3305,7 @@ export type ClassBody = { }; export type ClassDeclaration = { - type: 'ClassDeclaration'; + type: \'ClassDeclaration\'; _ClassDeclaration: void; body: ClassBody; id: ?Identifier; @@ -3325,7 +3325,7 @@ export type ClassDeclaration = { }; export type ClassExpression = { - type: 'ClassExpression'; + type: \'ClassExpression\'; _ClassExpression: void; body: ClassBody; id: ?Identifier; @@ -3345,7 +3345,7 @@ export type ClassExpression = { }; export type ComprehensionBlock = { - type: 'ComprehensionBlock'; + type: \'ComprehensionBlock\'; _ComprehensionBlock: void; each: boolean; left: Pattern; @@ -3362,7 +3362,7 @@ export type ComprehensionBlock = { }; export type ComprehensionExpression = { - type: 'ComprehensionExpression'; + type: \'ComprehensionExpression\'; _ComprehensionExpression: void; body: Expression; blocks: Array; @@ -3379,7 +3379,7 @@ export type ComprehensionExpression = { }; export type ConditionalExpression = { - type: 'ConditionalExpression'; + type: \'ConditionalExpression\'; _ConditionalExpression: void; alternate: Expression; consequent: Expression; @@ -3396,7 +3396,7 @@ export type ConditionalExpression = { }; export type ContinueStatement = { - type: 'ContinueStatement'; + type: \'ContinueStatement\'; _ContinueStatement: void; label: ?Identifier; end: number; @@ -3412,7 +3412,7 @@ export type ContinueStatement = { // TODO: Make this correct. export type Decorator = { - type: 'Decorator'; + type: \'Decorator\'; _Decorator: void; expression: Expression; end: number; @@ -3427,7 +3427,7 @@ export type Decorator = { }; export type DebuggerStatement = { - type: 'DebuggerStatement'; + type: \'DebuggerStatement\'; _DebuggerStatement: void; end: number; innerComments: ?Array; @@ -3441,7 +3441,7 @@ export type DebuggerStatement = { }; export type DoWhileStatement = { - type: 'DoWhileStatement'; + type: \'DoWhileStatement\'; _DoWhileStatement: void; body: Statement; test: Expression; @@ -3458,7 +3458,7 @@ export type DoWhileStatement = { // TODO: Make this correct. export type DoExpression = { - type: 'DoExpression'; + type: \'DoExpression\'; _DoExpression: void; body: Statement; end: number; @@ -3473,7 +3473,7 @@ export type DoExpression = { }; export type EmptyStatement = { - type: 'EmptyStatement'; + type: \'EmptyStatement\'; _EmptyStatement: void; end: number; innerComments: ?Array; @@ -3487,7 +3487,7 @@ export type EmptyStatement = { }; export type ExpressionStatement = { - type: 'ExpressionStatement'; + type: \'ExpressionStatement\'; _ExpressionStatement: void; expression: Expression; end: number; @@ -3502,7 +3502,7 @@ export type ExpressionStatement = { }; export type File = { - type: 'File'; + type: \'File\'; _File: void; program: Program; end: number; @@ -3517,7 +3517,7 @@ export type File = { }; export type ForInStatement = { - type: 'ForInStatement'; + type: \'ForInStatement\'; _ForInStatement: void; body: Statement; left: Node; @@ -3535,7 +3535,7 @@ export type ForInStatement = { // TODO: Make this correct. export type ForOfStatement = { - type: 'ForOfStatement'; + type: \'ForOfStatement\'; _ForOfStatement: void; body: Statement; left: Node; @@ -3552,7 +3552,7 @@ export type ForOfStatement = { }; export type ForStatement = { - type: 'ForStatement'; + type: \'ForStatement\'; _ForStatement: void; init: ?Node; test: ?Expression; @@ -3570,7 +3570,7 @@ export type ForStatement = { }; export type FunctionDeclaration = { - type: 'FunctionDeclaration'; + type: \'FunctionDeclaration\'; _FunctionDeclaration: void; body: BlockStatement; id: Identifier; @@ -3594,7 +3594,7 @@ export type FunctionDeclaration = { }; export type FunctionExpression = { - type: 'FunctionExpression'; + type: \'FunctionExpression\'; _FunctionExpression: void; body: BlockStatement; id: ?Identifier; @@ -3618,7 +3618,7 @@ export type FunctionExpression = { }; export type Identifier = { - type: 'Identifier'; + type: \'Identifier\'; _Identifier: void; name: string; typeAnnotation: ?TypeAnnotation; @@ -3634,7 +3634,7 @@ export type Identifier = { }; export type IfStatement = { - type: 'IfStatement'; + type: \'IfStatement\'; _IfStatement: void; alternate: ?Statement; consequent: Statement; @@ -3652,7 +3652,7 @@ export type IfStatement = { // TODO: Make this correct. export type ImportDefaultSpecifier = { - type: 'ImportDefaultSpecifier'; + type: \'ImportDefaultSpecifier\'; _ImportDefaultSpecifier: void; local: Node; end: number; @@ -3668,7 +3668,7 @@ export type ImportDefaultSpecifier = { // TODO: Make this correct. export type ImportNamespaceSpecifier = { - type: 'ImportNamespaceSpecifier'; + type: \'ImportNamespaceSpecifier\'; _ImportNamespaceSpecifier: void; local: Node; end: number; @@ -3684,7 +3684,7 @@ export type ImportNamespaceSpecifier = { // TODO: Make this correct. export type ImportDeclaration = { - type: 'ImportDeclaration'; + type: \'ImportDeclaration\'; _ImportDeclaration: void; specifiers: Array; source: Literal; @@ -3701,7 +3701,7 @@ export type ImportDeclaration = { // TODO: Make this correct. export type ImportSpecifier = { - type: 'ImportSpecifier'; + type: \'ImportSpecifier\'; _ImportSpecifier: void; imported: Node; local: Node; @@ -3717,7 +3717,7 @@ export type ImportSpecifier = { }; export type LabeledStatement = { - type: 'LabeledStatement'; + type: \'LabeledStatement\'; _LabeledStatement: void; body: Statement; label: Identifier; @@ -3733,7 +3733,7 @@ export type LabeledStatement = { }; export type Literal = { - type: 'Literal'; + type: \'Literal\'; _Literal: void; raw: string; regex: ?{pattern: string, flags: string}; @@ -3749,10 +3749,10 @@ export type Literal = { trailingComments: ?Array; }; -type LogicalOperator = '||' | '&&'; +type LogicalOperator = \'||\' | \'&&\'; export type LogicalExpression = { - type: 'LogicalExpression'; + type: \'LogicalExpression\'; _LogicalExpression: void; left: Expression; operator: LogicalOperator; @@ -3769,7 +3769,7 @@ export type LogicalExpression = { }; export type MemberExpression = { - type: 'MemberExpression'; + type: \'MemberExpression\'; _MemberExpression: void; computed: boolean; object: Expression; @@ -3787,7 +3787,7 @@ export type MemberExpression = { // TODO: Make this correct. export type MetaProperty = { - type: 'MetaProperty'; + type: \'MetaProperty\'; _MetaProperty: void; meta: Node; property: Node; @@ -3803,11 +3803,11 @@ export type MetaProperty = { }; export type MethodDefinition = { - type: 'MethodDefinition'; + type: \'MethodDefinition\'; _MethodDefinition: void; computed: boolean; key: Node; - kind: 'constructor' | 'method' | 'get' | 'set'; + kind: \'constructor\' | \'method\' | \'get\' | \'set\'; static: boolean; value: FunctionExpression; decorators: ?Array; @@ -3823,7 +3823,7 @@ export type MethodDefinition = { }; export type NewExpression = { - type: 'NewExpression'; + type: \'NewExpression\'; _NewExpression: void; arguments: Array; callee: Expression; @@ -3839,7 +3839,7 @@ export type NewExpression = { }; export type Noop = { - type: 'Noop'; + type: \'Noop\'; _Noop: void; end: number; innerComments: ?Array; @@ -3853,7 +3853,7 @@ export type Noop = { }; export type ObjectExpression = { - type: 'ObjectExpression'; + type: \'ObjectExpression\'; _ObjectExpression: void; properties: Array; end: number; @@ -3868,7 +3868,7 @@ export type ObjectExpression = { }; export type ObjectPattern = { - type: 'ObjectPattern'; + type: \'ObjectPattern\'; _ObjectPattern: void; properties: Array; typeAnnotation: ?TypeAnnotation; @@ -3884,7 +3884,7 @@ export type ObjectPattern = { }; export type Program = { - type: 'Program'; + type: \'Program\'; _Program: void; body: Array; end: number; @@ -3899,11 +3899,11 @@ export type Program = { }; export type Property = { - type: 'Property'; + type: \'Property\'; _Property: void; computed: boolean; key: Node; - kind: 'init' | 'get' | 'set'; + kind: \'init\' | \'get\' | \'set\'; method: boolean; shorthand: boolean; value: Node; @@ -3920,7 +3920,7 @@ export type Property = { }; export type RestElement = { - type: 'RestElement'; + type: \'RestElement\'; _RestElement: void; argument: Pattern; typeAnnotation: ?TypeAnnotation; @@ -3936,7 +3936,7 @@ export type RestElement = { }; export type ReturnStatement = { - type: 'ReturnStatement'; + type: \'ReturnStatement\'; _ReturnStatement: void; argument: ?Expression; end: number; @@ -3951,7 +3951,7 @@ export type ReturnStatement = { }; export type SequenceExpression = { - type: 'SequenceExpression'; + type: \'SequenceExpression\'; _SequenceExpression: void; expression: Array; end: number; @@ -3966,7 +3966,7 @@ export type SequenceExpression = { }; export type SpreadElement = { - type: 'SpreadElement'; + type: \'SpreadElement\'; _SpreadElement: void; argument: Expression; end: number; @@ -3981,7 +3981,7 @@ export type SpreadElement = { }; export type SpreadProperty = { - type: 'SpreadProperty'; + type: \'SpreadProperty\'; _SpreadProperty: void; argument: Expression; end: number; @@ -3996,7 +3996,7 @@ export type SpreadProperty = { }; export type Super = { - type: 'Super'; + type: \'Super\'; _Super: void; end: number; innerComments: ?Array; @@ -4010,7 +4010,7 @@ export type Super = { }; export type SwitchCase = { - type: 'SwitchCase'; + type: \'SwitchCase\'; _SwitchCase: void; consequent: Array; test: ?Expression; @@ -4026,7 +4026,7 @@ export type SwitchCase = { }; export type SwitchStatement = { - type: 'SwitchStatement'; + type: \'SwitchStatement\'; _SwitchStatement: void; cases: Array; discriminant: Expression; @@ -4043,7 +4043,7 @@ export type SwitchStatement = { }; export type TaggedTemplateExpression = { - type: 'TaggedTemplateExpression'; + type: \'TaggedTemplateExpression\'; _TaggedTemplateExpression: void; quasi: TemplateLiteral; tag: Expression; @@ -4059,7 +4059,7 @@ export type TaggedTemplateExpression = { }; export type TemplateElement = { - type: 'TemplateElement'; + type: \'TemplateElement\'; _TemplateElement: void; tail: boolean; value: {cooked: string, raw: string}; @@ -4075,7 +4075,7 @@ export type TemplateElement = { }; export type TemplateLiteral = { - type: 'TemplateLiteral'; + type: \'TemplateLiteral\'; _TemplateLiteral: void; expressions: Array; quasis: Array; @@ -4091,7 +4091,7 @@ export type TemplateLiteral = { }; export type ThisExpression = { - type: 'ThisExpression'; + type: \'ThisExpression\'; _ThisExpression: void; end: number; innerComments: ?Array; @@ -4105,7 +4105,7 @@ export type ThisExpression = { }; export type ThrowStatement = { - type: 'ThrowStatement'; + type: \'ThrowStatement\'; _ThrowStatement: void; argument: Expression; end: number; @@ -4120,7 +4120,7 @@ export type ThrowStatement = { }; export type TryStatement = { - type: 'TryStatement'; + type: \'TryStatement\'; _TryStatement: void; block: BlockStatement; finalizer: ?BlockStatement; @@ -4138,10 +4138,10 @@ export type TryStatement = { trailingComments: ?Array; }; -type UnaryOperator = '-' | '+' | '!' | '~' | 'typeof' | 'void' | 'delete'; +type UnaryOperator = \'-\' | \'+\' | \'!\' | \'~\' | \'typeof\' | \'void\' | \'delete\'; export type UnaryExpression = { - type: 'UnaryExpression'; + type: \'UnaryExpression\'; _UnaryExpression: void; argument: Expression; operator: UnaryOperator; @@ -4157,10 +4157,10 @@ export type UnaryExpression = { trailingComments: ?Array; }; -type UpdateOperator = '++' | '--'; +type UpdateOperator = \'++\' | \'--\'; export type UpdateExpression = { - type: 'UpdateExpression'; + type: \'UpdateExpression\'; _UpdateExpression: void; argument: Expression; operator: UpdateOperator; @@ -4177,10 +4177,10 @@ export type UpdateExpression = { }; export type VariableDeclaration = { - type: 'VariableDeclaration'; + type: \'VariableDeclaration\'; _VariableDeclaration: void; declarations: Array; - kind: 'var' | 'let' | 'const'; + kind: \'var\' | \'let\' | \'const\'; end: number; innerComments: ?Array; leadingComments: ?Array; @@ -4193,7 +4193,7 @@ export type VariableDeclaration = { }; export type VariableDeclarator = { - type: 'VariableDeclarator'; + type: \'VariableDeclarator\'; _VariableDeclarator: void; id: Pattern; init: ?Expression; @@ -4209,7 +4209,7 @@ export type VariableDeclarator = { }; export type WhileStatement = { - type: 'WhileStatement'; + type: \'WhileStatement\'; _WhileStatement: void; body: Statement; test: Expression; @@ -4225,7 +4225,7 @@ export type WhileStatement = { }; export type WithStatement = { - type: 'WithStatement'; + type: \'WithStatement\'; _WithStatement: void; body: Statement; object: Expression; @@ -4241,7 +4241,7 @@ export type WithStatement = { }; export type YieldExpression = { - type: 'YieldExpression'; + type: \'YieldExpression\'; _YieldExpression: void; argument: ?Expression; delegate: boolean; @@ -4258,7 +4258,7 @@ export type YieldExpression = { // TODO: Make this correct. export type ExportAllDeclaration = { - type: 'ExportAllDeclaration'; + type: \'ExportAllDeclaration\'; _ExportAllDeclaration: void; exported: Node; source: Node; @@ -4275,7 +4275,7 @@ export type ExportAllDeclaration = { // TODO: Make this correct. export type ExportDefaultDeclaration = { - type: 'ExportDefaultDeclaration'; + type: \'ExportDefaultDeclaration\'; _ExportDefaultDeclaration: void; declaration: Node; end: number; @@ -4291,7 +4291,7 @@ export type ExportDefaultDeclaration = { // TODO: Make this correct. export type ExportNamedDeclaration = { - type: 'ExportNamedDeclaration'; + type: \'ExportNamedDeclaration\'; _ExportNamedDeclaration: void; declaration: Node; source: Literal; @@ -4309,7 +4309,7 @@ export type ExportNamedDeclaration = { // TODO: Make this correct. export type ExportDefaultSpecifier = { - type: 'ExportDefaultSpecifier'; + type: \'ExportDefaultSpecifier\'; _ExportDefaultSpecifier: void; exported: Node; end: number; @@ -4325,7 +4325,7 @@ export type ExportDefaultSpecifier = { // TODO: Make this correct. export type ExportNamespaceSpecifier = { - type: 'ExportNamespaceSpecifier'; + type: \'ExportNamespaceSpecifier\'; _ExportNamespaceSpecifier: void; exported: Node; end: number; @@ -4341,7 +4341,7 @@ export type ExportNamespaceSpecifier = { // TODO: Make this correct. export type ExportSpecifier = { - type: 'ExportSpecifier'; + type: \'ExportSpecifier\'; _ExportSpecifier: void; local: Node; exported: Node; @@ -4357,7 +4357,7 @@ export type ExportSpecifier = { }; export type AnyTypeAnnotation = { - type: 'AnyTypeAnnotation'; + type: \'AnyTypeAnnotation\'; _AnyTypeAnnotation: void; end: number; innerComments: ?Array; @@ -4371,7 +4371,7 @@ export type AnyTypeAnnotation = { }; export type ArrayTypeAnnotation = { - type: 'ArrayTypeAnnotation'; + type: \'ArrayTypeAnnotation\'; _ArrayTypeAnnotation: void; elementType: Type; end: number; @@ -4386,7 +4386,7 @@ export type ArrayTypeAnnotation = { }; export type BooleanLiteralTypeAnnotation = { - type: 'BooleanLiteralTypeAnnotation'; + type: \'BooleanLiteralTypeAnnotation\'; _BooleanLiteralTypeAnnotation: void; raw: string; value: boolean; @@ -4402,7 +4402,7 @@ export type BooleanLiteralTypeAnnotation = { }; export type BooleanTypeAnnotation = { - type: 'BooleanTypeAnnotation'; + type: \'BooleanTypeAnnotation\'; _BooleanTypeAnnotation: void; end: number; innerComments: ?Array; @@ -4416,7 +4416,7 @@ export type BooleanTypeAnnotation = { }; export type ClassImplements = { - type: 'ClassImplements'; + type: \'ClassImplements\'; _ClassImplements: void; id: Identifier; typeParameters: ?TypeParameterInstantiation; @@ -4433,7 +4433,7 @@ export type ClassImplements = { }; export type ClassProperty = { - type: 'ClassProperty'; + type: \'ClassProperty\'; _ClassProperty: void; computed: boolean; key: Node; @@ -4453,7 +4453,7 @@ export type ClassProperty = { }; export type DeclareClass = { - type: 'DeclareClass'; + type: \'DeclareClass\'; _DeclareClass: void; body: ObjectTypeAnnotation; extends: Array; @@ -4472,7 +4472,7 @@ export type DeclareClass = { // TODO: Make this correct. export type DeclareFunction = { - type: 'DeclareFunction'; + type: \'DeclareFunction\'; _DeclareFunction: void; id: Identifier; end: number; @@ -4487,7 +4487,7 @@ export type DeclareFunction = { }; export type DeclareModule = { - type: 'DeclareModule'; + type: \'DeclareModule\'; _DeclareModule: void; body: BlockStatement; id: Node; @@ -4504,7 +4504,7 @@ export type DeclareModule = { // TODO: Make this correct. export type DeclareVariable = { - type: 'DeclareVariable'; + type: \'DeclareVariable\'; _DeclareVariable: void; id: Identifier; end: number; @@ -4519,7 +4519,7 @@ export type DeclareVariable = { }; export type FunctionTypeAnnotation = { - type: 'FunctionTypeAnnotation'; + type: \'FunctionTypeAnnotation\'; _FunctionTypeAnnotation: void; params: Array; rest: ?FunctionTypeParam; @@ -4537,7 +4537,7 @@ export type FunctionTypeAnnotation = { }; export type FunctionTypeParam = { - type: 'FunctionTypeParam'; + type: \'FunctionTypeParam\'; _FunctionTypeParam: void; name: Identifier; optional: boolean; @@ -4554,7 +4554,7 @@ export type FunctionTypeParam = { }; export type GenericTypeAnnotation = { - type: 'GenericTypeAnnotation'; + type: \'GenericTypeAnnotation\'; _GenericTypeAnnotation: void; id: Node; typeParameters: ?TypeParameterInstantiation; @@ -4570,7 +4570,7 @@ export type GenericTypeAnnotation = { }; export type InterfaceExtends = { - type: 'InterfaceExtends'; + type: \'InterfaceExtends\'; _InterfaceExtends: void; id: Identifier; typeParameters: ?TypeParameterInstantiation; @@ -4586,7 +4586,7 @@ export type InterfaceExtends = { }; export type InterfaceDeclaration = { - type: 'InterfaceDeclaration'; + type: \'InterfaceDeclaration\'; _InterfaceDeclaration: void; body: ObjectTypeAnnotation; extends: Array; @@ -4604,7 +4604,7 @@ export type InterfaceDeclaration = { }; export type IntersectionTypeAnnotation = { - type: 'IntersectionTypeAnnotation'; + type: \'IntersectionTypeAnnotation\'; _IntersectionTypeAnnotation: void; types: Array; end: number; @@ -4619,7 +4619,7 @@ export type IntersectionTypeAnnotation = { }; export type MixedTypeAnnotation = { - type: 'MixedTypeAnnotation'; + type: \'MixedTypeAnnotation\'; _MixedTypeAnnotation: void; end: number; innerComments: ?Array; @@ -4633,7 +4633,7 @@ export type MixedTypeAnnotation = { }; export type NullableTypeAnnotation = { - type: 'NullableTypeAnnotation'; + type: \'NullableTypeAnnotation\'; _NullableTypeAnnotation: void; typeAnnotation: Type; end: number; @@ -4648,7 +4648,7 @@ export type NullableTypeAnnotation = { }; export type NumberLiteralTypeAnnotation = { - type: 'NumberLiteralTypeAnnotation'; + type: \'NumberLiteralTypeAnnotation\'; _NumberLiteralTypeAnnotation: void; raw: string; value: number; @@ -4664,7 +4664,7 @@ export type NumberLiteralTypeAnnotation = { }; export type NumberTypeAnnotation = { - type: 'NumberTypeAnnotation'; + type: \'NumberTypeAnnotation\'; _NumberTypeAnnotation: void; end: number; innerComments: ?Array; @@ -4678,7 +4678,7 @@ export type NumberTypeAnnotation = { }; export type StringLiteralTypeAnnotation = { - type: 'StringLiteralTypeAnnotation'; + type: \'StringLiteralTypeAnnotation\'; _StringLiteralTypeAnnotation: void; raw: string; value: string; @@ -4694,7 +4694,7 @@ export type StringLiteralTypeAnnotation = { }; export type StringTypeAnnotation = { - type: 'StringTypeAnnotation'; + type: \'StringTypeAnnotation\'; _StringTypeAnnotation: void; end: number; innerComments: ?Array; @@ -4708,7 +4708,7 @@ export type StringTypeAnnotation = { }; export type TupleTypeAnnotation = { - type: 'TupleTypeAnnotation'; + type: \'TupleTypeAnnotation\'; _TupleTypeAnnotation: void; types: Array; end: number; @@ -4723,7 +4723,7 @@ export type TupleTypeAnnotation = { }; export type TypeofTypeAnnotation = { - type: 'TypeofTypeAnnotation'; + type: \'TypeofTypeAnnotation\'; _TypeofTypeAnnotation: void; argument: Type; end: number; @@ -4738,7 +4738,7 @@ export type TypeofTypeAnnotation = { }; export type TypeAlias = { - type: 'TypeAlias'; + type: \'TypeAlias\'; _TypeAlias: void; id: Identifier; right: Type; @@ -4755,7 +4755,7 @@ export type TypeAlias = { }; export type TypeAnnotation = { - type: 'TypeAnnotation'; + type: \'TypeAnnotation\'; _TypeAnnotation: void; typeAnnotation: Type; end: number; @@ -4770,7 +4770,7 @@ export type TypeAnnotation = { }; export type TypeCastExpression = { - type: 'TypeCastExpression'; + type: \'TypeCastExpression\'; _TypeCastExpression: void; expression: Expression; typeAnnotation: TypeAnnotation; @@ -4786,7 +4786,7 @@ export type TypeCastExpression = { }; export type TypeParameterDeclaration = { - type: 'TypeParameterDeclaration'; + type: \'TypeParameterDeclaration\'; _TypeParameterDeclaration: void; params: Array; end: number; @@ -4801,7 +4801,7 @@ export type TypeParameterDeclaration = { }; export type TypeParameterInstantiation = { - type: 'TypeParameterInstantiation'; + type: \'TypeParameterInstantiation\'; _TypeParameterInstantiation: void; params: Array; end: number; @@ -4816,7 +4816,7 @@ export type TypeParameterInstantiation = { }; export type ObjectTypeAnnotation = { - type: 'ObjectTypeAnnotation'; + type: \'ObjectTypeAnnotation\'; _ObjectTypeAnnotation: void; callProperties: Array; indexers: Array; @@ -4833,7 +4833,7 @@ export type ObjectTypeAnnotation = { }; export type ObjectTypeCallProperty = { - type: 'ObjectTypeCallProperty'; + type: \'ObjectTypeCallProperty\'; _ObjectTypeCallProperty: void; static: boolean; value: FunctionTypeAnnotation; @@ -4849,7 +4849,7 @@ export type ObjectTypeCallProperty = { }; export type ObjectTypeIndexer = { - type: 'ObjectTypeIndexer'; + type: \'ObjectTypeIndexer\'; _ObjectTypeIndexer: void; id: Identifier; key: Type; @@ -4866,7 +4866,7 @@ export type ObjectTypeIndexer = { }; export type ObjectTypeProperty = { - type: 'ObjectTypeProperty'; + type: \'ObjectTypeProperty\'; _ObjectTypeProperty: void; key: Node; optional: boolean; @@ -4883,7 +4883,7 @@ export type ObjectTypeProperty = { }; export type QualifiedTypeIdentifier = { - type: 'QualifiedTypeIdentifier'; + type: \'QualifiedTypeIdentifier\'; _QualifiedTypeIdentifier: void; id: Identifier; qualification: Node; @@ -4899,7 +4899,7 @@ export type QualifiedTypeIdentifier = { }; export type UnionTypeAnnotation = { - type: 'UnionTypeAnnotation'; + type: \'UnionTypeAnnotation\'; _UnionTypeAnnotation: void; types: Array; end: number; @@ -4914,7 +4914,7 @@ export type UnionTypeAnnotation = { }; export type VoidTypeAnnotation = { - type: 'VoidTypeAnnotation'; + type: \'VoidTypeAnnotation\'; _VoidTypeAnnotation: void; end: number; innerComments: ?Array; @@ -4928,7 +4928,7 @@ export type VoidTypeAnnotation = { }; export type JSXAttribute = { - type: 'JSXAttribute'; + type: \'JSXAttribute\'; _JSXAttribute: void; name: Node; value: ?Node; @@ -4944,7 +4944,7 @@ export type JSXAttribute = { }; export type JSXClosingElement = { - type: 'JSXClosingElement'; + type: \'JSXClosingElement\'; _JSXClosingElement: void; name: Node; end: number; @@ -4959,7 +4959,7 @@ export type JSXClosingElement = { }; export type JSXElement = { - type: 'JSXElement'; + type: \'JSXElement\'; _JSXElement: void; children: Array; closingElement: ?JSXClosingElement; @@ -4976,7 +4976,7 @@ export type JSXElement = { }; export type JSXEmptyExpression = { - type: 'JSXEmptyExpression'; + type: \'JSXEmptyExpression\'; _JSXEmptyExpression: void; end: number; innerComments: ?Array; @@ -4990,7 +4990,7 @@ export type JSXEmptyExpression = { }; export type JSXExpressionContainer = { - type: 'JSXExpressionContainer'; + type: \'JSXExpressionContainer\'; _JSXExpressionContainer: void; expression: Expression; end: number; @@ -5005,7 +5005,7 @@ export type JSXExpressionContainer = { }; export type JSXIdentifier = { - type: 'JSXIdentifier'; + type: \'JSXIdentifier\'; _JSXIdentifier: void; name: string; end: number; @@ -5020,7 +5020,7 @@ export type JSXIdentifier = { }; export type JSXMemberExpression = { - type: 'JSXMemberExpression'; + type: \'JSXMemberExpression\'; _JSXMemberExpression: void; computed: boolean; object: Node; @@ -5037,7 +5037,7 @@ export type JSXMemberExpression = { }; export type JSXNamespacedName = { - type: 'JSXNamespacedName'; + type: \'JSXNamespacedName\'; _JSXNamespacedName: void; name: JSXIdentifier; namespace: JSXIdentifier; @@ -5053,7 +5053,7 @@ export type JSXNamespacedName = { }; export type JSXOpeningElement = { - type: 'JSXOpeningElement'; + type: \'JSXOpeningElement\'; _JSXOpeningElement: void; attributes: Array; name: Array; @@ -5070,7 +5070,7 @@ export type JSXOpeningElement = { }; export type JSXSpreadAttribute = { - type: 'JSXSpreadAttribute'; + type: \'JSXSpreadAttribute\'; _JSXSpreadAttribute: void; argument: Expression; end: number; @@ -5110,9 +5110,9 @@ export type JSXSpreadAttribute = { // TODO: Make this correct. // TODO: Make this correct. // TODO: Make this correct. -"use strict"; +\"use strict\"; export type Comment = { - type: "CommentLine"; + type: \"CommentLine\"; _CommentLine: void; value: string; end: number; @@ -5122,7 +5122,7 @@ export type Comment = { }; start: number } | { - type: "CommentBlock"; + type: \"CommentBlock\"; _CommentBlock: void; value: string; end: number; @@ -5133,7 +5133,7 @@ export type Comment = { start: number }; export type Declaration = { - type: "ClassBody"; + type: \"ClassBody\"; _ClassBody: void; body: Array; end: number; @@ -5146,7 +5146,7 @@ export type Declaration = { start: number; trailingComments: ?Array } | { - type: "ClassDeclaration"; + type: \"ClassDeclaration\"; _ClassDeclaration: void; body: ClassBody; id: ?Identifier; @@ -5164,7 +5164,7 @@ export type Declaration = { start: number; trailingComments: ?Array } | { - type: "FunctionDeclaration"; + type: \"FunctionDeclaration\"; _FunctionDeclaration: void; body: BlockStatement; id: Identifier; @@ -5186,11 +5186,11 @@ export type Declaration = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "MethodDefinition"; + type: \"MethodDefinition\"; _MethodDefinition: void; computed: boolean; key: Node; - kind: "constructor" | "method" | "get" | "set"; + kind: \"constructor\" | \"method\" | \"get\" | \"set\"; static: boolean; value: FunctionExpression; decorators: ?Array; @@ -5204,10 +5204,10 @@ export type Declaration = { start: number; trailingComments: ?Array } | { - type: "VariableDeclaration"; + type: \"VariableDeclaration\"; _VariableDeclaration: void; declarations: Array; - kind: "var" | "let" | "const"; + kind: \"var\" | \"let\" | \"const\"; end: number; innerComments: ?Array; leadingComments: ?Array; @@ -5218,7 +5218,7 @@ export type Declaration = { start: number; trailingComments: ?Array } | { - type: "ClassProperty"; + type: \"ClassProperty\"; _ClassProperty: void; computed: boolean; key: Node; @@ -5237,7 +5237,7 @@ export type Declaration = { trailingComments: ?Array }; export type Expression = { - type: "ArrayExpression"; + type: \"ArrayExpression\"; _ArrayExpression: void; elements: Array; end: number; @@ -5250,7 +5250,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "AssignmentExpression"; + type: \"AssignmentExpression\"; _AssignmentExpression: void; left: Pattern; operator: AssignmentOperator; @@ -5265,7 +5265,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "AwaitExpression"; + type: \"AwaitExpression\"; _AwaitExpression: void; all: boolean; argument: ?Expression; @@ -5279,7 +5279,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "BinaryExpression"; + type: \"BinaryExpression\"; _BinaryExpression: void; left: Expression; operator: BinaryOperator; @@ -5294,7 +5294,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "BindExpression"; + type: \"BindExpression\"; _BindExpression: void; callee: Node; object: Node; @@ -5308,7 +5308,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "CallExpression"; + type: \"CallExpression\"; _CallExpression: void; arguments: Array; callee: Expression; @@ -5322,7 +5322,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "ClassExpression"; + type: \"ClassExpression\"; _ClassExpression: void; body: ClassBody; id: ?Identifier; @@ -5340,7 +5340,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "ComprehensionExpression"; + type: \"ComprehensionExpression\"; _ComprehensionExpression: void; body: Expression; blocks: Array; @@ -5355,7 +5355,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "ConditionalExpression"; + type: \"ConditionalExpression\"; _ConditionalExpression: void; alternate: Expression; consequent: Expression; @@ -5370,7 +5370,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "DoExpression"; + type: \"DoExpression\"; _DoExpression: void; body: Statement; end: number; @@ -5383,7 +5383,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "FunctionExpression"; + type: \"FunctionExpression\"; _FunctionExpression: void; body: BlockStatement; id: ?Identifier; @@ -5405,7 +5405,7 @@ export type Expression = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "Identifier"; + type: \"Identifier\"; _Identifier: void; name: string; typeAnnotation: ?TypeAnnotation; @@ -5419,7 +5419,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "Literal"; + type: \"Literal\"; _Literal: void; raw: string; regex: ?{ pattern: string; flags: string }; @@ -5434,7 +5434,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "LogicalExpression"; + type: \"LogicalExpression\"; _LogicalExpression: void; left: Expression; operator: LogicalOperator; @@ -5449,7 +5449,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "MemberExpression"; + type: \"MemberExpression\"; _MemberExpression: void; computed: boolean; object: Expression; @@ -5464,7 +5464,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "NewExpression"; + type: \"NewExpression\"; _NewExpression: void; arguments: Array; callee: Expression; @@ -5478,7 +5478,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "ObjectExpression"; + type: \"ObjectExpression\"; _ObjectExpression: void; properties: Array; end: number; @@ -5491,7 +5491,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "SequenceExpression"; + type: \"SequenceExpression\"; _SequenceExpression: void; expression: Array; end: number; @@ -5504,7 +5504,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "TaggedTemplateExpression"; + type: \"TaggedTemplateExpression\"; _TaggedTemplateExpression: void; quasi: TemplateLiteral; tag: Expression; @@ -5518,7 +5518,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "TemplateLiteral"; + type: \"TemplateLiteral\"; _TemplateLiteral: void; expressions: Array; quasis: Array; @@ -5532,7 +5532,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "ThisExpression"; + type: \"ThisExpression\"; _ThisExpression: void; end: number; innerComments: ?Array; @@ -5544,7 +5544,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "UnaryExpression"; + type: \"UnaryExpression\"; _UnaryExpression: void; argument: Expression; operator: UnaryOperator; @@ -5559,7 +5559,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "UpdateExpression"; + type: \"UpdateExpression\"; _UpdateExpression: void; argument: Expression; operator: UpdateOperator; @@ -5574,7 +5574,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "YieldExpression"; + type: \"YieldExpression\"; _YieldExpression: void; argument: ?Expression; delegate: boolean; @@ -5588,7 +5588,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "TypeCastExpression"; + type: \"TypeCastExpression\"; _TypeCastExpression: void; expression: Expression; typeAnnotation: TypeAnnotation; @@ -5602,7 +5602,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "JSXElement"; + type: \"JSXElement\"; _JSXElement: void; children: Array; closingElement: ?JSXClosingElement; @@ -5617,7 +5617,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "JSXEmptyExpression"; + type: \"JSXEmptyExpression\"; _JSXEmptyExpression: void; end: number; innerComments: ?Array; @@ -5629,7 +5629,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "JSXExpressionContainer"; + type: \"JSXExpressionContainer\"; _JSXExpressionContainer: void; expression: Expression; end: number; @@ -5642,7 +5642,7 @@ export type Expression = { start: number; trailingComments: ?Array } | { - type: "JSXMemberExpression"; + type: \"JSXMemberExpression\"; _JSXMemberExpression: void; computed: boolean; object: Node; @@ -5658,7 +5658,7 @@ export type Expression = { trailingComments: ?Array }; export type Function = { - type: "ArrowFunctionExpression"; + type: \"ArrowFunctionExpression\"; _ArrowFunctionExpression: void; body: Node; id: ?Identifier; @@ -5680,7 +5680,7 @@ export type Function = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "FunctionDeclaration"; + type: \"FunctionDeclaration\"; _FunctionDeclaration: void; body: BlockStatement; id: Identifier; @@ -5702,7 +5702,7 @@ export type Function = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "FunctionExpression"; + type: \"FunctionExpression\"; _FunctionExpression: void; body: BlockStatement; id: ?Identifier; @@ -5725,7 +5725,7 @@ export type Function = { typeParameters: ?TypeParameterDeclaration }; export type Node = { - type: "ArrayExpression"; + type: \"ArrayExpression\"; _ArrayExpression: void; elements: Array; end: number; @@ -5738,7 +5738,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ArrayPattern"; + type: \"ArrayPattern\"; _ArrayPattern: void; elements: Array; typeAnnotation: ?TypeAnnotation; @@ -5752,7 +5752,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ArrowFunctionExpression"; + type: \"ArrowFunctionExpression\"; _ArrowFunctionExpression: void; body: Node; id: ?Identifier; @@ -5774,7 +5774,7 @@ export type Node = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "AssignmentExpression"; + type: \"AssignmentExpression\"; _AssignmentExpression: void; left: Pattern; operator: AssignmentOperator; @@ -5789,7 +5789,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "AssignmentPattern"; + type: \"AssignmentPattern\"; _AssignmentPattern: void; left: Pattern; right: Expression; @@ -5803,7 +5803,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "AwaitExpression"; + type: \"AwaitExpression\"; _AwaitExpression: void; all: boolean; argument: ?Expression; @@ -5817,7 +5817,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "BinaryExpression"; + type: \"BinaryExpression\"; _BinaryExpression: void; left: Expression; operator: BinaryOperator; @@ -5832,7 +5832,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "BindExpression"; + type: \"BindExpression\"; _BindExpression: void; callee: Node; object: Node; @@ -5846,7 +5846,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "BlockStatement"; + type: \"BlockStatement\"; _BlockStatement: void; body: Array; end: number; @@ -5859,7 +5859,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "BreakStatement"; + type: \"BreakStatement\"; _BreakStatement: void; label: ?Identifier; end: number; @@ -5872,7 +5872,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "CallExpression"; + type: \"CallExpression\"; _CallExpression: void; arguments: Array; callee: Expression; @@ -5886,7 +5886,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "CatchClause"; + type: \"CatchClause\"; _CatchClause: void; body: BlockStatement; param: Pattern; @@ -5900,7 +5900,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ClassBody"; + type: \"ClassBody\"; _ClassBody: void; body: Array; end: number; @@ -5913,7 +5913,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ClassDeclaration"; + type: \"ClassDeclaration\"; _ClassDeclaration: void; body: ClassBody; id: ?Identifier; @@ -5931,7 +5931,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ClassExpression"; + type: \"ClassExpression\"; _ClassExpression: void; body: ClassBody; id: ?Identifier; @@ -5949,7 +5949,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ComprehensionBlock"; + type: \"ComprehensionBlock\"; _ComprehensionBlock: void; each: boolean; left: Pattern; @@ -5964,7 +5964,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ComprehensionExpression"; + type: \"ComprehensionExpression\"; _ComprehensionExpression: void; body: Expression; blocks: Array; @@ -5979,7 +5979,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ConditionalExpression"; + type: \"ConditionalExpression\"; _ConditionalExpression: void; alternate: Expression; consequent: Expression; @@ -5994,7 +5994,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ContinueStatement"; + type: \"ContinueStatement\"; _ContinueStatement: void; label: ?Identifier; end: number; @@ -6007,7 +6007,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "Decorator"; + type: \"Decorator\"; _Decorator: void; expression: Expression; end: number; @@ -6020,7 +6020,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "DebuggerStatement"; + type: \"DebuggerStatement\"; _DebuggerStatement: void; end: number; innerComments: ?Array; @@ -6032,7 +6032,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "DoWhileStatement"; + type: \"DoWhileStatement\"; _DoWhileStatement: void; body: Statement; test: Expression; @@ -6046,7 +6046,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "DoExpression"; + type: \"DoExpression\"; _DoExpression: void; body: Statement; end: number; @@ -6059,7 +6059,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "EmptyStatement"; + type: \"EmptyStatement\"; _EmptyStatement: void; end: number; innerComments: ?Array; @@ -6071,7 +6071,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ExpressionStatement"; + type: \"ExpressionStatement\"; _ExpressionStatement: void; expression: Expression; end: number; @@ -6084,7 +6084,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "File"; + type: \"File\"; _File: void; program: Program; end: number; @@ -6097,7 +6097,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ForInStatement"; + type: \"ForInStatement\"; _ForInStatement: void; body: Statement; left: Node; @@ -6112,7 +6112,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ForOfStatement"; + type: \"ForOfStatement\"; _ForOfStatement: void; body: Statement; left: Node; @@ -6127,7 +6127,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ForStatement"; + type: \"ForStatement\"; _ForStatement: void; init: ?Node; test: ?Expression; @@ -6143,7 +6143,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "FunctionDeclaration"; + type: \"FunctionDeclaration\"; _FunctionDeclaration: void; body: BlockStatement; id: Identifier; @@ -6165,7 +6165,7 @@ export type Node = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "FunctionExpression"; + type: \"FunctionExpression\"; _FunctionExpression: void; body: BlockStatement; id: ?Identifier; @@ -6187,7 +6187,7 @@ export type Node = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "Identifier"; + type: \"Identifier\"; _Identifier: void; name: string; typeAnnotation: ?TypeAnnotation; @@ -6201,7 +6201,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "IfStatement"; + type: \"IfStatement\"; _IfStatement: void; alternate: ?Statement; consequent: Statement; @@ -6216,7 +6216,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ImportDefaultSpecifier"; + type: \"ImportDefaultSpecifier\"; _ImportDefaultSpecifier: void; local: Node; end: number; @@ -6229,7 +6229,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ImportNamespaceSpecifier"; + type: \"ImportNamespaceSpecifier\"; _ImportNamespaceSpecifier: void; local: Node; end: number; @@ -6242,7 +6242,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ImportDeclaration"; + type: \"ImportDeclaration\"; _ImportDeclaration: void; specifiers: Array; source: Literal; @@ -6256,7 +6256,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ImportSpecifier"; + type: \"ImportSpecifier\"; _ImportSpecifier: void; imported: Node; local: Node; @@ -6270,7 +6270,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "LabeledStatement"; + type: \"LabeledStatement\"; _LabeledStatement: void; body: Statement; label: Identifier; @@ -6284,7 +6284,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "Literal"; + type: \"Literal\"; _Literal: void; raw: string; regex: ?{ pattern: string; flags: string }; @@ -6299,7 +6299,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "LogicalExpression"; + type: \"LogicalExpression\"; _LogicalExpression: void; left: Expression; operator: LogicalOperator; @@ -6314,7 +6314,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "MemberExpression"; + type: \"MemberExpression\"; _MemberExpression: void; computed: boolean; object: Expression; @@ -6329,7 +6329,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "MetaProperty"; + type: \"MetaProperty\"; _MetaProperty: void; meta: Node; property: Node; @@ -6343,11 +6343,11 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "MethodDefinition"; + type: \"MethodDefinition\"; _MethodDefinition: void; computed: boolean; key: Node; - kind: "constructor" | "method" | "get" | "set"; + kind: \"constructor\" | \"method\" | \"get\" | \"set\"; static: boolean; value: FunctionExpression; decorators: ?Array; @@ -6361,7 +6361,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "NewExpression"; + type: \"NewExpression\"; _NewExpression: void; arguments: Array; callee: Expression; @@ -6375,7 +6375,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "Noop"; + type: \"Noop\"; _Noop: void; end: number; innerComments: ?Array; @@ -6387,7 +6387,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ObjectExpression"; + type: \"ObjectExpression\"; _ObjectExpression: void; properties: Array; end: number; @@ -6400,7 +6400,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ObjectPattern"; + type: \"ObjectPattern\"; _ObjectPattern: void; properties: Array; typeAnnotation: ?TypeAnnotation; @@ -6414,7 +6414,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "Program"; + type: \"Program\"; _Program: void; body: Array; end: number; @@ -6427,11 +6427,11 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "Property"; + type: \"Property\"; _Property: void; computed: boolean; key: Node; - kind: "init" | "get" | "set"; + kind: \"init\" | \"get\" | \"set\"; method: boolean; shorthand: boolean; value: Node; @@ -6446,7 +6446,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "RestElement"; + type: \"RestElement\"; _RestElement: void; argument: Pattern; typeAnnotation: ?TypeAnnotation; @@ -6460,7 +6460,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ReturnStatement"; + type: \"ReturnStatement\"; _ReturnStatement: void; argument: ?Expression; end: number; @@ -6473,7 +6473,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "SequenceExpression"; + type: \"SequenceExpression\"; _SequenceExpression: void; expression: Array; end: number; @@ -6486,7 +6486,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "SpreadElement"; + type: \"SpreadElement\"; _SpreadElement: void; argument: Expression; end: number; @@ -6499,7 +6499,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "SpreadProperty"; + type: \"SpreadProperty\"; _SpreadProperty: void; argument: Expression; end: number; @@ -6512,7 +6512,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "Super"; + type: \"Super\"; _Super: void; end: number; innerComments: ?Array; @@ -6524,7 +6524,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "SwitchCase"; + type: \"SwitchCase\"; _SwitchCase: void; consequent: Array; test: ?Expression; @@ -6538,7 +6538,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "SwitchStatement"; + type: \"SwitchStatement\"; _SwitchStatement: void; cases: Array; discriminant: Expression; @@ -6553,7 +6553,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TaggedTemplateExpression"; + type: \"TaggedTemplateExpression\"; _TaggedTemplateExpression: void; quasi: TemplateLiteral; tag: Expression; @@ -6567,7 +6567,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TemplateElement"; + type: \"TemplateElement\"; _TemplateElement: void; tail: boolean; value: { cooked: string; raw: string }; @@ -6581,7 +6581,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TemplateLiteral"; + type: \"TemplateLiteral\"; _TemplateLiteral: void; expressions: Array; quasis: Array; @@ -6595,7 +6595,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ThisExpression"; + type: \"ThisExpression\"; _ThisExpression: void; end: number; innerComments: ?Array; @@ -6607,7 +6607,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ThrowStatement"; + type: \"ThrowStatement\"; _ThrowStatement: void; argument: Expression; end: number; @@ -6620,7 +6620,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TryStatement"; + type: \"TryStatement\"; _TryStatement: void; block: BlockStatement; finalizer: ?BlockStatement; @@ -6637,7 +6637,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "UnaryExpression"; + type: \"UnaryExpression\"; _UnaryExpression: void; argument: Expression; operator: UnaryOperator; @@ -6652,7 +6652,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "UpdateExpression"; + type: \"UpdateExpression\"; _UpdateExpression: void; argument: Expression; operator: UpdateOperator; @@ -6667,10 +6667,10 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "VariableDeclaration"; + type: \"VariableDeclaration\"; _VariableDeclaration: void; declarations: Array; - kind: "var" | "let" | "const"; + kind: \"var\" | \"let\" | \"const\"; end: number; innerComments: ?Array; leadingComments: ?Array; @@ -6681,7 +6681,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "VariableDeclarator"; + type: \"VariableDeclarator\"; _VariableDeclarator: void; id: Pattern; init: ?Expression; @@ -6695,7 +6695,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "WhileStatement"; + type: \"WhileStatement\"; _WhileStatement: void; body: Statement; test: Expression; @@ -6709,7 +6709,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "WithStatement"; + type: \"WithStatement\"; _WithStatement: void; body: Statement; object: Expression; @@ -6723,7 +6723,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "YieldExpression"; + type: \"YieldExpression\"; _YieldExpression: void; argument: ?Expression; delegate: boolean; @@ -6737,7 +6737,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ExportAllDeclaration"; + type: \"ExportAllDeclaration\"; _ExportAllDeclaration: void; exported: Node; source: Node; @@ -6751,7 +6751,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ExportDefaultDeclaration"; + type: \"ExportDefaultDeclaration\"; _ExportDefaultDeclaration: void; declaration: Node; end: number; @@ -6764,7 +6764,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ExportNamedDeclaration"; + type: \"ExportNamedDeclaration\"; _ExportNamedDeclaration: void; declaration: Node; source: Literal; @@ -6779,7 +6779,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ExportDefaultSpecifier"; + type: \"ExportDefaultSpecifier\"; _ExportDefaultSpecifier: void; exported: Node; end: number; @@ -6792,7 +6792,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ExportNamespaceSpecifier"; + type: \"ExportNamespaceSpecifier\"; _ExportNamespaceSpecifier: void; exported: Node; end: number; @@ -6805,7 +6805,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ExportSpecifier"; + type: \"ExportSpecifier\"; _ExportSpecifier: void; local: Node; exported: Node; @@ -6819,7 +6819,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "AnyTypeAnnotation"; + type: \"AnyTypeAnnotation\"; _AnyTypeAnnotation: void; end: number; innerComments: ?Array; @@ -6831,7 +6831,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ArrayTypeAnnotation"; + type: \"ArrayTypeAnnotation\"; _ArrayTypeAnnotation: void; elementType: Type; end: number; @@ -6844,7 +6844,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "BooleanLiteralTypeAnnotation"; + type: \"BooleanLiteralTypeAnnotation\"; _BooleanLiteralTypeAnnotation: void; raw: string; value: boolean; @@ -6858,7 +6858,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "BooleanTypeAnnotation"; + type: \"BooleanTypeAnnotation\"; _BooleanTypeAnnotation: void; end: number; innerComments: ?Array; @@ -6870,7 +6870,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ClassImplements"; + type: \"ClassImplements\"; _ClassImplements: void; id: Identifier; typeParameters: ?TypeParameterInstantiation; @@ -6885,7 +6885,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ClassProperty"; + type: \"ClassProperty\"; _ClassProperty: void; computed: boolean; key: Node; @@ -6903,7 +6903,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "DeclareClass"; + type: \"DeclareClass\"; _DeclareClass: void; body: ObjectTypeAnnotation; extends: Array; @@ -6919,7 +6919,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "DeclareFunction"; + type: \"DeclareFunction\"; _DeclareFunction: void; id: Identifier; end: number; @@ -6932,7 +6932,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "DeclareModule"; + type: \"DeclareModule\"; _DeclareModule: void; body: BlockStatement; id: Node; @@ -6946,7 +6946,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "DeclareVariable"; + type: \"DeclareVariable\"; _DeclareVariable: void; id: Identifier; end: number; @@ -6959,7 +6959,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "FunctionTypeAnnotation"; + type: \"FunctionTypeAnnotation\"; _FunctionTypeAnnotation: void; params: Array; rest: ?FunctionTypeParam; @@ -6975,7 +6975,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "FunctionTypeParam"; + type: \"FunctionTypeParam\"; _FunctionTypeParam: void; name: Identifier; optional: boolean; @@ -6990,7 +6990,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "GenericTypeAnnotation"; + type: \"GenericTypeAnnotation\"; _GenericTypeAnnotation: void; id: Node; typeParameters: ?TypeParameterInstantiation; @@ -7004,7 +7004,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "InterfaceExtends"; + type: \"InterfaceExtends\"; _InterfaceExtends: void; id: Identifier; typeParameters: ?TypeParameterInstantiation; @@ -7018,7 +7018,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "InterfaceDeclaration"; + type: \"InterfaceDeclaration\"; _InterfaceDeclaration: void; body: ObjectTypeAnnotation; extends: Array; @@ -7034,7 +7034,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "IntersectionTypeAnnotation"; + type: \"IntersectionTypeAnnotation\"; _IntersectionTypeAnnotation: void; types: Array; end: number; @@ -7047,7 +7047,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "MixedTypeAnnotation"; + type: \"MixedTypeAnnotation\"; _MixedTypeAnnotation: void; end: number; innerComments: ?Array; @@ -7059,7 +7059,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "NullableTypeAnnotation"; + type: \"NullableTypeAnnotation\"; _NullableTypeAnnotation: void; typeAnnotation: Type; end: number; @@ -7072,7 +7072,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "NumberLiteralTypeAnnotation"; + type: \"NumberLiteralTypeAnnotation\"; _NumberLiteralTypeAnnotation: void; raw: string; value: number; @@ -7086,7 +7086,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "NumberTypeAnnotation"; + type: \"NumberTypeAnnotation\"; _NumberTypeAnnotation: void; end: number; innerComments: ?Array; @@ -7098,7 +7098,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "StringLiteralTypeAnnotation"; + type: \"StringLiteralTypeAnnotation\"; _StringLiteralTypeAnnotation: void; raw: string; value: string; @@ -7112,7 +7112,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "StringTypeAnnotation"; + type: \"StringTypeAnnotation\"; _StringTypeAnnotation: void; end: number; innerComments: ?Array; @@ -7124,7 +7124,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TupleTypeAnnotation"; + type: \"TupleTypeAnnotation\"; _TupleTypeAnnotation: void; types: Array; end: number; @@ -7137,7 +7137,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TypeofTypeAnnotation"; + type: \"TypeofTypeAnnotation\"; _TypeofTypeAnnotation: void; argument: Type; end: number; @@ -7150,7 +7150,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TypeAlias"; + type: \"TypeAlias\"; _TypeAlias: void; id: Identifier; right: Type; @@ -7165,7 +7165,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TypeAnnotation"; + type: \"TypeAnnotation\"; _TypeAnnotation: void; typeAnnotation: Type; end: number; @@ -7178,7 +7178,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TypeCastExpression"; + type: \"TypeCastExpression\"; _TypeCastExpression: void; expression: Expression; typeAnnotation: TypeAnnotation; @@ -7192,7 +7192,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TypeParameterDeclaration"; + type: \"TypeParameterDeclaration\"; _TypeParameterDeclaration: void; params: Array; end: number; @@ -7205,7 +7205,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "TypeParameterInstantiation"; + type: \"TypeParameterInstantiation\"; _TypeParameterInstantiation: void; params: Array; end: number; @@ -7218,7 +7218,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ObjectTypeAnnotation"; + type: \"ObjectTypeAnnotation\"; _ObjectTypeAnnotation: void; callProperties: Array; indexers: Array; @@ -7233,7 +7233,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ObjectTypeCallProperty"; + type: \"ObjectTypeCallProperty\"; _ObjectTypeCallProperty: void; static: boolean; value: FunctionTypeAnnotation; @@ -7247,7 +7247,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ObjectTypeIndexer"; + type: \"ObjectTypeIndexer\"; _ObjectTypeIndexer: void; id: Identifier; key: Type; @@ -7262,7 +7262,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "ObjectTypeProperty"; + type: \"ObjectTypeProperty\"; _ObjectTypeProperty: void; key: Node; optional: boolean; @@ -7277,7 +7277,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "QualifiedTypeIdentifier"; + type: \"QualifiedTypeIdentifier\"; _QualifiedTypeIdentifier: void; id: Identifier; qualification: Node; @@ -7291,7 +7291,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "UnionTypeAnnotation"; + type: \"UnionTypeAnnotation\"; _UnionTypeAnnotation: void; types: Array; end: number; @@ -7304,7 +7304,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "VoidTypeAnnotation"; + type: \"VoidTypeAnnotation\"; _VoidTypeAnnotation: void; end: number; innerComments: ?Array; @@ -7316,7 +7316,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXAttribute"; + type: \"JSXAttribute\"; _JSXAttribute: void; name: Node; value: ?Node; @@ -7330,7 +7330,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXClosingElement"; + type: \"JSXClosingElement\"; _JSXClosingElement: void; name: Node; end: number; @@ -7343,7 +7343,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXElement"; + type: \"JSXElement\"; _JSXElement: void; children: Array; closingElement: ?JSXClosingElement; @@ -7358,7 +7358,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXEmptyExpression"; + type: \"JSXEmptyExpression\"; _JSXEmptyExpression: void; end: number; innerComments: ?Array; @@ -7370,7 +7370,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXExpressionContainer"; + type: \"JSXExpressionContainer\"; _JSXExpressionContainer: void; expression: Expression; end: number; @@ -7383,7 +7383,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXIdentifier"; + type: \"JSXIdentifier\"; _JSXIdentifier: void; name: string; end: number; @@ -7396,7 +7396,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXMemberExpression"; + type: \"JSXMemberExpression\"; _JSXMemberExpression: void; computed: boolean; object: Node; @@ -7411,7 +7411,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXNamespacedName"; + type: \"JSXNamespacedName\"; _JSXNamespacedName: void; name: JSXIdentifier; namespace: JSXIdentifier; @@ -7425,7 +7425,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXOpeningElement"; + type: \"JSXOpeningElement\"; _JSXOpeningElement: void; attributes: Array; name: Array; @@ -7440,7 +7440,7 @@ export type Node = { start: number; trailingComments: ?Array } | { - type: "JSXSpreadAttribute"; + type: \"JSXSpreadAttribute\"; _JSXSpreadAttribute: void; argument: Expression; end: number; @@ -7454,7 +7454,7 @@ export type Node = { trailingComments: ?Array }; export type Pattern = { - type: "ArrayPattern"; + type: \"ArrayPattern\"; _ArrayPattern: void; elements: Array; typeAnnotation: ?TypeAnnotation; @@ -7468,7 +7468,7 @@ export type Pattern = { start: number; trailingComments: ?Array } | { - type: "AssignmentPattern"; + type: \"AssignmentPattern\"; _AssignmentPattern: void; left: Pattern; right: Expression; @@ -7482,7 +7482,7 @@ export type Pattern = { start: number; trailingComments: ?Array } | { - type: "Identifier"; + type: \"Identifier\"; _Identifier: void; name: string; typeAnnotation: ?TypeAnnotation; @@ -7496,7 +7496,7 @@ export type Pattern = { start: number; trailingComments: ?Array } | { - type: "ObjectPattern"; + type: \"ObjectPattern\"; _ObjectPattern: void; properties: Array; typeAnnotation: ?TypeAnnotation; @@ -7510,7 +7510,7 @@ export type Pattern = { start: number; trailingComments: ?Array } | { - type: "RestElement"; + type: \"RestElement\"; _RestElement: void; argument: Pattern; typeAnnotation: ?TypeAnnotation; @@ -7525,7 +7525,7 @@ export type Pattern = { trailingComments: ?Array }; export type Statement = { - type: "BlockStatement"; + type: \"BlockStatement\"; _BlockStatement: void; body: Array; end: number; @@ -7538,7 +7538,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "BreakStatement"; + type: \"BreakStatement\"; _BreakStatement: void; label: ?Identifier; end: number; @@ -7551,7 +7551,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "ContinueStatement"; + type: \"ContinueStatement\"; _ContinueStatement: void; label: ?Identifier; end: number; @@ -7564,7 +7564,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "DoWhileStatement"; + type: \"DoWhileStatement\"; _DoWhileStatement: void; body: Statement; test: Expression; @@ -7578,7 +7578,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "EmptyStatement"; + type: \"EmptyStatement\"; _EmptyStatement: void; end: number; innerComments: ?Array; @@ -7590,7 +7590,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "ExpressionStatement"; + type: \"ExpressionStatement\"; _ExpressionStatement: void; expression: Expression; end: number; @@ -7603,7 +7603,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "ForInStatement"; + type: \"ForInStatement\"; _ForInStatement: void; body: Statement; left: Node; @@ -7618,7 +7618,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "ForOfStatement"; + type: \"ForOfStatement\"; _ForOfStatement: void; body: Statement; left: Node; @@ -7633,7 +7633,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "ForStatement"; + type: \"ForStatement\"; _ForStatement: void; init: ?Node; test: ?Expression; @@ -7649,7 +7649,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "IfStatement"; + type: \"IfStatement\"; _IfStatement: void; alternate: ?Statement; consequent: Statement; @@ -7664,7 +7664,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "LabeledStatement"; + type: \"LabeledStatement\"; _LabeledStatement: void; body: Statement; label: Identifier; @@ -7678,7 +7678,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "ReturnStatement"; + type: \"ReturnStatement\"; _ReturnStatement: void; argument: ?Expression; end: number; @@ -7691,7 +7691,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "SwitchStatement"; + type: \"SwitchStatement\"; _SwitchStatement: void; cases: Array; discriminant: Expression; @@ -7706,7 +7706,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "ThrowStatement"; + type: \"ThrowStatement\"; _ThrowStatement: void; argument: Expression; end: number; @@ -7719,7 +7719,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "TryStatement"; + type: \"TryStatement\"; _TryStatement: void; block: BlockStatement; finalizer: ?BlockStatement; @@ -7736,7 +7736,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "WhileStatement"; + type: \"WhileStatement\"; _WhileStatement: void; body: Statement; test: Expression; @@ -7750,7 +7750,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "WithStatement"; + type: \"WithStatement\"; _WithStatement: void; body: Statement; object: Expression; @@ -7764,7 +7764,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "DeclareClass"; + type: \"DeclareClass\"; _DeclareClass: void; body: ObjectTypeAnnotation; extends: Array; @@ -7780,7 +7780,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "DeclareFunction"; + type: \"DeclareFunction\"; _DeclareFunction: void; id: Identifier; end: number; @@ -7793,7 +7793,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "DeclareModule"; + type: \"DeclareModule\"; _DeclareModule: void; body: BlockStatement; id: Node; @@ -7807,7 +7807,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "DeclareVariable"; + type: \"DeclareVariable\"; _DeclareVariable: void; id: Identifier; end: number; @@ -7820,7 +7820,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "InterfaceDeclaration"; + type: \"InterfaceDeclaration\"; _InterfaceDeclaration: void; body: ObjectTypeAnnotation; extends: Array; @@ -7836,7 +7836,7 @@ export type Statement = { start: number; trailingComments: ?Array } | { - type: "TypeAlias"; + type: \"TypeAlias\"; _TypeAlias: void; id: Identifier; right: Type; @@ -7852,7 +7852,7 @@ export type Statement = { trailingComments: ?Array }; export type Type = { - type: "AnyTypeAnnotation"; + type: \"AnyTypeAnnotation\"; _AnyTypeAnnotation: void; end: number; innerComments: ?Array; @@ -7864,7 +7864,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "ArrayTypeAnnotation"; + type: \"ArrayTypeAnnotation\"; _ArrayTypeAnnotation: void; elementType: Type; end: number; @@ -7877,7 +7877,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "BooleanLiteralTypeAnnotation"; + type: \"BooleanLiteralTypeAnnotation\"; _BooleanLiteralTypeAnnotation: void; raw: string; value: boolean; @@ -7891,7 +7891,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "BooleanTypeAnnotation"; + type: \"BooleanTypeAnnotation\"; _BooleanTypeAnnotation: void; end: number; innerComments: ?Array; @@ -7903,7 +7903,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "FunctionTypeAnnotation"; + type: \"FunctionTypeAnnotation\"; _FunctionTypeAnnotation: void; params: Array; rest: ?FunctionTypeParam; @@ -7919,7 +7919,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "GenericTypeAnnotation"; + type: \"GenericTypeAnnotation\"; _GenericTypeAnnotation: void; id: Node; typeParameters: ?TypeParameterInstantiation; @@ -7933,7 +7933,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "IntersectionTypeAnnotation"; + type: \"IntersectionTypeAnnotation\"; _IntersectionTypeAnnotation: void; types: Array; end: number; @@ -7946,7 +7946,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "MixedTypeAnnotation"; + type: \"MixedTypeAnnotation\"; _MixedTypeAnnotation: void; end: number; innerComments: ?Array; @@ -7958,7 +7958,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "NullableTypeAnnotation"; + type: \"NullableTypeAnnotation\"; _NullableTypeAnnotation: void; typeAnnotation: Type; end: number; @@ -7971,7 +7971,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "NumberLiteralTypeAnnotation"; + type: \"NumberLiteralTypeAnnotation\"; _NumberLiteralTypeAnnotation: void; raw: string; value: number; @@ -7985,7 +7985,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "NumberTypeAnnotation"; + type: \"NumberTypeAnnotation\"; _NumberTypeAnnotation: void; end: number; innerComments: ?Array; @@ -7997,7 +7997,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "StringLiteralTypeAnnotation"; + type: \"StringLiteralTypeAnnotation\"; _StringLiteralTypeAnnotation: void; raw: string; value: string; @@ -8011,7 +8011,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "StringTypeAnnotation"; + type: \"StringTypeAnnotation\"; _StringTypeAnnotation: void; end: number; innerComments: ?Array; @@ -8023,7 +8023,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "TupleTypeAnnotation"; + type: \"TupleTypeAnnotation\"; _TupleTypeAnnotation: void; types: Array; end: number; @@ -8036,7 +8036,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "ObjectTypeAnnotation"; + type: \"ObjectTypeAnnotation\"; _ObjectTypeAnnotation: void; callProperties: Array; indexers: Array; @@ -8051,7 +8051,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "UnionTypeAnnotation"; + type: \"UnionTypeAnnotation\"; _UnionTypeAnnotation: void; types: Array; end: number; @@ -8064,7 +8064,7 @@ export type Type = { start: number; trailingComments: ?Array } | { - type: "VoidTypeAnnotation"; + type: \"VoidTypeAnnotation\"; _VoidTypeAnnotation: void; end: number; innerComments: ?Array; @@ -8077,7 +8077,7 @@ export type Type = { trailingComments: ?Array }; export type CommentLine = { - type: "CommentLine"; + type: \"CommentLine\"; _CommentLine: void; value: string; end: number; @@ -8088,7 +8088,7 @@ export type CommentLine = { start: number }; export type CommentBlock = { - type: "CommentBlock"; + type: \"CommentBlock\"; _CommentBlock: void; value: string; end: number; @@ -8099,7 +8099,7 @@ export type CommentBlock = { start: number }; export type ArrayExpression = { - type: "ArrayExpression"; + type: \"ArrayExpression\"; _ArrayExpression: void; elements: Array; end: number; @@ -8113,7 +8113,7 @@ export type ArrayExpression = { trailingComments: ?Array }; export type ArrayPattern = { - type: "ArrayPattern"; + type: \"ArrayPattern\"; _ArrayPattern: void; elements: Array; typeAnnotation: ?TypeAnnotation; @@ -8128,7 +8128,7 @@ export type ArrayPattern = { trailingComments: ?Array }; export type ArrowFunctionExpression = { - type: "ArrowFunctionExpression"; + type: \"ArrowFunctionExpression\"; _ArrowFunctionExpression: void; body: Node; id: ?Identifier; @@ -8150,9 +8150,9 @@ export type ArrowFunctionExpression = { returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration }; -type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&="; +type AssignmentOperator = \"=\" | \"+=\" | \"-=\" | \"*=\" | \"/=\" | \"%=\" | \"<<=\" | \">>=\" | \">>>=\" | \"|=\" | \"^=\" | \"&=\"; export type AssignmentExpression = { - type: "AssignmentExpression"; + type: \"AssignmentExpression\"; _AssignmentExpression: void; left: Pattern; operator: AssignmentOperator; @@ -8168,7 +8168,7 @@ export type AssignmentExpression = { trailingComments: ?Array }; export type AssignmentPattern = { - type: "AssignmentPattern"; + type: \"AssignmentPattern\"; _AssignmentPattern: void; left: Pattern; right: Expression; @@ -8183,7 +8183,7 @@ export type AssignmentPattern = { trailingComments: ?Array }; export type AwaitExpression = { - type: "AwaitExpression"; + type: \"AwaitExpression\"; _AwaitExpression: void; all: boolean; argument: ?Expression; @@ -8197,9 +8197,9 @@ export type AwaitExpression = { start: number; trailingComments: ?Array }; -type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "&" | "|" | "^" | "in" | "instanceof" | ".."; +type BinaryOperator = \"==\" | \"!=\" | \"===\" | \"!==\" | \"<\" | \"<=\" | \">\" | \">=\" | \"<<\" | \">>\" | \">>>\" | \"+\" | \"-\" | \"*\" | \"/\" | \"%\" | \"&\" | \"|\" | \"^\" | \"in\" | \"instanceof\" | \"..\"; export type BinaryExpression = { - type: "BinaryExpression"; + type: \"BinaryExpression\"; _BinaryExpression: void; left: Expression; operator: BinaryOperator; @@ -8215,7 +8215,7 @@ export type BinaryExpression = { trailingComments: ?Array }; export type BindExpression = { - type: "BindExpression"; + type: \"BindExpression\"; _BindExpression: void; callee: Node; object: Node; @@ -8230,7 +8230,7 @@ export type BindExpression = { trailingComments: ?Array }; export type BlockStatement = { - type: "BlockStatement"; + type: \"BlockStatement\"; _BlockStatement: void; body: Array; end: number; @@ -8244,7 +8244,7 @@ export type BlockStatement = { trailingComments: ?Array }; export type BreakStatement = { - type: "BreakStatement"; + type: \"BreakStatement\"; _BreakStatement: void; label: ?Identifier; end: number; @@ -8258,7 +8258,7 @@ export type BreakStatement = { trailingComments: ?Array }; export type CallExpression = { - type: "CallExpression"; + type: \"CallExpression\"; _CallExpression: void; arguments: Array; callee: Expression; @@ -8273,7 +8273,7 @@ export type CallExpression = { trailingComments: ?Array }; export type CatchClause = { - type: "CatchClause"; + type: \"CatchClause\"; _CatchClause: void; body: BlockStatement; param: Pattern; @@ -8288,7 +8288,7 @@ export type CatchClause = { trailingComments: ?Array }; export type ClassBody = { - type: "ClassBody"; + type: \"ClassBody\"; _ClassBody: void; body: Array; end: number; @@ -8302,7 +8302,7 @@ export type ClassBody = { trailingComments: ?Array }; export type ClassDeclaration = { - type: "ClassDeclaration"; + type: \"ClassDeclaration\"; _ClassDeclaration: void; body: ClassBody; id: ?Identifier; @@ -8321,7 +8321,7 @@ export type ClassDeclaration = { trailingComments: ?Array }; export type ClassExpression = { - type: "ClassExpression"; + type: \"ClassExpression\"; _ClassExpression: void; body: ClassBody; id: ?Identifier; @@ -8340,7 +8340,7 @@ export type ClassExpression = { trailingComments: ?Array }; export type ComprehensionBlock = { - type: "ComprehensionBlock"; + type: \"ComprehensionBlock\"; _ComprehensionBlock: void; each: boolean; left: Pattern; @@ -8356,7 +8356,7 @@ export type ComprehensionBlock = { trailingComments: ?Array }; export type ComprehensionExpression = { - type: "ComprehensionExpression"; + type: \"ComprehensionExpression\"; _ComprehensionExpression: void; body: Expression; blocks: Array; @@ -8372,7 +8372,7 @@ export type ComprehensionExpression = { trailingComments: ?Array }; export type ConditionalExpression = { - type: "ConditionalExpression"; + type: \"ConditionalExpression\"; _ConditionalExpression: void; alternate: Expression; consequent: Expression; @@ -8388,7 +8388,7 @@ export type ConditionalExpression = { trailingComments: ?Array }; export type ContinueStatement = { - type: "ContinueStatement"; + type: \"ContinueStatement\"; _ContinueStatement: void; label: ?Identifier; end: number; @@ -8402,7 +8402,7 @@ export type ContinueStatement = { trailingComments: ?Array }; export type Decorator = { - type: "Decorator"; + type: \"Decorator\"; _Decorator: void; expression: Expression; end: number; @@ -8416,7 +8416,7 @@ export type Decorator = { trailingComments: ?Array }; export type DebuggerStatement = { - type: "DebuggerStatement"; + type: \"DebuggerStatement\"; _DebuggerStatement: void; end: number; innerComments: ?Array; @@ -8429,7 +8429,7 @@ export type DebuggerStatement = { trailingComments: ?Array }; export type DoWhileStatement = { - type: "DoWhileStatement"; + type: \"DoWhileStatement\"; _DoWhileStatement: void; body: Statement; test: Expression; @@ -8444,7 +8444,7 @@ export type DoWhileStatement = { trailingComments: ?Array }; export type DoExpression = { - type: "DoExpression"; + type: \"DoExpression\"; _DoExpression: void; body: Statement; end: number; @@ -8458,7 +8458,7 @@ export type DoExpression = { trailingComments: ?Array }; export type EmptyStatement = { - type: "EmptyStatement"; + type: \"EmptyStatement\"; _EmptyStatement: void; end: number; innerComments: ?Array; @@ -8471,7 +8471,7 @@ export type EmptyStatement = { trailingComments: ?Array }; export type ExpressionStatement = { - type: "ExpressionStatement"; + type: \"ExpressionStatement\"; _ExpressionStatement: void; expression: Expression; end: number; @@ -8485,7 +8485,7 @@ export type ExpressionStatement = { trailingComments: ?Array }; export type File = { - type: "File"; + type: \"File\"; _File: void; program: Program; end: number; @@ -8499,7 +8499,7 @@ export type File = { trailingComments: ?Array }; export type ForInStatement = { - type: "ForInStatement"; + type: \"ForInStatement\"; _ForInStatement: void; body: Statement; left: Node; @@ -8515,7 +8515,7 @@ export type ForInStatement = { trailingComments: ?Array }; export type ForOfStatement = { - type: "ForOfStatement"; + type: \"ForOfStatement\"; _ForOfStatement: void; body: Statement; left: Node; @@ -8531,7 +8531,7 @@ export type ForOfStatement = { trailingComments: ?Array }; export type ForStatement = { - type: "ForStatement"; + type: \"ForStatement\"; _ForStatement: void; init: ?Node; test: ?Expression; @@ -8548,7 +8548,7 @@ export type ForStatement = { trailingComments: ?Array }; export type FunctionDeclaration = { - type: "FunctionDeclaration"; + type: \"FunctionDeclaration\"; _FunctionDeclaration: void; body: BlockStatement; id: Identifier; @@ -8571,7 +8571,7 @@ export type FunctionDeclaration = { typeParameters: ?TypeParameterDeclaration }; export type FunctionExpression = { - type: "FunctionExpression"; + type: \"FunctionExpression\"; _FunctionExpression: void; body: BlockStatement; id: ?Identifier; @@ -8594,7 +8594,7 @@ export type FunctionExpression = { typeParameters: ?TypeParameterDeclaration }; export type Identifier = { - type: "Identifier"; + type: \"Identifier\"; _Identifier: void; name: string; typeAnnotation: ?TypeAnnotation; @@ -8609,7 +8609,7 @@ export type Identifier = { trailingComments: ?Array }; export type IfStatement = { - type: "IfStatement"; + type: \"IfStatement\"; _IfStatement: void; alternate: ?Statement; consequent: Statement; @@ -8625,7 +8625,7 @@ export type IfStatement = { trailingComments: ?Array }; export type ImportDefaultSpecifier = { - type: "ImportDefaultSpecifier"; + type: \"ImportDefaultSpecifier\"; _ImportDefaultSpecifier: void; local: Node; end: number; @@ -8639,7 +8639,7 @@ export type ImportDefaultSpecifier = { trailingComments: ?Array }; export type ImportNamespaceSpecifier = { - type: "ImportNamespaceSpecifier"; + type: \"ImportNamespaceSpecifier\"; _ImportNamespaceSpecifier: void; local: Node; end: number; @@ -8653,7 +8653,7 @@ export type ImportNamespaceSpecifier = { trailingComments: ?Array }; export type ImportDeclaration = { - type: "ImportDeclaration"; + type: \"ImportDeclaration\"; _ImportDeclaration: void; specifiers: Array; source: Literal; @@ -8668,7 +8668,7 @@ export type ImportDeclaration = { trailingComments: ?Array }; export type ImportSpecifier = { - type: "ImportSpecifier"; + type: \"ImportSpecifier\"; _ImportSpecifier: void; imported: Node; local: Node; @@ -8683,7 +8683,7 @@ export type ImportSpecifier = { trailingComments: ?Array }; export type LabeledStatement = { - type: "LabeledStatement"; + type: \"LabeledStatement\"; _LabeledStatement: void; body: Statement; label: Identifier; @@ -8698,7 +8698,7 @@ export type LabeledStatement = { trailingComments: ?Array }; export type Literal = { - type: "Literal"; + type: \"Literal\"; _Literal: void; raw: string; regex: ?{ pattern: string; flags: string }; @@ -8713,9 +8713,9 @@ export type Literal = { start: number; trailingComments: ?Array }; -type LogicalOperator = "||" | "&&"; +type LogicalOperator = \"||\" | \"&&\"; export type LogicalExpression = { - type: "LogicalExpression"; + type: \"LogicalExpression\"; _LogicalExpression: void; left: Expression; operator: LogicalOperator; @@ -8731,7 +8731,7 @@ export type LogicalExpression = { trailingComments: ?Array }; export type MemberExpression = { - type: "MemberExpression"; + type: \"MemberExpression\"; _MemberExpression: void; computed: boolean; object: Expression; @@ -8747,7 +8747,7 @@ export type MemberExpression = { trailingComments: ?Array }; export type MetaProperty = { - type: "MetaProperty"; + type: \"MetaProperty\"; _MetaProperty: void; meta: Node; property: Node; @@ -8762,11 +8762,11 @@ export type MetaProperty = { trailingComments: ?Array }; export type MethodDefinition = { - type: "MethodDefinition"; + type: \"MethodDefinition\"; _MethodDefinition: void; computed: boolean; key: Node; - kind: "constructor" | "method" | "get" | "set"; + kind: \"constructor\" | \"method\" | \"get\" | \"set\"; static: boolean; value: FunctionExpression; decorators: ?Array; @@ -8781,7 +8781,7 @@ export type MethodDefinition = { trailingComments: ?Array }; export type NewExpression = { - type: "NewExpression"; + type: \"NewExpression\"; _NewExpression: void; arguments: Array; callee: Expression; @@ -8796,7 +8796,7 @@ export type NewExpression = { trailingComments: ?Array }; export type Noop = { - type: "Noop"; + type: \"Noop\"; _Noop: void; end: number; innerComments: ?Array; @@ -8809,7 +8809,7 @@ export type Noop = { trailingComments: ?Array }; export type ObjectExpression = { - type: "ObjectExpression"; + type: \"ObjectExpression\"; _ObjectExpression: void; properties: Array; end: number; @@ -8823,7 +8823,7 @@ export type ObjectExpression = { trailingComments: ?Array }; export type ObjectPattern = { - type: "ObjectPattern"; + type: \"ObjectPattern\"; _ObjectPattern: void; properties: Array; typeAnnotation: ?TypeAnnotation; @@ -8838,7 +8838,7 @@ export type ObjectPattern = { trailingComments: ?Array }; export type Program = { - type: "Program"; + type: \"Program\"; _Program: void; body: Array; end: number; @@ -8852,11 +8852,11 @@ export type Program = { trailingComments: ?Array }; export type Property = { - type: "Property"; + type: \"Property\"; _Property: void; computed: boolean; key: Node; - kind: "init" | "get" | "set"; + kind: \"init\" | \"get\" | \"set\"; method: boolean; shorthand: boolean; value: Node; @@ -8872,7 +8872,7 @@ export type Property = { trailingComments: ?Array }; export type RestElement = { - type: "RestElement"; + type: \"RestElement\"; _RestElement: void; argument: Pattern; typeAnnotation: ?TypeAnnotation; @@ -8887,7 +8887,7 @@ export type RestElement = { trailingComments: ?Array }; export type ReturnStatement = { - type: "ReturnStatement"; + type: \"ReturnStatement\"; _ReturnStatement: void; argument: ?Expression; end: number; @@ -8901,7 +8901,7 @@ export type ReturnStatement = { trailingComments: ?Array }; export type SequenceExpression = { - type: "SequenceExpression"; + type: \"SequenceExpression\"; _SequenceExpression: void; expression: Array; end: number; @@ -8915,7 +8915,7 @@ export type SequenceExpression = { trailingComments: ?Array }; export type SpreadElement = { - type: "SpreadElement"; + type: \"SpreadElement\"; _SpreadElement: void; argument: Expression; end: number; @@ -8929,7 +8929,7 @@ export type SpreadElement = { trailingComments: ?Array }; export type SpreadProperty = { - type: "SpreadProperty"; + type: \"SpreadProperty\"; _SpreadProperty: void; argument: Expression; end: number; @@ -8943,7 +8943,7 @@ export type SpreadProperty = { trailingComments: ?Array }; export type Super = { - type: "Super"; + type: \"Super\"; _Super: void; end: number; innerComments: ?Array; @@ -8956,7 +8956,7 @@ export type Super = { trailingComments: ?Array }; export type SwitchCase = { - type: "SwitchCase"; + type: \"SwitchCase\"; _SwitchCase: void; consequent: Array; test: ?Expression; @@ -8971,7 +8971,7 @@ export type SwitchCase = { trailingComments: ?Array }; export type SwitchStatement = { - type: "SwitchStatement"; + type: \"SwitchStatement\"; _SwitchStatement: void; cases: Array; discriminant: Expression; @@ -8987,7 +8987,7 @@ export type SwitchStatement = { trailingComments: ?Array }; export type TaggedTemplateExpression = { - type: "TaggedTemplateExpression"; + type: \"TaggedTemplateExpression\"; _TaggedTemplateExpression: void; quasi: TemplateLiteral; tag: Expression; @@ -9002,7 +9002,7 @@ export type TaggedTemplateExpression = { trailingComments: ?Array }; export type TemplateElement = { - type: "TemplateElement"; + type: \"TemplateElement\"; _TemplateElement: void; tail: boolean; value: { cooked: string; raw: string }; @@ -9017,7 +9017,7 @@ export type TemplateElement = { trailingComments: ?Array }; export type TemplateLiteral = { - type: "TemplateLiteral"; + type: \"TemplateLiteral\"; _TemplateLiteral: void; expressions: Array; quasis: Array; @@ -9032,7 +9032,7 @@ export type TemplateLiteral = { trailingComments: ?Array }; export type ThisExpression = { - type: "ThisExpression"; + type: \"ThisExpression\"; _ThisExpression: void; end: number; innerComments: ?Array; @@ -9045,7 +9045,7 @@ export type ThisExpression = { trailingComments: ?Array }; export type ThrowStatement = { - type: "ThrowStatement"; + type: \"ThrowStatement\"; _ThrowStatement: void; argument: Expression; end: number; @@ -9059,7 +9059,7 @@ export type ThrowStatement = { trailingComments: ?Array }; export type TryStatement = { - type: "TryStatement"; + type: \"TryStatement\"; _TryStatement: void; block: BlockStatement; finalizer: ?BlockStatement; @@ -9076,9 +9076,9 @@ export type TryStatement = { start: number; trailingComments: ?Array }; -type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; +type UnaryOperator = \"-\" | \"+\" | \"!\" | \"~\" | \"typeof\" | \"void\" | \"delete\"; export type UnaryExpression = { - type: "UnaryExpression"; + type: \"UnaryExpression\"; _UnaryExpression: void; argument: Expression; operator: UnaryOperator; @@ -9093,9 +9093,9 @@ export type UnaryExpression = { start: number; trailingComments: ?Array }; -type UpdateOperator = "++" | "--"; +type UpdateOperator = \"++\" | \"--\"; export type UpdateExpression = { - type: "UpdateExpression"; + type: \"UpdateExpression\"; _UpdateExpression: void; argument: Expression; operator: UpdateOperator; @@ -9111,10 +9111,10 @@ export type UpdateExpression = { trailingComments: ?Array }; export type VariableDeclaration = { - type: "VariableDeclaration"; + type: \"VariableDeclaration\"; _VariableDeclaration: void; declarations: Array; - kind: "var" | "let" | "const"; + kind: \"var\" | \"let\" | \"const\"; end: number; innerComments: ?Array; leadingComments: ?Array; @@ -9126,7 +9126,7 @@ export type VariableDeclaration = { trailingComments: ?Array }; export type VariableDeclarator = { - type: "VariableDeclarator"; + type: \"VariableDeclarator\"; _VariableDeclarator: void; id: Pattern; init: ?Expression; @@ -9141,7 +9141,7 @@ export type VariableDeclarator = { trailingComments: ?Array }; export type WhileStatement = { - type: "WhileStatement"; + type: \"WhileStatement\"; _WhileStatement: void; body: Statement; test: Expression; @@ -9156,7 +9156,7 @@ export type WhileStatement = { trailingComments: ?Array }; export type WithStatement = { - type: "WithStatement"; + type: \"WithStatement\"; _WithStatement: void; body: Statement; object: Expression; @@ -9171,7 +9171,7 @@ export type WithStatement = { trailingComments: ?Array }; export type YieldExpression = { - type: "YieldExpression"; + type: \"YieldExpression\"; _YieldExpression: void; argument: ?Expression; delegate: boolean; @@ -9186,7 +9186,7 @@ export type YieldExpression = { trailingComments: ?Array }; export type ExportAllDeclaration = { - type: "ExportAllDeclaration"; + type: \"ExportAllDeclaration\"; _ExportAllDeclaration: void; exported: Node; source: Node; @@ -9201,7 +9201,7 @@ export type ExportAllDeclaration = { trailingComments: ?Array }; export type ExportDefaultDeclaration = { - type: "ExportDefaultDeclaration"; + type: \"ExportDefaultDeclaration\"; _ExportDefaultDeclaration: void; declaration: Node; end: number; @@ -9215,7 +9215,7 @@ export type ExportDefaultDeclaration = { trailingComments: ?Array }; export type ExportNamedDeclaration = { - type: "ExportNamedDeclaration"; + type: \"ExportNamedDeclaration\"; _ExportNamedDeclaration: void; declaration: Node; source: Literal; @@ -9231,7 +9231,7 @@ export type ExportNamedDeclaration = { trailingComments: ?Array }; export type ExportDefaultSpecifier = { - type: "ExportDefaultSpecifier"; + type: \"ExportDefaultSpecifier\"; _ExportDefaultSpecifier: void; exported: Node; end: number; @@ -9245,7 +9245,7 @@ export type ExportDefaultSpecifier = { trailingComments: ?Array }; export type ExportNamespaceSpecifier = { - type: "ExportNamespaceSpecifier"; + type: \"ExportNamespaceSpecifier\"; _ExportNamespaceSpecifier: void; exported: Node; end: number; @@ -9259,7 +9259,7 @@ export type ExportNamespaceSpecifier = { trailingComments: ?Array }; export type ExportSpecifier = { - type: "ExportSpecifier"; + type: \"ExportSpecifier\"; _ExportSpecifier: void; local: Node; exported: Node; @@ -9274,7 +9274,7 @@ export type ExportSpecifier = { trailingComments: ?Array }; export type AnyTypeAnnotation = { - type: "AnyTypeAnnotation"; + type: \"AnyTypeAnnotation\"; _AnyTypeAnnotation: void; end: number; innerComments: ?Array; @@ -9287,7 +9287,7 @@ export type AnyTypeAnnotation = { trailingComments: ?Array }; export type ArrayTypeAnnotation = { - type: "ArrayTypeAnnotation"; + type: \"ArrayTypeAnnotation\"; _ArrayTypeAnnotation: void; elementType: Type; end: number; @@ -9301,7 +9301,7 @@ export type ArrayTypeAnnotation = { trailingComments: ?Array }; export type BooleanLiteralTypeAnnotation = { - type: "BooleanLiteralTypeAnnotation"; + type: \"BooleanLiteralTypeAnnotation\"; _BooleanLiteralTypeAnnotation: void; raw: string; value: boolean; @@ -9316,7 +9316,7 @@ export type BooleanLiteralTypeAnnotation = { trailingComments: ?Array }; export type BooleanTypeAnnotation = { - type: "BooleanTypeAnnotation"; + type: \"BooleanTypeAnnotation\"; _BooleanTypeAnnotation: void; end: number; innerComments: ?Array; @@ -9329,7 +9329,7 @@ export type BooleanTypeAnnotation = { trailingComments: ?Array }; export type ClassImplements = { - type: "ClassImplements"; + type: \"ClassImplements\"; _ClassImplements: void; id: Identifier; typeParameters: ?TypeParameterInstantiation; @@ -9345,7 +9345,7 @@ export type ClassImplements = { trailingComments: ?Array }; export type ClassProperty = { - type: "ClassProperty"; + type: \"ClassProperty\"; _ClassProperty: void; computed: boolean; key: Node; @@ -9364,7 +9364,7 @@ export type ClassProperty = { trailingComments: ?Array }; export type DeclareClass = { - type: "DeclareClass"; + type: \"DeclareClass\"; _DeclareClass: void; body: ObjectTypeAnnotation; extends: Array; @@ -9381,7 +9381,7 @@ export type DeclareClass = { trailingComments: ?Array }; export type DeclareFunction = { - type: "DeclareFunction"; + type: \"DeclareFunction\"; _DeclareFunction: void; id: Identifier; end: number; @@ -9395,7 +9395,7 @@ export type DeclareFunction = { trailingComments: ?Array }; export type DeclareModule = { - type: "DeclareModule"; + type: \"DeclareModule\"; _DeclareModule: void; body: BlockStatement; id: Node; @@ -9410,7 +9410,7 @@ export type DeclareModule = { trailingComments: ?Array }; export type DeclareVariable = { - type: "DeclareVariable"; + type: \"DeclareVariable\"; _DeclareVariable: void; id: Identifier; end: number; @@ -9424,7 +9424,7 @@ export type DeclareVariable = { trailingComments: ?Array }; export type FunctionTypeAnnotation = { - type: "FunctionTypeAnnotation"; + type: \"FunctionTypeAnnotation\"; _FunctionTypeAnnotation: void; params: Array; rest: ?FunctionTypeParam; @@ -9441,7 +9441,7 @@ export type FunctionTypeAnnotation = { trailingComments: ?Array }; export type FunctionTypeParam = { - type: "FunctionTypeParam"; + type: \"FunctionTypeParam\"; _FunctionTypeParam: void; name: Identifier; optional: boolean; @@ -9457,7 +9457,7 @@ export type FunctionTypeParam = { trailingComments: ?Array }; export type GenericTypeAnnotation = { - type: "GenericTypeAnnotation"; + type: \"GenericTypeAnnotation\"; _GenericTypeAnnotation: void; id: Node; typeParameters: ?TypeParameterInstantiation; @@ -9472,7 +9472,7 @@ export type GenericTypeAnnotation = { trailingComments: ?Array }; export type InterfaceExtends = { - type: "InterfaceExtends"; + type: \"InterfaceExtends\"; _InterfaceExtends: void; id: Identifier; typeParameters: ?TypeParameterInstantiation; @@ -9487,7 +9487,7 @@ export type InterfaceExtends = { trailingComments: ?Array }; export type InterfaceDeclaration = { - type: "InterfaceDeclaration"; + type: \"InterfaceDeclaration\"; _InterfaceDeclaration: void; body: ObjectTypeAnnotation; extends: Array; @@ -9504,7 +9504,7 @@ export type InterfaceDeclaration = { trailingComments: ?Array }; export type IntersectionTypeAnnotation = { - type: "IntersectionTypeAnnotation"; + type: \"IntersectionTypeAnnotation\"; _IntersectionTypeAnnotation: void; types: Array; end: number; @@ -9518,7 +9518,7 @@ export type IntersectionTypeAnnotation = { trailingComments: ?Array }; export type MixedTypeAnnotation = { - type: "MixedTypeAnnotation"; + type: \"MixedTypeAnnotation\"; _MixedTypeAnnotation: void; end: number; innerComments: ?Array; @@ -9531,7 +9531,7 @@ export type MixedTypeAnnotation = { trailingComments: ?Array }; export type NullableTypeAnnotation = { - type: "NullableTypeAnnotation"; + type: \"NullableTypeAnnotation\"; _NullableTypeAnnotation: void; typeAnnotation: Type; end: number; @@ -9545,7 +9545,7 @@ export type NullableTypeAnnotation = { trailingComments: ?Array }; export type NumberLiteralTypeAnnotation = { - type: "NumberLiteralTypeAnnotation"; + type: \"NumberLiteralTypeAnnotation\"; _NumberLiteralTypeAnnotation: void; raw: string; value: number; @@ -9560,7 +9560,7 @@ export type NumberLiteralTypeAnnotation = { trailingComments: ?Array }; export type NumberTypeAnnotation = { - type: "NumberTypeAnnotation"; + type: \"NumberTypeAnnotation\"; _NumberTypeAnnotation: void; end: number; innerComments: ?Array; @@ -9573,7 +9573,7 @@ export type NumberTypeAnnotation = { trailingComments: ?Array }; export type StringLiteralTypeAnnotation = { - type: "StringLiteralTypeAnnotation"; + type: \"StringLiteralTypeAnnotation\"; _StringLiteralTypeAnnotation: void; raw: string; value: string; @@ -9588,7 +9588,7 @@ export type StringLiteralTypeAnnotation = { trailingComments: ?Array }; export type StringTypeAnnotation = { - type: "StringTypeAnnotation"; + type: \"StringTypeAnnotation\"; _StringTypeAnnotation: void; end: number; innerComments: ?Array; @@ -9601,7 +9601,7 @@ export type StringTypeAnnotation = { trailingComments: ?Array }; export type TupleTypeAnnotation = { - type: "TupleTypeAnnotation"; + type: \"TupleTypeAnnotation\"; _TupleTypeAnnotation: void; types: Array; end: number; @@ -9615,7 +9615,7 @@ export type TupleTypeAnnotation = { trailingComments: ?Array }; export type TypeofTypeAnnotation = { - type: "TypeofTypeAnnotation"; + type: \"TypeofTypeAnnotation\"; _TypeofTypeAnnotation: void; argument: Type; end: number; @@ -9629,7 +9629,7 @@ export type TypeofTypeAnnotation = { trailingComments: ?Array }; export type TypeAlias = { - type: "TypeAlias"; + type: \"TypeAlias\"; _TypeAlias: void; id: Identifier; right: Type; @@ -9645,7 +9645,7 @@ export type TypeAlias = { trailingComments: ?Array }; export type TypeAnnotation = { - type: "TypeAnnotation"; + type: \"TypeAnnotation\"; _TypeAnnotation: void; typeAnnotation: Type; end: number; @@ -9659,7 +9659,7 @@ export type TypeAnnotation = { trailingComments: ?Array }; export type TypeCastExpression = { - type: "TypeCastExpression"; + type: \"TypeCastExpression\"; _TypeCastExpression: void; expression: Expression; typeAnnotation: TypeAnnotation; @@ -9674,7 +9674,7 @@ export type TypeCastExpression = { trailingComments: ?Array }; export type TypeParameterDeclaration = { - type: "TypeParameterDeclaration"; + type: \"TypeParameterDeclaration\"; _TypeParameterDeclaration: void; params: Array; end: number; @@ -9688,7 +9688,7 @@ export type TypeParameterDeclaration = { trailingComments: ?Array }; export type TypeParameterInstantiation = { - type: "TypeParameterInstantiation"; + type: \"TypeParameterInstantiation\"; _TypeParameterInstantiation: void; params: Array; end: number; @@ -9702,7 +9702,7 @@ export type TypeParameterInstantiation = { trailingComments: ?Array }; export type ObjectTypeAnnotation = { - type: "ObjectTypeAnnotation"; + type: \"ObjectTypeAnnotation\"; _ObjectTypeAnnotation: void; callProperties: Array; indexers: Array; @@ -9718,7 +9718,7 @@ export type ObjectTypeAnnotation = { trailingComments: ?Array }; export type ObjectTypeCallProperty = { - type: "ObjectTypeCallProperty"; + type: \"ObjectTypeCallProperty\"; _ObjectTypeCallProperty: void; static: boolean; value: FunctionTypeAnnotation; @@ -9733,7 +9733,7 @@ export type ObjectTypeCallProperty = { trailingComments: ?Array }; export type ObjectTypeIndexer = { - type: "ObjectTypeIndexer"; + type: \"ObjectTypeIndexer\"; _ObjectTypeIndexer: void; id: Identifier; key: Type; @@ -9749,7 +9749,7 @@ export type ObjectTypeIndexer = { trailingComments: ?Array }; export type ObjectTypeProperty = { - type: "ObjectTypeProperty"; + type: \"ObjectTypeProperty\"; _ObjectTypeProperty: void; key: Node; optional: boolean; @@ -9765,7 +9765,7 @@ export type ObjectTypeProperty = { trailingComments: ?Array }; export type QualifiedTypeIdentifier = { - type: "QualifiedTypeIdentifier"; + type: \"QualifiedTypeIdentifier\"; _QualifiedTypeIdentifier: void; id: Identifier; qualification: Node; @@ -9780,7 +9780,7 @@ export type QualifiedTypeIdentifier = { trailingComments: ?Array }; export type UnionTypeAnnotation = { - type: "UnionTypeAnnotation"; + type: \"UnionTypeAnnotation\"; _UnionTypeAnnotation: void; types: Array; end: number; @@ -9794,7 +9794,7 @@ export type UnionTypeAnnotation = { trailingComments: ?Array }; export type VoidTypeAnnotation = { - type: "VoidTypeAnnotation"; + type: \"VoidTypeAnnotation\"; _VoidTypeAnnotation: void; end: number; innerComments: ?Array; @@ -9807,7 +9807,7 @@ export type VoidTypeAnnotation = { trailingComments: ?Array }; export type JSXAttribute = { - type: "JSXAttribute"; + type: \"JSXAttribute\"; _JSXAttribute: void; name: Node; value: ?Node; @@ -9822,7 +9822,7 @@ export type JSXAttribute = { trailingComments: ?Array }; export type JSXClosingElement = { - type: "JSXClosingElement"; + type: \"JSXClosingElement\"; _JSXClosingElement: void; name: Node; end: number; @@ -9836,7 +9836,7 @@ export type JSXClosingElement = { trailingComments: ?Array }; export type JSXElement = { - type: "JSXElement"; + type: \"JSXElement\"; _JSXElement: void; children: Array; closingElement: ?JSXClosingElement; @@ -9852,7 +9852,7 @@ export type JSXElement = { trailingComments: ?Array }; export type JSXEmptyExpression = { - type: "JSXEmptyExpression"; + type: \"JSXEmptyExpression\"; _JSXEmptyExpression: void; end: number; innerComments: ?Array; @@ -9865,7 +9865,7 @@ export type JSXEmptyExpression = { trailingComments: ?Array }; export type JSXExpressionContainer = { - type: "JSXExpressionContainer"; + type: \"JSXExpressionContainer\"; _JSXExpressionContainer: void; expression: Expression; end: number; @@ -9879,7 +9879,7 @@ export type JSXExpressionContainer = { trailingComments: ?Array }; export type JSXIdentifier = { - type: "JSXIdentifier"; + type: \"JSXIdentifier\"; _JSXIdentifier: void; name: string; end: number; @@ -9893,7 +9893,7 @@ export type JSXIdentifier = { trailingComments: ?Array }; export type JSXMemberExpression = { - type: "JSXMemberExpression"; + type: \"JSXMemberExpression\"; _JSXMemberExpression: void; computed: boolean; object: Node; @@ -9909,7 +9909,7 @@ export type JSXMemberExpression = { trailingComments: ?Array }; export type JSXNamespacedName = { - type: "JSXNamespacedName"; + type: \"JSXNamespacedName\"; _JSXNamespacedName: void; name: JSXIdentifier; namespace: JSXIdentifier; @@ -9924,7 +9924,7 @@ export type JSXNamespacedName = { trailingComments: ?Array }; export type JSXOpeningElement = { - type: "JSXOpeningElement"; + type: \"JSXOpeningElement\"; _JSXOpeningElement: void; attributes: Array; name: Array; @@ -9940,7 +9940,7 @@ export type JSXOpeningElement = { trailingComments: ?Array }; export type JSXSpreadAttribute = { - type: "JSXSpreadAttribute"; + type: \"JSXSpreadAttribute\"; _JSXSpreadAttribute: void; argument: Expression; end: number; diff --git a/tests/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap b/tests/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap index 7a88908c..2769d314 100644 --- a/tests/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap @@ -33,7 +33,7 @@ class MyClass2 { } } -var c2: MyClass2 = new MyClass2(0, ""); // no error +var c2: MyClass2 = new MyClass2(0, \"\"); // no error // no arity error in type annotation using polymorphic type alias @@ -112,7 +112,7 @@ class MyClass2 { this.y = y; } } -var c2: MyClass2 = new MyClass2(0, ""); +var c2: MyClass2 = new MyClass2(0, \"\"); type MyObject = { x: T }; var o: MyObject = { x: 0 }; type MySubobject = { y: number } & MyObject; diff --git a/tests/type_args_strict/__snapshots__/jsfmt.spec.js.snap b/tests/type_args_strict/__snapshots__/jsfmt.spec.js.snap index a59f5c45..73e59e3a 100644 --- a/tests/type_args_strict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_args_strict/__snapshots__/jsfmt.spec.js.snap @@ -32,7 +32,7 @@ class MyClass2 { } } -var c2: MyClass2 = new MyClass2(0, ""); // error, missing argument list (1-2) +var c2: MyClass2 = new MyClass2(0, \"\"); // error, missing argument list (1-2) // arity error in type annotation using polymorphic type alias @@ -110,7 +110,7 @@ class MyClass2 { this.y = y; } } -var c2: MyClass2 = new MyClass2(0, ""); +var c2: MyClass2 = new MyClass2(0, \"\"); type MyObject = { x: T }; var o: MyObject = { x: 0 }; type MySubobject = { y: number } & MyObject; diff --git a/tests/type_only_vars/__snapshots__/jsfmt.spec.js.snap b/tests/type_only_vars/__snapshots__/jsfmt.spec.js.snap index 25a97594..0d66c0ec 100644 --- a/tests/type_only_vars/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_only_vars/__snapshots__/jsfmt.spec.js.snap @@ -28,33 +28,33 @@ exports[`test bad_shadowing.js 1`] = ` * @flow */ -import typeof A from "./A.js"; -import type {Foo, Bar as Baz} from "./A.js"; +import typeof A from \"./A.js\"; +import type {Foo, Bar as Baz} from \"./A.js\"; type duck = { quack: () => string; } // These string types should confict with the imported types -var A: string = "Hello"; -var Foo: string = "Goodbye"; -var Baz: string = "Go away please"; +var A: string = \"Hello\"; +var Foo: string = \"Goodbye\"; +var Baz: string = \"Go away please\"; // This string type should conflict with the typedef -var duck: string = "quack"; +var duck: string = \"quack\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow */ // These string types should confict with the imported types // This string type should conflict with the typedef -import typeof A from "./A.js"; -import type { Foo, Bar as Baz } from "./A.js"; +import typeof A from \"./A.js\"; +import type { Foo, Bar as Baz } from \"./A.js\"; type duck = { quack(): string }; -var A: string = "Hello"; -var Foo: string = "Goodbye"; -var Baz: string = "Go away please"; -var duck: string = "quack"; +var A: string = \"Hello\"; +var Foo: string = \"Goodbye\"; +var Baz: string = \"Go away please\"; +var duck: string = \"quack\"; " `; @@ -63,10 +63,10 @@ exports[`test good_shadowing.js 1`] = ` * @flow */ -import typeof A from "./A.js"; -import type {Foo, Bar as Baz} from "./A.js"; +import typeof A from \"./A.js\"; +import type {Foo, Bar as Baz} from \"./A.js\"; -var A = require('./A.js'); +var A = require(\'./A.js\'); var Foo = A.Foo; var Baz = A.Bar; @@ -85,9 +85,9 @@ var b: Foo = new A.Foo(); */ // errors in prev block leave type bindings in place, so these are errors // errors from value positions only -import typeof A from "./A.js"; -import type { Foo, Bar as Baz } from "./A.js"; -var A = require("./A.js"); +import typeof A from \"./A.js\"; +import type { Foo, Bar as Baz } from \"./A.js\"; +var A = require(\"./A.js\"); var Foo = A.Foo; var Baz = A.Bar; var m = A; @@ -104,12 +104,12 @@ exports[`test import_type.js 1`] = ` * @flow */ -import typeof A from "./A.js"; -import type {Foo, Bar as Baz} from "./A.js"; +import typeof A from \"./A.js\"; +import type {Foo, Bar as Baz} from \"./A.js\"; -var actualA = require('./A.js'); +var actualA = require(\'./A.js\'); -// You can't use it as an identifier +// You can\'t use it as an identifier var m = A; var n = Foo; var o = Baz; @@ -121,11 +121,11 @@ var a: Foo = new actualA.Foo(); /** * @flow */ -// You can't use it as an identifier +// You can\'t use it as an identifier // But using it in a type should still work -import typeof A from "./A.js"; -import type { Foo, Bar as Baz } from "./A.js"; -var actualA = require("./A.js"); +import typeof A from \"./A.js\"; +import type { Foo, Bar as Baz } from \"./A.js\"; +var actualA = require(\"./A.js\"); var m = A; var n = Foo; var o = Baz; @@ -141,7 +141,7 @@ exports[`test type_alias.js 1`] = ` type Foo = number; -// You can't use it as an identifier +// You can\'t use it as an identifier var x = Foo; // But using it in a type should still work @@ -152,7 +152,7 @@ type c = Foo; /** * @flow */ -// You can't use it as an identifier +// You can\'t use it as an identifier // But using it in a type should still work type Foo = number; var x = Foo; diff --git a/tests/type_param_defaults/__snapshots__/jsfmt.spec.js.snap b/tests/type_param_defaults/__snapshots__/jsfmt.spec.js.snap index c4689042..913a7d62 100644 --- a/tests/type_param_defaults/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_param_defaults/__snapshots__/jsfmt.spec.js.snap @@ -13,7 +13,7 @@ class B extends A {} var b_number: B = new B(123); var b_void: B = new B(); -var b_default: B<> = new B('hello'); +var b_default: B<> = new B(\'hello\'); var b_star: B<*> = new B(123); @@ -27,8 +27,8 @@ class C extends A {} var c_number: C = new C(123); // Error number ~> ?string var c_void: C = new C(); -var c_default: C<> = new C('hello'); -var c_star: C<*> = new C('hello'); +var c_default: C<> = new C(\'hello\'); +var c_star: C<*> = new C(\'hello\'); (c_void.p: boolean); // Error void ~> boolean (c_default.p: boolean); // Error string ~> boolean @@ -37,9 +37,9 @@ var c_star: C<*> = new C('hello'); class D extends A {} var d_number: D = new D(123); var d_void: D = new D(); -var d_default: D = new D('hello'); -var d_too_few_args: D<> = new D('hello'); // Error too few tparams -var d_too_many: D = new D('hello'); // Error too many tparams +var d_default: D = new D(\'hello\'); +var d_too_few_args: D<> = new D(\'hello\'); // Error too few tparams +var d_too_many: D = new D(\'hello\'); // Error too many tparams var d_star: D<*> = new D(10); // error, number ~> string (d_number.p: boolean); // Error number ~> boolean @@ -52,18 +52,18 @@ class F {} // Error: number ~> string class G extends A {} -var g_default: G = new G('hello'); +var g_default: G = new G(\'hello\'); (g_default.p: boolean); // Error string ~> boolean -class H {} // Error - can't refer to T before it's defined +class H {} // Error - can\'t refer to T before it\'s defined class I extends A {} var i_number: I = new I(123); // Error number ~> ?string var i_void: I = new I(); -var i_default: I<> = new I('hello'); -var i_star: I<*> = new I('hello'); +var i_default: I<> = new I(\'hello\'); +var i_star: I<*> = new I(\'hello\'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Test out simple defaults @@ -85,7 +85,7 @@ var i_star: I<*> = new I('hello'); // Error: string ~> number // Error: number ~> string // Error string ~> boolean -// Error - can't refer to T before it's defined +// Error - can\'t refer to T before it\'s defined // Error number ~> ?string class A { p: T; @@ -96,7 +96,7 @@ class A { class B extends A {} var b_number: B = new B(123); var b_void: B = new B(); -var b_default: B<> = new B("hello"); +var b_default: B<> = new B(\"hello\"); var b_star: B<*> = new B(123); (b_number.p: boolean); (b_void.p: boolean); @@ -105,17 +105,17 @@ var b_star: B<*> = new B(123); class C extends A {} var c_number: C = new C(123); var c_void: C = new C(); -var c_default: C<> = new C("hello"); -var c_star: C<*> = new C("hello"); +var c_default: C<> = new C(\"hello\"); +var c_star: C<*> = new C(\"hello\"); (c_void.p: boolean); (c_default.p: boolean); (c_star.p: boolean); class D extends A {} var d_number: D = new D(123); var d_void: D = new D(); -var d_default: D = new D("hello"); -var d_too_few_args: D<> = new D("hello"); -var d_too_many: D = new D("hello"); +var d_default: D = new D(\"hello\"); +var d_too_few_args: D<> = new D(\"hello\"); +var d_too_many: D = new D(\"hello\"); var d_star: D<*> = new D(10); (d_number.p: boolean); (d_void.p: boolean); @@ -124,13 +124,13 @@ var d_star: D<*> = new D(10); class E {} class F {} class G extends A {} -var g_default: G = new G("hello"); +var g_default: G = new G(\"hello\"); (g_default.p: boolean); class H {} class I extends A {} var i_number: I = new I(123); var i_void: I = new I(); -var i_default: I<> = new I("hello"); -var i_star: I<*> = new I("hello"); +var i_default: I<> = new I(\"hello\"); +var i_star: I<*> = new I(\"hello\"); " `; diff --git a/tests/type_param_variance/__snapshots__/jsfmt.spec.js.snap b/tests/type_param_variance/__snapshots__/jsfmt.spec.js.snap index 651af201..185e5603 100644 --- a/tests/type_param_variance/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_param_variance/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ exports[`test promise.js 1`] = ` * which is covariant. * * Explicit variance control via annotation is coming, - * but not immediately. In the meantime, Promise's + * but not immediately. In the meantime, Promise\'s * participation in async/await makes certain kinds of * errors onerous (and nonobvious) without covariance. * @@ -14,7 +14,7 @@ exports[`test promise.js 1`] = ` async function foo(x: boolean): Promise { if (x) { - return {bar: 'baz'}; // OK, because of covariant type param + return {bar: \'baz\'}; // OK, because of covariant type param } else { return null; } @@ -33,7 +33,7 @@ run() * which is covariant. * * Explicit variance control via annotation is coming, - * but not immediately. In the meantime, Promise's + * but not immediately. In the meantime, Promise\'s * participation in async/await makes certain kinds of * errors onerous (and nonobvious) without covariance. * @@ -42,7 +42,7 @@ run() // OK, because of covariant type param async function foo(x: boolean): Promise { if (x) { - return { bar: "baz" }; + return { bar: \"baz\" }; } else { return null; } diff --git a/tests/type_param_variance2/__snapshots__/jsfmt.spec.js.snap b/tests/type_param_variance2/__snapshots__/jsfmt.spec.js.snap index 53839b61..adc9efec 100644 --- a/tests/type_param_variance2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_param_variance2/__snapshots__/jsfmt.spec.js.snap @@ -11,7 +11,7 @@ exports[`test promise.js 1`] = ` async function foo(x: boolean): Promise { if (x) { - return {bar: 'baz'}; // OK, because of covariant type param + return {bar: \'baz\'}; // OK, because of covariant type param } else { return null; } @@ -36,7 +36,7 @@ run() // OK, because of covariant type param async function foo(x: boolean): Promise { if (x) { - return { bar: "baz" }; + return { bar: \"baz\" }; } else { return null; } diff --git a/tests/typecast/__snapshots__/jsfmt.spec.js.snap b/tests/typecast/__snapshots__/jsfmt.spec.js.snap index 5a58aa1b..28c07733 100644 --- a/tests/typecast/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typecast/__snapshots__/jsfmt.spec.js.snap @@ -5,16 +5,16 @@ exports[`test typecast.js 1`] = ` var tests = [ () => { // erroneous typcasts raise errors... - var n = ("hey" : number); - // ...but 'any' does dynamic downcasts, if you must - var x: number = ("hey": any); - var y = (("hey": any): number); + var n = (\"hey\" : number); + // ...but \'any\' does dynamic downcasts, if you must + var x: number = (\"hey\": any); + var y = ((\"hey\": any): number); }, () => { // typecasts in sequences // (parens always required around typecasts) - var s: string = ((0: number), ("hey": string)); + var s: string = ((0: number), (\"hey\": string)); }, () => { @@ -30,7 +30,7 @@ var tests = [ * Copyright 2004-present Facebook. All Rights Reserved. */ // erroneous typcasts raise errors... -// ...but 'any' does dynamic downcasts, if you must +// ...but \'any\' does dynamic downcasts, if you must // typecasts in sequences // (parens always required around typecasts) // TODO pending array element inference issues @@ -40,12 +40,12 @@ var tests = [ // var b = [(0 : ?number), 1, 2, 3, 4, 5, 6, 7, null]; var tests = [ () => { - var n = ("hey": number); - var x: number = ("hey": any); - var y = (("hey": any): number); + var n = (\"hey\": number); + var x: number = (\"hey\": any); + var y = ((\"hey\": any): number); }, () => { - var s: string = ((0: number), ("hey": string)); + var s: string = ((0: number), (\"hey\": string)); }, () => { diff --git a/tests/typeof/__snapshots__/jsfmt.spec.js.snap b/tests/typeof/__snapshots__/jsfmt.spec.js.snap index 05ea3f39..59a90c9e 100644 --- a/tests/typeof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typeof/__snapshots__/jsfmt.spec.js.snap @@ -23,7 +23,7 @@ var a: MyClass1 = new MyClass1(); // of the class value itself with the type of its // instances. -// Aside: it's worth staring at the following (correct) +// Aside: it\'s worth staring at the following (correct) // type annotations until they make sense: // // MyClass1 : Class @@ -59,7 +59,7 @@ var c: typeof MyClass2 = new MyClass2(); var numValue:number = 42; var d: typeof numValue = 100; -var e: typeof numValue = 'asdf'; // Error: string ~> number +var e: typeof numValue = \'asdf\'; // Error: string ~> number ///////////////////////////////// // == typeof <> == // @@ -69,18 +69,18 @@ type numberAlias = number; // This is an error because typeof takes a value, not // a type, as an argument. However, the current error -// is suboptimal - just 'cannot resolve name'. TODO. +// is suboptimal - just \'cannot resolve name\'. TODO. // -var f: typeof numberAlias = 42; // Error: 'typeof <>' makes no sense... +var f: typeof numberAlias = 42; // Error: \'typeof <>\' makes no sense... /** * Use of a non-class/non-function value in type annotation. * These provoke a specific error, not just the generic - * "type is incompatible" + * \"type is incompatible\" */ - var Map = { "A": "this is A", "B": "this is B", "C": "this is C" }; - var keys: $Keys = "A"; // Error: ineligible value used in type anno + var Map = { \"A\": \"this is A\", \"B\": \"this is B\", \"C\": \"this is C\" }; + var keys: $Keys = \"A\"; // Error: ineligible value used in type anno ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow @@ -97,7 +97,7 @@ var f: typeof numberAlias = 42; // Error: 'typeof <>' makes no sense // Following tests are errors which conflate the type // of the class value itself with the type of its // instances. -// Aside: it's worth staring at the following (correct) +// Aside: it\'s worth staring at the following (correct) // type annotations until they make sense: // // MyClass1 : Class @@ -127,13 +127,13 @@ var f: typeof numberAlias = 42; // Error: 'typeof <>' makes no sense ///////////////////////////////// // This is an error because typeof takes a value, not // a type, as an argument. However, the current error -// is suboptimal - just 'cannot resolve name'. TODO. +// is suboptimal - just \'cannot resolve name\'. TODO. // -// Error: 'typeof <>' makes no sense... +// Error: \'typeof <>\' makes no sense... /** * Use of a non-class/non-function value in type annotation. * These provoke a specific error, not just the generic - * "type is incompatible" + * \"type is incompatible\" */ // Error: ineligible value used in type anno class MyClass1 { @@ -151,10 +151,10 @@ class MyClass2 { var c: typeof MyClass2 = new MyClass2(); var numValue: number = 42; var d: typeof numValue = 100; -var e: typeof numValue = "asdf"; +var e: typeof numValue = \"asdf\"; type numberAlias = number; var f: typeof numberAlias = 42; -var Map = { "A": "this is A", "B": "this is B", "C": "this is C" }; -var keys: $Keys = "A"; +var Map = { \"A\": \"this is A\", \"B\": \"this is B\", \"C\": \"this is C\" }; +var keys: $Keys = \"A\"; " `; diff --git a/tests/unary/__snapshots__/jsfmt.spec.js.snap b/tests/unary/__snapshots__/jsfmt.spec.js.snap index f6f051d0..8caffa30 100644 --- a/tests/unary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unary/__snapshots__/jsfmt.spec.js.snap @@ -6,11 +6,11 @@ function x0(y: string): number { } function x1(y: string): number { - return -y; // error, we don't allow coercion here + return -y; // error, we don\'t allow coercion here } function x3(y: string) { - return ~y; // error, we don't allow coercion here + return ~y; // error, we don\'t allow coercion here } function x4(y: string): boolean { @@ -21,8 +21,8 @@ function x4(y: string): boolean { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // ok, + exists solely for coercion -// error, we don't allow coercion here -// error, we don't allow coercion here +// error, we don\'t allow coercion here +// error, we don\'t allow coercion here // ok, coercion is allowed // error, number ~> void function x0(y: string): number { @@ -53,27 +53,27 @@ let tests = [ }, function(y: string) { - y++; // error, we don't allow coercion here + y++; // error, we don\'t allow coercion here (y: number); // ok, y is a number now - y++; // error, but you still can't write a number to a string + y++; // error, but you still can\'t write a number to a string }, function(y: string) { - y--; // error, we don't allow coercion here + y--; // error, we don\'t allow coercion here }, function(y: string) { - ++y; // error, we don't allow coercion here + ++y; // error, we don\'t allow coercion here }, function(y: string) { - --y; // error, we don't allow coercion here + --y; // error, we don\'t allow coercion here }, function() { const y = 123; - y++; // error, can't update const - y--; // error, can't update const + y++; // error, can\'t update const + y--; // error, can\'t update const }, function(y: any) { @@ -82,14 +82,14 @@ let tests = [ ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -// error, we don't allow coercion here +// error, we don\'t allow coercion here // ok, y is a number now -// error, but you still can't write a number to a string -// error, we don't allow coercion here -// error, we don't allow coercion here -// error, we don't allow coercion here -// error, can't update const -// error, can't update const +// error, but you still can\'t write a number to a string +// error, we don\'t allow coercion here +// error, we don\'t allow coercion here +// error, we don\'t allow coercion here +// error, can\'t update const +// error, can\'t update const // ok let tests = [ function(y: number) { diff --git a/tests/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap b/tests/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap index 26ce87e1..c300345f 100644 --- a/tests/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap @@ -4,7 +4,7 @@ exports[`test buffer.js 1`] = ` * * Not in flow. * If this module is successfully imported/required, its - * type will be Any, so arbitraty uses won't cause errors. + * type will be Any, so arbitraty uses won\'t cause errors. * However, if a library module declaration is bound to * the same name as an unchecked module, it will be used * to satisfy imports/requires instead. @@ -17,7 +17,7 @@ export var INSPECT_MAX_BYTES = 0; * * Not in flow. * If this module is successfully imported/required, its - * type will be Any, so arbitraty uses won't cause errors. + * type will be Any, so arbitraty uses won\'t cause errors. * However, if a library module declaration is bound to * the same name as an unchecked module, it will be used * to satisfy imports/requires instead. @@ -32,27 +32,27 @@ exports[`test test.js 1`] = ` * @flow */ -/* 'buffer' is the name of both an unchecked module in this directory, +/* \'buffer\' is the name of both an unchecked module in this directory, * and a module declared in library file node.js. * If the require below resolves to the unchecked module, the mistyping * that follows will cause no errors, but if we resolve to the library - * instead, we'll get the desired error. + * instead, we\'ll get the desired error. */ -var buffer = require("buffer"); +var buffer = require(\"buffer\"); var x: string = buffer.INSPECT_MAX_BYTES; // error, number ~/> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Copyright 2004-present Facebook. All Rights Reserved. * @flow */ -/* 'buffer' is the name of both an unchecked module in this directory, +/* \'buffer\' is the name of both an unchecked module in this directory, * and a module declared in library file node.js. * If the require below resolves to the unchecked module, the mistyping * that follows will cause no errors, but if we resolve to the library - * instead, we'll get the desired error. + * instead, we\'ll get the desired error. */ // error, number ~/> string -var buffer = require("buffer"); +var buffer = require(\"buffer\"); var x: string = buffer.INSPECT_MAX_BYTES; " `; diff --git a/tests/unchecked_node_module_vs_lib/__snapshots__/jsfmt.spec.js.snap b/tests/unchecked_node_module_vs_lib/__snapshots__/jsfmt.spec.js.snap index 12278bfa..9d800772 100644 --- a/tests/unchecked_node_module_vs_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unchecked_node_module_vs_lib/__snapshots__/jsfmt.spec.js.snap @@ -7,23 +7,23 @@ exports[`test test.js 1`] = ` */ // node_modules/buffer/index.js is unchecked, -// so we shouldn't pick up its boolean redefinition of INSPECT_MAX_BYTES +// so we shouldn\'t pick up its boolean redefinition of INSPECT_MAX_BYTES // -var buffer = require("buffer"); +var buffer = require(\"buffer\"); var b: boolean = buffer.INSPECT_MAX_BYTES; // error, number ~/> boolean // node_modules/crypto/index.js is checked, // so we should pick up its boolean redefinition of DEFAULT_ENCODING // -var crypto = require("crypto"); -var b: boolean = crypto.DEFAULT_ENCODING; // no error, we've overridden +var crypto = require(\"crypto\"); +var b: boolean = crypto.DEFAULT_ENCODING; // no error, we\'ve overridden -// names that are explicit paths shouldn't fall back to lib defs +// names that are explicit paths shouldn\'t fall back to lib defs // -var buffer2 = require("./buffer"); +var buffer2 = require(\"./buffer\"); var x2: string = buffer2.INSPECT_MAX_BYTES; // error, module not found -var buffer3 = require("./buffer.js"); +var buffer3 = require(\"./buffer.js\"); var x3: string = buffer3.INSPECT_MAX_BYTES; // error, module not found ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @@ -33,24 +33,24 @@ var x3: string = buffer3.INSPECT_MAX_BYTES; // error, module not found * @flow */ // node_modules/buffer/index.js is unchecked, -// so we shouldn't pick up its boolean redefinition of INSPECT_MAX_BYTES +// so we shouldn\'t pick up its boolean redefinition of INSPECT_MAX_BYTES // // error, number ~/> boolean // node_modules/crypto/index.js is checked, // so we should pick up its boolean redefinition of DEFAULT_ENCODING // -// no error, we've overridden -// names that are explicit paths shouldn't fall back to lib defs +// no error, we\'ve overridden +// names that are explicit paths shouldn\'t fall back to lib defs // // error, module not found // error, module not found -var buffer = require("buffer"); +var buffer = require(\"buffer\"); var b: boolean = buffer.INSPECT_MAX_BYTES; -var crypto = require("crypto"); +var crypto = require(\"crypto\"); var b: boolean = crypto.DEFAULT_ENCODING; -var buffer2 = require("./buffer"); +var buffer2 = require(\"./buffer\"); var x2: string = buffer2.INSPECT_MAX_BYTES; -var buffer3 = require("./buffer.js"); +var buffer3 = require(\"./buffer.js\"); var x3: string = buffer3.INSPECT_MAX_BYTES; " `; diff --git a/tests/unreachable/__snapshots__/jsfmt.spec.js.snap b/tests/unreachable/__snapshots__/jsfmt.spec.js.snap index 05f9bad3..6220e2ca 100644 --- a/tests/unreachable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unreachable/__snapshots__/jsfmt.spec.js.snap @@ -49,7 +49,7 @@ exports[`test unreachable.js 1`] = ` "/* @flow */ function foo(x, y) { - "use strict"; + \"use strict\"; return bar(x) + baz(y); // function declaration is hoisted, should not generate warning @@ -80,7 +80,7 @@ foo(1, 2); // variable declaration is hoisted, should not generate warning // assignments are not hoisted, should generate 2 warnings function foo(x, y) { - "use strict"; + \"use strict\"; return bar(x) + baz(y); function bar(ecks) { return x + ecks; @@ -88,11 +88,8 @@ function foo(x, y) { var baz = function(why) { return y + why; }; - var xy, - z; - var tu = 5, - v, - w = 7; + var xy, z; + var tu = 5, v, w = 7; } foo(1, 2); " diff --git a/tests/value/__snapshots__/jsfmt.spec.js.snap b/tests/value/__snapshots__/jsfmt.spec.js.snap index cd1ee30d..cb0d055f 100644 --- a/tests/value/__snapshots__/jsfmt.spec.js.snap +++ b/tests/value/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ exports[`test value.js 1`] = ` "var o = {}; -o["x"] = 4; -var y:string = o["x"]; +o[\"x\"] = 4; +var y:string = o[\"x\"]; var table: { [_: string]: number } = {}; -table["x"] = "hello"; +table[\"x\"] = \"hello\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var o = {}; -o["x"] = 4; -var y: string = o["x"]; +o[\"x\"] = 4; +var y: string = o[\"x\"]; var table: { [_: string]: number } = {}; -table["x"] = "hello"; +table[\"x\"] = \"hello\"; " `; diff --git a/tests/weakmode/__snapshots__/jsfmt.spec.js.snap b/tests/weakmode/__snapshots__/jsfmt.spec.js.snap index e74a014c..3b30766d 100644 --- a/tests/weakmode/__snapshots__/jsfmt.spec.js.snap +++ b/tests/weakmode/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test should_fail_without_weak.js 1`] = ` // This should fail without weak mode, because of the glaring type error. function returns_a_string() { - return "Hello"; + return \"Hello\"; } function expects_an_int() { @@ -13,7 +13,7 @@ function expects_an_int() { /* @flow */ // This should fail without weak mode, because of the glaring type error. function returns_a_string() { - return "Hello"; + return \"Hello\"; } function expects_an_int() { return returns_a_string() * 10; @@ -26,7 +26,7 @@ exports[`test should_pass_with_weak.js 1`] = ` // This should fail without weak mode, because of the glaring type error. function returns_a_string() { - return "Hello"; + return \"Hello\"; } function expects_an_int() { @@ -36,7 +36,7 @@ function expects_an_int() { /* @flow weak */ // This should fail without weak mode, because of the glaring type error. function returns_a_string() { - return "Hello"; + return \"Hello\"; } function expects_an_int() { return returns_a_string() * 10; diff --git a/tests/while/__snapshots__/jsfmt.spec.js.snap b/tests/while/__snapshots__/jsfmt.spec.js.snap index 1ddf70d9..43e3bb65 100644 --- a/tests/while/__snapshots__/jsfmt.spec.js.snap +++ b/tests/while/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ function foo(x: boolean) { } return; } - //console.log('this is still reachable'); + //console.log(\'this is still reachable\'); } function bar(x: boolean) { @@ -17,12 +17,12 @@ function bar(x: boolean) { while (ii > 0) { return; } - //console.log('this is still reachable'); + //console.log(\'this is still reachable\'); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -//console.log('this is still reachable'); -//console.log('this is still reachable'); +//console.log(\'this is still reachable\'); +//console.log(\'this is still reachable\'); function foo(x: boolean) { var ii = 10; while (ii-- >= 0) {