diff --git a/package.json b/package.json index 22fd8dbb..2dcbcb5d 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,9 @@ "setupFiles": [ "/tests_config/run_spec.js" ], + "snapshotSerializers": [ + "/tests_config/raw-serializer.js" + ], "testRegex": "jsfmt\\.spec\\.js$", "testPathIgnorePatterns": [ "tests/new_react", diff --git a/tests/array_spread/__snapshots__/jsfmt.spec.js.snap b/tests/array_spread/__snapshots__/jsfmt.spec.js.snap index 40037c63..51d92f94 100644 --- a/tests/array_spread/__snapshots__/jsfmt.spec.js.snap +++ b/tests/array_spread/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`multiple.js 1`] = ` -"[...a, ...b,]; +[...a, ...b,]; [...a, ...b]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [...a, ...b]; [...a, ...b]; -" + `; diff --git a/tests/arrays/__snapshots__/jsfmt.spec.js.snap b/tests/arrays/__snapshots__/jsfmt.spec.js.snap index a999aea0..68648917 100644 --- a/tests/arrays/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrays/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`last.js 1`] = ` -"[,]; +[,]; [,,]; [,,1,]; [,,1,1]; @@ -10,11 +10,11 @@ exports[`last.js 1`] = ` [, ,]; [, , 1]; [, , 1, 1]; -" + `; exports[`preserve_empty_lines.js 1`] = ` -"a = [ +a = [ 1, 2, @@ -28,5 +28,5 @@ exports[`preserve_empty_lines.js 1`] = ` ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a = [1, 2, 3, 4]; -" + `; diff --git a/tests/arrow-call/__snapshots__/jsfmt.spec.js.snap b/tests/arrow-call/__snapshots__/jsfmt.spec.js.snap index d5f35820..692a3845 100644 --- a/tests/arrow-call/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrow-call/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`arrow_call.js 1`] = ` -"const testResults = results.testResults.map(testResult => +const testResults = results.testResults.map(testResult => formatResult(testResult, formatter, reporter) ); @@ -11,19 +11,19 @@ it('mocks regexp instances', () => { ).not.toThrow(); }); -expect(() => asyncRequest({ url: \\"/test-endpoint\\" })) +expect(() => asyncRequest({ url: "/test-endpoint" })) .toThrowError(/Required parameter/); -expect(() => asyncRequest({ url: \\"/test-endpoint-but-with-a-long-url\\" })) +expect(() => asyncRequest({ url: "/test-endpoint-but-with-a-long-url" })) .toThrowError(/Required parameter/); -expect(() => asyncRequest({ url: \\"/test-endpoint-but-with-a-suuuuuuuuper-long-url\\" })) +expect(() => asyncRequest({ url: "/test-endpoint-but-with-a-suuuuuuuuper-long-url" })) .toThrowError(/Required parameter/); -expect(() => asyncRequest({ type: \\"foo\\", url: \\"/test-endpoint\\" })) +expect(() => asyncRequest({ type: "foo", url: "/test-endpoint" })) .not.toThrowError(); -expect(() => asyncRequest({ type: \\"foo\\", url: \\"/test-endpoint-but-with-a-long-url\\" })) +expect(() => asyncRequest({ type: "foo", url: "/test-endpoint-but-with-a-long-url" })) .not.toThrowError(); const a = Observable @@ -43,33 +43,33 @@ const testResults = results.testResults.map(testResult => formatResult(testResult, formatter, reporter) ); -it(\\"mocks regexp instances\\", () => { +it("mocks regexp instances", () => { expect(() => moduleMocker.generateFromMetadata(moduleMocker.getMetadata(/a/)) ).not.toThrow(); }); -expect(() => asyncRequest({ url: \\"/test-endpoint\\" })).toThrowError( +expect(() => asyncRequest({ url: "/test-endpoint" })).toThrowError( /Required parameter/ ); expect(() => - asyncRequest({ url: \\"/test-endpoint-but-with-a-long-url\\" }) + asyncRequest({ url: "/test-endpoint-but-with-a-long-url" }) ).toThrowError(/Required parameter/); expect(() => - asyncRequest({ url: \\"/test-endpoint-but-with-a-suuuuuuuuper-long-url\\" }) + asyncRequest({ url: "/test-endpoint-but-with-a-suuuuuuuuper-long-url" }) ).toThrowError(/Required parameter/); expect(() => - asyncRequest({ type: \\"foo\\", url: \\"/test-endpoint\\" }) + asyncRequest({ type: "foo", url: "/test-endpoint" }) ).not.toThrowError(); expect(() => - asyncRequest({ type: \\"foo\\", url: \\"/test-endpoint-but-with-a-long-url\\" }) + asyncRequest({ type: "foo", url: "/test-endpoint-but-with-a-long-url" }) ).not.toThrowError(); -const a = Observable.fromPromise(axiosInstance.post(\\"/carts/mine\\")).map( +const a = Observable.fromPromise(axiosInstance.post("/carts/mine")).map( response => response.data ); @@ -82,11 +82,11 @@ func( veryLooooooooooooooooooooooooongName => veryLoooooooooooooooongName.something() ); -" + `; exports[`arrow_call.js 2`] = ` -"const testResults = results.testResults.map(testResult => +const testResults = results.testResults.map(testResult => formatResult(testResult, formatter, reporter) ); @@ -96,19 +96,19 @@ it('mocks regexp instances', () => { ).not.toThrow(); }); -expect(() => asyncRequest({ url: \\"/test-endpoint\\" })) +expect(() => asyncRequest({ url: "/test-endpoint" })) .toThrowError(/Required parameter/); -expect(() => asyncRequest({ url: \\"/test-endpoint-but-with-a-long-url\\" })) +expect(() => asyncRequest({ url: "/test-endpoint-but-with-a-long-url" })) .toThrowError(/Required parameter/); -expect(() => asyncRequest({ url: \\"/test-endpoint-but-with-a-suuuuuuuuper-long-url\\" })) +expect(() => asyncRequest({ url: "/test-endpoint-but-with-a-suuuuuuuuper-long-url" })) .toThrowError(/Required parameter/); -expect(() => asyncRequest({ type: \\"foo\\", url: \\"/test-endpoint\\" })) +expect(() => asyncRequest({ type: "foo", url: "/test-endpoint" })) .not.toThrowError(); -expect(() => asyncRequest({ type: \\"foo\\", url: \\"/test-endpoint-but-with-a-long-url\\" })) +expect(() => asyncRequest({ type: "foo", url: "/test-endpoint-but-with-a-long-url" })) .not.toThrowError(); const a = Observable @@ -128,33 +128,33 @@ const testResults = results.testResults.map(testResult => formatResult(testResult, formatter, reporter), ); -it(\\"mocks regexp instances\\", () => { +it("mocks regexp instances", () => { expect(() => moduleMocker.generateFromMetadata(moduleMocker.getMetadata(/a/)), ).not.toThrow(); }); -expect(() => asyncRequest({ url: \\"/test-endpoint\\" })).toThrowError( +expect(() => asyncRequest({ url: "/test-endpoint" })).toThrowError( /Required parameter/, ); expect(() => - asyncRequest({ url: \\"/test-endpoint-but-with-a-long-url\\" }), + asyncRequest({ url: "/test-endpoint-but-with-a-long-url" }), ).toThrowError(/Required parameter/); expect(() => - asyncRequest({ url: \\"/test-endpoint-but-with-a-suuuuuuuuper-long-url\\" }), + asyncRequest({ url: "/test-endpoint-but-with-a-suuuuuuuuper-long-url" }), ).toThrowError(/Required parameter/); expect(() => - asyncRequest({ type: \\"foo\\", url: \\"/test-endpoint\\" }), + asyncRequest({ type: "foo", url: "/test-endpoint" }), ).not.toThrowError(); expect(() => - asyncRequest({ type: \\"foo\\", url: \\"/test-endpoint-but-with-a-long-url\\" }), + asyncRequest({ type: "foo", url: "/test-endpoint-but-with-a-long-url" }), ).not.toThrowError(); -const a = Observable.fromPromise(axiosInstance.post(\\"/carts/mine\\")).map( +const a = Observable.fromPromise(axiosInstance.post("/carts/mine")).map( response => response.data, ); @@ -167,5 +167,5 @@ func( veryLooooooooooooooooooooooooongName => veryLoooooooooooooooongName.something(), ); -" + `; diff --git a/tests/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/arrows/__snapshots__/jsfmt.spec.js.snap index 10d1c4f8..41457180 100644 --- a/tests/arrows/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrows/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`arrow_function_expression.js 1`] = ` -"(a => {}).length +(a => {}).length typeof (() => {}); export default (() => {})(); (() => {})()\`\`; @@ -54,7 +54,7 @@ a = () => ({} = 0); a = () => ({}, a); a => a instanceof {}; a => ({}().b && 0); -a => ({}::b()\`\`[\\"\\"].c++ && 0 ? 0 : 0); +a => ({}::b()\`\`[""].c++ && 0 ? 0 : 0); a => ({}().c = 0); x => ({}()()); x => ({}()\`\`); @@ -63,18 +63,18 @@ x => ({}().b); a::(b => c); a = b => c; a = (b?) => c; -" + `; exports[`block_like.js 1`] = ` -"a = () => ({} = this); +a = () => ({} = this); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a = () => ({} = this); -" + `; exports[`call.js 1`] = ` -"Seq(typeDef.interface.groups).forEach(group => +Seq(typeDef.interface.groups).forEach(group => Seq(group.members).forEach((member, memberName) => markdownDoc( member.doc, @@ -224,18 +224,18 @@ function render() { } jest.mock( - \\"../SearchSource\\", + "../SearchSource", () => class { findMatchingTests(pattern) { return { paths: [] }; } } ); -" + `; exports[`currying.js 1`] = ` -"const fn = b => c => d => { +const fn = b => c => d => { return 3; }; @@ -258,37 +258,37 @@ const mw = store => next => action => { const middleware = options => (req, res, next) => { // ... }; -" + `; exports[`long-call-no-args.js 1`] = ` -"veryLongCall(VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT, () => {}) +veryLongCall(VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT, () => {}) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ veryLongCall( VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT, () => {} ); -" + `; exports[`long-contents.js 1`] = ` -"const foo = () => { +const foo = () => { expect(arg1, arg2, arg3).toEqual({message: 'test', messageType: 'SMS', status: 'Unknown', created: '11/01/2017 13:36'}); }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const foo = () => { expect(arg1, arg2, arg3).toEqual({ - message: \\"test\\", - messageType: \\"SMS\\", - status: \\"Unknown\\", - created: \\"11/01/2017 13:36\\" + message: "test", + messageType: "SMS", + status: "Unknown", + created: "11/01/2017 13:36" }); }; -" + `; exports[`short_body.js 1`] = ` -"const initializeSnapshotState = ( +const initializeSnapshotState = ( testFile: Path, update: boolean, testPath: string, @@ -301,5 +301,5 @@ const initializeSnapshotState = ( testPath: string, expand: boolean ) => new SnapshotState(testFile, update, testPath, expand); -" + `; diff --git a/tests/assignment/__snapshots__/jsfmt.spec.js.snap b/tests/assignment/__snapshots__/jsfmt.spec.js.snap index 69f93fe4..d3553705 100644 --- a/tests/assignment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/assignment/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`binaryish.js 1`] = ` -"const computedDescriptionLines = (showConfirm && +const computedDescriptionLines = (showConfirm && descriptionLinesConfirming) || (focused && !loading && descriptionLinesFocused) || descriptionLines; @@ -18,5 +18,5 @@ const computedDescriptionLines = computedDescriptionLines = (focused && !loading && descriptionLinesFocused) || descriptionLines; -" + `; diff --git a/tests/assignment_comments/__snapshots__/jsfmt.spec.js.snap b/tests/assignment_comments/__snapshots__/jsfmt.spec.js.snap index 2992463f..5446a599 100644 --- a/tests/assignment_comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/assignment_comments/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`assignment_comments.js 1`] = ` -"fnString = +fnString = // Comment 'some' + 'long' + 'string'; @@ -58,52 +58,52 @@ let f = ( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fnString = // Comment - \\"some\\" + \\"long\\" + \\"string\\"; + "some" + "long" + "string"; var fnString = // Comment - \\"some\\" + \\"long\\" + \\"string\\"; + "some" + "long" + "string"; var fnString = // Comment - \\"some\\" + \\"long\\" + \\"string\\"; + "some" + "long" + "string"; var fnString = // Comment - \\"some\\" + \\"long\\" + \\"string\\"; + "some" + "long" + "string"; var fnString = /* comment */ - \\"some\\" + \\"long\\" + \\"string\\"; + "some" + "long" + "string"; var fnString = /** * multi-line */ - \\"some\\" + \\"long\\" + \\"string\\"; + "some" + "long" + "string"; var fnString = - /* inline */ \\"some\\" + - \\"long\\" + - \\"string\\" + - \\"some\\" + - \\"long\\" + - \\"string\\" + - \\"some\\" + - \\"long\\" + - \\"string\\" + - \\"some\\" + - \\"long\\" + - \\"string\\"; + /* inline */ "some" + + "long" + + "string" + + "some" + + "long" + + "string" + + "some" + + "long" + + "string" + + "some" + + "long" + + "string"; var fnString = // Comment // Comment - \\"some\\" + \\"long\\" + \\"string\\"; + "some" + "long" + "string"; var fnString = // Comment - \\"some\\" + \\"long\\" + \\"string\\"; + "some" + "long" + "string"; let f = ( //comment @@ -117,5 +117,5 @@ let f = ( let f = ( a = b //comment ) => {}; -" + `; diff --git a/tests/assignment_expression/__snapshots__/jsfmt.spec.js.snap b/tests/assignment_expression/__snapshots__/jsfmt.spec.js.snap index cc53cafe..f109bb1a 100644 --- a/tests/assignment_expression/__snapshots__/jsfmt.spec.js.snap +++ b/tests/assignment_expression/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`assignment_expression.js 1`] = ` -"this.size = this._origin = this._capacity = 0; +this.size = this._origin = this._capacity = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this.size = this._origin = this._capacity = 0; -" + `; diff --git a/tests/async/__snapshots__/jsfmt.spec.js.snap b/tests/async/__snapshots__/jsfmt.spec.js.snap index 4ec14ed9..29282dd6 100644 --- a/tests/async/__snapshots__/jsfmt.spec.js.snap +++ b/tests/async/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`await_parse.js 1`] = ` -"async function f() { (await f()).length } +async function f() { (await f()).length } async function g() { invariant( (await driver.navigator.getUrl()).substr(-7) @@ -26,26 +26,26 @@ function* f() { async function f() { a = !await f(); } -" + `; exports[`conditional-expression.js 1`] = ` -"async function f() { +async function f() { const result = typeof fn === 'function' ? await fn() : null; } (async function() { console.log( - await (true ? Promise.resolve(\\"A\\") : Promise.resolve(\\"B\\")) + await (true ? Promise.resolve("A") : Promise.resolve("B")) ); })() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ async function f() { - const result = typeof fn === \\"function\\" ? await fn() : null; + const result = typeof fn === "function" ? await fn() : null; } (async function() { - console.log(await (true ? Promise.resolve(\\"A\\") : Promise.resolve(\\"B\\"))); + console.log(await (true ? Promise.resolve("A") : Promise.resolve("B"))); })(); -" + `; diff --git a/tests/binary-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/binary-expressions/__snapshots__/jsfmt.spec.js.snap index 09286db6..f6d36a54 100644 --- a/tests/binary-expressions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/binary-expressions/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`arrow.js 1`] = ` -"function f() { +function f() { const appEntitys = getAppEntitys(loadObject).filter( entity => entity && entity.isInstallAvailable() && !entity.isQueue() && entity.isDisabled() ) @@ -16,11 +16,11 @@ function f() { entity.isDisabled() ); } -" + `; exports[`comment.js 1`] = ` -"a = ( +a = ( // Commment 1 (Math.random() * (yRange * (1 - minVerticalFraction))) + (minVerticalFraction * yRange) @@ -31,11 +31,11 @@ a = Math.random() * (yRange * (1 - minVerticalFraction)) + minVerticalFraction * yRange - offset; -" + `; exports[`exp.js 1`] = ` -"a ** b ** c; +a ** b ** c; (a ** b) ** c; a.b ** c; (-a) ** b; @@ -52,11 +52,11 @@ a ** -b; -(a ** b); (a * b) ** c; a ** (b * c); -" + `; exports[`inline-object-array.js 1`] = ` -"prevState = prevState || { +prevState = prevState || { catalogs: [], loadState: LOADED, opened: false, @@ -75,21 +75,21 @@ prevState = prevState || { catalogs: [], loadState: LOADED, opened: false, - searchQuery: \\"\\", + searchQuery: "", selectedCatalog: null }; this.steps = steps || [ { - name: \\"mock-module\\", - path: \\"/nux/mock-module\\" + name: "mock-module", + path: "/nux/mock-module" } ]; -" + `; exports[`short-right.js 1`] = ` -"this._cumulativeHeights && +this._cumulativeHeights && Math.abs( this._cachedItemHeight(this._firstVisibleIndex + i) - this._provider.fastHeight(i + this._firstVisibleIndex), @@ -120,16 +120,16 @@ foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo( ) + a; const isPartOfPackageJSON = - dependenciesArray.indexOf(dependencyWithOutRelativePath.split(\\"/\\")[0]) !== -1; + dependenciesArray.indexOf(dependencyWithOutRelativePath.split("/")[0]) !== -1; defaultContent.filter(defaultLocale => { // ... })[0] || null; -" + `; exports[`test.js 1`] = ` -"// It should always break the highest precedence operators first, and +// It should always break the highest precedence operators first, and // break them all at the same time. const x = longVariable + longVariable + longVariable; @@ -191,5 +191,5 @@ foo( ? number + 5 : false ); -" + `; diff --git a/tests/binary_math/__snapshots__/jsfmt.spec.js.snap b/tests/binary_math/__snapshots__/jsfmt.spec.js.snap index 45ee59c6..12922bd7 100644 --- a/tests/binary_math/__snapshots__/jsfmt.spec.js.snap +++ b/tests/binary_math/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`parens.js 1`] = ` -"const result = (a + b) >>> 1; +const result = (a + b) >>> 1; var sizeIndex = ((index - 1) >>> level) & MASK; var from = offset > left ? 0 : (left - offset) >> level; var to = ((right - offset) >> level) + 1; @@ -21,5 +21,5 @@ var res = size < SIZE ? 0 : (size - 1) >>> SHIFT << SHIFT; sign = 1 - 2 * (b[3] >> 7); exponent = (((b[3] << 1) & 0xff) | (b[2] >> 7)) - 127; mantissa = ((b[2] & 0x7f) << 16) | (b[1] << 8) | b[0]; -" + `; diff --git a/tests/bracketSpacing/__snapshots__/jsfmt.spec.js.snap b/tests/bracketSpacing/__snapshots__/jsfmt.spec.js.snap index be1f1b9e..a5ca0db2 100644 --- a/tests/bracketSpacing/__snapshots__/jsfmt.spec.js.snap +++ b/tests/bracketSpacing/__snapshots__/jsfmt.spec.js.snap @@ -1,37 +1,37 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`array.js 1`] = ` -"const arr1 = [1,2,3,4]; +const arr1 = [1,2,3,4]; const arr2 = [1, 2, 3, 4]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const arr1 = [1, 2, 3, 4]; const arr2 = [1, 2, 3, 4]; -" + `; exports[`array.js 2`] = ` -"const arr1 = [1,2,3,4]; +const arr1 = [1,2,3,4]; const arr2 = [1, 2, 3, 4]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const arr1 = [1, 2, 3, 4]; const arr2 = [1, 2, 3, 4]; -" + `; exports[`object.js 1`] = ` -"const obj1 = {a:1, b:2, c:3} +const obj1 = {a:1, b:2, c:3} const obj2 = { a:1, b:2, c:3 }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const obj1 = { a: 1, b: 2, c: 3 }; const obj2 = { a: 1, b: 2, c: 3 }; -" + `; exports[`object.js 2`] = ` -"const obj1 = {a:1, b:2, c:3} +const obj1 = {a:1, b:2, c:3} const obj2 = { a:1, b:2, c:3 }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const obj1 = {a: 1, b: 2, c: 3}; const obj2 = {a: 1, b: 2, c: 3}; -" + `; diff --git a/tests/break-calls/__snapshots__/jsfmt.spec.js.snap b/tests/break-calls/__snapshots__/jsfmt.spec.js.snap index 48187b39..5a98e9d5 100644 --- a/tests/break-calls/__snapshots__/jsfmt.spec.js.snap +++ b/tests/break-calls/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`break.js 1`] = ` -"h(f(g(() => { +h(f(g(() => { a }))) @@ -77,11 +77,11 @@ const mapChargeItems = fp.flow( expect( new LongLongLongLongLongRange([0, 0], [0, 0]) ).toEqualAtomLongLongLongLongRange(new LongLongLongRange([0, 0], [0, 0])); -" + `; exports[`parent.js 1`] = ` -"runtimeAgent.getProperties( +runtimeAgent.getProperties( objectId, false, // ownProperties false, // accessorPropertiesOnly @@ -100,5 +100,5 @@ runtimeAgent.getProperties( return 1; } ); -" + `; diff --git a/tests/class_comment/__snapshots__/jsfmt.spec.js.snap b/tests/class_comment/__snapshots__/jsfmt.spec.js.snap index e30bc141..d3f57b76 100644 --- a/tests/class_comment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/class_comment/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`comments.js 1`] = ` -"class A // comment 1 +class A // comment 1 // comment 2 extends B {} @@ -68,5 +68,5 @@ class x { // do nothing } } -" + `; diff --git a/tests/class_extends/__snapshots__/jsfmt.spec.js.snap b/tests/class_extends/__snapshots__/jsfmt.spec.js.snap index 5e48be6d..30d23b52 100644 --- a/tests/class_extends/__snapshots__/jsfmt.spec.js.snap +++ b/tests/class_extends/__snapshots__/jsfmt.spec.js.snap @@ -1,57 +1,57 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`extends.js 1`] = ` -"// \\"ArrowFunctionExpression\\" +// "ArrowFunctionExpression" class a extends (() => {}) {} -// \\"AssignmentExpression\\" +// "AssignmentExpression" class a extends (b = c) {} -// \\"AwaitExpression\\" +// "AwaitExpression" async function f() { class a extends (await b) {} } -// \\"BinaryExpression\\" +// "BinaryExpression" class a extends (b + c) {} -// \\"CallExpression\\" +// "CallExpression" class a extends b() {} -// \\"ClassExpression\\" +// "ClassExpression" class a extends class {} {} -// \\"ConditionalExpression\\" +// "ConditionalExpression" class a extends (b ? c : d) {} -// \\"FunctionExpression\\" +// "FunctionExpression" class a extends (function() {}) {} -// \\"LogicalExpression\\" +// "LogicalExpression" class a extends (b || c) {} -// \\"MemberExpression\\" +// "MemberExpression" class a extends b.c {} -// \\"NewExpression\\" +// "NewExpression" class a extends (new B()) {} -// \\"ObjectExpression\\" +// "ObjectExpression" class a extends ({}) {} -// \\"SequenceExpression\\" +// "SequenceExpression" class a extends (b, c) {} -// \\"TaggedTemplateExpression\\" +// "TaggedTemplateExpression" class a extends \`\` {} -// \\"UnaryExpression\\" +// "UnaryExpression" class a extends (void b) {} -// \\"UpdateExpression\\" +// "UpdateExpression" class a extends (++b) {} -// \\"YieldExpression\\" +// "YieldExpression" function* f() { // Flow has a bug parsing it. // class a extends (yield 1) {} @@ -59,62 +59,62 @@ function* f() { x = class extends (++b) {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// \\"ArrowFunctionExpression\\" +// "ArrowFunctionExpression" class a extends (() => {}) {} -// \\"AssignmentExpression\\" +// "AssignmentExpression" class a extends (b = c) {} -// \\"AwaitExpression\\" +// "AwaitExpression" async function f() { class a extends (await b) {} } -// \\"BinaryExpression\\" +// "BinaryExpression" class a extends (b + c) {} -// \\"CallExpression\\" +// "CallExpression" class a extends b() {} -// \\"ClassExpression\\" +// "ClassExpression" class a extends class {} {} -// \\"ConditionalExpression\\" +// "ConditionalExpression" class a extends (b ? c : d) {} -// \\"FunctionExpression\\" +// "FunctionExpression" class a extends function() {} {} -// \\"LogicalExpression\\" +// "LogicalExpression" class a extends (b || c) {} -// \\"MemberExpression\\" +// "MemberExpression" class a extends b.c {} -// \\"NewExpression\\" +// "NewExpression" class a extends (new B()) {} -// \\"ObjectExpression\\" +// "ObjectExpression" class a extends ({}) {} -// \\"SequenceExpression\\" +// "SequenceExpression" class a extends (b, c) {} -// \\"TaggedTemplateExpression\\" +// "TaggedTemplateExpression" class a extends \`\` {} -// \\"UnaryExpression\\" +// "UnaryExpression" class a extends (void b) {} -// \\"UpdateExpression\\" +// "UpdateExpression" class a extends (++b) {} -// \\"YieldExpression\\" +// "YieldExpression" function* f() { // Flow has a bug parsing it. // class a extends (yield 1) {} } x = class extends (++b) {}; -" + `; diff --git a/tests/classes/__snapshots__/jsfmt.spec.js.snap b/tests/classes/__snapshots__/jsfmt.spec.js.snap index f51a0b20..d9d69f14 100644 --- a/tests/classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/classes/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`binary.js 1`] = ` -"(class {}) + 1; +(class {}) + 1; (class a {}) + 1; (class extends b {}) + 1; (class a extends b {}) + 1; @@ -10,11 +10,11 @@ exports[`binary.js 1`] = ` (class a {} + 1); (class extends b {} + 1); (class a extends b {} + 1); -" + `; exports[`break.js 1`] = ` -"class MyContractSelectionWidget extends React.Component implements SomethingLarge { +class MyContractSelectionWidget extends React.Component implements SomethingLarge { method() {} } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -23,18 +23,18 @@ class MyContractSelectionWidget implements SomethingLarge { method() {} } -" + `; exports[`call.js 1`] = ` -"(class {})(class {}); +(class {})(class {}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (class {}(class {})); -" + `; exports[`empty.js 1`] = ` -"class A { +class A { // comment } @@ -61,21 +61,21 @@ class A {} class A { m() {} } -" + `; exports[`member.js 1`] = ` -"(class {})[1]; +(class {})[1]; (class {}).a; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (class {}[1]); (class {}.a); -" + `; exports[`ternary.js 1`] = ` -"if (1) (class {}) ? 1 : 2; +if (1) (class {}) ? 1 : 2; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (1) (class {} ? 1 : 2); -" + `; diff --git a/tests/comments/__snapshots__/jsfmt.spec.js.snap b/tests/comments/__snapshots__/jsfmt.spec.js.snap index 19d5f2c3..afa2ae54 100644 --- a/tests/comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/comments/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`assignment-pattern.js 1`] = ` -"const { a /* comment */ = 1 } = b; +const { a /* comment */ = 1 } = b; const { c = 1 /* comment */ } = d; @@ -15,11 +15,11 @@ const { c = 1 /* comment */ } = d; let { a = b //comment } = c; -" + `; exports[`before-comma.js 1`] = ` -"const foo = { +const foo = { a: 'a' /* comment for this line */, /* Section B */ @@ -27,16 +27,16 @@ exports[`before-comma.js 1`] = ` }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const foo = { - a: \\"a\\" /* comment for this line */, + a: "a" /* comment for this line */, /* Section B */ - b: \\"b\\" + b: "b" }; -" + `; exports[`blank.js 1`] = ` -"// This file only +// This file only // has comments. This comment // should still exist // @@ -79,11 +79,11 @@ exports[`blank.js 1`] = ` // comment // comment -" + `; exports[`call_comment.js 1`] = ` -"render( // Warm any cache +render( // Warm any cache , container ); @@ -104,11 +104,11 @@ React.render( , container ); -" + `; exports[`dangling.js 1`] = ` -"var x = {/* dangling */}; +var x = {/* dangling */}; var x = { // dangling }; @@ -135,11 +135,11 @@ declare class Foo extends Qux { /* dangling */ } export /* dangling */{}; -" + `; exports[`dangling_array.js 1`] = ` -"expect(() => {}).toTriggerReadyStateChanges([ +expect(() => {}).toTriggerReadyStateChanges([ // Nothing. ]); @@ -152,11 +152,11 @@ expect(() => {}).toTriggerReadyStateChanges( ); [1 /* first comment */, 2 /* second comment */, 3]; -" + `; exports[`dangling_for.js 1`] = ` -"for // comment +for // comment (;;); for /* comment */(;;); @@ -166,37 +166,37 @@ for (;;); /* comment */ for (;;); -" + `; exports[`export.js 1`] = ` -"export //comment +export //comment {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //comment export {}; -" + `; exports[`first-line.js 1`] = ` -"a // comment +a // comment b ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a; // comment b; -" + `; exports[`flow_union.js 1`] = ` -"type UploadState +type UploadState // The upload hasnt begun yet - = {type: \\"Not_begun\\"} + = {type: "Not_begun"} // The upload timed out - | {type: \\"Timed_out\\"} + | {type: "Timed_out"} // Failed somewhere on the line - | {type: \\"Failed\\", error: E, errorMsg: EM} + | {type: "Failed", error: E, errorMsg: EM} // Uploading to aws3 and CreatePostMutation succeeded - | {type: \\"Success\\", data: D}; + | {type: "Success", data: D}; type UploadState // The upload hasnt begun yet @@ -210,13 +210,13 @@ type UploadState ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type UploadState = // The upload hasnt begun yet - | { type: \\"Not_begun\\" } + | { type: "Not_begun" } // The upload timed out - | { type: \\"Timed_out\\" } + | { type: "Timed_out" } // Failed somewhere on the line - | { type: \\"Failed\\", error: E, errorMsg: EM } + | { type: "Failed", error: E, errorMsg: EM } // Uploading to aws3 and CreatePostMutation succeeded - | { type: \\"Success\\", data: D }; + | { type: "Success", data: D }; type UploadState = // The upload hasnt begun yet @@ -227,22 +227,22 @@ type UploadState = | C // Uploading to aws3 and CreatePostMutation succeeded | D; -" + `; exports[`function-declaration.js 1`] = ` -"function a(/* comment */) {} // comment +function a(/* comment */) {} // comment function b() {} // comment function c(/* comment */ argA, argB, argC) {} // comment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function a(/* comment */) {} // comment function b() {} // comment function c(/* comment */ argA, argB, argC) {} // comment -" + `; exports[`if.js 1`] = ` -"if (1) +if (1) // comment { false @@ -292,11 +292,11 @@ if (1) { } else { // comment } -" + `; exports[`issues.js 1`] = ` -"// Does not need to break as it fits in 80 columns +// Does not need to break as it fits in 80 columns this.call(a, /* comment */ b); function f( @@ -354,11 +354,11 @@ export type AsyncExecuteOptions = child_process$execFileOpts & { // optional trailing comma gets moved all the way to the beginning const regex = new RegExp( - '^\\\\\\\\s*' + // beginning of the line - 'name\\\\\\\\s*=\\\\\\\\s*' + // name = - '[\\\\'\\"]' + // opening quotation mark + '^\\\\s*' + // beginning of the line + 'name\\\\s*=\\\\s*' + // name = + '[\\'"]' + // opening quotation mark escapeStringRegExp(target.name) + // target name - '[\\\\'\\"]' + // closing quotation mark + '[\\'"]' + // closing quotation mark ',?$', // optional trailing comma ); @@ -425,30 +425,30 @@ throw new ProcessSystemError({ export type BuckWebSocketMessage = | { // Not actually from Buck - this is to let the receiver know that the socket is connected. - type: \\"SocketConnected\\" + type: "SocketConnected" } | { - type: \\"BuildProgressUpdated\\", + type: "BuildProgressUpdated", progressValue: number } | { - type: \\"BuildFinished\\", + type: "BuildFinished", exitCode: number } | { - type: \\"BuildStarted\\" + type: "BuildStarted" } | { - type: \\"ParseStarted\\" + type: "ParseStarted" } | { - type: \\"ParseFinished\\" + type: "ParseFinished" } | { - type: \\"RunStarted\\" + type: "RunStarted" } | { - type: \\"RunComplete\\" + type: "RunComplete" }; // Missing one level of indentation because of the comment @@ -469,16 +469,16 @@ export type AsyncExecuteOptions = child_process$execFileOpts & { // optional trailing comma gets moved all the way to the beginning const regex = new RegExp( - \\"^\\\\\\\\s*\\" + // beginning of the line - \\"name\\\\\\\\s*=\\\\\\\\s*\\" + // name = - \\"['\\\\\\"]\\" + // opening quotation mark + "^\\\\s*" + // beginning of the line + "name\\\\s*=\\\\s*" + // name = + "['\\"]" + // opening quotation mark escapeStringRegExp(target.name) + // target name - \\"['\\\\\\"]\\" + // closing quotation mark - \\",?$\\" // optional trailing comma + "['\\"]" + // closing quotation mark + ",?$" // optional trailing comma ); // The comment is moved and doesn't trigger the eslint rule anymore -import path from \\"path\\"; // eslint-disable-line nuclide-internal/prefer-nuclide-uri +import path from "path"; // eslint-disable-line nuclide-internal/prefer-nuclide-uri // Comments disappear in-between MemberExpressions Observable.of(process) @@ -510,18 +510,18 @@ if (1) { } // The comment makes the line break in a weird way -const result = asyncExecute(\\"non_existing_command\\", /* args */ []); +const result = asyncExecute("non_existing_command", /* args */ []); // The closing paren is printed on the same line as the comment foo( {} // Hi ); -" + `; exports[`jsx.js 1`] = ` -"
+
{ /* comment */ } @@ -655,11 +655,11 @@ exports[`jsx.js 1`] = `
{/*
Some very v ery very very long line to break line width limit
*/}
; -" + `; exports[`last-arg.js 1`] = ` -"type f = ( +type f = ( currentRequest: {a: number}, // TODO this is a very very very very long comment that makes it go > 80 columns ) => number; @@ -726,11 +726,11 @@ function f( ): number { return a + 1; } -" + `; exports[`preserve-new-line-last.js 1`] = ` -"function f() { +function f() { a /* eslint-disable */ } @@ -773,11 +773,11 @@ function name() { // comment3 why func3 commented // func3() } -" + `; exports[`return-statement.js 1`] = ` -"function jsx() { +function jsx() { return ( // Comment
@@ -1026,17 +1026,17 @@ function taggedTemplate() { function inlineComment() { return /* hi */ 42 || 42; } -" + `; exports[`switch.js 1`] = ` -"switch (node && node.type) { - case \\"Property\\": - case \\"MethodDefinition\\": +switch (node && node.type) { + case "Property": + case "MethodDefinition": prop = node.key; break; - case \\"MemberExpression\\": + case "MemberExpression": prop = node.property; break; @@ -1044,38 +1044,38 @@ exports[`switch.js 1`] = ` } switch (foo) { - case \\"bar\\": + case "bar": doThing() // no default } switch (foo) { - case \\"bar\\": //comment + case "bar": //comment doThing(); //comment - case \\"baz\\": + case "baz": doOtherThing(); //comment } switch (foo) { - case \\"bar\\": { + case "bar": { doThing(); } //comment - case \\"baz\\": { + case "baz": { doThing(); } //comment } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ switch (node && node.type) { - case \\"Property\\": - case \\"MethodDefinition\\": + case "Property": + case "MethodDefinition": prop = node.key; break; - case \\"MemberExpression\\": + case "MemberExpression": prop = node.property; break; @@ -1083,34 +1083,34 @@ switch (node && node.type) { } switch (foo) { - case \\"bar\\": + case "bar": doThing(); // no default } switch (foo) { - case \\"bar\\": //comment + case "bar": //comment doThing(); //comment - case \\"baz\\": + case "baz": doOtherThing(); //comment } switch (foo) { - case \\"bar\\": { + case "bar": { doThing(); } //comment - case \\"baz\\": { + case "baz": { doThing(); } //comment } -" + `; exports[`template-literal.js 1`] = ` -"\` +\` \${a // comment } @@ -1135,11 +1135,11 @@ a} /*comment*/ d}; \`; -" + `; exports[`try.js 1`] = ` -"// comment 1 +// comment 1 try { // comment 2 } @@ -1163,11 +1163,11 @@ try { // comment 5 // comment 7 } -" + `; exports[`variable_declarator.js 1`] = ` -"let obj = // Comment +let obj = // Comment { key: 'val' } @@ -1208,41 +1208,41 @@ let obj = [ let obj = // Comment { - key: \\"val\\" + key: "val" }; let obj = // Comment { - key: \\"val\\" + key: "val" }; let obj = { // Comment - key: \\"val\\" + key: "val" }; let obj = { // Comment - key: \\"val\\" + key: "val" }; let obj = // Comment - [\\"val\\"]; + ["val"]; let obj = // Comment - [\\"val\\"]; + ["val"]; let obj = [ // Comment - \\"val\\" + "val" ]; let obj = [ // Comment - \\"val\\" + "val" ]; -" + `; diff --git a/tests/computed_props/__snapshots__/jsfmt.spec.js.snap b/tests/computed_props/__snapshots__/jsfmt.spec.js.snap index fafd502e..62fba9b2 100644 --- a/tests/computed_props/__snapshots__/jsfmt.spec.js.snap +++ b/tests/computed_props/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`classes.js 1`] = ` -"class c { - [\\"i\\"]() {} +class c { + ["i"]() {} } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class c { - [\\"i\\"]() {} + ["i"]() {} } -" + `; diff --git a/tests/conditional/__snapshots__/jsfmt.spec.js.snap b/tests/conditional/__snapshots__/jsfmt.spec.js.snap index 3ce25410..873eb340 100644 --- a/tests/conditional/__snapshots__/jsfmt.spec.js.snap +++ b/tests/conditional/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`comments.js 1`] = ` -"var inspect = 4 === util.inspect.length +var inspect = 4 === util.inspect.length ? // node <= 0.8.x (function(v, colors) { return util.inspect(v, void 0, void 0, colors); @@ -28,16 +28,16 @@ const extractTextPluginOptions = shouldUseRelativeAssetPaths const extractTextPluginOptions = shouldUseRelativeAssetPaths ? // Making sure that the publicPath goes back to to build folder. - { publicPath: Array(cssFilename.split(\\"/\\").length).join(\\"../\\") } + { publicPath: Array(cssFilename.split("/").length).join("../") } : {}; const extractTextPluginOptions = shouldUseRelativeAssetPaths // Making sure that the publicPath goes back to to build folder. - ? { publicPath: Array(cssFilename.split(\\"/\\").length).join(\\"../\\") } + ? { publicPath: Array(cssFilename.split("/").length).join("../") } : {}; -const { configureStore } = process.env.NODE_ENV === \\"production\\" - ? require(\\"./configureProdStore\\") // a - : require(\\"./configureDevStore\\"); // b +const { configureStore } = process.env.NODE_ENV === "production" + ? require("./configureProdStore") // a + : require("./configureDevStore"); // b ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var inspect = 4 === util.inspect.length ? // node <= 0.8.x @@ -61,42 +61,42 @@ var inspect = 4 === util.inspect.length const extractTextPluginOptions = shouldUseRelativeAssetPaths ? // Making sure that the publicPath goes back to to build folder. - { publicPath: Array(cssFilename.split(\\"/\\").length).join(\\"../\\") } + { publicPath: Array(cssFilename.split("/").length).join("../") } : {}; const extractTextPluginOptions = shouldUseRelativeAssetPaths ? // Making sure that the publicPath goes back to to build folder. - { publicPath: Array(cssFilename.split(\\"/\\").length).join(\\"../\\") } + { publicPath: Array(cssFilename.split("/").length).join("../") } : {}; const extractTextPluginOptions = shouldUseRelativeAssetPaths // Making sure that the publicPath goes back to to build folder. - ? { publicPath: Array(cssFilename.split(\\"/\\").length).join(\\"../\\") } + ? { publicPath: Array(cssFilename.split("/").length).join("../") } : {}; -const { configureStore } = process.env.NODE_ENV === \\"production\\" - ? require(\\"./configureProdStore\\") // a - : require(\\"./configureDevStore\\"); // b -" +const { configureStore } = process.env.NODE_ENV === "production" + ? require("./configureProdStore") // a + : require("./configureDevStore"); // b + `; exports[`new-expression.js 1`] = ` -"const testConsole = new TestConsole( +const testConsole = new TestConsole( config.useStderr ? process.stderr : process.stdout ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const testConsole = new TestConsole( config.useStderr ? process.stderr : process.stdout ); -" + `; exports[`no-confusing-arrow.js 1`] = ` -"// no-confusing-arrow +// no-confusing-arrow var x = a => 1 ? 2 : 3; var x = a <= 1 ? 2 : 3; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // no-confusing-arrow var x = a => (1 ? 2 : 3); var x = a <= 1 ? 2 : 3; -" + `; diff --git a/tests/decorators/__snapshots__/jsfmt.spec.js.snap b/tests/decorators/__snapshots__/jsfmt.spec.js.snap index 86119734..8f929444 100644 --- a/tests/decorators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/decorators/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`mobx.js 1`] = ` -"import {observable} from \\"mobx\\"; +import {observable} from "mobx"; @observer class OrderLine { @observable price:number = 0; @@ -20,7 +20,7 @@ exports[`mobx.js 1`] = ` } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import { observable } from \\"mobx\\"; +import { observable } from "mobx"; @observer class OrderLine { @observable price: number = 0; @@ -38,11 +38,11 @@ import { observable } from \\"mobx\\"; this.price = price; } } -" + `; exports[`multiple.js 1`] = ` -"const dog = { +const dog = { @readonly @nonenumerable @doubledValue @@ -55,11 +55,11 @@ const dog = { @doubledValue legs: 4 }; -" + `; exports[`redux.js 1`] = ` -"@connect(mapStateToProps, mapDispatchToProps) +@connect(mapStateToProps, mapDispatchToProps) export class MyApp extends React.Component {} @connect(state => ({ todos: state.todos })) @@ -70,5 +70,5 @@ export class MyApp extends React.Component {} @connect(state => ({ todos: state.todos })) export class Home extends React.Component {} -" + `; diff --git a/tests/directives/__snapshots__/jsfmt.spec.js.snap b/tests/directives/__snapshots__/jsfmt.spec.js.snap index ba98973c..c5df6ee7 100644 --- a/tests/directives/__snapshots__/jsfmt.spec.js.snap +++ b/tests/directives/__snapshots__/jsfmt.spec.js.snap @@ -1,65 +1,65 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`last-line-0.js 1`] = ` -"'use strict';~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -\\"use strict\\"; -" +'use strict';~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +"use strict"; + `; exports[`last-line-1.js 1`] = ` -"'use strict'; +'use strict'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -\\"use strict\\"; -" +"use strict"; + `; exports[`last-line-2.js 1`] = ` -"'use strict'; +'use strict'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -\\"use strict\\"; -" +"use strict"; + `; exports[`newline.js 1`] = ` -"/* @flow */ +/* @flow */ -\\"use strict\\"; +"use strict"; -import a from \\"a\\"; +import a from "a"; a(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -\\"use strict\\"; +"use strict"; -import a from \\"a\\"; +import a from "a"; a(); -" + `; exports[`no-newline.js 1`] = ` -"\\"use strict\\"; +"use strict"; a ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -\\"use strict\\"; +"use strict"; a; -" + `; exports[`test.js 1`] = ` -"\\"use strict\\"; +"use strict"; function fn() { - \\"use strict\\"; + "use strict"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -\\"use strict\\"; +"use strict"; function fn() { - \\"use strict\\"; + "use strict"; } -" + `; diff --git a/tests/do/__snapshots__/jsfmt.spec.js.snap b/tests/do/__snapshots__/jsfmt.spec.js.snap index 4fd7295a..9c5d1030 100644 --- a/tests/do/__snapshots__/jsfmt.spec.js.snap +++ b/tests/do/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`do.js 1`] = ` -"const envSpecific = { +const envSpecific = { domain: do { if(env === 'production') 'https://abc.mno.com/'; @@ -11,9 +11,9 @@ exports[`do.js 1`] = ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const envSpecific = { domain: do { - if (env === \\"production\\") (\\"https://abc.mno.com/\\"); - else if (env === \\"development\\") (\\"http://localhost:4000\\"); + if (env === "production") ("https://abc.mno.com/"); + else if (env === "development") ("http://localhost:4000"); } }; -" + `; diff --git a/tests/dynamic_import/__snapshots__/jsfmt.spec.js.snap b/tests/dynamic_import/__snapshots__/jsfmt.spec.js.snap index be41fd38..1bcbd4f1 100644 --- a/tests/dynamic_import/__snapshots__/jsfmt.spec.js.snap +++ b/tests/dynamic_import/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"import(\\"module.js\\"); -import(\\"module.js\\").then((a) => a); +import("module.js"); +import("module.js").then((a) => a); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import(\\"module.js\\"); -import(\\"module.js\\").then(a => a); -" +import("module.js"); +import("module.js").then(a => a); + `; diff --git a/tests/empty_paren_comment/__snapshots__/jsfmt.spec.js.snap b/tests/empty_paren_comment/__snapshots__/jsfmt.spec.js.snap index bd4d43e2..7da9a748 100644 --- a/tests/empty_paren_comment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/empty_paren_comment/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`empty_paren_comment.js 1`] = ` -"let f = (/* ... */) => {} +let f = (/* ... */) => {} (function (/* ... */) {})(/* ... */) function f(/* ... */) {} @@ -52,5 +52,5 @@ f(/* ... */); f(a /* ... */); f(a, /* ... */ b); f(/* ... */ a, b); -" + `; diff --git a/tests/empty_statement/__snapshots__/jsfmt.spec.js.snap b/tests/empty_statement/__snapshots__/jsfmt.spec.js.snap index 42e607bc..fd88f42c 100644 --- a/tests/empty_statement/__snapshots__/jsfmt.spec.js.snap +++ b/tests/empty_statement/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`body.js 1`] = ` -"with (a); +with (a); if (1); else if (2); else; for (;;); while (1); @@ -19,5 +19,5 @@ for (var i in o); for (var i of o); do; while (1); -" + `; diff --git a/tests/es6modules/__snapshots__/jsfmt.spec.js.snap b/tests/es6modules/__snapshots__/jsfmt.spec.js.snap index c10231b6..e890040d 100644 --- a/tests/es6modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/es6modules/__snapshots__/jsfmt.spec.js.snap @@ -1,141 +1,141 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`export_default_arrow_expression.js 1`] = ` -"export default () => {}; +export default () => {}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default () => {}; -" + `; exports[`export_default_arrow_expression.js 2`] = ` -"export default () => {}; +export default () => {}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default () => {}; -" + `; exports[`export_default_call_expression.js 1`] = ` -"export default foo() +export default foo() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default foo(); -" + `; exports[`export_default_call_expression.js 2`] = ` -"export default foo() +export default foo() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default foo(); -" + `; exports[`export_default_class_declaration.js 1`] = ` -"export default class Foo {} +export default class Foo {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default class Foo {} -" + `; exports[`export_default_class_declaration.js 2`] = ` -"export default class Foo {} +export default class Foo {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default class Foo {} -" + `; exports[`export_default_class_expression.js 1`] = ` -"export default (class foobar {}) +export default (class foobar {}) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default (class foobar {}); -" + `; exports[`export_default_class_expression.js 2`] = ` -"export default (class foobar {}) +export default (class foobar {}) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default (class foobar {}); -" + `; exports[`export_default_function_declaration.js 1`] = ` -"export default function() {} +export default function() {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default function() {} -" + `; exports[`export_default_function_declaration.js 2`] = ` -"export default function() {} +export default function() {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default function() {} -" + `; exports[`export_default_function_declaration_async.js 1`] = ` -"export default async function foo() {} +export default async function foo() {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default (async function foo() {}); -" + `; exports[`export_default_function_declaration_async.js 2`] = ` -"export default async function foo() {} +export default async function foo() {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default async function foo() {} -" + `; exports[`export_default_function_declaration_named.js 1`] = ` -"export default function f(){} +export default function f(){} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default function f() {} -" + `; exports[`export_default_function_declaration_named.js 2`] = ` -"export default function f(){} +export default function f(){} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default function f() {} -" + `; exports[`export_default_function_expression.js 1`] = ` -"export default (function() {}); +export default (function() {}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default (function() {}); -" + `; exports[`export_default_function_expression.js 2`] = ` -"export default (function() {}); +export default (function() {}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default (function() {}); -" + `; exports[`export_default_function_expression_named.js 1`] = ` -"export default (function f(){}) +export default (function f(){}) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default (function f() {}); -" + `; exports[`export_default_function_expression_named.js 2`] = ` -"export default (function f(){}) +export default (function f(){}) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default (function f() {}); -" + `; exports[`export_default_new_expression.js 1`] = ` -"export default new Foo(); +export default new Foo(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default new Foo(); -" + `; exports[`export_default_new_expression.js 2`] = ` -"export default new Foo(); +export default new Foo(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default new Foo(); -" + `; diff --git a/tests/exact_object/__snapshots__/jsfmt.spec.js.snap b/tests/exact_object/__snapshots__/jsfmt.spec.js.snap index f2ac21e4..4269a885 100644 --- a/tests/exact_object/__snapshots__/jsfmt.spec.js.snap +++ b/tests/exact_object/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"type Props = {||}; +type Props = {||}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Props = {||}; -" + `; diff --git a/tests/export/__snapshots__/jsfmt.spec.js.snap b/tests/export/__snapshots__/jsfmt.spec.js.snap index 560bd687..5122b6f4 100644 --- a/tests/export/__snapshots__/jsfmt.spec.js.snap +++ b/tests/export/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bracket.js 1`] = ` -"export { +export { runTaskForChanged, description, someOtherLabel, @@ -24,11 +24,11 @@ export { soWeCanGetItTo80Columns }; export { fitsIn, oneLine }; -" + `; exports[`bracket.js 2`] = ` -"export { +export { runTaskForChanged, description, someOtherLabel, @@ -51,23 +51,23 @@ export { soWeCanGetItTo80Columns }; export {fitsIn, oneLine}; -" + `; exports[`empty.js 1`] = ` -"export {}; -export {} from \\".\\"; +export {}; +export {} from "."; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export {}; -export {} from \\".\\"; -" +export {} from "."; + `; exports[`empty.js 2`] = ` -"export {}; -export {} from \\".\\"; +export {}; +export {} from "."; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export {}; -export {} from \\".\\"; -" +export {} from "."; + `; diff --git a/tests/export_default/__snapshots__/jsfmt.spec.js.snap b/tests/export_default/__snapshots__/jsfmt.spec.js.snap index 27dbfe84..d2052563 100644 --- a/tests/export_default/__snapshots__/jsfmt.spec.js.snap +++ b/tests/export_default/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`body.js 1`] = ` -"export default (class {}[1] = 1); +export default (class {}[1] = 1); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export default (class {}[1] = 1); -" + `; diff --git a/tests/export_extension/__snapshots__/jsfmt.spec.js.snap b/tests/export_extension/__snapshots__/jsfmt.spec.js.snap index 460e2bfc..77248a66 100644 --- a/tests/export_extension/__snapshots__/jsfmt.spec.js.snap +++ b/tests/export_extension/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`export.js 1`] = ` -"export * as ns from 'mod'; +export * as ns from 'mod'; export v from 'mod'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -export * as ns from \\"mod\\"; -export v from \\"mod\\"; -" +export * as ns from "mod"; +export v from "mod"; + `; diff --git a/tests/exports/__snapshots__/jsfmt.spec.js.snap b/tests/exports/__snapshots__/jsfmt.spec.js.snap index 2e871ee5..1c070628 100644 --- a/tests/exports/__snapshots__/jsfmt.spec.js.snap +++ b/tests/exports/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\"; +export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports"; -export a,{b} from \\"./baz\\"; +export a,{b} from "./baz"; -export * as ns from \\"mod\\"; +export * as ns from "mod"; -export * as foo,{bar} from \\"./baz\\"; +export * as foo,{bar} from "./baz"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export { value1, @@ -15,12 +15,12 @@ export { value3, value4 as value4_renamed, value5 -} from \\"exports\\"; +} from "exports"; -export a, { b } from \\"./baz\\"; +export a, { b } from "./baz"; -export * as ns from \\"mod\\"; +export * as ns from "mod"; + +export * as foo, { bar } from "./baz"; -export * as foo, { bar } from \\"./baz\\"; -" `; diff --git a/tests/expression_statement/__snapshots__/jsfmt.spec.js.snap b/tests/expression_statement/__snapshots__/jsfmt.spec.js.snap index c6b6fd30..90441c9e 100644 --- a/tests/expression_statement/__snapshots__/jsfmt.spec.js.snap +++ b/tests/expression_statement/__snapshots__/jsfmt.spec.js.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`no_regression.js 1`] = ` -"// Ensure no regression. -\\"use strict\\"; +// Ensure no regression. +"use strict"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Ensure no regression. -\\"use strict\\"; -" +"use strict"; + `; exports[`use_strict.js 1`] = ` -"// Parentheses around expression statement should be preserved in this case. -(\\"use strict\\"); +// Parentheses around expression statement should be preserved in this case. +("use strict"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Parentheses around expression statement should be preserved in this case. -(\\"use strict\\"); -" +("use strict"); + `; diff --git a/tests/first_argument_expansion/__snapshots__/jsfmt.spec.js.snap b/tests/first_argument_expansion/__snapshots__/jsfmt.spec.js.snap index 6b86606b..b21d702c 100644 --- a/tests/first_argument_expansion/__snapshots__/jsfmt.spec.js.snap +++ b/tests/first_argument_expansion/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"setTimeout(function() { +setTimeout(function() { thing(); }, 500); -[\\"a\\",\\"b\\",\\"c\\"].reduce(function(item, thing) { - return thing + \\" \\" + item; -}, \\"letters:\\") +["a","b","c"].reduce(function(item, thing) { + return thing + " " + item; +}, "letters:") func(() => { thing(); @@ -66,7 +66,7 @@ func(() => { compose((a) => { return a.thing; }, b => { - return b + \\"\\"; + return b + ""; }); compose((a) => { @@ -93,9 +93,9 @@ setTimeout(function() { thing(); }, 500); -[\\"a\\", \\"b\\", \\"c\\"].reduce(function(item, thing) { - return thing + \\" \\" + item; -}, \\"letters:\\"); +["a", "b", "c"].reduce(function(item, thing) { + return thing + " " + item; +}, "letters:"); func(() => { thing(); @@ -166,7 +166,7 @@ compose( return a.thing; }, b => { - return b + \\"\\"; + return b + ""; } ); @@ -196,5 +196,5 @@ setTimeout( }, 500 ); -" + `; diff --git a/tests/flow/abnormal/__snapshots__/jsfmt.spec.js.snap b/tests/flow/abnormal/__snapshots__/jsfmt.spec.js.snap index 829dbc53..83b16bbc 100644 --- a/tests/flow/abnormal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/abnormal/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`break-continue.js 1`] = ` -"function foo() { +function foo() { while(true) { break; } } @@ -20,11 +20,11 @@ function bar() { continue L; } while (false); } -" + `; exports[`return.js 1`] = ` -"function bar(x:number) { } +function bar(x:number) { } function foo() { var x = null; if (x == null) return; @@ -37,16 +37,16 @@ function foo() { if (x == null) return; bar(x); } -" + `; exports[`toplevel_throw.js 1`] = ` -"// @flow +// @flow throw new Error('foo'); // no error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -throw new Error(\\"foo\\"); // no error -" +throw new Error("foo"); // no error + `; diff --git a/tests/flow/annot/__snapshots__/jsfmt.spec.js.snap b/tests/flow/annot/__snapshots__/jsfmt.spec.js.snap index d215387d..1a76ac62 100644 --- a/tests/flow/annot/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/annot/__snapshots__/jsfmt.spec.js.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`annot.js 1`] = ` -"function foo(str:string, i:number):string { +function foo(str:string, i:number):string { return str; } var bar: (str:number, i:number)=> string = foo; var qux = function(str:string, i:number):number { return foo(str,i); } -var obj: {str:string; i:number; j:boolean} = {str: \\"...\\", i: \\"...\\", k: false}; +var obj: {str:string; i:number; j:boolean} = {str: "...", i: "...", k: false}; -var arr: Array = [1,2,\\"...\\"]; +var arr: Array = [1,2,"..."]; // array sugar -var array: number[] = [1,2,\\"...\\"]; +var array: number[] = [1,2,"..."]; var matrix: number[][] = [[1,2],[3,4]]; var matrix_parens: (number[])[] = matrix; @@ -23,7 +23,7 @@ var nullable_array_parens: ?(number[]) = nullable_array; var array_of_nullable: (?number)[] = [null, 3]; -var array_of_tuple: [number, string][] = [[0, \\"foo\\"], [1, \\"bar\\"]]; +var array_of_tuple: [number, string][] = [[0, "foo"], [1, "bar"]]; var array_of_tuple_parens: ([number, string])[] = array_of_tuple; type ObjType = { 'bar-foo': string; 'foo-bar': number; }; @@ -31,7 +31,7 @@ var test_obj: ObjType = { 'bar-foo': '23' }; // param type annos are strict UBs like var type annos function param_anno(n:number):void { - n = \\"hey\\"; // error + n = "hey"; // error } // another error on param UB, more typical of www (mis)use-cases @@ -72,15 +72,15 @@ var qux = function(str: string, i: number): number { }; var obj: { str: string, i: number, j: boolean } = { - str: \\"...\\", - i: \\"...\\", + str: "...", + i: "...", k: false }; -var arr: Array = [1, 2, \\"...\\"]; +var arr: Array = [1, 2, "..."]; // array sugar -var array: number[] = [1, 2, \\"...\\"]; +var array: number[] = [1, 2, "..."]; var matrix: number[][] = [[1, 2], [3, 4]]; var matrix_parens: number[][] = matrix; @@ -90,15 +90,15 @@ var nullable_array_parens: ?(number[]) = nullable_array; var array_of_nullable: (?number)[] = [null, 3]; -var array_of_tuple: [number, string][] = [[0, \\"foo\\"], [1, \\"bar\\"]]; +var array_of_tuple: [number, string][] = [[0, "foo"], [1, "bar"]]; var array_of_tuple_parens: [number, string][] = array_of_tuple; -type ObjType = { \\"bar-foo\\": string, \\"foo-bar\\": number }; -var test_obj: ObjType = { \\"bar-foo\\": \\"23\\" }; +type ObjType = { "bar-foo": string, "foo-bar": number }; +var test_obj: ObjType = { "bar-foo": "23" }; // param type annos are strict UBs like var type annos function param_anno(n: number): void { - n = \\"hey\\"; // error + n = "hey"; // error } // another error on param UB, more typical of www (mis)use-cases @@ -131,11 +131,11 @@ function foobar(n: ?number): number | null | void { function barfoo(n: number | null | void): ?number { return n; } -" + `; exports[`forward_ref.js 1`] = ` -"let myClassInstance: MyClass = null; // forward ref ok, null ~> class error +let myClassInstance: MyClass = null; // forward ref ok, null ~> class error function bar(): MyClass { return null; // forward ref ok, null ~> class error @@ -166,22 +166,22 @@ function foo() { class MyClass {} // looked up above } -" + `; exports[`issue-530.js 1`] = ` -"function foo(...args: any) { } +function foo(...args: any) { } module.exports = foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(...args: any) {} module.exports = foo; -" + `; exports[`leak.js 1`] = ` -"/** @flow */ +/** @flow */ /* This test documents an example we ran into of a type annotation leaking. * @@ -226,20 +226,20 @@ function foo(x: { [key: string]: mixed }) { function bar(y: MyObj): string { return y.foo; } -" + `; exports[`other.js 1`] = ` -"class C { } +class C { } module.exports = (C: any); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class C {} module.exports = (C: any); -" + `; exports[`scope.js 1`] = ` -"type Merge = (a: T, b: T) => T; +type Merge = (a: T, b: T) => T; // hypothetical immutable map declare class Map { @@ -292,14 +292,14 @@ class Foo { }; } } -" + `; exports[`test.js 1`] = ` -"var C = require('./other'); +var C = require('./other'); ((0: C): string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var C = require(\\"./other\\"); +var C = require("./other"); ((0: C): string); -" + `; diff --git a/tests/flow/annot/any/__snapshots__/jsfmt.spec.js.snap b/tests/flow/annot/any/__snapshots__/jsfmt.spec.js.snap index 2232cb0e..78a46f5a 100644 --- a/tests/flow/annot/any/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/annot/any/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"type T = any; +type T = any; export default class { p: T; @@ -20,20 +20,20 @@ export default class { this.p = 0; } } -" + `; exports[`B.js 1`] = ` -"import A from \\"./A\\" +import A from "./A" class B extends A { p: string; // OK, string ~> any } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import A from \\"./A\\"; +import A from "./A"; class B extends A { p: string; // OK, string ~> any } -" + `; diff --git a/tests/flow/annot2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/annot2/__snapshots__/jsfmt.spec.js.snap index 33145307..a9c920bd 100644 --- a/tests/flow/annot2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/annot2/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/** +/** * @providesModule A * @flow */ -import type T from \\"T\\"; +import type T from "T"; export default class { p: T; @@ -21,7 +21,7 @@ export default class { * @flow */ -import type T from \\"T\\"; +import type T from "T"; export default class { p: T; @@ -30,15 +30,15 @@ export default class { this.p = 0; } } -" + `; exports[`B.js 1`] = ` -"/** +/** * @flow */ -import A from \\"A\\" +import A from "A" class B extends A { p: string; // OK, string ~> any @@ -48,21 +48,21 @@ class B extends A { * @flow */ -import A from \\"A\\"; +import A from "A"; class B extends A { p: string; // OK, string ~> any } -" + `; exports[`T.js 1`] = ` -"/** +/** * @providesModule T */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule T */ -" + `; diff --git a/tests/flow/any/__snapshots__/jsfmt.spec.js.snap b/tests/flow/any/__snapshots__/jsfmt.spec.js.snap index 2404ac01..935c1b6c 100644 --- a/tests/flow/any/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/any/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`any.js 1`] = ` -"// @flow +// @flow function foo(x:any):any { return x; } function bar(x:any):mixed { return x; } @@ -26,22 +26,22 @@ function qux(x: mixed): any { var x: string = foo(0); var y: string = bar(0); var z: string = qux(0); -" + `; exports[`anyexportflowfile.js 1`] = ` -"// @flow +// @flow module.exports = ((x: any) => x: any); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow module.exports = ((x: any) => x: any); -" + `; exports[`flowfixme.js 1`] = ` -"/* +/* FlowFixMe is a synonym for any, used by the Flow team to signal a needed mod to JS devs. @@ -88,11 +88,11 @@ var x: string = foo(0); var y: string = bar(0); var z: string = qux(0); var w: string = baz(0); -" + `; exports[`flowissue.js 1`] = ` -"/* +/* $FlowIssue is a synonym for any, used by JS devs to signal a potential typechecker bug to the Flow team. @@ -139,22 +139,22 @@ var x: string = foo(0); var y: string = bar(0); var z: string = qux(0); var w: string = baz(0); -" + `; exports[`nonflowfile.js 1`] = ` -"// @noflow +// @noflow module.exports = (x) => x; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow module.exports = x => x; -" + `; exports[`propagate.js 1`] = ` -"// @flow +// @flow declare class C { bar(n1: number, n2: number): number; @@ -192,24 +192,24 @@ 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); } } -" + `; exports[`reach.js 1`] = ` -"/** +/** * like class and function values, any-typed values may be used in * type annotations. Here we test propagation of any through the * annotation - without it, the body of the if will be unreachable @@ -236,5 +236,5 @@ function foo(o: ?AsyncRequest) { var n: number = o; } } -" + `; diff --git a/tests/flow/arith/__snapshots__/jsfmt.spec.js.snap b/tests/flow/arith/__snapshots__/jsfmt.spec.js.snap index 7996a15f..647b1e58 100644 --- a/tests/flow/arith/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/arith/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Arith.js 1`] = ` -" + /* @providesModule Arith */ function num(x:number) { } @@ -10,7 +10,7 @@ function str(x:string) { } function foo() { var x = 0; - var y = \\"...\\"; + var y = "..."; var z = {}; num(x+x); num(x+y); // error @@ -56,20 +56,20 @@ num(true + null); // === 1 num(undefined + true); // === NaN num(true + undefined); // === NaN -str(\\"foo\\" + true); // error -str(true + \\"foo\\"); // error -str(\\"foo\\" + null); // error -str(null + \\"foo\\"); // error -str(\\"foo\\" + undefined); // error -str(undefined + \\"foo\\"); // error +str("foo" + true); // error +str(true + "foo"); // error +str("foo" + null); // error +str(null + "foo"); // error +str("foo" + undefined); // error +str(undefined + "foo"); // error let tests = [ function(x: mixed, y: mixed) { (x + y); // error (x + 0); // error (0 + x); // error - (x + \\"\\"); // error - (\\"\\" + x); // error + (x + ""); // error + ("" + x); // error (x + {}); // error ({} + x); // error }, @@ -80,8 +80,8 @@ let tests = [ function() { ((1 + {}): number); // error: object !~> number (({} + 1): number); // error: object !~> number - ((\\"1\\" + {}): string); // error: object !~> string - (({} + \\"1\\"): string); // error: object !~> string + (("1" + {}): string); // error: object !~> string + (({} + "1"): string); // error: object !~> string }, function(x: any, y: number, z: string) { @@ -101,7 +101,7 @@ function str(x: string) {} function foo() { var x = 0; - var y = \\"...\\"; + var y = "..."; var z = {}; num(x + x); num(x + y); // error @@ -147,20 +147,20 @@ num(true + null); // === 1 num(undefined + true); // === NaN num(true + undefined); // === NaN -str(\\"foo\\" + true); // error -str(true + \\"foo\\"); // error -str(\\"foo\\" + null); // error -str(null + \\"foo\\"); // error -str(\\"foo\\" + undefined); // error -str(undefined + \\"foo\\"); // error +str("foo" + true); // error +str(true + "foo"); // error +str("foo" + null); // error +str(null + "foo"); // error +str("foo" + undefined); // error +str(undefined + "foo"); // error let tests = [ function(x: mixed, y: mixed) { x + y; // error x + 0; // error 0 + x; // error - x + \\"\\"; // error - \\"\\" + x; // error + x + ""; // error + "" + x; // error x + {}; // error ({} + x); // error }, @@ -171,8 +171,8 @@ let tests = [ function() { (1 + {}: number); // error: object !~> number ({} + 1: number); // error: object !~> number - (\\"1\\" + {}: string); // error: object !~> string - ({} + \\"1\\": string); // error: object !~> string + ("1" + {}: string); // error: object !~> string + ({} + "1": string); // error: object !~> string }, function(x: any, y: number, z: string) { @@ -183,16 +183,16 @@ let tests = [ (z + x: empty); // error, string ~> empty } ]; -" + `; exports[`exponent.js 1`] = ` -"/* @flow */ +/* @flow */ let x: number = 2 ** 3; x **= 4; -let y: string = \\"123\\"; +let y: string = "123"; y **= 2; // error 1 + 2 ** 3 + 4; @@ -204,17 +204,17 @@ y **= 2; // error let x: number = 2 ** 3; x **= 4; -let y: string = \\"123\\"; +let y: string = "123"; y **= 2; // error 1 + 2 ** 3 + 4; 2 ** 2; (-2) ** 2; -" + `; exports[`generic.js 1`] = ` -"/* @flow */ +/* @flow */ function f(a: A): A { return a + a; } // error function f(a: A, b: B): A {return a + b; } // error @@ -239,11 +239,11 @@ function f(a: A, b: B): B { function f(a: A, b: B): B { return b + a; } // error -" + `; exports[`mult.js 1`] = ` -"/* @flow */ +/* @flow */ function num(x:number) { } @@ -253,7 +253,7 @@ num(1 * null); let x: number = 2 * 3; x *= 4; -let y: string = \\"123\\"; +let y: string = "123"; y *= 2; // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -266,23 +266,23 @@ num(1 * null); let x: number = 2 * 3; x *= 4; -let y: string = \\"123\\"; +let y: string = "123"; y *= 2; // error -" + `; exports[`relational.js 1`] = ` -"/* @flow */ +/* @flow */ (1 < 2); -(1 < \\"foo\\"); // error -(\\"foo\\" < 1); // error -(\\"foo\\" < \\"bar\\"); +(1 < "foo"); // error +("foo" < 1); // error +("foo" < "bar"); (1 < {foo: 1}); // error ({foo: 1} < 1); // error ({foo: 1} < {foo: 1}); // error -(\\"foo\\" < {foo: 1}); // error -({foo: 1} < \\"foo\\"); // error +("foo" < {foo: 1}); // error +({foo: 1} < "foo"); // error var x = (null : ?number); (1 < x); // 2 errors: null !~> number; undefined !~> number @@ -306,14 +306,14 @@ let tests = [ /* @flow */ 1 < 2; -1 < \\"foo\\"; // error -\\"foo\\" < 1; // error -\\"foo\\" < \\"bar\\"; +1 < "foo"; // error +"foo" < 1; // error +"foo" < "bar"; 1 < { foo: 1 }; // error ({ foo: 1 } < 1); // error ({ foo: 1 } < { foo: 1 }); // error -\\"foo\\" < { foo: 1 }; // error -({ foo: 1 } < \\"foo\\"); // error +"foo" < { foo: 1 }; // error +({ foo: 1 } < "foo"); // error var x = (null: ?number); 1 < x; // 2 errors: null !~> number; undefined !~> number @@ -333,5 +333,5 @@ let tests = [ x > z; } ]; -" + `; diff --git a/tests/flow/array-filter/__snapshots__/jsfmt.spec.js.snap b/tests/flow/array-filter/__snapshots__/jsfmt.spec.js.snap index 392a3894..258d1246 100644 --- a/tests/flow/array-filter/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/array-filter/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ function filterOutVoids (arr: Array): Array { return arr.filter(Boolean) @@ -20,11 +20,11 @@ function filterOutVoids(arr: Array): Array { function filterOutSmall(arr: Array): Array { return arr.filter(num => num && num > 10); } -" + `; exports[`test2.js 1`] = ` -"/* @flow */ +/* @flow */ function filterItems(items: Array): Array { return items.map(item => { @@ -45,7 +45,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; @@ -54,8 +54,8 @@ 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/flow/array_spread/__snapshots__/jsfmt.spec.js.snap b/tests/flow/array_spread/__snapshots__/jsfmt.spec.js.snap index 458cf314..68f915c3 100644 --- a/tests/flow/array_spread/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/array_spread/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"var A = [1,2,3]; +var A = [1,2,3]; var B = [...A]; var C = [1,2,3]; B.sort((a, b) => a - b); @@ -16,7 +16,7 @@ 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/flow/arraylib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/arraylib/__snapshots__/jsfmt.spec.js.snap index c6ec7c02..a970a713 100644 --- a/tests/flow/arraylib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/arraylib/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`array_lib.js 1`] = ` -"/* @flow */ +/* @flow */ 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]; @@ -46,13 +46,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); @@ -65,7 +65,7 @@ function foo(x: string) {} var a = [0]; var b = a.map(function(x) { foo(x); - return \\"\\" + x; + return "" + x; }); var c: number = a[0]; @@ -73,18 +73,18 @@ 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: @@ -109,17 +109,17 @@ 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); }); } -" + `; diff --git a/tests/flow/arrays/__snapshots__/jsfmt.spec.js.snap b/tests/flow/arrays/__snapshots__/jsfmt.spec.js.snap index 28b3cd9c..4412f32f 100644 --- a/tests/flow/arrays/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/arrays/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Arrays.js 1`] = ` -" + /* @providesModule Arrays */ function foo(x:string) { } var a = []; a[0] = 1; -a[1] = \\"...\\"; +a[1] = "..."; foo(a[1]); var y; @@ -34,12 +34,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 */ @@ -47,7 +47,7 @@ function foo(x: string) {} var a = []; a[0] = 1; -a[1] = \\"...\\"; +a[1] = "..."; foo(a[1]); var y; @@ -73,17 +73,17 @@ 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"; + `; exports[`numeric_elem.js 1`] = ` -"var arr = []; +var arr = []; var day = new Date; // Date instances are numeric (see Flow_js.numeric) and thus can index into @@ -98,5 +98,5 @@ var day = new Date(); // arrays. arr[day] = 0; (arr[day]: string); // error: number ~> string -" + `; diff --git a/tests/flow/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/flow/arrows/__snapshots__/jsfmt.spec.js.snap index 16371dee..b20767c5 100644 --- a/tests/flow/arrows/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/arrows/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`advanced_arrows.js 1`] = ` -"/** +/** * @flow */ @@ -11,7 +11,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 @@ -23,18 +23,18 @@ var bad = (x: number): string => x; // Error! var ident = (x: T): T => x; (ident(1): number); -(ident(\\"hi\\"): number); // Error -" +(ident("hi"): number); // Error + `; exports[`arrows.js 1`] = ` -"function selectBestEffortImageForWidth( +function selectBestEffortImageForWidth( maxWidth: number, images: Array ): 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]; } @@ -45,11 +45,11 @@ function selectBestEffortImageForWidth( ): 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] ); } -" + `; diff --git a/tests/flow/async/__snapshots__/jsfmt.spec.js.snap b/tests/flow/async/__snapshots__/jsfmt.spec.js.snap index 623b46c9..7b73c9f7 100644 --- a/tests/flow/async/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/async/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`async.js 1`] = ` -"// @flow +// @flow -// \\"For async functions, a Promise is returned, -// and the type of return expressions must be T.\\" +// "For async functions, a Promise is returned, +// and the type of return expressions must be T." // async function f0(): Promise { @@ -29,7 +29,7 @@ async function f3(p: Promise): Promise { } // TODO: this is one of those bad generic errors, currently: -// \\"inconsistent use of library definitions\\" with two core.js locs +// "inconsistent use of library definitions" with two core.js locs async function f4(p: Promise): Promise { return await p; // error, number != bool } @@ -56,8 +56,8 @@ var objf : () => Promise = obj.f; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -// \\"For async functions, a Promise is returned, -// and the type of return expressions must be T.\\" +// "For async functions, a Promise is returned, +// and the type of return expressions must be T." // async function f0(): Promise { @@ -82,7 +82,7 @@ async function f3(p: Promise): Promise { } // TODO: this is one of those bad generic errors, currently: -// \\"inconsistent use of library definitions\\" with two core.js locs +// "inconsistent use of library definitions" with two core.js locs async function f4(p: Promise): Promise { return await p; // error, number != bool } @@ -114,11 +114,11 @@ class C { var obj = { f: async () => await 1 }; var objf: () => Promise = obj.f; -" + `; exports[`async_base_class.js 1`] = ` -"// This is kind of weird, but it should parse. This works in babel without the +// This is kind of weird, but it should parse. This works in babel without the // parens around (await promise). From the es6 and async/await specs I (nmote) // am not clear on whether it should. In any case it's a strange corner case // that is probably not important to support. @@ -147,11 +147,11 @@ async function foo() { class Bar extends (await P) {} return Bar; } -" + `; exports[`async_parse.js 1`] = ` -"async function f() {} +async function f() {} async function ft(a: T) {} class C { @@ -200,22 +200,22 @@ console.log(x.async); var async = 3; var y = { async }; -" + `; exports[`async_promise.js 1`] = ` -"async function f(): Promise { +async function f(): Promise { return Promise.resolve(1); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ async function f(): Promise { return Promise.resolve(1); } -" + `; exports[`async_return_void.js 1`] = ` -"// @flow +// @flow async function foo1(): Promise { return; @@ -244,11 +244,11 @@ async function foo3(): Promise { function bar() {} return bar(); } -" + `; exports[`async2.js 1`] = ` -"// @flow +// @flow // misc basic @@ -274,7 +274,7 @@ function test1() { function test2() { async function voidoid1() { - console.log(\\"HEY\\"); + console.log("HEY"); } var voidoid2: () => Promise = voidoid1; // ok @@ -287,7 +287,7 @@ function test2() { function test3() { async function voidoid4(): Promise { // ok - console.log(\\"HEY\\"); + console.log("HEY"); } } @@ -298,14 +298,14 @@ function test3() { function test4() { async function voidoid5(): void { // error, void != Promise - console.log(\\"HEY\\"); + console.log("HEY"); } } function test5() { async function voidoid6() : Promise { // error, number != void - console.log(\\"HEY\\"); + console.log("HEY"); } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -335,7 +335,7 @@ function test1() { function test2() { async function voidoid1() { - console.log(\\"HEY\\"); + console.log("HEY"); } var voidoid2: () => Promise = voidoid1; // ok @@ -349,7 +349,7 @@ function test2() { function test3() { async function voidoid4(): Promise { // ok - console.log(\\"HEY\\"); + console.log("HEY"); } } @@ -361,21 +361,21 @@ function test3() { function test4() { async function voidoid5(): void { // error, void != Promise - console.log(\\"HEY\\"); + console.log("HEY"); } } function test5() { async function voidoid6(): Promise { // error, number != void - console.log(\\"HEY\\"); + console.log("HEY"); } } -" + `; exports[`async3.js 1`] = ` -"// @flow +// @flow /** * test nested-promise unwrapping. @@ -439,11 +439,11 @@ async function baz() { // Promise ~> string error for the same reason var c: string = a; } -" + `; exports[`await_parse.js 1`] = ` -"async function f() { await 1; } +async function f() { await 1; } async function ft(a: T) { await 1; } class C { @@ -522,5 +522,5 @@ console.log(x.await); var await = 3; var y = { await }; -" + `; diff --git a/tests/flow/async_iteration/__snapshots__/jsfmt.spec.js.snap b/tests/flow/async_iteration/__snapshots__/jsfmt.spec.js.snap index 5a62f453..aeb65b47 100644 --- a/tests/flow/async_iteration/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/async_iteration/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`delegate_yield.js 1`] = ` -"async function *delegate_next() { +async function *delegate_next() { async function *inner() { var x: void = yield; // error: number ~> void } @@ -54,11 +54,11 @@ async function* delegate_return() { } var x: void = yield* inner(); // error: number ~> void } -" + `; exports[`generator.js 1`] = ` -"declare interface File { +declare interface File { readLine(): Promise; close(): void; EOF: boolean; @@ -79,7 +79,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 } } @@ -105,15 +105,15 @@ 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 } } -" + `; exports[`return.js 1`] = ` -"declare var gen: AsyncGenerator; +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 @@ -121,7 +121,7 @@ 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 { @@ -130,7 +130,7 @@ 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 } @@ -144,7 +144,7 @@ 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 { @@ -153,16 +153,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 } }); -" + `; exports[`throw.js 1`] = ` -"async function *catch_return() { +async function *catch_return() { try { yield 0; } catch (e) { @@ -171,7 +171,7 @@ exports[`throw.js 1`] = ` } (async () => { - catch_return().throw(\\"\\").then(({value}) => { + catch_return().throw("").then(({value}) => { if (value !== undefined) { (value: void); // error: number ~> void } @@ -188,7 +188,7 @@ async function *yield_return() { } (async () => { - yield_return().throw(\\"\\").then(({value}) => { + yield_return().throw("").then(({value}) => { if (value !== undefined) { (value: void); // error: number ~> void } @@ -204,7 +204,7 @@ async function* catch_return() { } async () => { - catch_return().throw(\\"\\").then(({ value }) => { + catch_return().throw("").then(({ value }) => { if (value !== undefined) { (value: void); // error: number ~> void } @@ -221,11 +221,11 @@ async function* yield_return() { } async () => { - yield_return().throw(\\"\\").then(({ value }) => { + yield_return().throw("").then(({ value }) => { if (value !== undefined) { (value: void); // error: number ~> void } }); }; -" + `; diff --git a/tests/flow/autocomplete/__snapshots__/jsfmt.spec.js.snap b/tests/flow/autocomplete/__snapshots__/jsfmt.spec.js.snap index 478e73ae..523965db 100644 --- a/tests/flow/autocomplete/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/autocomplete/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`customfun.js 1`] = ` -"// @flow +// @flow declare var idx: $Facebookism$Idx; declare var merge: $Facebookism$Merge; @@ -24,14 +24,14 @@ declare var objectGetPrototypeOf: Object$GetPrototypeOf; declare var objectAssign: Object$Assign; m; -" + `; exports[`unknown.js 1`] = ` -"// @noflow -module.exports = { x: { y: \\"\\" } }; +// @noflow +module.exports = { x: { y: "" } }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow -module.exports = { x: { y: \\"\\" } }; -" +module.exports = { x: { y: "" } }; + `; diff --git a/tests/flow/auxiliary/__snapshots__/jsfmt.spec.js.snap b/tests/flow/auxiliary/__snapshots__/jsfmt.spec.js.snap index 4687a8d8..54e16122 100644 --- a/tests/flow/auxiliary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/auxiliary/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`client.js 1`] = ` -"var y:number = x; +var y:number = x; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var y: number = x; -" + `; diff --git a/tests/flow/auxiliary/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/auxiliary/lib/__snapshots__/jsfmt.spec.js.snap index 5180d35d..4e140dd6 100644 --- a/tests/flow/auxiliary/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/auxiliary/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`lib.js 1`] = ` -"declare var x: string; +declare var x: string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare var x: string; -" + `; diff --git a/tests/flow/binary/__snapshots__/jsfmt.spec.js.snap b/tests/flow/binary/__snapshots__/jsfmt.spec.js.snap index 8f5a54fc..4cc24592 100644 --- a/tests/flow/binary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/binary/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`in.js 1`] = ` -"// @flow +// @flow let tests = [ // objects on RHS @@ -9,7 +9,7 @@ let tests = [ ('foo' in {}); ('foo' in { foo: null }); (0 in {}); - (0 in { \\"0\\": null }); + (0 in { "0": null }); }, // arrays on RHS @@ -61,31 +61,31 @@ let tests = [ 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 @@ -99,19 +99,19 @@ let tests = [ // in predicates function() { - if (\\"foo\\" in 123) { + if ("foo" in 123) { } // error - if (!\\"foo\\" in {}) { + if (!"foo" in {}) { } // error, !'foo' is a boolean - if (!(\\"foo\\" in {})) { + 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 } ]; -" + `; diff --git a/tests/flow/binding/__snapshots__/jsfmt.spec.js.snap b/tests/flow/binding/__snapshots__/jsfmt.spec.js.snap index 1ee41050..5770f352 100644 --- a/tests/flow/binding/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/binding/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`const.js 1`] = ` -"const x = 0; +const x = 0; // errors: const cannot be reassigned x++; @@ -19,8 +19,8 @@ x &= 0; // regression tests -- OK to assign consts like this: -const { foo } = { foo: \\"foo\\" } -const [ bar ] = [\\"bar\\"]; +const { foo } = { foo: "foo" } +const [ bar ] = ["bar"]; (foo: number); // error: string ~> number (bar: number); // error: string ~> number @@ -47,8 +47,8 @@ x &= 0; // regression tests -- OK to assign consts like this: -const { foo } = { foo: \\"foo\\" }; -const [bar] = [\\"bar\\"]; +const { foo } = { foo: "foo" }; +const [bar] = ["bar"]; (foo: number); // error: string ~> number (bar: number); // error: string ~> number @@ -56,11 +56,11 @@ declare var bazzes: { baz: string }[]; for (const { baz } of bazzes) { (baz: number); // error: string ~> number } -" + `; exports[`rebinding.js 1`] = ` -"/* @flow +/* @flow * test errors on illegal rebinding/reassignment * * type class let const var (reassign) @@ -455,16 +455,16 @@ function fn_params_clash_fn_binding(x, y) { let x = 0; // error: x already bound var y = 0; // OK } -" + `; exports[`scope.js 1`] = ` -"function block_scope() { +function block_scope() { let a: number = 0; var b: number = 0; { - let a = \\"\\"; // ok: local to block - var b = \\"\\"; // error: string ~> number + let a = ""; // ok: local to block + var b = ""; // error: string ~> number } } @@ -472,12 +472,12 @@ function switch_scope(x: string) { let a: number = 0; var b: number = 0; switch (x) { - case \\"foo\\": - let a = \\"\\"; // ok: local to switch - var b = \\"\\"; // error: string ~> number + case "foo": + let a = ""; // ok: local to switch + var b = ""; // error: string ~> number break; - case \\"bar\\": - let a = \\"\\"; // error: a already bound in switch + case "bar": + let a = ""; // error: a already bound in switch break; } } @@ -488,43 +488,43 @@ function switch_scope(x: string) { function switch_scope2(x: number) { switch (x) { case 0: - a = \\"\\"; // error: assign before declaration + a = ""; // error: assign before declaration break; case 1: var b = a; // error: use before declaration break; case 2: - let a = \\"\\"; + let a = ""; break; case 3: - a = \\"\\"; // error: skipped initializer + a = ""; // error: skipped initializer break; case 4: var c:string = a; // error: skipped initializer break; } - a = \\"\\"; // error: a no longer in scope + a = ""; // error: a no longer in scope } function try_scope() { let a: number = 0; try { - let a = \\"\\"; // ok + let a = ""; // ok } catch (e) { - let a = \\"\\"; // ok + let a = ""; // ok } finally { - let a = \\"\\"; // ok + let a = ""; // ok } } function for_scope_let() { let a: number = 0; - for (let a = \\"\\" /* ok: local to init */;;) {} + for (let a = "" /* ok: local to init */;;) {} } function for_scope_var() { var a: number = 0; - for (var a = \\"\\" /* error: string ~> number */;;) {} + for (var a = "" /* error: string ~> number */;;) {} } function for_in_scope_let(o: Object) { @@ -558,7 +558,7 @@ function default_param_1() { function default_param_2() { // fn body bindings not visible from param scope - let a = \\"\\"; + let a = ""; function f0(x = () => a): number { let a = 0; return x(); // error: string ~> number @@ -573,8 +573,8 @@ function block_scope() { let a: number = 0; var b: number = 0; { - let a = \\"\\"; // ok: local to block - var b = \\"\\"; // error: string ~> number + let a = ""; // ok: local to block + var b = ""; // error: string ~> number } } @@ -582,12 +582,12 @@ function switch_scope(x: string) { let a: number = 0; var b: number = 0; switch (x) { - case \\"foo\\": - let a = \\"\\"; // ok: local to switch - var b = \\"\\"; // error: string ~> number + case "foo": + let a = ""; // ok: local to switch + var b = ""; // error: string ~> number break; - case \\"bar\\": - let a = \\"\\"; // error: a already bound in switch + case "bar": + let a = ""; // error: a already bound in switch break; } } @@ -598,44 +598,44 @@ function switch_scope(x: string) { function switch_scope2(x: number) { switch (x) { case 0: - a = \\"\\"; // error: assign before declaration + a = ""; // error: assign before declaration break; case 1: var b = a; // error: use before declaration break; case 2: - let a = \\"\\"; + let a = ""; break; case 3: - a = \\"\\"; // error: skipped initializer + a = ""; // error: skipped initializer break; case 4: var c: string = a; // error: skipped initializer break; } - a = \\"\\"; // error: a no longer in scope + a = ""; // error: a no longer in scope } function try_scope() { let a: number = 0; try { - let a = \\"\\"; // ok + let a = ""; // ok } catch (e) { - let a = \\"\\"; // ok + let a = ""; // ok } finally { - let a = \\"\\"; // ok + let a = ""; // ok } } function for_scope_let() { let a: number = 0; - for (let a = \\"\\" /* ok: local to init */; ; ) { + for (let a = "" /* ok: local to init */; ; ) { } } function for_scope_var() { var a: number = 0; - for (var a = \\"\\" /* error: string ~> number */; ; ) { + for (var a = "" /* error: string ~> number */; ; ) { } } @@ -674,7 +674,7 @@ function default_param_1() { function default_param_2() { // fn body bindings not visible from param scope - let a = \\"\\"; + let a = ""; function f0(x = () => a): number { let a = 0; return x(); // error: string ~> number @@ -684,11 +684,11 @@ function default_param_2() { return x; } } -" + `; exports[`tdz.js 1`] = ` -"/** @flow */ +/** @flow */ // -- types --- @@ -742,7 +742,7 @@ function f3() { function foo() { return 0; } } var s2: string = foo(); // ok, hoisted outer not clobbered - function foo() { return \\"\\"; } + function foo() { return ""; } } // out-of-scope TDZ not enforced. sometimes right... @@ -846,7 +846,7 @@ function f3() { } var s2: string = foo(); // ok, hoisted outer not clobbered function foo() { - return \\"\\"; + return ""; } } @@ -899,5 +899,5 @@ f(a); // error: undefined ~/> number a = 10; f(a); // ok, a: number (not ?number) -" + `; diff --git a/tests/flow/bom/__snapshots__/jsfmt.spec.js.snap b/tests/flow/bom/__snapshots__/jsfmt.spec.js.snap index 7a8c5584..2072362e 100644 --- a/tests/flow/bom/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/bom/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`FormData.js 1`] = ` -"/* @flow */ +/* @flow */ // constructor const a: FormData = new FormData(); // correct @@ -73,53 +73,53 @@ for (let [x, y]: [number, number] of a.entries()) {} // incorrect // constructor const a: FormData = new FormData(); // correct -new FormData(\\"\\"); // incorrect -new FormData(document.createElement(\\"input\\")); // incorrect -new FormData(document.createElement(\\"form\\")); // correct +new FormData(""); // incorrect +new FormData(document.createElement("input")); // incorrect +new FormData(document.createElement("form")); // correct // has -const b: boolean = a.has(\\"foo\\"); // correct +const b: boolean = a.has("foo"); // correct // get -const c: ?(string | File) = a.get(\\"foo\\"); // correct -const d: string = a.get(\\"foo\\"); // incorrect -const e: Blob = a.get(\\"foo\\"); // incorrect -const f: ?(string | File | Blob) = a.get(\\"foo\\"); // incorrect +const c: ?(string | File) = a.get("foo"); // correct +const d: string = a.get("foo"); // incorrect +const e: Blob = a.get("foo"); // incorrect +const f: ?(string | File | Blob) = a.get("foo"); // incorrect a.get(2); // incorrect // getAll -const a1: Array = a.getAll(\\"foo\\"); // correct -const a2: Array = a.getAll(\\"foo\\"); // incorrect -const a3: Array = a.getAll(\\"foo\\"); // incorrect +const a1: Array = a.getAll("foo"); // correct +const a2: Array = a.getAll("foo"); // incorrect +const a3: Array = a.getAll("foo"); // incorrect a.getAll(23); // incorrect // set -a.set(\\"foo\\", \\"bar\\"); // correct -a.set(\\"foo\\", {}); // incorrect -a.set(2, \\"bar\\"); // incorrect -a.set(\\"foo\\", \\"bar\\", \\"baz\\"); // incorrect -a.set(\\"bar\\", new File([], \\"q\\")); // correct -a.set(\\"bar\\", new File([], \\"q\\"), \\"x\\"); // correct -a.set(\\"bar\\", new File([], \\"q\\"), 2); // incorrect -a.set(\\"bar\\", new Blob()); // correct -a.set(\\"bar\\", new Blob(), \\"x\\"); // correct -a.set(\\"bar\\", new Blob(), 2); // incorrect +a.set("foo", "bar"); // correct +a.set("foo", {}); // incorrect +a.set(2, "bar"); // incorrect +a.set("foo", "bar", "baz"); // incorrect +a.set("bar", new File([], "q")); // correct +a.set("bar", new File([], "q"), "x"); // correct +a.set("bar", new File([], "q"), 2); // incorrect +a.set("bar", new Blob()); // correct +a.set("bar", new Blob(), "x"); // correct +a.set("bar", new Blob(), 2); // incorrect // append -a.append(\\"foo\\", \\"bar\\"); // correct -a.append(\\"foo\\", {}); // incorrect -a.append(2, \\"bar\\"); // incorrect -a.append(\\"foo\\", \\"bar\\", \\"baz\\"); // incorrect -a.append(\\"foo\\", \\"bar\\"); // incorrect -a.append(\\"bar\\", new File([], \\"q\\")); // correct -a.append(\\"bar\\", new File([], \\"q\\"), \\"x\\"); // correct -a.append(\\"bar\\", new File([], \\"q\\"), 2); // incorrect -a.append(\\"bar\\", new Blob()); // correct -a.append(\\"bar\\", new Blob(), \\"x\\"); // correct -a.append(\\"bar\\", new Blob(), 2); // incorrect +a.append("foo", "bar"); // correct +a.append("foo", {}); // incorrect +a.append(2, "bar"); // incorrect +a.append("foo", "bar", "baz"); // incorrect +a.append("foo", "bar"); // incorrect +a.append("bar", new File([], "q")); // correct +a.append("bar", new File([], "q"), "x"); // correct +a.append("bar", new File([], "q"), 2); // incorrect +a.append("bar", new Blob()); // correct +a.append("bar", new Blob(), "x"); // correct +a.append("bar", new Blob(), 2); // incorrect // delete -a.delete(\\"xx\\"); // correct +a.delete("xx"); // correct a.delete(3); // incorrect // keys @@ -145,11 +145,11 @@ for (let [x, y]: [string, number] of a.entries()) { } // incorrect for (let [x, y]: [number, number] of a.entries()) { } // incorrect -" + `; exports[`MutationObserver.js 1`] = ` -"/* @flow */ +/* @flow */ // constructor function callback(arr: Array, observer: MutationObserver): void { @@ -196,11 +196,11 @@ new MutationObserver(42); // incorrect new MutationObserver((n: number) => {}); // incorrect // observe -const div = document.createElement(\\"div\\"); -o.observe(div, { attributes: true, attributeFilter: [\\"style\\"] }); // correct +const div = document.createElement("div"); +o.observe(div, { attributes: true, attributeFilter: ["style"] }); // correct o.observe(div, { characterData: true, invalid: true }); // correct o.observe(); // incorrect -o.observe(\\"invalid\\"); // incorrect +o.observe("invalid"); // incorrect o.observe(div); // incorrect o.observe(div, {}); // incorrect o.observe(div, { subtree: true }); // incorrect @@ -211,5 +211,5 @@ o.takeRecords(); // correct // disconnect o.disconnect(); // correct -" + `; diff --git a/tests/flow/bounded_poly/__snapshots__/jsfmt.spec.js.snap b/tests/flow/bounded_poly/__snapshots__/jsfmt.spec.js.snap index 2698f000..1843a50e 100644 --- a/tests/flow/bounded_poly/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/bounded_poly/__snapshots__/jsfmt.spec.js.snap @@ -1,22 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`scope.js 1`] = ` -"function foo(x:X, y:Y):void { } -foo(0, \\"\\"); +function foo(x:X, y:Y):void { } +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; } -" + `; exports[`test.js 1`] = ` -"function foo(x: T): T { +function foo(x: T): T { var _ = x * 1; // OK var y: string = x; // error return x; // OK @@ -34,7 +34,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 @@ -63,12 +63,12 @@ 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 var q: number = c.qux(0); /* 2 more errors, since argument U = number is incompatible with T = string, and * result T = string is incompatible with number */ -" + `; diff --git a/tests/flow/break/__snapshots__/jsfmt.spec.js.snap b/tests/flow/break/__snapshots__/jsfmt.spec.js.snap index e6819ea8..75fcddec 100644 --- a/tests/flow/break/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/break/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`break.js 1`] = ` -"function foo(b) { +function foo(b) { 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 @@ -14,10 +14,10 @@ exports[`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; @@ -29,10 +29,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 @@ -47,7 +47,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 @@ -59,7 +59,7 @@ function test_const() { let st: string = 'abc'; for (let i = 1; i < 100; i++) { - const fooRes: ?string = \\"HEY\\"; + const fooRes: ?string = "HEY"; if (!fooRes) { break; } @@ -75,7 +75,7 @@ function foo(b) { var z; while (b) { if (x == null) { - z = \\"\\"; + z = ""; break; } var y: number = x; // error: boolean !~> number @@ -86,10 +86,10 @@ function foo(b) { 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; @@ -101,10 +101,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 @@ -120,7 +120,7 @@ function qux(b) { while (b) { var y: number = z; if (b) { - z = \\"\\"; + z = ""; continue; } // error: string !~> number z = 0; @@ -131,10 +131,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; } @@ -144,5 +144,5 @@ function test_const() { return st; } -" + `; diff --git a/tests/flow/builtin_uses/__snapshots__/jsfmt.spec.js.snap b/tests/flow/builtin_uses/__snapshots__/jsfmt.spec.js.snap index 8951f4bd..21278ea0 100644 --- a/tests/flow/builtin_uses/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/builtin_uses/__snapshots__/jsfmt.spec.js.snap @@ -1,21 +1,21 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"var o = Object.freeze({ foo: 0 }); +var o = Object.freeze({ foo: 0 }); (o.foo: string); module.exports = o; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var o = Object.freeze({ foo: 0 }); (o.foo: string); module.exports = o; -" + `; exports[`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/flow/builtins/__snapshots__/jsfmt.spec.js.snap b/tests/flow/builtins/__snapshots__/jsfmt.spec.js.snap index 86a1670b..a9dbfd6e 100644 --- a/tests/flow/builtins/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/builtins/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`array.js 1`] = ` -"var a = [\\"...\\"]; +var a = ["..."]; var b = a.map (function (x) { return 0; }); var c: string = b[0]; // error: number !~> string var array = []; function f() { - array = array.map (function () { return \\"...\\"; }); + array = array.map (function () { return "..."; }); var x:number = array[0]; // error: string !~> number } var Foo = require('./genericfoo'); var foo = new Foo(); function g() { - var foo1 = foo.map (function() { return \\"...\\"; }); + var foo1 = foo.map (function() { return "..."; }); var x:number = foo1.get(); // error: string !~> number foo = foo1; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var a = [\\"...\\"]; +var a = ["..."]; var b = a.map(function(x) { return 0; }); @@ -28,25 +28,25 @@ var c: string = b[0]; // error: number !~> string var array = []; function f() { array = array.map(function() { - return \\"...\\"; + return "..."; }); var x: number = array[0]; // error: string !~> number } -var Foo = require(\\"./genericfoo\\"); +var Foo = require("./genericfoo"); var foo = new Foo(); function g() { var foo1 = foo.map(function() { - return \\"...\\"; + return "..."; }); var x: number = foo1.get(); // error: string !~> number foo = foo1; } -" + `; exports[`genericfoo.js 1`] = ` -"class Foo { +class Foo { x:T; self():Foo { return this; } map(callbackfn: () => U): Foo { return new Foo(); } @@ -71,5 +71,5 @@ class Foo { } module.exports = Foo; -" + `; diff --git a/tests/flow/call_caching1/__snapshots__/jsfmt.spec.js.snap b/tests/flow/call_caching1/__snapshots__/jsfmt.spec.js.snap index 2cc3053d..68ed1fcf 100644 --- a/tests/flow/call_caching1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/call_caching1/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @flow const Immutable = require('immutable'); @@ -14,7 +14,7 @@ for (let [taskStatus, tasksMap] of tasksPerStatusMap) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const Immutable = require(\\"immutable\\"); +const Immutable = require("immutable"); const tasksPerStatusMap = new Map( [].map(taskStatus => [taskStatus, new Map()]) @@ -22,11 +22,11 @@ const tasksPerStatusMap = new Map( for (let [taskStatus, tasksMap] of tasksPerStatusMap) { tasksPerStatusMap.set(taskStatus, Immutable.Map(tasksMap)); } -" + `; exports[`test2.js 1`] = ` -"/* @flow */ +/* @flow */ declare class Bar { update(updater: (value: this) => Bar): Bar; @@ -60,11 +60,11 @@ declare var items: Bar; declare var updater: (value: Bar) => Bar; foo(items, acc => acc.update(updater)); -" + `; exports[`test3.js 1`] = ` -"// @flow +// @flow declare class ImmBox { static (x: any): ImmBox; @@ -97,5 +97,5 @@ declare class Box { const outer = new Box(); const inner = outer.get(); outer.set(ImmBox(inner)); -" + `; diff --git a/tests/flow/call_caching1/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/call_caching1/lib/__snapshots__/jsfmt.spec.js.snap index 64ae4467..c77b512a 100644 --- a/tests/flow/call_caching1/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/call_caching1/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`core.js 1`] = ` -"declare class Array { +declare class Array { @@iterator(): Iterator; map(callbackfn: (value: T, index: number, array: Array) => U, thisArg?: any): Array; } @@ -55,11 +55,11 @@ declare class Map { constructor(iterable: ?Iterable<[K, V]>): void, set(key: K, value: V): Map } -" + `; exports[`immutable.js 1`] = ` -"declare module \\"immutable\\" { +declare module "immutable" { declare class Map { static (iter: Iterator<[K,V]>): Map; static (object: {+[k:K]:V}): Map; @@ -68,7 +68,7 @@ exports[`immutable.js 1`] = ` } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare module \\"immutable\\" { +declare module "immutable" { declare class Map { static (iter: Iterator<[K, V]>): Map, static (object: { +[k: K]: V }): Map, @@ -76,5 +76,5 @@ declare module \\"immutable\\" { set(key: K, value: V): this } } -" + `; diff --git a/tests/flow/call_caching2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/call_caching2/__snapshots__/jsfmt.spec.js.snap index cb82180a..ec9ce5c5 100644 --- a/tests/flow/call_caching2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/call_caching2/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @flow function Foo(items: ?Iterable) { Iterable(items || []).size; @@ -12,5 +12,5 @@ function Foo(items: ?Iterable) { function Foo(items: ?Iterable) { Iterable(items || []).size; } -" + `; diff --git a/tests/flow/call_caching2/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/call_caching2/lib/__snapshots__/jsfmt.spec.js.snap index 7c2fa1e6..117c95dd 100644 --- a/tests/flow/call_caching2/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/call_caching2/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`immutable.js 1`] = ` -"// Copyright 2004-present Facebook. All Rights Reserved. +// Copyright 2004-present Facebook. All Rights Reserved. declare class Array { } @@ -20,5 +20,5 @@ declare class Iterable { static (iter: Array): Iterable, size: number } -" + `; diff --git a/tests/flow/call_properties/__snapshots__/jsfmt.spec.js.snap b/tests/flow/call_properties/__snapshots__/jsfmt.spec.js.snap index 18494e19..75bfb094 100644 --- a/tests/flow/call_properties/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/call_properties/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"// You should be able to call objects with call properties +// You should be able to call objects with call properties function a(f: { (): string }, g: { (x: number): string } ): string { return f() + g(123); } @@ -13,7 +13,7 @@ function b(f: { (): string }): number { // ...or if the param type is wrong function c(f: { (x: number): number }): number { - return f(\\"hello\\"); + return f("hello"); } // ...or if the arity is wrong @@ -44,7 +44,7 @@ function b(f: { (): string }): number { // ...or if the param type is wrong function c(f: { (x: number): number }): number { - return f(\\"hello\\"); + return f("hello"); } // ...or if the arity is wrong @@ -62,70 +62,70 @@ function f(): number { var x = {}; return x(); } -" + `; exports[`B.js 1`] = ` -"// You should be able to use a function as an object with a call property -var a: { (x: number): string } = function (x: number): string { return \\"hi\\"; }; +// You should be able to use a function as an object with a call property +var a: { (x: number): string } = function (x: number): string { return "hi"; }; // ...and it should notice when the return type is wrong -var b: { (x: number): number } = function (x: number): string { return \\"hi\\"; }; +var b: { (x: number): number } = function (x: number): string { return "hi"; }; // ...or if the param type is wrong -var c: { (x: string): string } = function (x: number): string { return \\"hi\\"; }; +var c: { (x: string): string } = function (x: number): string { return "hi"; }; // ...or if the arity is wrong -var d: { (): string } = function (x: number): string { return \\"hi\\"; }; +var d: { (): string } = function (x: number): string { return "hi"; }; // ...but subtyping rules still apply var e: { (x: any): void } = function() { } // arity -var f: { (): mixed } = function(): string { return \\"hi\\" } // return type +var f: { (): mixed } = function(): string { return "hi" } // return type var g: { (x: string): void } = function(x: mixed) { } // param type // A function can be an object -var y : {} = function (x: number): string { return \\"hi\\"; }; -var z : Object = function (x: number): string { return \\"hi\\"; }; +var y : {} = function (x: number): string { return "hi"; }; +var z : Object = function (x: number): string { return "hi"; }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // You should be able to use a function as an object with a call property var a: { (x: number): string } = function(x: number): string { - return \\"hi\\"; + return "hi"; }; // ...and it should notice when the return type is wrong var b: { (x: number): number } = function(x: number): string { - return \\"hi\\"; + return "hi"; }; // ...or if the param type is wrong var c: { (x: string): string } = function(x: number): string { - return \\"hi\\"; + return "hi"; }; // ...or if the arity is wrong var d: { (): string } = function(x: number): string { - return \\"hi\\"; + return "hi"; }; // ...but subtyping rules still apply var e: { (x: any): void } = function() {}; // arity var f: { (): mixed } = function(): string { - return \\"hi\\"; + return "hi"; }; // return type var g: { (x: string): void } = function(x: mixed) {}; // param type // A function can be an object var y: {} = function(x: number): string { - return \\"hi\\"; + return "hi"; }; var z: Object = function(x: number): string { - return \\"hi\\"; + return "hi"; }; -" + `; exports[`C.js 1`] = ` -"// You should be able to use an object as a function +// You should be able to use an object as a function function a(x: { (z: number): string }): (z: number) => string { return x; } @@ -194,22 +194,22 @@ function f(x: { (z: number): string }): Function { function g(x: {}): Function { return x; // error } -" + `; exports[`D.js 1`] = ` -"// Multiple call properties should also be supported +// Multiple call properties should also be supported function a(f: { (): string; (x: number): string }): string { return f() + f(123); } // It should be fine when a function satisfies them all var b: { (): string; (x: number): string } = - function (x?: number): string { return \\"hi\\"; }; + function (x?: number): string { return "hi"; }; // ...but should notice when a function doesn't satisfy them all var c: { (): string; (x: number): string } = - function (x: number): string { return \\"hi\\"; }; + function (x: number): string { return "hi"; }; // Only one call property needs to match the function function d(x: { (): string; (x: number): string }): () => string { @@ -228,12 +228,12 @@ function a(f: { (): string, (x: number): string }): string { // It should be fine when a function satisfies them all var b: { (): string, (x: number): string } = function(x?: number): string { - return \\"hi\\"; + return "hi"; }; // ...but should notice when a function doesn't satisfy them all var c: { (): string, (x: number): string } = function(x: number): string { - return \\"hi\\"; + return "hi"; }; // Only one call property needs to match the function @@ -245,11 +245,11 @@ function d(x: { (): string, (x: number): string }): () => string { function e(x: { (): string, (x: number): string }): () => number { return x; } -" + `; exports[`E.js 1`] = ` -"// Expecting properties that don't exist should be an error +// Expecting properties that don't exist should be an error var a : { someProp: number } = function () {}; // Expecting properties that do exist should be fine @@ -270,54 +270,54 @@ var b: { apply: Function } = function() {}; var f = function() {}; f.myProp = 123; var c: { myProp: number } = f; -" + `; exports[`F.js 1`] = ` -"// You should be able to use an arrow function as an object with a call property +// You should be able to use an arrow function as an object with a call property var a: { (x: number): string } = (x) => x.toString() // ...and it should notice when the return type is wrong -var b: { (x: number): number } = (x) => \\"hi\\" +var b: { (x: number): number } = (x) => "hi" // ...or if the param type is wrong var c: { (x: string): string } = (x) => x.toFixed() // ...or if the arity is wrong -var d: { (): string } = (x) => \\"hi\\" +var d: { (): string } = (x) => "hi" // ...but subtyping rules still apply var e: { (x: any): void } = () => { } // arity -var f: { (): mixed } = () => \\"hi\\" // return type +var f: { (): mixed } = () => "hi" // return type var g: { (x: Date): void } = (x) => { x * 2 } // param type (date < number) // A function can be an object -var y : {} = (x) => \\"hi\\" -var z : Object = (x) => \\"hi\\" +var y : {} = (x) => "hi" +var z : Object = (x) => "hi" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // You should be able to use an arrow function as an object with a call property var a: { (x: number): string } = x => x.toString(); // ...and it should notice when the return type is wrong -var b: { (x: number): number } = x => \\"hi\\"; +var b: { (x: number): number } = x => "hi"; // ...or if the param type is wrong var c: { (x: string): string } = x => x.toFixed(); // ...or if the arity is wrong -var d: { (): string } = x => \\"hi\\"; +var d: { (): string } = x => "hi"; // ...but subtyping rules still apply var e: { (x: any): void } = () => {}; // arity -var f: { (): mixed } = () => \\"hi\\"; // return type +var f: { (): mixed } = () => "hi"; // return type var g: { (x: Date): void } = x => { x * 2; }; // param type (date < number) // A function can be an object -var y: {} = x => \\"hi\\"; -var z: Object = x => \\"hi\\"; -" +var y: {} = x => "hi"; +var z: Object = x => "hi"; + `; diff --git a/tests/flow/callable/__snapshots__/jsfmt.spec.js.snap b/tests/flow/callable/__snapshots__/jsfmt.spec.js.snap index 2fdbc337..9c65e94d 100644 --- a/tests/flow/callable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/callable/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`optional.js 1`] = ` -"type F = { +type F = { (x: string): number; p?: string; } @@ -22,11 +22,11 @@ function f(x) { } (f: F); -" + `; exports[`primitives.js 1`] = ` -"var x = Boolean(4); +var x = Boolean(4); function foo(fn:(value:any)=>boolean) { } foo(Boolean); @@ -69,5 +69,5 @@ type Callable = { declare var callable: Callable; callable(0); // error, number ~> string callable.call(null, 0); // error, number ~> string -" + `; diff --git a/tests/flow/check-contents/__snapshots__/jsfmt.spec.js.snap b/tests/flow/check-contents/__snapshots__/jsfmt.spec.js.snap index ce33d070..fe17e8bf 100644 --- a/tests/flow/check-contents/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/check-contents/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`not_flow.js 1`] = ` -"1 * 'foo'; +1 * 'foo'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -1 * \\"foo\\"; -" +1 * "foo"; + `; diff --git a/tests/flow/class_fields/__snapshots__/jsfmt.spec.js.snap b/tests/flow/class_fields/__snapshots__/jsfmt.spec.js.snap index 3fd5bd83..5366a73f 100644 --- a/tests/flow/class_fields/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/class_fields/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`base_class.js 1`] = ` -"// @flow +// @flow class Base { unannotatedField; @@ -82,14 +82,14 @@ class Base { initializedField = 42; initializedFieldWithThis = this.initializedField; annotatedInitializedFieldValid: ?number = 42; - annotatedInitializedFieldInvalid: number = \\"asdf\\"; // Error: string ~> number + annotatedInitializedFieldInvalid: number = "asdf"; // Error: string ~> number static unannotatedField; static annotatedField: number; - static initializedField = \\"asdf\\"; + static initializedField = "asdf"; static initializedFieldWithThis = this.initializedField; static annotatedInitializedFieldValid: ?number = 42; - static annotatedInitializedFieldInvalid: number = \\"asdf\\"; // Error: string ~> number + static annotatedInitializedFieldInvalid: number = "asdf"; // Error: string ~> number } var o = new Base(); @@ -146,11 +146,11 @@ var o = new Base(); (o.annotatedInitializedFieldInvalid: string); // Error: number ~> string (Base.annotatedInitializedFieldInvalid: number); (Base.annotatedInitializedFieldInvalid: string); // Error: number ~> string -" + `; exports[`derived_class.js 1`] = ` -"// @flow +// @flow class Base { base_unannotatedField; @@ -293,14 +293,14 @@ class Base { base_initializedField = 42; base_initializedFieldWithThis = this.base_initializedField; base_annotatedInitializedFieldValid: ?number = 42; - base_annotatedInitializedFieldInvalid: number = \\"asdf\\"; // Error: string ~> number + base_annotatedInitializedFieldInvalid: number = "asdf"; // Error: string ~> number static base_unannotatedField; static base_annotatedField: number; - static base_initializedField = \\"asdf\\"; + static base_initializedField = "asdf"; static base_initializedFieldWithThis = this.base_initializedField; static base_annotatedInitializedFieldValid: ?number = 42; - static base_annotatedInitializedFieldInvalid: number = \\"asdf\\"; // Error: string ~> number + static base_annotatedInitializedFieldInvalid: number = "asdf"; // Error: string ~> number inherited_initializer = 42; static inherited_initializer = 42; @@ -312,14 +312,14 @@ class Child extends Base { child_initializedField = 42; child_initializedFieldWithThis = this.child_initializedField; child_annotatedInitializedFieldValid: ?number = 42; - child_annotatedInitializedFieldInvalid: number = \\"asdf\\"; // Error: string ~> number + child_annotatedInitializedFieldInvalid: number = "asdf"; // Error: string ~> number static child_unannotatedField; static child_annotatedField: number; - static child_initializedField = \\"asdf\\"; + static child_initializedField = "asdf"; static child_initializedFieldWithThis = this.child_initializedField; static child_annotatedInitializedFieldValid: ?number = 42; - static child_annotatedInitializedFieldInvalid: number = \\"asdf\\"; // Error: string ~> number + static child_annotatedInitializedFieldInvalid: number = "asdf"; // Error: string ~> number inherited_initializer; static inherited_initializer; @@ -418,11 +418,11 @@ var o = new Child(); (o.inherited_initializer: string); // Error: number ~> string (Child.inherited_initializer: number); (Child.inherited_initializer: string); // Error: number ~> string -" + `; exports[`generic_class.js 1`] = ` -"// @flow +// @flow /** * Fields annotated with a generic should assume a type once the type param @@ -484,11 +484,11 @@ class ClassGenericInitialized { static invalid: T = 42; // Error: number ~> Generic static valid: T = ((42: any): T); } -" + `; exports[`scoping.js 1`] = ` -"// @flow +// @flow var someVar = 42; @@ -543,7 +543,7 @@ class Foo { static selfTypedInit = new Foo(); constructor() { - var someVar = \\"asdf\\"; + var someVar = "asdf"; } } @@ -569,5 +569,5 @@ class Foo { (new Foo().selfTypedInit: number); // Error: Foo ~> number (Foo.selfTypedInit: Foo); (Foo.selfTypedInit: number); // Error: Foo ~> number -" + `; diff --git a/tests/flow/class_method_default_parameters/__snapshots__/jsfmt.spec.js.snap b/tests/flow/class_method_default_parameters/__snapshots__/jsfmt.spec.js.snap index 0a1d2236..bc8b2999 100644 --- a/tests/flow/class_method_default_parameters/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/class_method_default_parameters/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`class_method_default_parameters.js 1`] = ` -"class A { +class A { b: string; @@ -42,5 +42,5 @@ class A { // error } } -" + `; diff --git a/tests/flow/class_munging/__snapshots__/jsfmt.spec.js.snap b/tests/flow/class_munging/__snapshots__/jsfmt.spec.js.snap index db48dcb2..148c5e4b 100644 --- a/tests/flow/class_munging/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/class_munging/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`with_munging.js 1`] = ` -"/** +/** * @flow */ @@ -23,7 +23,7 @@ class Bar extends Foo { class Foo { _method(): string { - return \\"this is private\\"; + return "this is private"; } } @@ -32,11 +32,11 @@ class Bar extends Foo { (this._method(): string); // error } } -" + `; exports[`without_munging.js 1`] = ` -"/** +/** * @flow * @preventMunge */ @@ -60,7 +60,7 @@ class Bar extends Foo { class Foo { _method(): string { - return \\"this is not private\\"; + return "this is not private"; } } @@ -69,5 +69,5 @@ class Bar extends Foo { (this._method(): string); // ok } } -" + `; diff --git a/tests/flow/class_statics/__snapshots__/jsfmt.spec.js.snap b/tests/flow/class_statics/__snapshots__/jsfmt.spec.js.snap index cf38583f..5874da94 100644 --- a/tests/flow/class_statics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/class_statics/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"class A { +class A { static x: number; static y: string; static foo(x: number) { } @@ -14,9 +14,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 @@ -76,9 +76,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 @@ -128,5 +128,5 @@ module.exports = { D: D, E: E }; -" + `; diff --git a/tests/flow/class_subtyping/__snapshots__/jsfmt.spec.js.snap b/tests/flow/class_subtyping/__snapshots__/jsfmt.spec.js.snap index 3d3d4338..38d77028 100644 --- a/tests/flow/class_subtyping/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/class_subtyping/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ class A {} class B {} @@ -12,12 +12,12 @@ class A {} class B {} module.exports = { A, B }; -" + `; exports[`test2.js 1`] = ` -"/* @flow */ -var I = require(\\"./test.js\\"); +/* @flow */ +var I = require("./test.js"); class C extends I.A {} @@ -25,17 +25,17 @@ 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(); -" + `; exports[`test3.js 1`] = ` -"class A {} +class A {} class B extends A {} class C extends B {} @@ -48,11 +48,11 @@ class C extends B {} var c: C> = new C(); // none of the type args matter var a: A> = c; // the third type arg is incorrect -" + `; exports[`test4.js 1`] = ` -"class C { x: X; } +class C { x: X; } function foo(c: C, x: X) { } @@ -83,5 +83,5 @@ class D extends C { } foo(new D(), { f_: 0 }); -" + `; diff --git a/tests/flow/class_type/__snapshots__/jsfmt.spec.js.snap b/tests/flow/class_type/__snapshots__/jsfmt.spec.js.snap index 89e01640..1844ca7f 100644 --- a/tests/flow/class_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/class_type/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"class A { } +class A { } function foo(x: Class): A { return new x(); // OK } @@ -24,11 +24,11 @@ class B { function bar(x: Class): B { return new x(); // error (too few args) } -" + `; exports[`test2.js 1`] = ` -"// A function to typecheck values against their types. Covariance of Class<.> +// A function to typecheck values against their types. Covariance of Class<.> // makes it useless in such a function (when limited to classes and instances), // since everything can be trivially satisfied by going to \`mixed\`. declare function check(cls: $Type, inst: X): void; @@ -57,5 +57,5 @@ check(A, new B()); check(C, new A()); check(C, new B()); check(B, new C()); -" + `; diff --git a/tests/flow/classes/__snapshots__/jsfmt.spec.js.snap b/tests/flow/classes/__snapshots__/jsfmt.spec.js.snap index b128e87b..24b71a28 100644 --- a/tests/flow/classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/classes/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"class A { +class A { foo(x:number):void { } } @@ -12,11 +12,11 @@ class A { } module.exports = A; -" + `; exports[`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; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var A = require(\\"./A\\"); +var A = require("./A"); class B extends A {} @@ -33,11 +33,11 @@ let b = new B(); (b.foo: number); // error, number !~> function module.exports = B; -" + `; exports[`C.js 1`] = ` -"var B = require('./B'); +var B = require('./B'); class C extends B { foo(x:string):void { } @@ -48,7 +48,7 @@ let c = new C(); module.exports = C; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var B = require(\\"./B\\"); +var B = require("./B"); class C extends B { foo(x: string): void {} @@ -58,22 +58,22 @@ let c = new C(); (c.foo: number); // error, number !~> function module.exports = C; -" + `; exports[`D.js 1`] = ` -"class D { } +class D { } class E { } new E().x ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class D {} class E {} new E().x; -" + `; exports[`class_shapes.js 1`] = ` -"/* @flow */ +/* @flow */ type Foo = { a: string; // exists in TestClass @@ -144,11 +144,11 @@ class Test2Class extends Test2Superclass { var z = new Test2Class(); var w: Foo = z; -" + `; exports[`expr.js 1`] = ` -"var Bar = class Foo { +var Bar = class Foo { static factory(): Foo { // OK: Foo is a type in this scope return new Foo() // OK: Foo is a runtime binding in this scope } @@ -210,11 +210,11 @@ var _Alias = class Alias { }; var alias1: Alias = new _Alias(); // error: bad pun var alias2: Alias = _Alias.factory(); // error: bad pun -" + `; exports[`extends_any.js 1`] = ` -"const Base: any = class {} +const Base: any = class {} class Derived1 extends Base {} class Derived2 extends Derived1 { m() {} @@ -225,11 +225,11 @@ class Derived1 extends Base {} class Derived2 extends Derived1 { m() {} } -" + `; exports[`loc.js 1`] = ` -"/* @flow */ +/* @flow */ type Foo = number @@ -240,16 +240,16 @@ class Foo {} // error, shadows type Foo type Foo = number; class Foo {} // error, shadows type Foo -" + `; exports[`statics.js 1`] = ` -"/* @flow */ +/* @flow */ class C { static p: string; } -C.p = \\"hi\\"; +C.p = "hi"; // Class static fields are compatible with object types (C: {p:string}); // ok @@ -263,7 +263,7 @@ declare var o: {p:number}; class C { static p: string; } -C.p = \\"hi\\"; +C.p = "hi"; // Class static fields are compatible with object types (C: { p: string }); // ok @@ -271,5 +271,5 @@ C.p = \\"hi\\"; declare var o: { p: number }; (o: Class); // error, object type incompatible with class type -" + `; diff --git a/tests/flow/closure/__snapshots__/jsfmt.spec.js.snap b/tests/flow/closure/__snapshots__/jsfmt.spec.js.snap index 76625bc0..0f4710eb 100644 --- a/tests/flow/closure/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/closure/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Closure.js 1`] = ` -"/*** +/*** * Test tracking of variable types across closure calls. * @flow */ @@ -11,7 +11,7 @@ function takes_string(_:string) { } // global write from function // -var global_x = \\"hello\\"; +var global_x = "hello"; function global_f() { } function global_g() { global_x = 42; } @@ -29,7 +29,7 @@ global_x = 42; // shouldn't pollute linear refinement function local_func() { - var local_x = \\"hello\\"; + var local_x = "hello"; function local_f() { } function local_g() { local_x = 42; } @@ -46,7 +46,7 @@ function local_func() { // global write from method // -var global_y = \\"hello\\"; +var global_y = "hello"; var global_o = { f: function() { }, @@ -66,7 +66,7 @@ global_y = 42; // shouldn't pollute linear refinement function local_meth() { - var local_y = \\"hello\\"; + var local_y = "hello"; var local_o = { f: function() { }, @@ -92,7 +92,7 @@ function takes_string(_: string) {} // global write from function // -var global_x = \\"hello\\"; +var global_x = "hello"; function global_f() {} function global_g() { @@ -111,7 +111,7 @@ global_x = 42; // shouldn't pollute linear refinement // function local_func() { - var local_x = \\"hello\\"; + var local_x = "hello"; function local_f() {} function local_g() { @@ -130,7 +130,7 @@ function local_func() { // global write from method // -var global_y = \\"hello\\"; +var global_y = "hello"; var global_o = { f: function() {}, @@ -151,7 +151,7 @@ global_y = 42; // shouldn't pollute linear refinement // function local_meth() { - var local_y = \\"hello\\"; + var local_y = "hello"; var local_o = { f: function() {}, @@ -168,18 +168,18 @@ function local_meth() { local_y = 42; // shouldn't pollute linear refinement } -" + `; exports[`cond_havoc.js 1`] = ` -"// @flow +// @flow // from sam, https://github.com/facebook/flow/issues/780 // call to f() within if should properly havoc x. // function example(b: bool): number { var x = 0; - function f() { x = \\"\\" } + function f() { x = "" } if (b) { f(); } @@ -194,18 +194,18 @@ function example(b: bool): number { function example(b: boolean): number { var x = 0; function f() { - x = \\"\\"; + x = ""; } if (b) { f(); } return x; // error, string ~/~> number (return type anno) TODO } -" + `; exports[`const.js 1`] = ` -"/*** +/*** * consts retain refinements * @flow */ @@ -232,20 +232,20 @@ function g(x: ?number) { function h(x: number | string | boolean) { const const_x = x; - if (typeof(const_x) == \\"number\\") { + if (typeof(const_x) == "number") { call_me = () => { var y:number = const_x; }; // ok - } else if (typeof(const_x) == \\"string\\") { + } else if (typeof(const_x) == "string") { call_me = () => { var y:string = const_x; }; // ok - } else if (typeof(const_x) == \\"boolean\\") { + } else if (typeof(const_x) == "boolean") { call_me = () => { var y:boolean = const_x; }; // ok } var var_x = x; - if (typeof(var_x) == \\"number\\") { + if (typeof(var_x) == "number") { call_me = () => { var y:number = var_x; }; // error - } else if (typeof(var_x) == \\"string\\") { + } else if (typeof(var_x) == "string") { call_me = () => { var y:string = var_x; }; // error - } else if (typeof(var_x) == \\"boolean\\") { + } else if (typeof(var_x) == "boolean") { call_me = () => { var y:boolean = var_x; }; // error } } @@ -282,30 +282,30 @@ function g(x: ?number) { function h(x: number | string | boolean) { const const_x = x; - if (typeof const_x == \\"number\\") { + if (typeof const_x == "number") { call_me = () => { var y: number = const_x; }; // ok - } else if (typeof const_x == \\"string\\") { + } else if (typeof const_x == "string") { call_me = () => { var y: string = const_x; }; // ok - } else if (typeof const_x == \\"boolean\\") { + } else if (typeof const_x == "boolean") { call_me = () => { var y: boolean = const_x; }; // ok } var var_x = x; - if (typeof var_x == \\"number\\") { + if (typeof var_x == "number") { call_me = () => { var y: number = var_x; }; // error - } else if (typeof var_x == \\"string\\") { + } else if (typeof var_x == "string") { call_me = () => { var y: string = var_x; }; // error - } else if (typeof var_x == \\"boolean\\") { + } else if (typeof var_x == "boolean") { call_me = () => { var y: boolean = var_x; }; // error @@ -314,5 +314,5 @@ function h(x: number | string | boolean) { // in a galaxy far far away call_me(); -" + `; diff --git a/tests/flow/commonjs/__snapshots__/jsfmt.spec.js.snap b/tests/flow/commonjs/__snapshots__/jsfmt.spec.js.snap index e0abce67..190f7e37 100644 --- a/tests/flow/commonjs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/commonjs/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Abs.js 1`] = ` -" + function f(x:string) { } module.exports = f; @@ -9,17 +9,17 @@ module.exports = f; function f(x: string) {} module.exports = f; -" + `; exports[`Rel.js 1`] = ` -" + var f = require('./Abs'); f(0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var f = require(\\"./Abs\\"); +var f = require("./Abs"); f(0); -" + `; diff --git a/tests/flow/computed_props/__snapshots__/jsfmt.spec.js.snap b/tests/flow/computed_props/__snapshots__/jsfmt.spec.js.snap index bf1ffc18..d8e2018a 100644 --- a/tests/flow/computed_props/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/computed_props/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"var ColorId = { +var ColorId = { RED: 'R', GREEN: 'G', BLUE: 'B', @@ -26,15 +26,15 @@ ColorIdToNumber.XXX; // oops module.exports = { ColorId, ColorNumber }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 = { @@ -43,16 +43,16 @@ var ColorIdToNumber = { [ColorId.BLUE]: ColorNumber.BLUE }; -(ColorIdToNumber[ColorId.RED]: \\"ffffff\\"); // oops +(ColorIdToNumber[ColorId.RED]: "ffffff"); // oops ColorIdToNumber.XXX; // oops module.exports = { ColorId, ColorNumber }; -" + `; exports[`test2.js 1`] = ` -"var { ColorId, ColorNumber } = require('./test'); +var { ColorId, ColorNumber } = require('./test'); var ColorIdToNumber = { [ColorId.RED]: ColorNumber.RED, [ColorId.GREEN]: ColorNumber.GREEN, @@ -63,41 +63,41 @@ var ColorIdToNumber = { module.exports = ColorIdToNumber; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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; -" + `; exports[`test3.js 1`] = ` -"var { ColorId } = require('./test'); +var { ColorId } = require('./test'); var ColorIdToNumber = require('./test2'); (ColorIdToNumber[ColorId.BLUE]: 'ffffff'); // oops ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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 -" `; exports[`test4.js 1`] = ` -"module.exports = 'hello'; +module.exports = 'hello'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = \\"hello\\"; -" +module.exports = "hello"; + `; exports[`test5.js 1`] = ` -"var hello = require('./test4'); +var hello = require('./test4'); var dummy = require('./test'); module.exports = { ...dummy, @@ -105,27 +105,27 @@ module.exports = { ...dummy, }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var hello = require(\\"./test4\\"); -var dummy = require(\\"./test\\"); +var hello = require("./test4"); +var dummy = require("./test"); module.exports = { ...dummy, - [hello]: \\"world\\", + [hello]: "world", ...dummy }; -" + `; exports[`test6.js 1`] = ` -"var o = require('./test5'); +var o = require('./test5'); (o.hello: 'nothing'); // oops ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var o = require(\\"./test5\\"); -(o.hello: \\"nothing\\"); // oops -" +var o = require("./test5"); +(o.hello: "nothing"); // oops + `; exports[`test7.js 1`] = ` -"var obj = {x: 0, m() { return this.x }} +var obj = {x: 0, m() { return this.x }} var x: string = obj['m'](); // error, number ~> string var arr = [function() { return this.length }]; @@ -137,7 +137,7 @@ var obj = { return this.x; } }; -var x: string = obj[\\"m\\"](); // error, number ~> string +var x: string = obj["m"](); // error, number ~> string var arr = [ function() { @@ -145,5 +145,5 @@ var arr = [ } ]; var y: string = arr[0](); // error: number ~> string -" + `; diff --git a/tests/flow/conditional/__snapshots__/jsfmt.spec.js.snap b/tests/flow/conditional/__snapshots__/jsfmt.spec.js.snap index e6e2a20f..3ace944d 100644 --- a/tests/flow/conditional/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/conditional/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`conditional.js 1`] = ` -"/* @flow */ +/* @flow */ function a(): number { var x: ?string = null; @@ -51,5 +51,5 @@ function d(): string { var x: ?number = null; return x != null ? x : x != null; } -" + `; diff --git a/tests/flow/config_all/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_all/__snapshots__/jsfmt.spec.js.snap index b7196c18..b2af66b9 100644 --- a/tests/flow/config_all/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_all/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`no_at_flow.js 1`] = ` -"var x: number = \\"not a number\\"; // Error: string ~> number +var x: number = "not a number"; // Error: string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x: number = \\"not a number\\"; // Error: string ~> number -" +var x: number = "not a number"; // Error: string ~> number + `; diff --git a/tests/flow/config_all_false/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_all_false/__snapshots__/jsfmt.spec.js.snap index 9dafaf24..63b9772d 100644 --- a/tests/flow/config_all_false/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_all_false/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`no_at_flow.js 1`] = ` -"var x: number = \\"not a number\\"; // No error +var x: number = "not a number"; // No error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x: number = \\"not a number\\"; // No error -" +var x: number = "not a number"; // No error + `; diff --git a/tests/flow/config_all_weak/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_all_weak/__snapshots__/jsfmt.spec.js.snap index 66434aa7..f6199b94 100644 --- a/tests/flow/config_all_weak/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_all_weak/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`no_at_flow.js 1`] = ` -"var x; +var x; x.length; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var x; x.length; -" + `; diff --git a/tests/flow/config_file_extensions/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_file_extensions/__snapshots__/jsfmt.spec.js.snap index 7a83d74e..84c65960 100644 --- a/tests/flow/config_file_extensions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_file_extensions/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* +/* * @flow */ @@ -18,11 +18,11 @@ foo('Hello, world!'); */ 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!"); + `; diff --git a/tests/flow/config_ignore/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_ignore/__snapshots__/jsfmt.spec.js.snap index 2f54b95c..8961ed62 100644 --- a/tests/flow/config_ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_ignore/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`foo.js 1`] = ` -"/* @flow */ +/* @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/flow/config_ignore/dir/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_ignore/dir/__snapshots__/jsfmt.spec.js.snap index b043acce..09b680fa 100644 --- a/tests/flow/config_ignore/dir/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_ignore/dir/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`foo.js 1`] = ` -"/* @flow */ +/* @flow */ -var x: number = \\"string\\"; // Error string ~> number +var x: number = "string"; // Error string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var x: number = \\"string\\"; // Error string ~> number -" +var x: number = "string"; // Error string ~> number + `; diff --git a/tests/flow/config_module_name_mapper_PROJECT_ROOT-1.0/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_name_mapper_PROJECT_ROOT-1.0/__snapshots__/jsfmt.spec.js.snap index cb4e0245..809b73eb 100644 --- a/tests/flow/config_module_name_mapper_PROJECT_ROOT-1.0/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_name_mapper_PROJECT_ROOT-1.0/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`main.js 1`] = ` -"// @flow +// @flow import {test} from 'testmodule'; @@ -10,9 +10,9 @@ var b: string = test; // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { test } from \\"testmodule\\"; +import { test } from "testmodule"; var a: number = test; var b: string = test; // Error: number ~> string -" + `; diff --git a/tests/flow/config_module_name_mapper_PROJECT_ROOT-1.0/src/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_name_mapper_PROJECT_ROOT-1.0/src/__snapshots__/jsfmt.spec.js.snap index ed693ef7..e48f145e 100644 --- a/tests/flow/config_module_name_mapper_PROJECT_ROOT-1.0/src/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_name_mapper_PROJECT_ROOT-1.0/src/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`testmodule.js 1`] = ` -"// @flow +// @flow export let test = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export let test = 42; -" + `; diff --git a/tests/flow/config_module_name_mapper_filetype/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_name_mapper_filetype/__snapshots__/jsfmt.spec.js.snap index 29a00832..c67b633f 100644 --- a/tests/flow/config_module_name_mapper_filetype/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_name_mapper_filetype/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @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 -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 + `; diff --git a/tests/flow/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap index 8bb8fc4e..827344bf 100644 --- a/tests/flow/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/* @flow */ +/* @flow */ var m1 = require('1DoesntExist'); import {numVal as numVal1} from '1DoesntExist'; @@ -17,8 +17,8 @@ import {numVal as numVal2} from '3DoesntExist'; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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; @@ -26,13 +26,13 @@ var a_2: number = numVal1; // // 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 + `; exports[`Exists.js 1`] = ` -"/** +/** * @providesModule Exists * @flow */ @@ -49,5 +49,5 @@ module.exports = { module.exports = { numVal: 42 }; -" + `; diff --git a/tests/flow/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap index 39629c76..27009ebc 100644 --- a/tests/flow/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/* @flow */ +/* @flow */ var m1 = require('./1DoesntExist'); var a_1: number = m1.numVal; @@ -29,34 +29,34 @@ var c_4: string = numVal3; // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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 -" + `; exports[`Exists.js 1`] = ` -"/* @flow */ +/* @flow */ module.exports = { numVal: 42 @@ -67,5 +67,5 @@ module.exports = { module.exports = { numVal: 42 }; -" + `; diff --git a/tests/flow/config_module_system_node_resolve_dirname/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_system_node_resolve_dirname/__snapshots__/jsfmt.spec.js.snap index 8e952737..c46c7a58 100644 --- a/tests/flow/config_module_system_node_resolve_dirname/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_system_node_resolve_dirname/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`toplevel.js 1`] = ` -"// @flow +// @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 -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! -" `; diff --git a/tests/flow/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/__snapshots__/jsfmt.spec.js.snap index a6279776..4cef1518 100644 --- a/tests/flow/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"// @flow +// @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/flow/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap index 0b954827..54bc969a 100644 --- a/tests/flow/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"// @flow +// @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/flow/config_module_system_node_resolve_dirname/subdir/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_system_node_resolve_dirname/subdir/__snapshots__/jsfmt.spec.js.snap index 10be9f9a..8ec7f5f6 100644 --- a/tests/flow/config_module_system_node_resolve_dirname/subdir/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_system_node_resolve_dirname/subdir/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`sublevel.js 1`] = ` -"// @flow +// @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 -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\\"); -" `; diff --git a/tests/flow/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap index 839f1fcf..a2c3b8da 100644 --- a/tests/flow/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"// @flow +// @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/flow/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap index 03e8baf2..38ec4f1d 100644 --- a/tests/flow/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`chain.js 1`] = ` -"/* @flow */ +/* @flow */ class A { _property1: number; @@ -14,7 +14,7 @@ class A { return 1; } static _sMethod(): string { - return \\"some string\\"; + return "some string"; } } A._sProperty = 48; @@ -25,16 +25,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 */ @@ -49,7 +49,7 @@ class A { return 1; } static _sMethod(): string { - return \\"some string\\"; + return "some string"; } } A._sProperty = 48; @@ -60,21 +60,21 @@ 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"; + `; exports[`commonjs_export.js 1`] = ` -"/* @flow */ +/* @flow */ class C { _p: string; @@ -89,16 +89,16 @@ class C { } module.exports = new C(); -" + `; exports[`commonjs_import.js 1`] = ` -"/* @flow */ +/* @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/flow/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap index 5d87fdbb..c79955ef 100644 --- a/tests/flow/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`chain.js 1`] = ` -"/* @flow */ +/* @flow */ class A { _property1: number; @@ -14,7 +14,7 @@ class A { return 1; } static _sMethod(): string { - return \\"some string\\"; + return "some string"; } } A._sProperty = 48; @@ -25,16 +25,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 */ @@ -49,7 +49,7 @@ class A { return 1; } static _sMethod(): string { - return \\"some string\\"; + return "some string"; } } A._sProperty = 48; @@ -60,15 +60,15 @@ 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"; + `; diff --git a/tests/flow/const_params/__snapshots__/jsfmt.spec.js.snap b/tests/flow/const_params/__snapshots__/jsfmt.spec.js.snap index e3bf3240..885dcc5d 100644 --- a/tests/flow/const_params/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/const_params/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/** +/** * test handling of const params * - reassignment prohibited * - durable refinements @@ -17,7 +17,7 @@ exports[`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 @@ -47,7 +47,7 @@ function durable_refi(x: ?number) { */ 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 @@ -62,5 +62,5 @@ function durable_refi(x: ?number) { }; } } -" + `; diff --git a/tests/flow/constructor/__snapshots__/jsfmt.spec.js.snap b/tests/flow/constructor/__snapshots__/jsfmt.spec.js.snap index 70b1d175..716d35fd 100644 --- a/tests/flow/constructor/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/constructor/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`constructor.js 1`] = ` -"class C { +class C { constructor() { } } @@ -37,14 +37,14 @@ declare class Bar {} declare class Foo { constructor(iterable: U): Bar } -(new Foo(\\"x\\"): Bar); // ok +(new Foo("x"): Bar); // ok (new Foo(123): Bar); // error, number !~> string // also overrides when it returns a different specialization of the same class declare class Baz { constructor(iterable: U): Baz } -(new Baz(\\"x\\"): Baz); // ok +(new Baz("x"): Baz); // ok (new Baz(123): Baz); // error, number !~> string -" + `; diff --git a/tests/flow/constructor_annots/__snapshots__/jsfmt.spec.js.snap b/tests/flow/constructor_annots/__snapshots__/jsfmt.spec.js.snap index 528ae496..90b1ffb4 100644 --- a/tests/flow/constructor_annots/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/constructor_annots/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`constructors.js 1`] = ` -"// Foo is a class-like function +// Foo is a class-like function function Foo() { this.x = 0; // constructs objects with property x } @@ -48,11 +48,11 @@ interface IFoo extends IFooPrototype { static y: boolean // error, should have declared static y: number instead } exports.Foo2 = (Foo: Class); -" + `; exports[`test.js 1`] = ` -"var Foo = require('./constructors').Foo; +var Foo = require('./constructors').Foo; var x: string = new Foo().x; // error, found number instead of string var y: string = Foo.y; // error, found number instead of string var z: string = new Foo().m(); @@ -62,14 +62,14 @@ var x2: string = new Foo2().x; // error, found boolean instead of string var y2: string = Foo2.y; // error, found boolean instead of string var z2: string = new Foo2().m(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var Foo = require(\\"./constructors\\").Foo; +var Foo = require("./constructors").Foo; var x: string = new Foo().x; // error, found number instead of string var y: string = Foo.y; // error, found number instead of string var z: string = new Foo().m(); -var Foo2 = require(\\"./constructors\\").Foo2; +var Foo2 = require("./constructors").Foo2; var x2: string = new Foo2().x; // error, found boolean instead of string var y2: string = Foo2.y; // error, found boolean instead of string var z2: string = new Foo2().m(); -" + `; diff --git a/tests/flow/contents/ignore/__snapshots__/jsfmt.spec.js.snap b/tests/flow/contents/ignore/__snapshots__/jsfmt.spec.js.snap index 694ce403..bb246ebf 100644 --- a/tests/flow/contents/ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/contents/ignore/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`dummy.js 1`] = ` -"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + `; exports[`test.js 1`] = ` -"require('./dummy'); +require('./dummy'); var xxx = 0; xxx ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\\"./dummy\\"); +require("./dummy"); var xxx = 0; xxx; -" + `; diff --git a/tests/flow/contents/no_flow/__snapshots__/jsfmt.spec.js.snap b/tests/flow/contents/no_flow/__snapshots__/jsfmt.spec.js.snap index 694ce403..bb246ebf 100644 --- a/tests/flow/contents/no_flow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/contents/no_flow/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`dummy.js 1`] = ` -"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + `; exports[`test.js 1`] = ` -"require('./dummy'); +require('./dummy'); var xxx = 0; xxx ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\\"./dummy\\"); +require("./dummy"); var xxx = 0; xxx; -" + `; diff --git a/tests/flow/core_tests/__snapshots__/jsfmt.spec.js.snap b/tests/flow/core_tests/__snapshots__/jsfmt.spec.js.snap index 7d604483..78665b3d 100644 --- a/tests/flow/core_tests/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/core_tests/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`boolean.js 1`] = ` -"// @flow +// @flow // Boolean (the class) tests. booleans (the literals) are not part of core.js @@ -15,7 +15,7 @@ let tests = [ new Boolean(false); new Boolean(NaN); new Boolean(undefined); - new Boolean(\\"\\"); + new Boolean(""); }, // toString @@ -40,7 +40,7 @@ let tests = [ Boolean(false); Boolean(NaN); Boolean(undefined); - Boolean(\\"\\"); + Boolean(""); }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -58,7 +58,7 @@ let tests = [ new Boolean(false); new Boolean(NaN); new Boolean(undefined); - new Boolean(\\"\\"); + new Boolean(""); }, // toString @@ -83,14 +83,14 @@ let tests = [ Boolean(false); Boolean(NaN); Boolean(undefined); - Boolean(\\"\\"); + Boolean(""); } ]; -" + `; exports[`map.js 1`] = ` -"// @flow +// @flow function* generator(): Iterable<[string, number]> { while (true) { @@ -127,7 +127,7 @@ let tests = [ function* generator(): Iterable<[string, number]> { while (true) { - yield [\\"foo\\", 123]; + yield ["foo", 123]; } } @@ -136,30 +136,30 @@ let tests = [ function() { let w = new Map(); let x = new Map(null); - let y = new Map([[\\"foo\\", 123]]); + let y = new Map([["foo", 123]]); let z = new Map(generator()); let a: Map = new Map(); - let b: Map = new Map([[\\"foo\\", 123]]); + let b: Map = new Map([["foo", 123]]); let c: Map = new Map(generator()); }, // bad constructors function() { - let x = new Map([\\"foo\\", 123]); // error - let y: Map = new Map([[\\"foo\\", 123]]); // error + let x = new Map(["foo", 123]); // error + let y: Map = new Map([["foo", 123]]); // error }, // get() function(x: Map) { - (x.get(\\"foo\\"): boolean); // error, string | void + (x.get("foo"): boolean); // error, string | void x.get(123); // error, wrong key type } ]; -" + `; exports[`regexp.js 1`] = ` -"// @flow +// @flow let tests = [ // constructor @@ -194,35 +194,35 @@ let tests = [ let tests = [ // constructor function() { - new RegExp(\\"foo\\"); + new RegExp("foo"); new RegExp(/foo/); - new RegExp(\\"foo\\", \\"i\\"); - new RegExp(\\"foo\\", \\"ig\\"); - new RegExp(/foo/, \\"i\\"); // invalid in ES5, valid in ES6 - new RegExp(/foo/g, \\"i\\"); // invalid in ES5, valid in ES6 + new RegExp("foo", "i"); + new RegExp("foo", "ig"); + new RegExp(/foo/, "i"); // invalid in ES5, valid in ES6 + new RegExp(/foo/g, "i"); // invalid in ES5, valid in ES6 }, // called as a function (equivalent to the constructor per ES6 21.2.3) function() { - RegExp(\\"foo\\"); + RegExp("foo"); RegExp(/foo/); - RegExp(\\"foo\\", \\"i\\"); - RegExp(\\"foo\\", \\"ig\\"); - RegExp(/foo/, \\"i\\"); // invalid in ES5, valid in ES6 - RegExp(/foo/g, \\"i\\"); // invalid in ES5, valid in ES6 + RegExp("foo", "i"); + RegExp("foo", "ig"); + RegExp(/foo/, "i"); // invalid in ES5, valid in ES6 + RegExp(/foo/g, "i"); // invalid in ES5, valid in ES6 }, // invalid flags function() { - RegExp(\\"foo\\", \\"z\\"); // error - new RegExp(\\"foo\\", \\"z\\"); // error + RegExp("foo", "z"); // error + new RegExp("foo", "z"); // error } ]; -" + `; exports[`weakset.js 1`] = ` -"// @flow +// @flow let ws = new WeakSet(); let obj: Object = {}; @@ -263,7 +263,7 @@ let ws5 = new WeakSet(numbers()); // error, must be objects let ws = new WeakSet(); let obj: Object = {}; -let dict: { foo: string } = { foo: \\"bar\\" }; +let dict: { foo: string } = { foo: "bar" }; ws.add(window); ws.add(obj); @@ -281,7 +281,7 @@ let ws3 = new WeakSet([1, 2, 3]); // error, must be objects function* generator(): Iterable<{ foo: string }> { while (true) { - yield { foo: \\"bar\\" }; + yield { foo: "bar" }; } } @@ -295,5 +295,5 @@ function* numbers(): Iterable { } let ws5 = new WeakSet(numbers()); // error, must be objects -" + `; diff --git a/tests/flow/covariance/__snapshots__/jsfmt.spec.js.snap b/tests/flow/covariance/__snapshots__/jsfmt.spec.js.snap index 8659c0a9..a5c499d5 100644 --- a/tests/flow/covariance/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/covariance/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"type CovArrayVerbose = Array; +type CovArrayVerbose = Array; var b: CovArrayVerbose = []; var y: CovArrayVerbose = b; -y[0] = \\"\\"; // error +y[0] = ""; // error class NVerbose { x: CovArrayVerbose; @@ -24,12 +24,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; @@ -54,7 +54,7 @@ n.x = [0]; type CovArrayVerbose = Array; var b: CovArrayVerbose = []; var y: CovArrayVerbose = b; -y[0] = \\"\\"; // error +y[0] = ""; // error class NVerbose { x: CovArrayVerbose; @@ -76,12 +76,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; @@ -102,5 +102,5 @@ n.x = [0]; (n.foo()[0]: string); // not an error! */ -" + `; diff --git a/tests/flow/coverage/__snapshots__/jsfmt.spec.js.snap b/tests/flow/coverage/__snapshots__/jsfmt.spec.js.snap index 5f1672f3..24dd2f49 100644 --- a/tests/flow/coverage/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/coverage/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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. @@ -13,7 +13,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. @@ -22,11 +22,11 @@ declare module foo { declare module bar { // TODO } -" + `; exports[`declare_module.js 1`] = ` -"// check coverage of declare module +// check coverage of declare module declare module foo { } @@ -35,20 +35,20 @@ declare module foo { declare module foo { } -" + `; exports[`no_pragma.js 1`] = ` -"let x = 0; +let x = 0; (x: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let x = 0; (x: string); -" + `; exports[`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. @@ -63,7 +63,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. @@ -73,5 +73,5 @@ declare module bar { // TODO } declare class qux {} -" + `; diff --git a/tests/flow/cycle/__snapshots__/jsfmt.spec.js.snap b/tests/flow/cycle/__snapshots__/jsfmt.spec.js.snap index c607473c..b49e0f0f 100644 --- a/tests/flow/cycle/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/cycle/__snapshots__/jsfmt.spec.js.snap @@ -1,31 +1,31 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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[`B.js 1`] = ` -"var A = require('./A'); +var A = require('./A'); //class B extends A { } module.exports = B; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var A = require(\\"./A\\"); +var A = require("./A"); //class B extends A { } module.exports = B; -" + `; diff --git a/tests/flow/date/__snapshots__/jsfmt.spec.js.snap b/tests/flow/date/__snapshots__/jsfmt.spec.js.snap index ab080405..7d9d0790 100644 --- a/tests/flow/date/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/date/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`date.js 1`] = ` -"var d = new Date(0); +var d = new Date(0); var x:string = d.getTime(); var y:number = d; @@ -38,7 +38,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); @@ -48,15 +48,15 @@ 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"); + `; diff --git a/tests/flow/declaration_files_haste/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_haste/__snapshots__/jsfmt.spec.js.snap index ac70ad00..f78a926a 100644 --- a/tests/flow/declaration_files_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_haste/__snapshots__/jsfmt.spec.js.snap @@ -1,65 +1,65 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ExplicitProvidesModuleDifferentName.js 1`] = ` -"/* +/* * @providesModule ExplicitProvidesModuleDifferentName * @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"; + `; exports[`ExplicitProvidesModuleSameName.js 1`] = ` -"/* +/* * @providesModule ExplicitProvidesModuleSameName * @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"; + `; exports[`ImplicitProvidesModule.js 1`] = ` -"/* +/* * @providesModule ImplicitProvidesModule * @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"; + `; exports[`md5.js 1`] = ` -"/* @providesModule md5 */ +/* @providesModule md5 */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule md5 */ -" + `; exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ var Implicit = require('ImplicitProvidesModule'); (Implicit.fun(): string); @@ -72,13 +72,13 @@ var ExplicitDifferentName = require('ExplicitProvidesModuleDifferentName'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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/flow/declaration_files_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap index 8067ca3b..ffdc9cd7 100644 --- a/tests/flow/declaration_files_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/declaration_files_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap index 592fed3e..4f6b8d58 100644 --- a/tests/flow/declaration_files_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`nested_test.js 1`] = ` -"/* @flow */ +/* @flow */ var docblock = require('qux/docblock'); var min = require('d3/min.js'); @@ -19,18 +19,18 @@ var unreachable = require('annotation'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var docblock = require(\\"qux/docblock\\"); -var min = require(\\"d3/min.js\\"); -var corge = require(\\"qux/corge\\"); -var SomeOtherModule = require(\\"SomeOtherModule\\"); +var docblock = require("qux/docblock"); +var min = require("d3/min.js"); +var corge = require("qux/corge"); +var SomeOtherModule = require("SomeOtherModule"); // 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); (SomeOtherModule.fun(): string); -" + `; diff --git a/tests/flow/declaration_files_haste/ws/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_haste/ws/__snapshots__/jsfmt.spec.js.snap index 3959b3ee..cfcb94a5 100644 --- a/tests/flow/declaration_files_haste/ws/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_haste/ws/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + `; diff --git a/tests/flow/declaration_files_haste/ws/test/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_haste/ws/test/__snapshots__/jsfmt.spec.js.snap index 55142189..8f867398 100644 --- a/tests/flow/declaration_files_haste/ws/test/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_haste/ws/test/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`client.js 1`] = ` -"var ws = require('../'); +var ws = require('../'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var ws = require(\\"../\\"); -" +var ws = require("../"); + `; diff --git a/tests/flow/declaration_files_incremental_haste/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_incremental_haste/__snapshots__/jsfmt.spec.js.snap index 9694ecb5..b1eb7f8a 100644 --- a/tests/flow/declaration_files_incremental_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_incremental_haste/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/* @providesModule A */ +/* @providesModule A */ class Implementation {} export function foo(): Implementation { return new Implementation; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -10,11 +10,11 @@ class Implementation {} export function foo(): Implementation { return new Implementation(); } -" + `; exports[`ExplicitProvidesModuleDifferentName.js 1`] = ` -"/* +/* * @providesModule ExplicitProvidesModuleDifferentName * @flow */ @@ -29,11 +29,11 @@ module.exports.fun = (): Implementation => new Implementation; class Implementation {} module.exports.fun = (): Implementation => new Implementation(); -" + `; exports[`ExplicitProvidesModuleSameName.js 1`] = ` -"/* +/* * @providesModule ExplicitProvidesModuleSameName * @flow */ @@ -48,11 +48,11 @@ module.exports.fun = (): Implementation => new Implementation; class Implementation {} module.exports.fun = (): Implementation => new Implementation(); -" + `; exports[`ImplicitProvidesModule.js 1`] = ` -"/* +/* * @providesModule ImplicitProvidesModule * @flow */ @@ -67,18 +67,18 @@ module.exports.fun = (): Implementation => new Implementation; class Implementation {} module.exports.fun = (): Implementation => new Implementation(); -" + `; exports[`md5.js 1`] = ` -"/* @providesModule md5 */ +/* @providesModule md5 */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule md5 */ -" + `; exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ var Implicit = require('ImplicitProvidesModule'); (Implicit.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean @@ -91,13 +91,13 @@ var ExplicitDifferentName = require('ExplicitProvidesModuleDifferentName'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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 -" + `; diff --git a/tests/flow/declaration_files_incremental_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_incremental_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap index b0cc8249..84303920 100644 --- a/tests/flow/declaration_files_incremental_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_incremental_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`min.js 1`] = ` -"class Implementation {} +class Implementation {} module.exports.fun = (): Implementation => new Implementation; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Implementation {} module.exports.fun = (): Implementation => new Implementation(); -" + `; diff --git a/tests/flow/declaration_files_incremental_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_incremental_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap index f0d02f70..daebf099 100644 --- a/tests/flow/declaration_files_incremental_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_incremental_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`nested_test.js 1`] = ` -"/* @flow */ +/* @flow */ var docblock = require('qux/docblock'); var min = require('d3/min.js'); @@ -13,12 +13,12 @@ var corge = require('qux/corge'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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 (corge.fun(): boolean); // Error: Either Implementation ~> boolean or Declaration ~> boolean -" + `; diff --git a/tests/flow/declaration_files_incremental_haste/ws/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_incremental_haste/ws/__snapshots__/jsfmt.spec.js.snap index 3959b3ee..cfcb94a5 100644 --- a/tests/flow/declaration_files_incremental_haste/ws/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_incremental_haste/ws/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + `; diff --git a/tests/flow/declaration_files_incremental_haste/ws/test/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_incremental_haste/ws/test/__snapshots__/jsfmt.spec.js.snap index 55142189..8f867398 100644 --- a/tests/flow/declaration_files_incremental_haste/ws/test/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_incremental_haste/ws/test/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`client.js 1`] = ` -"var ws = require('../'); +var ws = require('../'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var ws = require(\\"../\\"); -" +var ws = require("../"); + `; diff --git a/tests/flow/declaration_files_incremental_haste_name_reducers/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_incremental_haste_name_reducers/__snapshots__/jsfmt.spec.js.snap index 00ed0966..051dcef8 100644 --- a/tests/flow/declaration_files_incremental_haste_name_reducers/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_incremental_haste_name_reducers/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/* @flow */ +/* @flow */ class AImplementation {} export function foo(): AImplementation { return new AImplementation(); } @@ -12,11 +12,11 @@ class AImplementation {} export function foo(): AImplementation { return new AImplementation(); } -" + `; exports[`index.js 1`] = ` -"/* @flow */ +/* @flow */ var A = require('A'); (A.foo(): boolean); // Error: Either AImplementation ~> boolean or ADefinition ~> boolean @@ -26,10 +26,10 @@ var test = require('test'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var A = require(\\"A\\"); +var A = require("A"); (A.foo(): boolean); // Error: Either AImplementation ~> boolean or ADefinition ~> boolean -var test = require(\\"test\\"); +var test = require("test"); (test.foo(): boolean); // Error: Either TestImplementation ~> boolean or TestDefinition ~> boolean -" + `; diff --git a/tests/flow/declaration_files_incremental_node/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_incremental_node/__snapshots__/jsfmt.spec.js.snap index 6d7ced59..87b97735 100644 --- a/tests/flow/declaration_files_incremental_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_incremental_node/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"class Implementation {} +class Implementation {} export function foo(): Implementation { return new Implementation; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Implementation {} export function foo(): Implementation { return new Implementation(); } -" + `; exports[`test_absolute.js 1`] = ` -"/* @flow */ +/* @flow */ // This will require ./node_modules/B.js.flow var B1 = require('B'); @@ -57,54 +57,54 @@ var F = require('package_with_dir_main'); /* @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 -" + `; exports[`test_relative.js 1`] = ` -"import { foo } from './A'; +import { foo } from './A'; (foo(): boolean); // Error: either Implementation ~> boolean or Definition ~> boolean ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import { foo } from \\"./A\\"; +import { foo } from "./A"; (foo(): boolean); // Error: either Implementation ~> boolean or Definition ~> boolean -" + `; diff --git a/tests/flow/declaration_files_node/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declaration_files_node/__snapshots__/jsfmt.spec.js.snap index 091649c0..128ba56c 100644 --- a/tests/flow/declaration_files_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declaration_files_node/__snapshots__/jsfmt.spec.js.snap @@ -1,27 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/* @flow */ +/* @flow */ module.exports.fun = (): string => 'hello there!'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -module.exports.fun = (): string => \\"hello there!\\"; -" +module.exports.fun = (): string => "hello there!"; + `; exports[`CJS.js 1`] = ` -"// @flow +// @flow module.exports = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow module.exports = 42; -" + `; exports[`test_absolute.js 1`] = ` -"/* @flow */ +/* @flow */ // This will require ./node_modules/B.js.flow var B1 = require('B'); @@ -46,29 +46,29 @@ var F = require('package_with_dir_main'); /* @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 -" + `; exports[`test_relative.js 1`] = ` -"/* @flow */ +/* @flow */ // This will require ./A.js.flow var A1 = require('./A'); @@ -85,15 +85,15 @@ var CJS = require('./CJS.js'); /* @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 -" + `; diff --git a/tests/flow/declare_class/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declare_class/__snapshots__/jsfmt.spec.js.snap index 0093346a..046e2d87 100644 --- a/tests/flow/declare_class/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declare_class/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`declare_class.js 1`] = ` -"declare class C { +declare class C { static x: number; static foo(x: number): void; } -C.x = \\"\\"; -C.foo(\\"\\"); +C.x = ""; +C.foo(""); (C.name: string); (C.name: number); // error, it's a string @@ -17,10 +17,10 @@ declare class C { static foo(x: number): void } -C.x = \\"\\"; -C.foo(\\"\\"); +C.x = ""; +C.foo(""); (C.name: string); (C.name: number); // error, it's a string -" + `; diff --git a/tests/flow/declare_class/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declare_class/lib/__snapshots__/jsfmt.spec.js.snap index c6d76d68..413f6df5 100644 --- a/tests/flow/declare_class/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declare_class/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"declare class _C { +declare class _C { foo(): number; } declare var _module: { @@ -20,5 +20,5 @@ declare var _module: { declare class D extends _module.C { foo(): string } -" + `; diff --git a/tests/flow/declare_export/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declare_export/__snapshots__/jsfmt.spec.js.snap index 6c252eb3..6e430513 100644 --- a/tests/flow/declare_export/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declare_export/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`B.js 1`] = ` -"/* @flow */ +/* @flow */ exports.numberValue = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ exports.numberValue = 42; -" + `; exports[`C.js 1`] = ` -"/* @flow */ +/* @flow */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -" + `; exports[`CommonJS_Clobbering_Class.js 1`] = ` -"/** +/** * @providesModule CommonJS_Clobbering_Class * @flow */ @@ -72,11 +72,11 @@ class Test extends Base { } module.exports = Test; -" + `; exports[`CommonJS_Clobbering_Lit.js 1`] = ` -"/** +/** * @providesModule CommonJS_Clobbering_Lit * @flow */ @@ -101,11 +101,11 @@ module.exports = { numberValue4: 4, numberValue5: 5 }; -" + `; exports[`CommonJS_Named.js 1`] = ` -"/** +/** * @providesModule CommonJS_Named * @flow */ @@ -126,11 +126,11 @@ exports.numberValue2 = 2; exports.numberValue3 = 3; exports.numberValue4 = 4; exports.numberValue5 = 5; -" + `; exports[`ES6_Default_AnonFunction1.js 1`] = ` -"/** +/** * @providesModule ES6_Default_AnonFunction1 * @flow */ @@ -143,11 +143,11 @@ declare export default () => number; */ declare export default () => number -" + `; exports[`ES6_Default_AnonFunction2.js 1`] = ` -"/** +/** * @providesModule ES6_Default_AnonFunction2 * @flow */ @@ -160,11 +160,11 @@ declare export default () =>number; */ declare export default () => number -" + `; exports[`ES6_Default_NamedClass1.js 1`] = ` -"/** +/** * @providesModule ES6_Default_NamedClass1 * @flow */ @@ -189,11 +189,11 @@ declare export default class FooImpl { givesANum(): number } // Default-exported class should also be available in local scope declare export { FooImpl as Foo }; declare export function getAFoo(): FooImpl; -" + `; exports[`ES6_Default_NamedClass2.js 1`] = ` -"/** +/** * @providesModule ES6_Default_NamedClass2 * @flow */ @@ -206,11 +206,11 @@ declare export default class Foo { givesANum(): number; }; */ declare export default class Foo { givesANum(): number } -" + `; exports[`ES6_Default_NamedFunction1.js 1`] = ` -"/** +/** * @providesModule ES6_Default_NamedFunction1 * @flow */ @@ -223,11 +223,11 @@ declare export default function foo():number; */ declare export default function foo(): number; -" + `; exports[`ES6_Default_NamedFunction2.js 1`] = ` -"/** +/** * @providesModule ES6_Default_NamedFunction2 * @flow */ @@ -240,11 +240,11 @@ declare export default function foo():number; */ declare export default function foo(): number; -" + `; exports[`ES6_DefaultAndNamed.js 1`] = ` -"/* @flow */ +/* @flow */ declare export default number; declare export var str: string; @@ -253,45 +253,45 @@ declare export var str: string; declare export default number declare export var str: string; -" + `; exports[`ES6_ExportAllFrom_Intermediary1.js 1`] = ` -"/** +/** * @providesModule ES6_ExportAllFrom_Intermediary1 * @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" + `; exports[`ES6_ExportAllFrom_Intermediary2.js 1`] = ` -"/** +/** * @providesModule ES6_ExportAllFrom_Intermediary2 * @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" + `; exports[`ES6_ExportAllFrom_Source1.js 1`] = ` -"/** +/** * @providesModule ES6_ExportAllFrom_Source1 * @flow */ @@ -304,11 +304,11 @@ declare export var numberValue1: number; */ declare export var numberValue1: number; -" + `; exports[`ES6_ExportAllFrom_Source2.js 1`] = ` -"/** +/** * @providesModule ES6_ExportAllFrom_Source2 * @flow */ @@ -321,24 +321,24 @@ declare export var numberValue2: number; */ declare export var numberValue2: number; -" + `; exports[`ES6_ExportAllFromMulti.js 1`] = ` -"// @flow +// @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" + `; exports[`ES6_ExportFrom_Intermediary1.js 1`] = ` -"/** +/** * @providesModule ES6_ExportFrom_Intermediary1 * @flow */ @@ -346,7 +346,7 @@ exports[`ES6_ExportFrom_Intermediary1.js 1`] = ` declare export { numberValue1, numberValue2 as numberValue2_renamed -} from \\"ES6_ExportFrom_Source1\\"; +} from "ES6_ExportFrom_Source1"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary1 @@ -356,12 +356,12 @@ declare export { declare export { numberValue1, numberValue2 as numberValue2_renamed -} from \\"ES6_ExportFrom_Source1\\"; -" +} from "ES6_ExportFrom_Source1"; + `; exports[`ES6_ExportFrom_Intermediary2.js 1`] = ` -"/** +/** * @providesModule ES6_ExportFrom_Intermediary2 * @flow */ @@ -369,7 +369,7 @@ exports[`ES6_ExportFrom_Intermediary2.js 1`] = ` declare export { numberValue1, numberValue2 as numberValue2_renamed2 -} from \\"ES6_ExportFrom_Source2\\"; +} from "ES6_ExportFrom_Source2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary2 @@ -379,12 +379,12 @@ declare export { declare export { numberValue1, numberValue2 as numberValue2_renamed2 -} from \\"ES6_ExportFrom_Source2\\"; -" +} from "ES6_ExportFrom_Source2"; + `; exports[`ES6_ExportFrom_Source1.js 1`] = ` -"/** +/** * @providesModule ES6_ExportFrom_Source1 * @flow */ @@ -399,11 +399,11 @@ declare export var numberValue2: number; declare export var numberValue1: number; declare export var numberValue2: number; -" + `; exports[`ES6_ExportFrom_Source2.js 1`] = ` -"/** +/** * @providesModule ES6_ExportFrom_Source2 * @flow */ @@ -418,11 +418,11 @@ declare export var numberValue2: number; declare export var numberValue1: number; declare export var numberValue2: number; -" + `; exports[`ES6_Named1.js 1`] = ` -"/** +/** * @providesModule ES6_Named1 * @flow */ @@ -465,11 +465,11 @@ declare export class NumberGenerator { givesANumber(): number } declare export var varDeclNumber1: number; declare export var varDeclNumber2: number; -" + `; exports[`ES6_Named2.js 1`] = ` -"/** +/** * @providesModule ES6_Named2 * @flow */ @@ -508,11 +508,11 @@ declare export class NumberGenerator2 { givesANumber(): number } declare export var varDeclNumber3: number; declare export var varDeclNumber4: number; -" + `; exports[`ProvidesModuleA.js 1`] = ` -"/** +/** * @providesModule A * @flow */ @@ -521,7 +521,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = \\"str\\"; +exports.stringValue = "str"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule A @@ -532,12 +532,12 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = \\"str\\"; -" +exports.stringValue = "str"; + `; exports[`ProvidesModuleCJSDefault.js 1`] = ` -"/** +/** * @providesModule CJSDefault * @flow */ @@ -554,11 +554,11 @@ module.exports = { module.exports = { numberValue: 42 }; -" + `; exports[`ProvidesModuleD.js 1`] = ` -"/** +/** * @providesModule D * @flow */ @@ -567,11 +567,11 @@ exports[`ProvidesModuleD.js 1`] = ` * @providesModule D * @flow */ -" + `; exports[`ProvidesModuleES6Default.js 1`] = ` -"/** +/** * @providesModule ES6Default * @flow */ @@ -592,59 +592,59 @@ export default { numberValue: 42, }; */ -" + `; exports[`SideEffects.js 1`] = ` -"/* @flow */ +/* @flow */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -" + `; exports[`es6modules.js 1`] = ` -"/* @flow */ +/* @flow */ // ===================== // // == Path Resolution == // // ===================== // // @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 -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 @@ -655,15 +655,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(); @@ -671,7 +671,7 @@ 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\\"; +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(); @@ -681,22 +681,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 -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 @@ -705,13 +705,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 @@ -719,7 +719,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 @@ -727,35 +727,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 @@ -769,15 +769,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 @@ -787,11 +787,11 @@ var ac2: string = numberValue5; // Error: number ~> string 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 @@ -799,7 +799,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 @@ -807,31 +807,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 @@ -845,15 +845,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 @@ -861,7 +861,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 @@ -873,13 +873,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 == // @@ -887,7 +887,7 @@ import {specifierNumber} from \\"ES6_Named1\\"; // Error: Did you mean \`specifi import { numberValue1 as numberValue8, numberValue2 as numberValue9 -} from \\"./ES6_ExportAllFromMulti\\"; +} from "./ES6_ExportAllFromMulti"; var at1: number = numberValue8; var at2: string = numberValue8; // Error: number ~> string @@ -902,41 +902,41 @@ var at4: string = numberValue9; // Error: number ~> string // ===================== // // @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 -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 @@ -947,15 +947,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(); @@ -963,7 +963,7 @@ 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\\"; +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(); @@ -973,22 +973,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 -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 @@ -997,17 +997,17 @@ 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_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 @@ -1015,49 +1015,49 @@ 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 { 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 @@ -1065,17 +1065,17 @@ 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_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 @@ -1083,46 +1083,46 @@ 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 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\\") +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 @@ -1130,7 +1130,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 @@ -1142,13 +1142,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 == // @@ -1156,12 +1156,12 @@ import { specifierNumber } from \\"ES6_Named1\\"; // Error: Did you mean \`speci import { numberValue1 as numberValue8, numberValue2 as numberValue9 -} from \\"./ES6_ExportAllFromMulti\\"; +} from "./ES6_ExportAllFromMulti"; var at1: number = numberValue8; var at2: string = numberValue8; // Error: number ~> string var at3: number = numberValue9; var at4: string = numberValue9; // Error: number ~> string -" + `; diff --git a/tests/flow/declare_fun/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declare_fun/__snapshots__/jsfmt.spec.js.snap index aca6289e..f3e79fd5 100644 --- a/tests/flow/declare_fun/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declare_fun/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"declare function foo(x: number): string; +declare function foo(x: number): string; declare function foo(x: string): number; declare function foo(x: X): X; (foo(0): string); // OK -(foo(\\"hello\\"): number); // OK +(foo("hello"): number); // OK (foo(false): void); // error, boolean ~/~ undefined ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare function foo(x: number): string; @@ -14,7 +14,7 @@ declare function foo(x: string): number; declare function foo(x: X): X; (foo(0): string); // OK -(foo(\\"hello\\"): number); // OK +(foo("hello"): number); // OK (foo(false): void); // error, boolean ~/~ undefined -" + `; diff --git a/tests/flow/declare_module_exports/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declare_module_exports/__snapshots__/jsfmt.spec.js.snap index 2d2bdd26..100d76dc 100644 --- a/tests/flow/declare_module_exports/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declare_module_exports/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`main.js 1`] = ` -"// @flow +// @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 /** @@ -19,25 +19,25 @@ 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 -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 /** @@ -45,12 +45,12 @@ 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 -" + `; diff --git a/tests/flow/declare_module_exports/flow-typed/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declare_module_exports/flow-typed/__snapshots__/jsfmt.spec.js.snap index b10873f2..1032cf40 100644 --- a/tests/flow/declare_module_exports/flow-typed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declare_module_exports/flow-typed/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`libs.js 1`] = ` -"declare module \\"declare_module_exports\\" { +declare module "declare_module_exports" { declare module.exports: number; } -declare module \\"declare_m_e_with_other_value_declares\\" { +declare module "declare_m_e_with_other_value_declares" { declare module.exports: number; declare var str: string; } -declare module \\"declare_m_e_with_other_type_declares\\" { +declare module "declare_m_e_with_other_type_declares" { declare module.exports: number; declare type str2 = string; } @@ -20,26 +20,26 @@ declare module \\"declare_m_e_with_other_type_declares\\" { * syntaxes will work. */ -declare module \\"DEPRECATED__declare_var_exports\\" { +declare module "DEPRECATED__declare_var_exports" { declare var exports: number; } /** * Ensure that, if both are present, \`declare module.exports\` wins */ -declare module \\"declare_m_e_with_declare_var_e\\" { +declare module "declare_m_e_with_declare_var_e" { declare module.exports: number; declare var exports: string; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare module \\"declare_module_exports\\" { +declare module "declare_module_exports" { declare module.exports: number; } -declare module \\"declare_m_e_with_other_value_declares\\" { +declare module "declare_m_e_with_other_value_declares" { declare module.exports: number; declare var str: string; } -declare module \\"declare_m_e_with_other_type_declares\\" { +declare module "declare_m_e_with_other_type_declares" { declare module.exports: number; declare type str2 = string; @@ -48,16 +48,16 @@ declare module \\"declare_m_e_with_other_type_declares\\" { * syntaxes will work. */ } -declare module \\"DEPRECATED__declare_var_exports\\" { +declare module "DEPRECATED__declare_var_exports" { declare var exports: number; /** * Ensure that, if both are present, \`declare module.exports\` wins */ } -declare module \\"declare_m_e_with_declare_var_e\\" { +declare module "declare_m_e_with_declare_var_e" { declare module.exports: number; declare var exports: string; } -" + `; diff --git a/tests/flow/declare_type/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declare_type/__snapshots__/jsfmt.spec.js.snap index db1fd1fb..7b737b9d 100644 --- a/tests/flow/declare_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declare_type/__snapshots__/jsfmt.spec.js.snap @@ -1,20 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`import_declare_type.js 1`] = ` -"/** +/** * @flow */ //////////////////////////////////////////////////////////// // == 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 ////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ blah(0, 0); (3 : Bar); // error : number ~> A -(\\"lol\\" : Id); // error : string ~> number +("lol" : Id); // error : string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow @@ -39,21 +39,21 @@ blah(0, 0); //////////////////////////////////////////////////////////// // == 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); @@ -61,6 +61,6 @@ blah(0, 0); (3: Bar); // error : number ~> A -(\\"lol\\": Id); // error : string ~> number -" +("lol": Id); // error : string ~> number + `; diff --git a/tests/flow/declare_type/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/declare_type/lib/__snapshots__/jsfmt.spec.js.snap index fff1c2bd..99527ba4 100644 --- a/tests/flow/declare_type/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/declare_type/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`DeclareModule_TypeAlias.js 1`] = ` -"/** +/** * @flow */ @@ -20,11 +20,11 @@ declare module ModuleAliasFoo { declare type toz = string; declare function foo(bar: baz): toz; } -" + `; exports[`declare_type_exports.js 1`] = ` -"/* @flow */ +/* @flow */ declare module 'foo' { declare class A { @@ -44,7 +44,7 @@ declare module 'foo' { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -declare module \\"foo\\" { +declare module "foo" { declare class A { toz: number } @@ -59,5 +59,5 @@ declare module \\"foo\\" { (a: number, b: number): number }; } -" + `; diff --git a/tests/flow/def_site_variance/__snapshots__/jsfmt.spec.js.snap b/tests/flow/def_site_variance/__snapshots__/jsfmt.spec.js.snap index 954911aa..6604bc70 100644 --- a/tests/flow/def_site_variance/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/def_site_variance/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"class Variance<+Out,-In> { +class Variance<+Out,-In> { foo(x: Out): Out { return x; } bar(y: In): In { return y; } } @@ -65,5 +65,5 @@ class PropVariance<+Out, -In> { con_dict1: { -[k: string]: Out }; // error con_dict2: { -[k: string]: In }; // ok } -" + `; diff --git a/tests/flow/demo/1/__snapshots__/jsfmt.spec.js.snap b/tests/flow/demo/1/__snapshots__/jsfmt.spec.js.snap index 1ced68b3..a7741213 100644 --- a/tests/flow/demo/1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/demo/1/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`f.js 1`] = ` -"/* demo */ +/* demo */ function f(x) { return 42/x; } @@ -20,5 +20,5 @@ var x = null; //... f(x); -" + `; diff --git a/tests/flow/demo/2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/demo/2/__snapshots__/jsfmt.spec.js.snap index db4f0b42..3d11a76f 100644 --- a/tests/flow/demo/2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/demo/2/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/* @providesModule Demo */ +/* @providesModule Demo */ class A { x: number; // instance field declaration @@ -46,16 +46,16 @@ var a = new A(42); a.onLoad(callback); module.exports = A; -" + `; exports[`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 A = require("Demo"); + +var z = new A("42").getX(); -var z = new A(\\"42\\").getX(); -" `; diff --git a/tests/flow/deps/__snapshots__/jsfmt.spec.js.snap b/tests/flow/deps/__snapshots__/jsfmt.spec.js.snap index eb15a925..51fd4e77 100644 --- a/tests/flow/deps/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/deps/__snapshots__/jsfmt.spec.js.snap @@ -1,70 +1,70 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"require('./C'); +require('./C'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\\"./C\\"); -" +require("./C"); + `; exports[`B.js 1`] = ` -"require('./C'); +require('./C'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\\"./C\\"); -" +require("./C"); + `; exports[`C.js 1`] = ` -"require('./D'); +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[`D.js 1`] = ` -"require('./I'); +require('./I'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\\"./I\\"); -" +require("./I"); + `; exports[`E.js 1`] = ` -"require('./I'); +require('./I'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\\"./I\\"); -" +require("./I"); + `; exports[`F.js 1`] = ` -"// empty +// empty ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // empty -" + `; exports[`G.js 1`] = ` -"require('./H'); +require('./H'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\\"./H\\"); -" +require("./H"); + `; exports[`H.js 1`] = ` -"// empty +// empty ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // empty -" + `; exports[`I.js 1`] = ` -"require('./A'); +require('./A'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\\"./A\\"); -" +require("./A"); + `; diff --git a/tests/flow/destructuring/__snapshots__/jsfmt.spec.js.snap b/tests/flow/destructuring/__snapshots__/jsfmt.spec.js.snap index 6bdd1e56..1edc5a71 100644 --- a/tests/flow/destructuring/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/destructuring/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`array_rest.js 1`] = ` -"let xs = [0, \\"\\", true]; +let xs = [0, "", true]; let [a, ...ys] = xs; let [b, ...zs] = ys; let c = zs[0]; // retain tuple info @@ -14,7 +14,7 @@ let d = zs[1]; // run off the end let [...e] = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -let xs = [0, \\"\\", true]; +let xs = [0, "", true]; let [a, ...ys] = xs; let [b, ...zs] = ys; let c = zs[0]; // retain tuple info @@ -26,36 +26,36 @@ let d = zs[1]; // run off the end (d: void); // error: number|string|boolean ~> void let [...e] = 0; -" + `; exports[`computed.js 1`] = ` -"var { [\\"key\\"]: val1 } = { key: \\"val\\" }; +var { ["key"]: val1 } = { key: "val" }; (val1: void); // error: string ~> void -var key: string = \\"key\\"; -var { [key]: val2 } = { key: \\"val\\" }; +var key: string = "key"; +var { [key]: val2 } = { key: "val" }; (val2: void); // ok (gasp!) by existing StrT -> ElemT rule -var { [\\"key\\"]: val3, ...spread } = { key: \\"val\\" }; +var { ["key"]: val3, ...spread } = { key: "val" }; (spread.key: void); // error (gasp!) in general we don't know if a computed prop should be excluded from spread ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var { [\\"key\\"]: val1 } = { key: \\"val\\" }; +var { ["key"]: val1 } = { key: "val" }; (val1: void); // error: string ~> void -var key: string = \\"key\\"; -var { [key]: val2 } = { key: \\"val\\" }; +var key: string = "key"; +var { [key]: val2 } = { key: "val" }; (val2: void); // ok (gasp!) by existing StrT -> ElemT rule -var { [\\"key\\"]: val3, ...spread } = { key: \\"val\\" }; +var { ["key"]: val3, ...spread } = { key: "val" }; (spread.key: void); // error (gasp!) in general we don't know if a computed prop should be excluded from spread -" + `; exports[`defaults.js 1`] = ` -"/* @flow */ +/* @flow */ -function obj_prop_fun({p:{q=0}={q:true}}={p:{q:\\"\\"}}) { +function obj_prop_fun({p:{q=0}={q:true}}={p:{q:""}}) { // errors: // * number ~> void, from default on _.p.q // * boolean ~> void, from default on _.p @@ -68,7 +68,7 @@ obj_prop_fun({}); // ok obj_prop_fun({p:{}}); // ok obj_prop_fun({p:{q:null}}); // ok, provides add'l lower bound -function obj_prop_var(o={p:{q:\\"\\"}}) { +function obj_prop_var(o={p:{q:""}}) { var {p:{q=0}={q:true}} = o; // errors: // * number ~> void, from default on o.p.q @@ -82,7 +82,7 @@ obj_prop_var({}); // ok obj_prop_var({p:{}}); // ok obj_prop_var({p:{q:null}}); // ok, provides add'l lower bound -function obj_rest({p:{q,...o}={q:0,r:0}}={p:{q:0,r:\\"\\"}}) { +function obj_rest({p:{q,...o}={q:0,r:0}}={p:{q:0,r:""}}) { // errors: // * number ~> void, from default on _.p // * string ~> void, from default on _ @@ -138,7 +138,7 @@ function default_expr_scope({a, b = a}) {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -function obj_prop_fun({ p: { q = 0 } = { q: true } } = { p: { q: \\"\\" } }) { +function obj_prop_fun({ p: { q = 0 } = { q: true } } = { p: { q: "" } }) { // errors: // * number ~> void, from default on _.p.q // * boolean ~> void, from default on _.p @@ -151,7 +151,7 @@ obj_prop_fun({}); // ok obj_prop_fun({ p: {} }); // ok obj_prop_fun({ p: { q: null } }); // ok, provides add'l lower bound -function obj_prop_var(o = { p: { q: \\"\\" } }) { +function obj_prop_var(o = { p: { q: "" } }) { var { p: { q = 0 } = { q: true } } = o; // errors: // * number ~> void, from default on o.p.q @@ -166,7 +166,7 @@ obj_prop_var({ p: {} }); // ok obj_prop_var({ p: { q: null } }); // ok, provides add'l lower bound function obj_rest( - { p: { q, ...o } = { q: 0, r: 0 } } = { p: { q: 0, r: \\"\\" } } + { p: { q, ...o } = { q: 0, r: 0 } } = { p: { q: 0, r: "" } } ) { // errors: // * number ~> void, from default on _.p @@ -222,11 +222,11 @@ function obj_prop_union({ p }: { p: number | string } = { p: true }) {} function obj_prop_union2({ p }: { p: number } | { p: string } = { p: true }) {} function default_expr_scope({ a, b = a }) {} -" + `; exports[`destructuring.js 1`] = ` -"declare var a:string; +declare var a:string; declare var b:string; declare var c:string; [{a1:a, b},c] = [{a1:0, b:1},2]; @@ -250,17 +250,17 @@ foo({p:0, z:[1,2]}); function bar({x, ...z}) { var o:{x: string; y: number;} = z; } -bar({x:\\"\\",y:0}); +bar({x:"",y:0}); -var spread = {y:\\"\\"}; +var spread = {y:""}; var extend: {x:number; y:string; z: boolean} = {x:0, ...spread}; function qux(_: {a:number}) { } -qux({a:\\"\\"}); +qux({a:""}); function corge({b}: {b:string}) { } corge({b:0}); -var {n}:{n: number} = {n: \\"\\"} +var {n}:{n: number} = {n: ""} function test() { var {foo} = {bar: 123}; // error on foo @@ -308,7 +308,7 @@ var { m } = { m: 0 }; var obj; ({ n: obj.x } = { n: 3 }); -[obj.x] = [\\"foo\\"]; +[obj.x] = ["foo"]; function foo({ p, z: [r] }) { a = p; @@ -322,17 +322,17 @@ foo({ p: 0, z: [1, 2] }); function bar({ x, ...z }) { var o: { x: string, y: number } = z; } -bar({ x: \\"\\", y: 0 }); +bar({ x: "", y: 0 }); -var spread = { y: \\"\\" }; +var spread = { y: "" }; var extend: { x: number, y: string, z: boolean } = { x: 0, ...spread }; function qux(_: { a: number }) {} -qux({ a: \\"\\" }); +qux({ a: "" }); function corge({ b }: { b: string }) {} corge({ b: 0 }); -var { n }: { n: number } = { n: \\"\\" }; +var { n }: { n: number } = { n: "" }; function test() { var { foo } = { bar: 123 }; // error on foo @@ -340,7 +340,7 @@ function test() { } function test() { - var x = { foo: \\"abc\\", bar: 123 }; + var x = { foo: "abc", bar: 123 }; var { foo, ...rest } = x; (x.baz: string); // error, baz doesn't exist (rest.baz: string); // no error, rest is unsealed @@ -369,20 +369,20 @@ var cp1: number = childprop1; var cp1_err: string = childprop1; // Error: number ~> string var cp2: number = others.childprop1; var cp2_err: string = others.childprop2; // Error: number ~> string -" + `; exports[`eager.js 1`] = ` -"var x; +var x; ({x} = null); // error, property \`x\` can not be accessed on \`null\` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var x; ({ x } = null); // error, property \`x\` can not be accessed on \`null\` -" + `; exports[`poly.js 1`] = ` -"// @flow +// @flow function obj_pattern({ prop } : { prop: X }) {} // prop: X type Prop = { prop: X }; @@ -449,11 +449,11 @@ function arr_rest_pattern([_, ...a]: ArrRest) { // a: [X] a[0]; } -" + `; exports[`rec.js 1`] = ` -"// @flow +// @flow // Make sure that destructuring doesn't cause infinite loops when combined with // funny doses of repositioning @@ -494,11 +494,11 @@ foo = (i: number) => { declare var o; var { x: o } = o; -" + `; exports[`refinement_non_termination.js 1`] = ` -"// @flow +// @flow function _([argArray]: Array) { if (argArray instanceof NullValue || argArray instanceof UndefinedValue) { @@ -519,29 +519,29 @@ function _([argArray]: Array) { class Value {} class NullValue extends Value {} class UndefinedValue extends Value {} -" + `; exports[`string_lit.js 1`] = ` -"var { \\"key\\": val } = { key: \\"val\\" }; +var { "key": val } = { key: "val" }; (val: void); // error: string ~> void -var { \\"with-dash\\": with_dash } = { \\"with-dash\\": \\"motivating example\\" }; -(with_dash: \\"motivating example\\"); // ok +var { "with-dash": with_dash } = { "with-dash": "motivating example" }; +(with_dash: "motivating example"); // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var { key: val } = { key: \\"val\\" }; +var { key: val } = { key: "val" }; (val: void); // error: string ~> void -var { \\"with-dash\\": with_dash } = { \\"with-dash\\": \\"motivating example\\" }; -(with_dash: \\"motivating example\\"); // ok -" +var { "with-dash": with_dash } = { "with-dash": "motivating example" }; +(with_dash: "motivating example"); // ok + `; exports[`unannotated.js 1`] = ` -"// @flow +// @flow var { x } = { - x: { foo: \\"foo\\" } + x: { foo: "foo" } }; function bar() { @@ -551,11 +551,11 @@ function bar() { // @flow var { x } = { - x: { foo: \\"foo\\" } + x: { foo: "foo" } }; function bar() { x.bar; } -" + `; diff --git a/tests/flow/dictionary/__snapshots__/jsfmt.spec.js.snap b/tests/flow/dictionary/__snapshots__/jsfmt.spec.js.snap index e73ef3f1..5ab4045b 100644 --- a/tests/flow/dictionary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/dictionary/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`any.js 1`] = ` -"/* @flow */ +/* @flow */ const dict: {[key: string]: number} = {} const k: any = 'foo' @@ -10,13 +10,13 @@ const val: string = dict[k] // error: number incompatible with string /* @flow */ const dict: { [key: string]: number } = {}; -const k: any = \\"foo\\"; +const k: any = "foo"; const val: string = dict[k]; // error: number incompatible with string -" + `; exports[`compatible.js 1`] = ` -"/* @flow */ +/* @flow */ function foo0(x: Array<{[key: string]: mixed}>): Array<{[key: string]: mixed}> { // this adds a fooBar property to the param type, which should NOT cause @@ -39,7 +39,7 @@ function foo0( ): Array<{ [key: string]: mixed }> { // this adds a fooBar property to the param type, which should NOT cause // an error in the return type because it is a dictionary. - x[0].fooBar = \\"foobar\\"; + x[0].fooBar = "foobar"; return x; } @@ -49,11 +49,11 @@ function foo2( // x's prototype has a toString method return x; } -" + `; exports[`dictionary.js 1`] = ` -"/* Dictionary types are object types that include an indexer, which specifies a +/* Dictionary types are object types that include an indexer, which specifies a * key type and a value type. The presence of an indexer makes the object type * unsealed, but all added properties must be consistent with the indexer * signature. @@ -82,7 +82,7 @@ class Y {} function set_prop_to_string_key( o: {[k:string]:any}, ) { - o.prop = \\"ok\\"; + o.prop = "ok"; } // **UNSOUND** @@ -92,7 +92,7 @@ function unsound_dict_has_every_key( o: {[k:string]:X}, ) { (o.p: X); // ok - (o[\\"p\\"]: X); // ok + (o["p"]: X); // ok } // As with any object type, we can assign subtypes to properties. @@ -118,7 +118,7 @@ function get_prop_contravariant( function add_prop_to_nonstring_key_dot( o: {[k:number]:any}, ) { - o.prop = \\"err\\"; // error: string ~> number + o.prop = "err"; // error: string ~> number } // Bracket notation can be used to add properties to dictionaries with @@ -127,7 +127,7 @@ function add_prop_to_nonstring_key_dot( function add_prop_to_nonstring_key_bracket( o: {[k:number]:any}, ) { - o[0] = \\"ok\\"; + o[0] = "ok"; } // Objects can be part dict, part not by mixing an indexer with declared props. @@ -154,9 +154,9 @@ function object_prototype( // Because we support non-string props w/ bracket notation, it's possible to // write into a declared prop unsoundly. function unsound_string_conversion_alias_declared_prop( - o: {[k:number]:any, \\"0\\":X}, + o: {[k:number]:any, "0":X}, ) { - o[0] = \\"not-x\\"; // a[\\"0\\"] no longer X + o[0] = "not-x"; // a["0"] no longer X } function unification_dict_values_invariant( @@ -401,7 +401,7 @@ class Y {} // Any property can be set on a dict with string keys. function set_prop_to_string_key(o: { [k: string]: any }) { - o.prop = \\"ok\\"; + o.prop = "ok"; } // **UNSOUND** @@ -409,7 +409,7 @@ function set_prop_to_string_key(o: { [k: string]: any }) { // return type in a maybe. function unsound_dict_has_every_key(o: { [k: string]: X }) { (o.p: X); // ok - (o[\\"p\\"]: X); // ok + (o["p"]: X); // ok } // As with any object type, we can assign subtypes to properties. @@ -429,14 +429,14 @@ function get_prop_contravariant(o: { [k: string]: B }) { // Dot-notation can not be used to add properties to dictionaries with // non-string keys, because keys are strings. function add_prop_to_nonstring_key_dot(o: { [k: number]: any }) { - o.prop = \\"err\\"; // error: string ~> number + o.prop = "err"; // error: string ~> number } // Bracket notation can be used to add properties to dictionaries with // non-string keys, even though all keys are strings. This is a convenient // affordance. function add_prop_to_nonstring_key_bracket(o: { [k: number]: any }) { - o[0] = \\"ok\\"; + o[0] = "ok"; } // Objects can be part dict, part not by mixing an indexer with declared props. @@ -459,9 +459,9 @@ function object_prototype( // Because we support non-string props w/ bracket notation, it's possible to // write into a declared prop unsoundly. function unsound_string_conversion_alias_declared_prop( - o: { [k: number]: any, \\"0\\": X } + o: { [k: number]: any, "0": X } ) { - o[0] = \\"not-x\\"; // a[\\"0\\"] no longer X + o[0] = "not-x"; // a["0"] no longer X } function unification_dict_values_invariant(x: Array<{ [k: string]: B }>) { @@ -649,11 +649,11 @@ function subtype_optional_c_to_dict(x: { p?: C }): { [k: string]: B } { // error: C ~> B return x; } -" + `; exports[`incompatible.js 1`] = ` -"/* @flow */ +/* @flow */ var x : {[key: string]: string} = {}; var y : {[key: string]: number} = x; // 2 errors, number !~> string & vice versa @@ -772,11 +772,11 @@ function foo8(x: { [key: string]: number }) { (x.foo: string); // error (x.foo: number); } -" + `; exports[`issue-1745.js 1`] = ` -"/* @flow */ +/* @flow */ class A { x: {[k:string]: number}; @@ -827,11 +827,11 @@ class B { this.x = { bar: 0 }; // no error } } -" + `; exports[`test.js 1`] = ` -"type Params = {count: number; [name: string]: string}; +type Params = {count: number; [name: string]: string}; type QueryFunction = (params: Params) => string; var o: { foo: QueryFunction } = { @@ -852,20 +852,20 @@ var o: { foo: QueryFunction } = { }; module.exports = o; -" + `; exports[`test_client.js 1`] = ` -"var o = require('./test'); +var o = require('./test'); o.foo = function (params) { return params.count; // error, number ~/~ string } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var o = require(\\"./test\\"); +var o = require("./test"); o.foo = function(params) { return params.count; // error, number ~/~ string }; -" + `; diff --git a/tests/flow/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap b/tests/flow/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap index 845c76bf..91c0864c 100644 --- a/tests/flow/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ast.js 1`] = ` -"/** +/** * @flow */ @@ -87,13 +87,13 @@ export type TypedNode = */ export type InferredType = - | \\"unknown\\" - | \\"gender\\" - | \\"enum\\" - | \\"number-or-string\\" - | \\"number\\" - | \\"string\\" - | \\"error\\"; + | "unknown" + | "gender" + | "enum" + | "number-or-string" + | "number" + | "string" + | "error"; export type Pos = { firstLine: number, @@ -103,8 +103,8 @@ export type Pos = { }; export type TypedBinaryOpNode = { - exprNodeType: \\"binary_op\\", - binaryOp: \\"plus\\" | \\"multiply\\" | \\"divide\\" | \\"minus\\", + exprNodeType: "binary_op", + binaryOp: "plus" | "multiply" | "divide" | "minus", lhs: TypedNode, rhs: TypedNode, pos: Pos, @@ -113,7 +113,7 @@ export type TypedBinaryOpNode = { }; export type TypedUnaryMinusNode = { - exprNodeType: \\"unary_minus\\", + exprNodeType: "unary_minus", op: TypedNode, pos: Pos, exprType: InferredType, @@ -121,23 +121,23 @@ export type TypedUnaryMinusNode = { }; export type TypedNumberNode = { - exprNodeType: \\"number\\", + exprNodeType: "number", value: number, pos: Pos, - exprType: \\"number\\", + exprType: "number", typed: true }; export type TypedStringLiteralNode = { - exprNodeType: \\"string_literal\\", + exprNodeType: "string_literal", value: string, pos: Pos, - exprType: \\"string\\", + exprType: "string", typed: true }; export type TypedVariableNode = { - exprNodeType: \\"variable\\", + exprNodeType: "variable", name: string, pos: Pos, exprType: InferredType, @@ -145,11 +145,11 @@ export type TypedVariableNode = { }; export type TypedFunctionInvocationNode = { - exprNodeType: \\"function_invocation\\", + exprNodeType: "function_invocation", name: string, parameters: TypedNode[], pos: Pos, - exprType: \\"error\\" | \\"string\\", + exprType: "error" | "string", typed: true }; @@ -160,11 +160,11 @@ export type TypedNode = | TypedStringLiteralNode | TypedVariableNode | TypedFunctionInvocationNode; -" + `; exports[`emit.js 1`] = ` -"/** +/** * @flow */ import * as t from './jsAst'; @@ -233,54 +233,54 @@ export function emitExpression(node: TypedNode) : t.Expression { /** * @flow */ -import * as t from \\"./jsAst\\"; +import * as t from "./jsAst"; const b = t.builders; -import type { TypedNode } from \\"./ast\\"; +import type { TypedNode } from "./ast"; function getBinaryOp( - op: \\"plus\\" | \\"minus\\" | \\"divide\\" | \\"multiply\\" -): \\"+\\" | \\"-\\" | \\"*\\" | \\"/\\" { + op: "plus" | "minus" | "divide" | "multiply" +): "+" | "-" | "*" | "/" { switch (op) { - case \\"plus\\": - return \\"+\\"; - case \\"minus\\": - return \\"-\\"; - case \\"divide\\": - return \\"/\\"; - case \\"multiply\\": - return \\"*\\"; + case "plus": + return "+"; + case "minus": + return "-"; + case "divide": + return "/"; + case "multiply": + return "*"; default: - throw new Error(\\"Invalid binary operator: \\" + op); + throw new Error("Invalid binary operator: " + op); } } export function emitExpression(node: TypedNode): t.Expression { switch (node.exprNodeType) { - case \\"string_literal\\": // FALLTHROUGH - case \\"number\\": + case "string_literal": // FALLTHROUGH + case "number": return b.literal(node.value); - case \\"variable\\": + case "variable": return b.memberExpression( - b.identifier(\\"vars\\"), + b.identifier("vars"), b.identifier(node.name), false ); - case \\"binary_op\\": { + case "binary_op": { const lhs = emitExpression(node.lhs); const rhs = emitExpression(node.rhs); const op = getBinaryOp(node.binaryOp); return b.binaryExpression(op, lhs, rhs); } - case \\"unary_minus\\": { + case "unary_minus": { const operand = emitExpression(node.op); - return b.unaryExpression(\\"-\\", operand, true); + return b.unaryExpression("-", operand, true); } - case \\"function_invocation\\": { + case "function_invocation": { const callee = b.memberExpression( - b.identifier(\\"fns\\"), + b.identifier("fns"), b.identifier(node.name), false ); @@ -290,14 +290,14 @@ export function emitExpression(node: TypedNode): t.Expression { return b.callExpression(callee, args); } default: - throw new Error(\\"Unknown expression type: \\" + node.type); + throw new Error("Unknown expression type: " + node.type); } } -" + `; exports[`jsAst.js 1`] = ` -"/** +/** * @flow */ export type Comment = { @@ -960,7 +960,7 @@ export type File = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"File\\", + type: "File", program: Program }; @@ -969,60 +969,60 @@ export type Program = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"Program\\", + type: "Program", body: Statement[] }; export type BinaryOperator = - | \\"==\\" - | \\"!=\\" - | \\"===\\" - | \\"!==\\" - | \\"<\\" - | \\"<=\\" - | \\">\\" - | \\">=\\" - | \\"<<\\" - | \\">>\\" - | \\">>>\\" - | \\"+\\" - | \\"-\\" - | \\"*\\" - | \\"/\\" - | \\"%\\" - | \\"&\\" // TODO Missing from the Parser API. - | \\"|\\" - | \\"^\\" - | \\"in\\" - | \\"instanceof\\" - | \\"..\\"; + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "<<" + | ">>" + | ">>>" + | "+" + | "-" + | "*" + | "/" + | "%" + | "&" // TODO Missing from the Parser API. + | "|" + | "^" + | "in" + | "instanceof" + | ".."; export type UnaryOperator = - | \\"-\\" - | \\"+\\" - | \\"!\\" - | \\"~\\" - | \\"typeof\\" - | \\"void\\" - | \\"delete\\"; + | "-" + | "+" + | "!" + | "~" + | "typeof" + | "void" + | "delete"; export type AssignmentOperator = - | \\"=\\" - | \\"+=\\" - | \\"-=\\" - | \\"*=\\" - | \\"/=\\" - | \\"%=\\" - | \\"<<=\\" - | \\">>=\\" - | \\">>>=\\" - | \\"|=\\" - | \\"^=\\" - | \\"&=\\"; + | "=" + | "+=" + | "-=" + | "*=" + | "/=" + | "%=" + | "<<=" + | ">>=" + | ">>>=" + | "|=" + | "^=" + | "&="; -export type UpdateOperator = \\"++\\" | \\"--\\"; +export type UpdateOperator = "++" | "--"; -export type LogicalOperator = \\"&&\\" | \\"||\\"; +export type LogicalOperator = "&&" | "||"; export type Node = | EmptyStatement @@ -1078,7 +1078,7 @@ export type EmptyStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"EmptyStatement\\" + type: "EmptyStatement" }; export type BlockStatement = { @@ -1086,7 +1086,7 @@ export type BlockStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"BlockStatement\\", + type: "BlockStatement", body: Statement[] }; @@ -1095,7 +1095,7 @@ export type ExpressionStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ExpressionStatement\\", + type: "ExpressionStatement", expression: Expression }; @@ -1104,7 +1104,7 @@ export type IfStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"IfStatement\\", + type: "IfStatement", test: Expression, consequent: Statement, alternate: ?Statement @@ -1115,7 +1115,7 @@ export type BreakStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"BreakStatement\\", + type: "BreakStatement", label: ?Identifier }; @@ -1124,7 +1124,7 @@ export type ContinueStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ContinueStatement\\", + type: "ContinueStatement", label: ?Identifier }; @@ -1133,7 +1133,7 @@ export type ReturnStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ReturnStatement\\", + type: "ReturnStatement", argument: ?Expression }; @@ -1142,7 +1142,7 @@ export type ThrowStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ThrowStatement\\", + type: "ThrowStatement", argument: ?Expression }; @@ -1151,7 +1151,7 @@ export type WhileStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"WhileStatement\\", + type: "WhileStatement", test: Expression, body: Statement }; @@ -1161,7 +1161,7 @@ export type ForStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ForStatement\\", + type: "ForStatement", init: ?(VariableDeclaration | Expression), test: ?Expression, update: ?Expression, @@ -1173,7 +1173,7 @@ export type ForInStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ForInStatement\\", + type: "ForInStatement", left: VariableDeclaration | Expression, right: Expression, body: Statement @@ -1184,7 +1184,7 @@ export type TryStatement = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"TryStatement\\", + type: "TryStatement", block: BlockStatement, handler: ?CatchClause, handlers: CatchClause[], @@ -1196,7 +1196,7 @@ export type CatchClause = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"CatchClause\\", + type: "CatchClause", param: Pattern, guard: ?Expression, body: BlockStatement @@ -1224,7 +1224,7 @@ export type Identifier = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"Identifier\\", + type: "Identifier", name: string }; @@ -1233,7 +1233,7 @@ export type Literal = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"Literal\\", + type: "Literal", value: ?(string | boolean | number | RegExp), regex: ?{ pattern: string, flags: string } }; @@ -1243,7 +1243,7 @@ export type ThisExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ThisExpression\\" + type: "ThisExpression" }; export type ArrayExpression = { @@ -1251,7 +1251,7 @@ export type ArrayExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ArrayExpression\\", + type: "ArrayExpression", elements: Expression[] }; @@ -1260,7 +1260,7 @@ export type ObjectExpreession = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ObjectExpression\\", + type: "ObjectExpression", properties: Property[] }; @@ -1269,8 +1269,8 @@ export type Property = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"Property\\", - kind: \\"init\\" | \\"get\\" | \\"set\\", + type: "Property", + kind: "init" | "get" | "set", key: Literal | Identifier, value: Expression }; @@ -1280,7 +1280,7 @@ export type FunctionExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"FunctionExpression\\", + type: "FunctionExpression", id: ?Identifier, params: Pattern[], body: BlockStatement @@ -1291,7 +1291,7 @@ export type BinaryExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"BinaryExpression\\", + type: "BinaryExpression", operator: BinaryOperator, left: Expression, right: Expression @@ -1302,7 +1302,7 @@ export type UnaryExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"UnaryExpression\\", + type: "UnaryExpression", operator: UnaryOperator, argument: Expression, prefix: boolean @@ -1313,7 +1313,7 @@ export type AssignmentExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"AssignmentExpression\\", + type: "AssignmentExpression", operator: AssignmentOperator, left: Pattern, right: Expression @@ -1324,7 +1324,7 @@ export type UpdateExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"UpdateExpression\\", + type: "UpdateExpression", operator: UpdateOperator, argument: Expression, prefix: boolean @@ -1335,7 +1335,7 @@ export type LogicalExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"LogicalExpression\\", + type: "LogicalExpression", operator: LogicalOperator, left: Expression, right: Expression @@ -1346,7 +1346,7 @@ export type ConditionalExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"ConditionalExpression\\", + type: "ConditionalExpression", test: Expression, consequent: Expression, alternate: Expression @@ -1357,7 +1357,7 @@ export type NewExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"NewExpression\\", + type: "NewExpression", callee: Expression, arguments: Expression[] }; @@ -1367,7 +1367,7 @@ export type CallExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"CallExpression\\", + type: "CallExpression", callee: Expression, arguments: Expression[] }; @@ -1377,7 +1377,7 @@ export type MemberExpression = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"MemberExpression\\", + type: "MemberExpression", object: Expression, property: Identifier | Expression, computed: boolean @@ -1393,8 +1393,8 @@ export type VariableDeclaration = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"VariableDeclaration\\", - kind: \\"var\\" | \\"let\\" | \\"const\\", + type: "VariableDeclaration", + kind: "var" | "let" | "const", declarations: VariableDeclarator[] }; @@ -1403,7 +1403,7 @@ export type FunctionDeclaration = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"FunctionDeclaration\\", + type: "FunctionDeclaration", id: Identifier, body: BlockStatement, params: Pattern[] @@ -1414,7 +1414,7 @@ export type VariableDeclarator = { start: SourcePosition, end: SourcePosition, comments: ?Array, - type: \\"VariableDeclarator\\", + type: "VariableDeclarator", id: Pattern, init: ?Expression }; @@ -1466,7 +1466,7 @@ export const builders: { arrayExpression(elements: Expression[]): ArrayExpression, objectExpreession(properties: Property[]): ObjectExpreession, property( - kind: \\"init\\" | \\"get\\" | \\"set\\", + kind: "init" | "get" | "set", key: Literal | Identifier, value: Expression ): Property, @@ -1513,7 +1513,7 @@ export const builders: { computed: boolean ): MemberExpression, variableDeclaration( - kind: \\"var\\" | \\"let\\" | \\"const\\", + kind: "var" | "let" | "const", declarations: VariableDeclarator[] ): VariableDeclaration, functionDeclaration( @@ -1523,5 +1523,5 @@ export const builders: { ): FunctionDeclaration, variableDeclarator(id: Pattern, init?: Expression): VariableDeclarator } = a; -" + `; diff --git a/tests/flow/docblock_flow/__snapshots__/jsfmt.spec.js.snap b/tests/flow/docblock_flow/__snapshots__/jsfmt.spec.js.snap index c8eff340..de5ba770 100644 --- a/tests/flow/docblock_flow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/docblock_flow/__snapshots__/jsfmt.spec.js.snap @@ -1,20 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`license_with_flow.js 1`] = ` -"/* Copyright example */ +/* Copyright example */ /* @flow */ -(\\"\\": void); // error +("": void); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* Copyright example */ /* @flow */ -(\\"\\": void); // error -" +("": void); // error + `; exports[`max_header_tokens.js 1`] = ` -"/* @flow */ +/* @flow */ /* second token */ /* third token */ /** @@ -31,20 +31,20 @@ exports[`max_header_tokens.js 1`] = ` * * @flow */ -" + `; exports[`multiple_flows_1.js 1`] = ` -"/* @flow */ +/* @flow */ /* @flow */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ /* @flow */ -" + `; exports[`multiple_flows_2.js 1`] = ` -"/** +/** * @flow * @noflow */ @@ -53,11 +53,11 @@ exports[`multiple_flows_2.js 1`] = ` * @flow * @noflow */ -" + `; exports[`multiple_providesModule_1.js 1`] = ` -"/** +/** * @providesModule Foo * @providesModule Bar * @flow @@ -68,11 +68,11 @@ exports[`multiple_providesModule_1.js 1`] = ` * @providesModule Bar * @flow */ -" + `; exports[`multiple_providesModule_2.js 1`] = ` -"/** +/** * @providesModule Foo * @flow */ @@ -87,40 +87,40 @@ exports[`multiple_providesModule_2.js 1`] = ` /** * @providesModule Bar */ -" + `; exports[`use_strict_with_flow.js 1`] = ` -"\\"use strict\\"; +"use strict"; /* @flow */ -(\\"\\": void); // error +("": void); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -\\"use strict\\"; +"use strict"; /* @flow */ -(\\"\\": void); // error -" +("": void); // error + `; exports[`with_flow.js 1`] = ` -"/* @flow */ +/* @flow */ -(\\"\\": void); // error +("": void); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -(\\"\\": void); // error -" +("": void); // error + `; exports[`without_flow.js 1`] = ` -"/* some other comment */ +/* some other comment */ -(\\"\\": void); // no error +("": void); // no error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* some other comment */ -(\\"\\": void); // no error -" +("": void); // no error + `; diff --git a/tests/flow/dom/__snapshots__/jsfmt.spec.js.snap b/tests/flow/dom/__snapshots__/jsfmt.spec.js.snap index 9ee068ba..a345eb37 100644 --- a/tests/flow/dom/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/dom/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CanvasRenderingContext2D.js 1`] = ` -"// @flow +// @flow let tests = [ // fillRect @@ -25,14 +25,14 @@ let tests = [ // moveTo function(ctx: CanvasRenderingContext2D) { - ctx.moveTo(\\"0\\", \\"1\\"); // error: should be numbers + ctx.moveTo("0", "1"); // error: should be numbers } ]; -" + `; exports[`CustomEvent.js 1`] = ` -"// @flow +// @flow let tests = [ // CustomEvent @@ -47,15 +47,15 @@ let tests = [ 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 }); } ]; -" + `; exports[`Document.js 1`] = ` -"// @flow +// @flow let tests = [ // createElement @@ -73,18 +73,18 @@ let tests = [ let tests = [ // createElement function(document: Document) { - (document.createElement(\\"canvas\\"): HTMLCanvasElement); - (document.createElement(\\"link\\"): HTMLLinkElement); - (document.createElement(\\"option\\"): HTMLOptionElement); - (document.createElement(\\"select\\"): HTMLSelectElement); - (document.querySelector(\\"select\\"): HTMLSelectElement | null); + (document.createElement("canvas"): HTMLCanvasElement); + (document.createElement("link"): HTMLLinkElement); + (document.createElement("option"): HTMLOptionElement); + (document.createElement("select"): HTMLSelectElement); + (document.querySelector("select"): HTMLSelectElement | null); } ]; -" + `; exports[`Element.js 1`] = ` -"// @flow +// @flow let tests = [ // scrollIntoView @@ -111,21 +111,21 @@ 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); } ]; -" + `; exports[`HTMLCanvasElement.js 1`] = ` -"// @flow +// @flow let tests = [ // getContext @@ -139,14 +139,14 @@ let tests = [ let tests = [ // getContext function(el: HTMLCanvasElement) { - (el.getContext(\\"2d\\"): ?CanvasRenderingContext2D); + (el.getContext("2d"): ?CanvasRenderingContext2D); } ]; -" + `; exports[`HTMLElement.js 1`] = ` -"// @flow +// @flow let tests = [ // scrollIntoView @@ -173,21 +173,21 @@ 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); } ]; -" + `; exports[`HTMLInputElement.js 1`] = ` -"// @flow +// @flow let tests = [ // setRangeText @@ -205,18 +205,18 @@ let tests = [ 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 } ]; -" + `; exports[`URL.js 1`] = ` -"/* @flow */ +/* @flow */ const a = new URL('http://flowtype.org/'); // correct const b = new URL('/docs', a); // correct @@ -239,9 +239,9 @@ const r: string = c.username; // correct ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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 @@ -257,11 +257,11 @@ const o: string = c.port; // correct const p: string = c.protocol; // correct const q: string = c.search; // correct const r: string = c.username; // correct -" + `; exports[`eventtarget.js 1`] = ` -"// @flow +// @flow let listener: EventListener = function (event: Event) :void {}; @@ -295,15 +295,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() { @@ -312,11 +312,11 @@ let tests = [ }; } ]; -" + `; exports[`path2d.js 1`] = ` -"// @flow +// @flow let tests = [ // arcTo @@ -336,14 +336,14 @@ 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 } ]; -" + `; exports[`registerElement.js 1`] = ` -"// @flow +// @flow let tests = [ // should work with Object.create() @@ -407,7 +407,7 @@ let tests = [ 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() {} @@ -431,7 +431,7 @@ let tests = [ }, // or with Object.assign() function() { - document.registerElement(\\"custom-element\\", { + document.registerElement("custom-element", { prototype: Object.assign(Object.create(HTMLElement.prototype), { createdCallback() {}, attachedCallback() {}, @@ -447,7 +447,7 @@ let tests = [ }, // should complain about invalid callback parameters function() { - document.registerElement(\\"custom-element\\", { + document.registerElement("custom-element", { prototype: { attributeChangedCallback( localName: string, @@ -459,11 +459,11 @@ let tests = [ }); } ]; -" + `; exports[`traversal.js 1`] = ` -"// @flow +// @flow let tests = [ // basic functionality @@ -849,12 +849,12 @@ let tests = [ -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, { acceptNode: node => NodeFilter.FILTER_ACCEPT }); // valid document.createNodeIterator(document.body, -1, { - acceptNode: node => \\"accept\\" + acceptNode: node => "accept" }); // invalid document.createNodeIterator(document.body, -1, {}); // invalid }, @@ -864,15 +864,15 @@ let tests = [ -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, { acceptNode: node => NodeFilter.FILTER_ACCEPT }); // valid document.createTreeWalker(document.body, -1, { - acceptNode: node => \\"accept\\" + acceptNode: node => "accept" }); // invalid document.createTreeWalker(document.body, -1, {}); // invalid } ]; -" + `; diff --git a/tests/flow/dump-types/__snapshots__/jsfmt.spec.js.snap b/tests/flow/dump-types/__snapshots__/jsfmt.spec.js.snap index 2ed540bf..31c680de 100644 --- a/tests/flow/dump-types/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/dump-types/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`import.js 1`] = ` -"// @flow +// @flow var num = 42; function bar() { } bar(); @@ -12,11 +12,11 @@ var num = 42; function bar() {} bar(); module.exports = num; -" + `; exports[`test.js 1`] = ` -"// @flow +// @flow var num = require('./import'); function foo(x) { } foo(0); @@ -39,7 +39,7 @@ declare var obj: {a?: {b: ?{c: null | {d: number}}}}; const idxResult = idx(obj, obj => obj.a.b.c.d); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var num = require(\\"./import\\"); +var num = require("./import"); function foo(x) {} foo(0); var a: string = num; @@ -67,5 +67,5 @@ function f3(x: ?string) { declare var idx: $Facebookism$Idx; declare var obj: { a?: { b: ?{ c: null | { d: number } } } }; const idxResult = idx(obj, obj => obj.a.b.c.d); -" + `; diff --git a/tests/flow/duplicate_methods/__snapshots__/jsfmt.spec.js.snap b/tests/flow/duplicate_methods/__snapshots__/jsfmt.spec.js.snap index 9d10f5e3..f1755615 100644 --- a/tests/flow/duplicate_methods/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/duplicate_methods/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"class C1 { +class C1 { m() { } m() { } } @@ -78,5 +78,5 @@ class C5 { } new C5().m = new C5().m - 42; -" + `; diff --git a/tests/flow/encaps/__snapshots__/jsfmt.spec.js.snap b/tests/flow/encaps/__snapshots__/jsfmt.spec.js.snap index 70121e3e..ec346840 100644 --- a/tests/flow/encaps/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/encaps/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`encaps.js 1`] = ` -"class A { } +class A { } var a = new A(); var s1 = \`l\${a.x}r\`; // error: no prop x in A @@ -12,7 +12,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,10 +29,10 @@ 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\`; (s3.foo: number); // error: string ~> number -" + `; diff --git a/tests/flow/enumerror/__snapshots__/jsfmt.spec.js.snap b/tests/flow/enumerror/__snapshots__/jsfmt.spec.js.snap index 31ad91ff..882eb7c0 100644 --- a/tests/flow/enumerror/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/enumerror/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`enumerror.js 1`] = ` -"/** @flow */ +/** @flow */ function isActive(ad: {state: $Keys<{ PAUSED: string; @@ -23,7 +23,7 @@ function isActive2(ad: {state: $Keys}): boolean { 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 @@ -39,22 +39,22 @@ function isActive( }> } ): 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; @@ -62,5 +62,5 @@ function keys2union(s: Keys): Union { function union2keys(s: Union): Keys { return s; } // ok -" + `; diff --git a/tests/flow/equals/__snapshots__/jsfmt.spec.js.snap b/tests/flow/equals/__snapshots__/jsfmt.spec.js.snap index b792f864..2fbb5d02 100644 --- a/tests/flow/equals/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/equals/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`equals.js 1`] = ` -"/* @flow */ +/* @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); @@ -17,14 +17,14 @@ var x = (null : ?number); /* @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; 1 == x; -" + `; diff --git a/tests/flow/error_messages/__snapshots__/jsfmt.spec.js.snap b/tests/flow/error_messages/__snapshots__/jsfmt.spec.js.snap index e542499a..a40dd1f2 100644 --- a/tests/flow/error_messages/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/error_messages/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/es6modules/__snapshots__/jsfmt.spec.js.snap b/tests/flow/es6modules/__snapshots__/jsfmt.spec.js.snap index a9c5e41b..bfdc6568 100644 --- a/tests/flow/es6modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/es6modules/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`B.js 1`] = ` -"/* @flow */ +/* @flow */ exports.numberValue = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ exports.numberValue = 42; -" + `; exports[`C.js 1`] = ` -"/* @flow */ +/* @flow */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -" + `; exports[`CommonJS_Clobbering_Class.js 1`] = ` -"/** +/** * @providesModule CommonJS_Clobbering_Class * @flow */ @@ -72,11 +72,11 @@ class Test extends Base { } module.exports = Test; -" + `; exports[`CommonJS_Clobbering_Frozen.js 1`] = ` -"/** +/** * @providesModule CommonJS_Clobbering_Frozen * @flow */ @@ -93,11 +93,11 @@ module.exports = Object.freeze({ module.exports = Object.freeze({ numberValue1: 1 }); -" + `; exports[`CommonJS_Clobbering_Lit.js 1`] = ` -"/** +/** * @providesModule CommonJS_Clobbering_Lit * @flow */ @@ -122,11 +122,11 @@ module.exports = { numberValue4: 4, numberValue5: 5 }; -" + `; exports[`CommonJS_Named.js 1`] = ` -"/** +/** * @providesModule CommonJS_Named * @flow */ @@ -147,11 +147,11 @@ exports.numberValue2 = 2; exports.numberValue3 = 3; exports.numberValue4 = 4; exports.numberValue5 = 5; -" + `; exports[`ES6_Default_AnonClass1.js 1`] = ` -"/** +/** * @providesModule ES6_Default_AnonClass1 * @flow */ @@ -168,11 +168,11 @@ export default class { return 42; } } -" + `; exports[`ES6_Default_AnonClass2.js 1`] = ` -"/** +/** * @providesModule ES6_Default_AnonClass2 * @flow */ @@ -189,11 +189,11 @@ export default class { return 42; } } -" + `; exports[`ES6_Default_AnonFunction1.js 1`] = ` -"/** +/** * @providesModule ES6_Default_AnonFunction1 * @flow */ @@ -208,11 +208,11 @@ export default function():number { return 42; } export default function(): number { return 42; } -" + `; exports[`ES6_Default_AnonFunction2.js 1`] = ` -"/** +/** * @providesModule ES6_Default_AnonFunction2 * @flow */ @@ -227,11 +227,11 @@ export default function():number { return 42; } export default function(): number { return 42; } -" + `; exports[`ES6_Default_NamedClass1.js 1`] = ` -"/** +/** * @providesModule ES6_Default_NamedClass1 * @flow */ @@ -258,11 +258,11 @@ export default class Foo { // // Default-exported class should also be available in local scope new Foo(); -" + `; exports[`ES6_Default_NamedClass2.js 1`] = ` -"/** +/** * @providesModule ES6_Default_NamedClass2 * @flow */ @@ -279,11 +279,11 @@ export default class Foo { return 42; } } -" + `; exports[`ES6_Default_NamedFunction1.js 1`] = ` -"/** +/** * @providesModule ES6_Default_NamedFunction1 * @flow */ @@ -298,11 +298,11 @@ export default function foo():number { return 42; } export default function foo(): number { return 42; } -" + `; exports[`ES6_Default_NamedFunction2.js 1`] = ` -"/** +/** * @providesModule ES6_Default_NamedFunction2 * @flow */ @@ -317,11 +317,11 @@ export default function foo():number { return 42; } export default function foo(): number { return 42; } -" + `; exports[`ES6_DefaultAndNamed.js 1`] = ` -"/* @flow */ +/* @flow */ export default 42; export var str = 'asdf'; @@ -329,46 +329,46 @@ export var str = 'asdf'; /* @flow */ export default 42; -export var str = \\"asdf\\"; -" +export var str = "asdf"; + `; exports[`ES6_ExportAllFrom_Intermediary1.js 1`] = ` -"/** +/** * @providesModule ES6_ExportAllFrom_Intermediary1 * @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"; + `; exports[`ES6_ExportAllFrom_Intermediary2.js 1`] = ` -"/** +/** * @providesModule ES6_ExportAllFrom_Intermediary2 * @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"; + `; exports[`ES6_ExportAllFrom_Source1.js 1`] = ` -"/** +/** * @providesModule ES6_ExportAllFrom_Source1 * @flow */ @@ -381,11 +381,11 @@ export var numberValue1 = 1; */ export var numberValue1 = 1; -" + `; exports[`ES6_ExportAllFrom_Source2.js 1`] = ` -"/** +/** * @providesModule ES6_ExportAllFrom_Source2 * @flow */ @@ -398,24 +398,24 @@ export var numberValue2 = 1; */ export var numberValue2 = 1; -" + `; exports[`ES6_ExportAllFromMulti.js 1`] = ` -"// @flow +// @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"; + `; exports[`ES6_ExportFrom_Intermediary1.js 1`] = ` -"/** +/** * @providesModule ES6_ExportFrom_Intermediary1 * @flow */ @@ -423,7 +423,7 @@ exports[`ES6_ExportFrom_Intermediary1.js 1`] = ` export { numberValue1, numberValue2 as numberValue2_renamed -} from \\"ES6_ExportFrom_Source1\\"; +} from "ES6_ExportFrom_Source1"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary1 @@ -433,12 +433,12 @@ export { export { numberValue1, numberValue2 as numberValue2_renamed -} from \\"ES6_ExportFrom_Source1\\"; -" +} from "ES6_ExportFrom_Source1"; + `; exports[`ES6_ExportFrom_Intermediary2.js 1`] = ` -"/** +/** * @providesModule ES6_ExportFrom_Intermediary2 * @flow */ @@ -446,7 +446,7 @@ exports[`ES6_ExportFrom_Intermediary2.js 1`] = ` export { numberValue1, numberValue2 as numberValue2_renamed2 -} from \\"ES6_ExportFrom_Source2\\"; +} from "ES6_ExportFrom_Source2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary2 @@ -456,12 +456,12 @@ export { export { numberValue1, numberValue2 as numberValue2_renamed2 -} from \\"ES6_ExportFrom_Source2\\"; -" +} from "ES6_ExportFrom_Source2"; + `; exports[`ES6_ExportFrom_Source1.js 1`] = ` -"/** +/** * @providesModule ES6_ExportFrom_Source1 * @flow */ @@ -474,11 +474,11 @@ export var numberValue1 = 1, numberValue2 = 2; */ export var numberValue1 = 1, numberValue2 = 2; -" + `; exports[`ES6_ExportFrom_Source2.js 1`] = ` -"/** +/** * @providesModule ES6_ExportFrom_Source2 * @flow */ @@ -491,11 +491,11 @@ export var numberValue1 = 1, numberValue2 = 2; */ export var numberValue1 = 1, numberValue2 = 2; -" + `; exports[`ES6_Named1.js 1`] = ` -"/** +/** * @providesModule ES6_Named1 * @flow */ @@ -546,11 +546,11 @@ export class NumberGenerator { export var varDeclNumber1 = 1, varDeclNumber2 = 2; export var { destructuredObjNumber } = { destructuredObjNumber: 1 }; export var [destructuredArrNumber] = [1]; -" + `; exports[`ES6_Named2.js 1`] = ` -"/** +/** * @providesModule ES6_Named2 * @flow */ @@ -597,22 +597,22 @@ export class NumberGenerator2 { export var varDeclNumber3 = 1, varDeclNumber4 = 2; export var { destructuredObjNumber2 } = { destructuredObjNumber2: 1 }; export var [destructuredArrNumber2] = [1]; -" + `; exports[`ExportType.js 1`] = ` -"// @flow +// @flow export type typeAlias = number; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export type typeAlias = number; -" + `; exports[`ProvidesModuleA.js 1`] = ` -"/** +/** * @providesModule A * @flow */ @@ -621,7 +621,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = \\"str\\"; +exports.stringValue = "str"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule A @@ -632,12 +632,12 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = \\"str\\"; -" +exports.stringValue = "str"; + `; exports[`ProvidesModuleCJSDefault.js 1`] = ` -"/** +/** * @providesModule CJSDefault * @flow */ @@ -654,11 +654,11 @@ module.exports = { module.exports = { numberValue: 42 }; -" + `; exports[`ProvidesModuleD.js 1`] = ` -"/** +/** * @providesModule D * @flow */ @@ -667,11 +667,11 @@ exports[`ProvidesModuleD.js 1`] = ` * @providesModule D * @flow */ -" + `; exports[`ProvidesModuleES6Default.js 1`] = ` -"/** +/** * @providesModule ES6Default * @flow */ @@ -692,59 +692,59 @@ export default { numberValue: 42, }; */ -" + `; exports[`SideEffects.js 1`] = ` -"/* @flow */ +/* @flow */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -" + `; exports[`es6modules.js 1`] = ` -"/* @flow */ +/* @flow */ // ===================== // // == Path Resolution == // // ===================== // // @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 -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 @@ -755,15 +755,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(); @@ -771,7 +771,7 @@ 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\\"; +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(); @@ -781,22 +781,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 -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 @@ -805,21 +805,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 @@ -827,57 +827,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 @@ -887,19 +887,19 @@ var ac2: string = numberValue5; // Error: number ~> string 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 @@ -907,53 +907,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 @@ -961,7 +961,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 @@ -973,13 +973,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 == // @@ -987,7 +987,7 @@ import {specifierNumber} from \\"ES6_Named1\\"; // Error: Did you mean \`specifi import { numberValue1 as numberValue8, numberValue2 as numberValue9 -} from \\"./ES6_ExportAllFromMulti\\"; +} from "./ES6_ExportAllFromMulti"; var at1: number = numberValue8; var at2: string = numberValue8; // Error: number ~> string @@ -998,7 +998,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 */ @@ -1007,41 +1007,41 @@ import {typeAlias} from \\"./ExportType\\"; // Error: Cannot vanilla-import a ty // ===================== // // @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 -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 @@ -1052,15 +1052,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(); @@ -1068,7 +1068,7 @@ 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\\"; +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(); @@ -1078,22 +1078,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 -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 @@ -1102,21 +1102,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 @@ -1124,57 +1124,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 @@ -1182,21 +1182,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 @@ -1204,54 +1204,54 @@ 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\\") +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 @@ -1259,7 +1259,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 @@ -1271,13 +1271,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 == // @@ -1285,7 +1285,7 @@ import { specifierNumber } from \\"ES6_Named1\\"; // Error: Did you mean \`speci import { numberValue1 as numberValue8, numberValue2 as numberValue9 -} from \\"./ES6_ExportAllFromMulti\\"; +} from "./ES6_ExportAllFromMulti"; var at1: number = numberValue8; var at2: string = numberValue8; // Error: number ~> string @@ -1296,39 +1296,39 @@ 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! + `; exports[`test_imports_are_frozen.js 1`] = ` -"/* @flow */ +/* @flow */ // // Imports // // 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 @@ -1338,19 +1338,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 } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1361,27 +1361,27 @@ function testRequires() { // // 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 // @@ -1390,20 +1390,20 @@ 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 } -" + `; diff --git a/tests/flow/es_declare_module/__snapshots__/jsfmt.spec.js.snap b/tests/flow/es_declare_module/__snapshots__/jsfmt.spec.js.snap index 99e78760..b3e271c6 100644 --- a/tests/flow/es_declare_module/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/es_declare_module/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`es_declare_module.js 1`] = ` -"// @flow +// @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); @@ -12,41 +12,41 @@ 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 -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 -import {exports as nope} from \\"ES\\"; // Error: Not an export +import {exports as nope} from "ES"; // Error: Not an export ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @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); @@ -54,35 +54,35 @@ 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 -" `; diff --git a/tests/flow/es_declare_module/flow-typed/__snapshots__/jsfmt.spec.js.snap b/tests/flow/es_declare_module/flow-typed/__snapshots__/jsfmt.spec.js.snap index 956a0dc9..b2ba337a 100644 --- a/tests/flow/es_declare_module/flow-typed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/es_declare_module/flow-typed/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`declares.js 1`] = ` -"declare module \\"CJS_Named\\" { +declare module "CJS_Named" { declare var num1: number; declare var str1: string; } -declare module \\"CJS_Clobbered\\" { +declare module "CJS_Clobbered" { declare var num2: number; declare type numType = number; declare var exports: { @@ -14,7 +14,7 @@ declare module \\"CJS_Clobbered\\" { }; } -declare module \\"ES\\" { +declare module "ES" { declare var strHidden: string; declare export {strHidden as str3}; declare export var num3: number; @@ -23,18 +23,18 @@ declare module \\"ES\\" { declare var exports: number; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare module \\"CJS_Named\\" { +declare module "CJS_Named" { declare var num1: number; declare var str1: string; } -declare module \\"CJS_Clobbered\\" { +declare module "CJS_Clobbered" { declare var num2: number; declare type numType = number; declare var exports: { numExport: number }; } -declare module \\"ES\\" { +declare module "ES" { declare var strHidden: string; declare export { strHidden as str3 }; declare export var num3: number; @@ -42,5 +42,5 @@ declare module \\"ES\\" { declare export type T = number; declare var exports: number; } -" + `; diff --git a/tests/flow/esproposal_class_instance_fields.ignore/__snapshots__/jsfmt.spec.js.snap b/tests/flow/esproposal_class_instance_fields.ignore/__snapshots__/jsfmt.spec.js.snap index 4256eb8d..d5a821e6 100644 --- a/tests/flow/esproposal_class_instance_fields.ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/esproposal_class_instance_fields.ignore/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ class Foo { annotationOnly: string; @@ -14,9 +14,9 @@ class Foo { class Foo { annotationOnly: string; - initOnly = \\"asdf\\"; - initWithAnnotation: string = \\"asdf\\"; + initOnly = "asdf"; + initWithAnnotation: string = "asdf"; [computed]: string; } -" + `; diff --git a/tests/flow/esproposal_class_instance_fields.warn/__snapshots__/jsfmt.spec.js.snap b/tests/flow/esproposal_class_instance_fields.warn/__snapshots__/jsfmt.spec.js.snap index ec5e8237..29f2b5b4 100644 --- a/tests/flow/esproposal_class_instance_fields.warn/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/esproposal_class_instance_fields.warn/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ class Foo { annotationOnly: string; @@ -13,8 +13,8 @@ class Foo { class Foo { annotationOnly: string; - initOnly = \\"asdf\\"; - initWithAnnotation: string = \\"asdf\\"; + initOnly = "asdf"; + initWithAnnotation: string = "asdf"; } -" + `; diff --git a/tests/flow/esproposal_class_static_fields.ignore/__snapshots__/jsfmt.spec.js.snap b/tests/flow/esproposal_class_static_fields.ignore/__snapshots__/jsfmt.spec.js.snap index 2278d1bf..19d1b114 100644 --- a/tests/flow/esproposal_class_static_fields.ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/esproposal_class_static_fields.ignore/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ class Foo { static annotationOnly: string; @@ -13,8 +13,8 @@ class Foo { class Foo { static annotationOnly: string; - static initOnly = \\"asdf\\"; - static initWithAnnotation: string = \\"asdf\\"; + static initOnly = "asdf"; + static initWithAnnotation: string = "asdf"; } -" + `; diff --git a/tests/flow/esproposal_class_static_fields.warn/__snapshots__/jsfmt.spec.js.snap b/tests/flow/esproposal_class_static_fields.warn/__snapshots__/jsfmt.spec.js.snap index 2278d1bf..19d1b114 100644 --- a/tests/flow/esproposal_class_static_fields.warn/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/esproposal_class_static_fields.warn/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ class Foo { static annotationOnly: string; @@ -13,8 +13,8 @@ class Foo { class Foo { static annotationOnly: string; - static initOnly = \\"asdf\\"; - static initWithAnnotation: string = \\"asdf\\"; + static initOnly = "asdf"; + static initWithAnnotation: string = "asdf"; } -" + `; diff --git a/tests/flow/esproposal_export_star_as.enable/__snapshots__/jsfmt.spec.js.snap b/tests/flow/esproposal_export_star_as.enable/__snapshots__/jsfmt.spec.js.snap index ebeec82c..504f20cf 100644 --- a/tests/flow/esproposal_export_star_as.enable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/esproposal_export_star_as.enable/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`dest.js 1`] = ` -"// @flow +// @flow -import {source} from \\"./test\\"; +import {source} from "./test"; var a: number = source.num; var b: string = source.num; // Error: num ~> string @@ -13,36 +13,36 @@ var d: number = source.str; // Error: num ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { source } from \\"./test\\"; +import { source } from "./test"; var a: number = source.num; var b: string = source.num; // Error: num ~> string var c: string = source.str; var d: number = source.str; // Error: num ~> string -" + `; exports[`source.js 1`] = ` -"// @flow +// @flow export var str = 'asdf'; export var num = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export var str = \\"asdf\\"; +export var str = "asdf"; export var num = 42; -" + `; exports[`test.js 1`] = ` -"// @flow +// @flow -export * as source from \\"./source\\"; +export * as source from "./source"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export * as source from \\"./source\\"; -" +export * as source from "./source"; + `; diff --git a/tests/flow/esproposal_export_star_as.ignore/__snapshots__/jsfmt.spec.js.snap b/tests/flow/esproposal_export_star_as.ignore/__snapshots__/jsfmt.spec.js.snap index 1aa7c086..e7d69f2c 100644 --- a/tests/flow/esproposal_export_star_as.ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/esproposal_export_star_as.ignore/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`dest.js 1`] = ` -"// @flow +// @flow -import {source} from \\"./test\\"; +import {source} from "./test"; var a: number = source.num; var b: string = source.num; // Error: num ~> string @@ -13,36 +13,36 @@ var d: number = source.str; // Ignored error: num ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { source } from \\"./test\\"; +import { source } from "./test"; var a: number = source.num; var b: string = source.num; // Error: num ~> string var c: string = source.str; var d: number = source.str; // Ignored error: num ~> string -" + `; exports[`source.js 1`] = ` -"// @flow +// @flow export var str = 'asdf'; export var num = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export var str = \\"asdf\\"; +export var str = "asdf"; export var num = 42; -" + `; exports[`test.js 1`] = ` -"// @flow +// @flow -export * as source from \\"./source\\"; +export * as source from "./source"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export * as source from \\"./source\\"; -" +export * as source from "./source"; + `; diff --git a/tests/flow/esproposal_export_star_as.warn/__snapshots__/jsfmt.spec.js.snap b/tests/flow/esproposal_export_star_as.warn/__snapshots__/jsfmt.spec.js.snap index 510cda6b..c2c1cf73 100644 --- a/tests/flow/esproposal_export_star_as.warn/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/esproposal_export_star_as.warn/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ -export * as foo from \\"./test\\"; +export * as foo from "./test"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -export * as foo from \\"./test\\"; -" +export * as foo from "./test"; + `; diff --git a/tests/flow/export_default/__snapshots__/jsfmt.spec.js.snap b/tests/flow/export_default/__snapshots__/jsfmt.spec.js.snap index 37a848cf..3f9a467f 100644 --- a/tests/flow/export_default/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/export_default/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`P.js 1`] = ` -"module.exports = require('M'); +module.exports = require('M'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = require(\\"M\\"); -" +module.exports = require("M"); + `; exports[`test.js 1`] = ` -"var M = require('M'); +var M = require('M'); var N = require('N'); N.x = M(N.x); var P = require('./P'); // implementation of P redirects to module M @@ -16,12 +16,12 @@ N.y = P(N.y); var Q = require('Q'); // declaration of Q redirects to module M N.z = Q(N.z); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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); -" + `; diff --git a/tests/flow/export_default/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/export_default/lib/__snapshots__/jsfmt.spec.js.snap index dca6b58f..e2352da0 100644 --- a/tests/flow/export_default/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/export_default/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`lib.js 1`] = ` -"declare module M { +declare module M { declare function exports(x:string): string; } declare module N { @@ -22,7 +22,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/flow/export_type/__snapshots__/jsfmt.spec.js.snap b/tests/flow/export_type/__snapshots__/jsfmt.spec.js.snap index 83f6f209..c23006ac 100644 --- a/tests/flow/export_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/export_type/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`cjs_with_types.js 1`] = ` -"/* @flow */ +/* @flow */ export type talias4 = number; export interface IFoo { prop: number }; @@ -14,18 +14,18 @@ export type talias4 = number; export interface IFoo { prop: number } module.exports = {}; -" + `; exports[`importer.js 1`] = ` -"/* @flow */ +/* @flow */ import type { inlinedType1, standaloneType1, talias1, talias3, -} from \\"./types_only\\"; +} from "./types_only"; var a: inlinedType1 = 42; var b: inlinedType1 = 'asdf'; // Error: string ~> number @@ -39,11 +39,11 @@ var f: talias1 = 'asdf'; // Error: string ~> number var g: talias3 = 42; 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 -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} @@ -58,36 +58,36 @@ 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} -" + `; exports[`types_only.js 1`] = ` -"/* @flow */ +/* @flow */ export type inlinedType1 = number; var a: inlinedType1 = 42; @@ -99,7 +99,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 }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -107,7 +107,7 @@ export interface IFoo { prop: number }; 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 }; @@ -115,14 +115,14 @@ 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 } -" + `; exports[`types_only2.js 1`] = ` -"/* @flow */ +/* @flow */ export type talias1 = number; export type talias2 = number; @@ -133,5 +133,5 @@ export interface IFoo2 { prop: string }; export type talias1 = number; export type talias2 = number; export interface IFoo2 { prop: string } -" + `; diff --git a/tests/flow/extensions/__snapshots__/jsfmt.spec.js.snap b/tests/flow/extensions/__snapshots__/jsfmt.spec.js.snap index 4067aab7..83844314 100644 --- a/tests/flow/extensions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/extensions/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/facebook_fbt_none/__snapshots__/jsfmt.spec.js.snap b/tests/flow/facebook_fbt_none/__snapshots__/jsfmt.spec.js.snap index ad5b6a5f..424b8ba6 100644 --- a/tests/flow/facebook_fbt_none/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/facebook_fbt_none/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`main.js 1`] = ` -"// @flow +// @flow var React = require('react'); (: React.Element<*>); (: number); // Error: ReactElement ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var React = require(\\"react\\"); +var React = require("react"); (: React.Element<*>); (: number); // Error: ReactElement ~> number -" + `; diff --git a/tests/flow/facebook_fbt_some/__snapshots__/jsfmt.spec.js.snap b/tests/flow/facebook_fbt_some/__snapshots__/jsfmt.spec.js.snap index 69430b2d..e56370de 100644 --- a/tests/flow/facebook_fbt_some/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/facebook_fbt_some/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`main.js 1`] = ` -"// @flow +// @flow (: number); (: string); // Error (the libdef in this test marks fbt as number) @@ -10,5 +10,5 @@ exports[`main.js 1`] = ` (: number); (: string); // Error (the libdef in this test marks fbt as number) -" + `; diff --git a/tests/flow/facebook_fbt_some/flow-typed/__snapshots__/jsfmt.spec.js.snap b/tests/flow/facebook_fbt_some/flow-typed/__snapshots__/jsfmt.spec.js.snap index d035b074..99296afa 100644 --- a/tests/flow/facebook_fbt_some/flow-typed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/facebook_fbt_some/flow-typed/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`fbt.js 1`] = ` -"type Fbt = number +type Fbt = number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Fbt = number; -" + `; diff --git a/tests/flow/facebookisms/__snapshots__/jsfmt.spec.js.snap b/tests/flow/facebookisms/__snapshots__/jsfmt.spec.js.snap index e85d2900..2729d742 100644 --- a/tests/flow/facebookisms/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/facebookisms/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Bar.js 1`] = ` -"var Bar = { x: 0 }; +var Bar = { x: 0 }; module.exports = Bar; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var Bar = { x: 0 }; module.exports = Bar; -" + `; exports[`copyProperties.js 1`] = ` -"// @flow +// @flow let tests = [ // global @@ -62,7 +62,7 @@ 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 @@ -71,8 +71,8 @@ let tests = [ // 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 }); }, @@ -80,7 +80,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 @@ -89,11 +89,11 @@ let tests = [ x(copyProperties); } ]; -" + `; exports[`invariant.js 1`] = ` -"/* @flow */ +/* @flow */ let tests = [ function() { @@ -113,7 +113,7 @@ let tests = [ 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) { @@ -122,36 +122,36 @@ let tests = [ (x: string); } ]; -" + `; exports[`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; } -" + `; exports[`mergeInto.js 1`] = ` -"// @flow +// @flow let tests = [ // global @@ -198,15 +198,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 @@ -220,28 +220,28 @@ let tests = [ x(mergeInto); } ]; -" + `; exports[`test.js 1`] = ` -"var Bar = require('./Bar'); +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/flow/fetch/__snapshots__/jsfmt.spec.js.snap b/tests/flow/fetch/__snapshots__/jsfmt.spec.js.snap index 6f38991e..2d7a1e2d 100644 --- a/tests/flow/fetch/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/fetch/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`fetch.js 1`] = ` -"/* @flow */ +/* @flow */ // most of the details are tested in the separate file // here I test the basic usage @@ -32,31 +32,31 @@ const d: Promise = fetch('image.png'); // incorrect // most of the details are tested in the separate file // here I test the basic usage -const myRequest = new Request(\\"http://google.com\\"); +const myRequest = new Request("http://google.com"); const a: Promise = fetch(myRequest).then(response => response.text()); const b: Promise = fetch(myRequest); // incorrect var myInit = { - method: \\"GET\\", + method: "GET", headers: { - \\"Content-Type\\": \\"image/jpeg\\" + "Content-Type": "image/jpeg" }, - mode: \\"cors\\", - cache: \\"default\\" + mode: "cors", + cache: "default" }; -const c: Promise = fetch(\\"image.png\\").then(response => response.blob()); // correct +const c: Promise = fetch("image.png").then(response => response.blob()); // correct + +const d: Promise = fetch("image.png"); // incorrect -const d: Promise = fetch(\\"image.png\\"); // incorrect -" `; exports[`headers.js 1`] = ` -"/* @flow */ +/* @flow */ -const a = new Headers(\\"'Content-Type': 'image/jpeg'\\"); // not correct +const a = new Headers("'Content-Type': 'image/jpeg'"); // not correct const b = new Headers(['Content-Type', 'image/jpeg']); // not correct const c = new Headers({'Content-Type', 'image/jpeg'}); // correct const d = new Headers(c); // correct @@ -85,22 +85,22 @@ e.getAll('content-type').forEach((v: string) => {}); // correct ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -const a = new Headers(\\"'Content-Type': 'image/jpeg'\\"); // not correct -const b = new Headers([\\"Content-Type\\", \\"image/jpeg\\"]); // not correct -const c = new Headers({ \\"Content-Type\\", \\"image/jpeg\\" }); // correct +const a = new Headers("'Content-Type': 'image/jpeg'"); // not correct +const b = new Headers(["Content-Type", "image/jpeg"]); // not correct +const c = new Headers({ "Content-Type", "image/jpeg" }); // correct const d = new Headers(c); // correct const e: Headers = new Headers(); // correct -e.append(\\"Content-Type\\", \\"image/jpeg\\"); // correct -e.append(\\"Content-Type\\"); // not correct -e.append({ \\"Content-Type\\", \\"image/jpeg\\" }); // not correct -e.set(\\"Content-Type\\", \\"image/jpeg\\"); // correct -e.set(\\"Content-Type\\"); // not correct -e.set({ \\"Content-Type\\", \\"image/jpeg\\" }); // not correct +e.append("Content-Type", "image/jpeg"); // correct +e.append("Content-Type"); // not correct +e.append({ "Content-Type", "image/jpeg" }); // not correct +e.set("Content-Type", "image/jpeg"); // correct +e.set("Content-Type"); // not correct +e.set({ "Content-Type", "image/jpeg" }); // not correct -const f: Headers = e.append(\\"Content-Type\\", \\"image/jpeg\\"); // not correct +const f: Headers = e.append("Content-Type", "image/jpeg"); // not correct -const g: string = e.get(\\"Content-Type\\"); // correct -const h: number = e.get(\\"Content-Type\\"); // not correct +const g: string = e.get("Content-Type"); // correct +const h: number = e.get("Content-Type"); // not correct for (let v of e) { const [i, j]: [string, string] = v; // correct @@ -110,12 +110,12 @@ for (let v of e.entries()) { const [i, j]: [string, string] = v; // correct } -e.getAll(\\"content-type\\").forEach((v: string) => {}); // correct -" +e.getAll("content-type").forEach((v: string) => {}); // correct + `; exports[`request.js 1`] = ` -"/* @flow */ +/* @flow */ const a: Request = new Request(); // incorrect const b: Request = new Request('http://example.org'); // correct const c: Request = new Request(b); // correct @@ -162,7 +162,7 @@ const k: Request = new Request('http://example.org', { headers: { 'Content-Type': 'image/jpeg' }, - body: new URLSearchParams(\\"key=value\\"), + body: new URLSearchParams("key=value"), mode: 'cors', cache: 'default' }) // correct @@ -185,21 +185,21 @@ const m: Request = new Request('http://example.org', { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ const a: Request = new Request(); // incorrect -const b: Request = new Request(\\"http://example.org\\"); // correct +const b: Request = new Request("http://example.org"); // correct const c: Request = new Request(b); // correct const d: Request = new Request(c.clone()); // correct (doesn't make much sense though) const e: Request = new Request(b, c); // incorrect const f: Request = new Request({}); // incorrect -const g: Request = new Request(\\"http://example.org\\", {}); // correct +const g: Request = new Request("http://example.org", {}); // correct -const h: Request = new Request(\\"http://example.org\\", { - method: \\"GET\\", +const h: Request = new Request("http://example.org", { + method: "GET", headers: { - \\"Content-Type\\": \\"image/jpeg\\" + "Content-Type": "image/jpeg" }, - mode: \\"cors\\", - cache: \\"default\\" + mode: "cors", + cache: "default" }); // correct var bodyUsed: boolean = h.bodyUsed; @@ -209,52 +209,52 @@ h.text().then((t: Buffer) => t); // incorrect h.arrayBuffer().then((ab: ArrayBuffer) => ab); // correct h.arrayBuffer().then((ab: Buffer) => ab); // incorrect -const i: Request = new Request(\\"http://example.org\\", { - method: \\"POST\\", +const i: Request = new Request("http://example.org", { + method: "POST", headers: { - \\"Content-Type\\": \\"application/octet-stream\\" + "Content-Type": "application/octet-stream" }, body: new ArrayBuffer(10) }); // correct -const j: Request = new Request(\\"http://example.org\\", { - method: \\"POST\\", +const j: Request = new Request("http://example.org", { + method: "POST", headers: { - \\"Content-Type\\": \\"application/octet-stream\\" + "Content-Type": "application/octet-stream" }, body: new Uint8Array(10) }); // correct -const k: Request = new Request(\\"http://example.org\\", { - method: \\"POST\\", +const k: Request = new Request("http://example.org", { + method: "POST", headers: { - \\"Content-Type\\": \\"image/jpeg\\" + "Content-Type": "image/jpeg" }, - body: new URLSearchParams(\\"key=value\\"), - mode: \\"cors\\", - cache: \\"default\\" + body: new URLSearchParams("key=value"), + mode: "cors", + cache: "default" }); // correct -const l: Request = new Request(\\"http://example.org\\", { - method: \\"GET\\", - headers: \\"Content-Type: image/jpeg\\", - mode: \\"cors\\", - cache: \\"default\\" +const l: Request = new Request("http://example.org", { + method: "GET", + headers: "Content-Type: image/jpeg", + mode: "cors", + cache: "default" }); // incorrect - headers is string -const m: Request = new Request(\\"http://example.org\\", { - method: \\"CONNECT\\", +const m: Request = new Request("http://example.org", { + method: "CONNECT", headers: { - \\"Content-Type\\": \\"image/jpeg\\" + "Content-Type": "image/jpeg" }, - mode: \\"cors\\", - cache: \\"default\\" + mode: "cors", + cache: "default" }); // incorrect - CONNECT is forbidden -" + `; exports[`response.js 1`] = ` -"/* @flow */ +/* @flow */ const a: Response = new Response(); // correct const b: Response = new Response(new Blob()); // correct const c: Response = new Response(new FormData()); // correct @@ -263,23 +263,23 @@ const d: Response = new Response(new FormData(), { status: 404 }); // correct -const e: Response = new Response(\\"responsebody\\", { - status: \\"404\\" +const e: Response = new Response("responsebody", { + status: "404" }); // incorrect -const f: Response = new Response(\\"responsebody\\", { +const f: Response = new Response("responsebody", { status: 404, - headers: \\"'Content-Type': 'image/jpeg'\\" + headers: "'Content-Type': 'image/jpeg'" }); // incorrect -const g: Response = new Response(\\"responsebody\\", { +const g: Response = new Response("responsebody", { status: 404, headers: { 'Content-Type': 'image/jpeg' } }); // correct -const h: Response = new Response(\\"responsebody\\", { +const h: Response = new Response("responsebody", { status: 404, headers: new Headers({ 'Content-Type': 'image/jpeg' @@ -310,33 +310,33 @@ const d: Response = new Response(new FormData(), { status: 404 }); // correct -const e: Response = new Response(\\"responsebody\\", { - status: \\"404\\" +const e: Response = new Response("responsebody", { + status: "404" }); // incorrect -const f: Response = new Response(\\"responsebody\\", { +const f: Response = new Response("responsebody", { status: 404, - headers: \\"'Content-Type': 'image/jpeg'\\" + headers: "'Content-Type': 'image/jpeg'" }); // incorrect -const g: Response = new Response(\\"responsebody\\", { +const g: Response = new Response("responsebody", { status: 404, headers: { - \\"Content-Type\\": \\"image/jpeg\\" + "Content-Type": "image/jpeg" } }); // correct -const h: Response = new Response(\\"responsebody\\", { +const h: Response = new Response("responsebody", { status: 404, headers: new Headers({ - \\"Content-Type\\": \\"image/jpeg\\" + "Content-Type": "image/jpeg" }) }); // correct, if verbose const i: Response = new Response({ status: 404, headers: new Headers({ - \\"Content-Type\\": \\"image/jpeg\\" + "Content-Type": "image/jpeg" }) }); // incorrect @@ -347,13 +347,13 @@ h.text().then((t: string) => t); // correct h.text().then((t: Buffer) => t); // incorrect h.arrayBuffer().then((ab: ArrayBuffer) => ab); // correct h.arrayBuffer().then((ab: Buffer) => ab); // incorrect -" + `; exports[`urlsearchparams.js 1`] = ` -"/* @flow */ +/* @flow */ -const a = new URLSearchParams(\\"key1=value1\\"); // correct +const a = new URLSearchParams("key1=value1"); // correct const b = new URLSearchParams(['key1', 'value1']); // not correct const c = new URLSearchParams({'key1', 'value1'}); // not correct const d = new URLSearchParams(c); // correct @@ -382,22 +382,22 @@ e.getAll('key1').forEach((v: string) => {}); // correct ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -const a = new URLSearchParams(\\"key1=value1\\"); // correct -const b = new URLSearchParams([\\"key1\\", \\"value1\\"]); // not correct -const c = new URLSearchParams({ \\"key1\\", \\"value1\\" }); // not correct +const a = new URLSearchParams("key1=value1"); // correct +const b = new URLSearchParams(["key1", "value1"]); // not correct +const c = new URLSearchParams({ "key1", "value1" }); // not correct const d = new URLSearchParams(c); // correct const e: URLSearchParams = new URLSearchParams(); // correct -e.append(\\"key1\\", \\"value1\\"); // correct -e.append(\\"key1\\"); // not correct -e.append({ \\"key1\\", \\"value1\\" }); // not correct -e.set(\\"key1\\", \\"value1\\"); // correct -e.set(\\"key1\\"); // not correct -e.set({ \\"key1\\", \\"value1\\" }); // not correct +e.append("key1", "value1"); // correct +e.append("key1"); // not correct +e.append({ "key1", "value1" }); // not correct +e.set("key1", "value1"); // correct +e.set("key1"); // not correct +e.set({ "key1", "value1" }); // not correct -const f: URLSearchParams = e.append(\\"key1\\", \\"value1\\"); // not correct +const f: URLSearchParams = e.append("key1", "value1"); // not correct -const g: string = e.get(\\"key1\\"); // correct -const h: number = e.get(\\"key1\\"); // not correct +const g: string = e.get("key1"); // correct +const h: number = e.get("key1"); // not correct for (let v of e) { const [i, j]: [string, string] = v; // correct @@ -407,6 +407,6 @@ for (let v of e.entries()) { const [i, j]: [string, string] = v; // correct } -e.getAll(\\"key1\\").forEach((v: string) => {}); // correct -" +e.getAll("key1").forEach((v: string) => {}); // correct + `; diff --git a/tests/flow/find-module/__snapshots__/jsfmt.spec.js.snap b/tests/flow/find-module/__snapshots__/jsfmt.spec.js.snap index 787a7563..0096dbdd 100644 --- a/tests/flow/find-module/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/find-module/__snapshots__/jsfmt.spec.js.snap @@ -1,21 +1,21 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`req.js 1`] = ` -"module.exports = 0; +module.exports = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ module.exports = 0; -" + `; exports[`test.js 1`] = ` -"var x = require('./req'); +var x = require('./req'); (x: string); 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/flow/fixpoint/__snapshots__/jsfmt.spec.js.snap b/tests/flow/fixpoint/__snapshots__/jsfmt.spec.js.snap index 24322eb0..29961318 100644 --- a/tests/flow/fixpoint/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/fixpoint/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Fun.js 1`] = ` -" + /* @providesModule Fun */ function eq(x:number,y:number) { return true }; @@ -28,7 +28,7 @@ function mk_factorial() { var factorial = mk_factorial(); -factorial(\\"...\\"); +factorial("..."); module.exports = {fn: fix}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -66,14 +66,14 @@ function mk_factorial() { } var factorial = mk_factorial(); -factorial(\\"...\\"); +factorial("..."); module.exports = { fn: fix }; -" + `; exports[`Ycombinator.js 1`] = ` -" + /* @providesModule Ycombinator */ function Y(f) { @@ -121,5 +121,5 @@ Y(func1); Y(func2); module.exports = Y; -" + `; diff --git a/tests/flow/flow_ast.template_strings/__snapshots__/jsfmt.spec.js.snap b/tests/flow/flow_ast.template_strings/__snapshots__/jsfmt.spec.js.snap index 1800433a..bceacdfb 100644 --- a/tests/flow/flow_ast.template_strings/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/flow_ast.template_strings/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`foo.js 1`] = ` -"a\`foo \${bar} baz\` +a\`foo \${bar} baz\` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a\`foo \${bar} baz\`; -" + `; diff --git a/tests/flow/focus-check/__snapshots__/jsfmt.spec.js.snap b/tests/flow/focus-check/__snapshots__/jsfmt.spec.js.snap index d08751f7..ae876dd7 100644 --- a/tests/flow/focus-check/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/focus-check/__snapshots__/jsfmt.spec.js.snap @@ -1,34 +1,34 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"// @flow +// @flow (require('./b'): number); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -(require(\\"./b\\"): number); -" +(require("./b"): number); + `; exports[`b.js 1`] = ` -"// @flow +// @flow -module.exports = \\"\\"; +module.exports = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -module.exports = \\"\\"; -" +module.exports = ""; + `; exports[`test.js 1`] = ` -"// @flow +// @flow -(\\"\\": number); +("": number); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -(\\"\\": number); -" +("": number); + `; diff --git a/tests/flow/for/__snapshots__/jsfmt.spec.js.snap b/tests/flow/for/__snapshots__/jsfmt.spec.js.snap index aeffc471..bd5f3b29 100644 --- a/tests/flow/for/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/for/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`abnormal.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x: boolean) { var max = 10; @@ -59,7 +59,7 @@ function foo(x: boolean) { } return; } - console.log(\\"this is still reachable\\"); + console.log("this is still reachable"); } function bar(x: boolean) { @@ -67,7 +67,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) { @@ -75,7 +75,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) { @@ -84,9 +84,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) { @@ -94,13 +94,13 @@ function corge(x: boolean) { for (var ii = 0; ii < max; ii++) { break; } - console.log(\\"this is still reachable\\"); + console.log("this is still reachable"); } -" + `; exports[`abnormal_for_in.js 1`] = ` -"function foo(x: boolean) { +function foo(x: boolean) { var obj = { a: 1, b: 2}; for (var prop in obj) { if (x) { @@ -151,21 +151,21 @@ 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) { @@ -174,22 +174,22 @@ 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"); } -" + `; exports[`abnormal_for_of.js 1`] = ` -"function foo(x: boolean) { +function foo(x: boolean) { var arr = [1, 2, 3]; for (var elem of arr) { if (x) { @@ -240,21 +240,21 @@ 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) { @@ -263,16 +263,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"); } -" + `; diff --git a/tests/flow/forof/__snapshots__/jsfmt.spec.js.snap b/tests/flow/forof/__snapshots__/jsfmt.spec.js.snap index 3bfba67c..cd0e4042 100644 --- a/tests/flow/forof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/forof/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`forof.js 1`] = ` -"/** +/** * @flow */ @@ -108,5 +108,5 @@ function testSet2(set: Set<*>): void { (x: number); // Anything goes } } -" + `; diff --git a/tests/flow/function/__snapshots__/jsfmt.spec.js.snap b/tests/flow/function/__snapshots__/jsfmt.spec.js.snap index b27f9446..01c1c408 100644 --- a/tests/flow/function/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/function/__snapshots__/jsfmt.spec.js.snap @@ -1,31 +1,31 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`apply.js 1`] = ` -"function test(a: string, b: number): number { - return this.length; // expect []/\\"\\" this +function test(a: string, b: number): number { + return this.length; // expect []/"" this } // tuples flow correctly into params -test.apply(\\"\\", [\\"\\", 0]); +test.apply("", ["", 0]); // wrong this is an error -test.apply(0, [\\"\\", 0]); // error: lookup \`length\` on Number +test.apply(0, ["", 0]); // error: lookup \`length\` on Number // not enough arguments is an error -test.apply(\\"\\", [\\"\\"]); // error: void ~> number +test.apply("", [""]); // error: void ~> number // mistyped arguments is an error -test.apply(\\"\\", [\\"\\", \\"\\"]); // error: string ~> number (2nd arg) -test.apply(\\"\\", [0, 0]); // error: number ~> string (1st arg) +test.apply("", ["", ""]); // error: string ~> number (2nd arg) +test.apply("", [0, 0]); // error: number ~> string (1st arg) // resolve args array from tvar -function f(args) { test.apply(\\"\\", args) } -f([\\"\\", 0]); // OK -f([\\"\\", \\"\\"]); // error: string ~> number (2nd arg) +function f(args) { test.apply("", args) } +f(["", 0]); // OK +f(["", ""]); // error: string ~> number (2nd arg) f([0, 0]); // error: number ~> string (1st arg) // expect array -test.apply(\\"\\", \\"not array\\"); // error: expect array of args +test.apply("", "not array"); // error: expect array of args // expect 4 errors: // - lookup length on Number (because 0 is used as \`this\`) @@ -42,7 +42,7 @@ test.apply(\\"\\", \\"not array\\"); // error: expect array of args // args are optional function test2(): number { return 0; } (test2.apply(): number); -(test2.apply(\\"\\"): number); +(test2.apply(""): number); // callable objects function test3(x: { (a: string, b: string): void }) { @@ -51,39 +51,39 @@ function test3(x: { (a: string, b: string): void }) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function test(a: string, b: number): number { - return this.length; // expect []/\\"\\" this + return this.length; // expect []/"" this } // tuples flow correctly into params -test.apply(\\"\\", [\\"\\", 0]); +test.apply("", ["", 0]); // wrong this is an error -test.apply(0, [\\"\\", 0]); // error: lookup \`length\` on Number +test.apply(0, ["", 0]); // error: lookup \`length\` on Number // not enough arguments is an error -test.apply(\\"\\", [\\"\\"]); // error: void ~> number +test.apply("", [""]); // error: void ~> number // mistyped arguments is an error -test.apply(\\"\\", [\\"\\", \\"\\"]); // error: string ~> number (2nd arg) -test.apply(\\"\\", [0, 0]); // error: number ~> string (1st arg) +test.apply("", ["", ""]); // error: string ~> number (2nd arg) +test.apply("", [0, 0]); // error: number ~> string (1st arg) // resolve args array from tvar function f(args) { - test.apply(\\"\\", args); + test.apply("", args); } -f([\\"\\", 0]); // OK -f([\\"\\", \\"\\"]); // error: string ~> number (2nd arg) +f(["", 0]); // OK +f(["", ""]); // error: string ~> number (2nd arg) f([0, 0]); // error: number ~> string (1st arg) // expect array -test.apply(\\"\\", \\"not array\\"); // error: expect array of args +test.apply("", "not array"); // error: expect array of args // expect 4 errors: // - lookup length on Number (because 0 is used as \`this\`) // - 123 is not a string // - 'foo' is not a number // - return type (number) is not void -(test.call.apply(test, [0, 123, \\"foo\\"]): void); +(test.call.apply(test, [0, 123, "foo"]): void); // expect 2 errors: // - lookup length on number (0 is used as \`this\`) @@ -95,18 +95,18 @@ function test2(): number { return 0; } (test2.apply(): number); -(test2.apply(\\"\\"): number); +(test2.apply(""): number); // callable objects function test3(x: { (a: string, b: string): void }) { - x.apply(x, [\\"foo\\", \\"bar\\"]); // ok - x.apply(x, [\\"foo\\", 123]); // error, number !~> string + x.apply(x, ["foo", "bar"]); // ok + x.apply(x, ["foo", 123]); // error, number !~> string } -" + `; exports[`bind.js 1`] = ` -"// @flow +// @flow let tests = [ function(x: (a: string, b: string) => void) { @@ -139,56 +139,56 @@ let tests = [ let tests = [ function(x: (a: string, b: string) => void) { - let y = x.bind(x, \\"foo\\"); - y(\\"bar\\"); // ok + let y = x.bind(x, "foo"); + y("bar"); // ok y(123); // error, number !~> string }, // callable objects function(x: { (a: string, b: string): void }) { - let y = x.bind(x, \\"foo\\"); - y(\\"bar\\"); // ok + let y = x.bind(x, "foo"); + y("bar"); // ok y(123); // error, number !~> string }, // non-callable objects function(x: { a: string }) { - x.bind(x, \\"foo\\"); // error + x.bind(x, "foo"); // error }, // callable objects with overridden \`bind\` method function(x: { (a: string, b: string): void, bind(a: string): void }) { - (x.bind(\\"foo\\"): void); // ok + (x.bind("foo"): void); // ok (x.bind(123): void); // error, number !~> string } ]; -" + `; exports[`call.js 1`] = ` -"// @flow +// @flow function test(a: string, b: number): number { - return this.length; // expect []/\\"\\" this + return this.length; // expect []/"" this } // args flow correctly into params -test.call(\\"\\", \\"\\", 0); +test.call("", "", 0); // wrong this is an error -test.call(0, \\"\\", 0); // error: lookup \`length\` on Number +test.call(0, "", 0); // error: lookup \`length\` on Number // not enough arguments is an error -test.call(\\"\\", \\"\\"); // error: void ~> number +test.call("", ""); // error: void ~> number // mistyped arguments is an error -test.call(\\"\\", \\"\\", \\"\\"); // error: string ~> number (2nd arg) -test.call(\\"\\", 0, 0); // error: number ~> string (1st arg) +test.call("", "", ""); // error: string ~> number (2nd arg) +test.call("", 0, 0); // error: number ~> string (1st arg) // resolve args array from tvar -function f(args) { test.call(\\"\\", args[0], args[1]) } -f([\\"\\", 0]); // OK -f([\\"\\", \\"\\"]); // error: string ~> number (2nd arg) +function f(args) { test.call("", args[0], args[1]) } +f(["", 0]); // OK +f(["", ""]); // error: string ~> number (2nd arg) f([0, 0]); // error: number ~> string (1st arg) // expect 3 errors: @@ -200,7 +200,7 @@ f([0, 0]); // error: number ~> string (1st arg) // args are optional function test2(): number { return 0; } (test2.call(): number); -(test2.call(\\"\\"): number); +(test2.call(""): number); // callable objects function test3(x: { (a: string, b: string): void }) { @@ -211,53 +211,53 @@ function test3(x: { (a: string, b: string): void }) { // @flow function test(a: string, b: number): number { - return this.length; // expect []/\\"\\" this + return this.length; // expect []/"" this } // args flow correctly into params -test.call(\\"\\", \\"\\", 0); +test.call("", "", 0); // wrong this is an error -test.call(0, \\"\\", 0); // error: lookup \`length\` on Number +test.call(0, "", 0); // error: lookup \`length\` on Number // not enough arguments is an error -test.call(\\"\\", \\"\\"); // error: void ~> number +test.call("", ""); // error: void ~> number // mistyped arguments is an error -test.call(\\"\\", \\"\\", \\"\\"); // error: string ~> number (2nd arg) -test.call(\\"\\", 0, 0); // error: number ~> string (1st arg) +test.call("", "", ""); // error: string ~> number (2nd arg) +test.call("", 0, 0); // error: number ~> string (1st arg) // resolve args array from tvar function f(args) { - test.call(\\"\\", args[0], args[1]); + test.call("", args[0], args[1]); } -f([\\"\\", 0]); // OK -f([\\"\\", \\"\\"]); // error: string ~> number (2nd arg) +f(["", 0]); // OK +f(["", ""]); // error: string ~> number (2nd arg) f([0, 0]); // error: number ~> string (1st arg) // expect 3 errors: // - lookup length on Number (0 used as \`this\`) // - number !~> string (param a) // - string !~> number (param b) -(test.apply.call(test, 0, [0, \\"foo\\"]): number); +(test.apply.call(test, 0, [0, "foo"]): number); // args are optional function test2(): number { return 0; } (test2.call(): number); -(test2.call(\\"\\"): number); +(test2.call(""): number); // callable objects function test3(x: { (a: string, b: string): void }) { - x.call(x, \\"foo\\", \\"bar\\"); // ok - x.call(x, \\"foo\\", 123); // error, number !~> string + x.call(x, "foo", "bar"); // ok + x.call(x, "foo", 123); // error, number !~> string } -" + `; exports[`function.js 1`] = ` -"/** +/** * @flow */ @@ -344,13 +344,13 @@ var c: Function = C; function good(x: Function, MyThing: Function): number { var o: Object = x; // Function is an Object x.foo = 123; - x[\\"foo\\"] = 456; + x["foo"] = 456; x(); ; var { ...something } = x; - Object.assign(x, { hi: \\"there\\" }); + Object.assign(x, { hi: "there" }); Object.keys(x); - return x.bar + x[\\"bar\\"] + x.lala(); + return x.bar + x["bar"] + x.lala(); } function bad(x: Function, y: Object): void { @@ -373,9 +373,9 @@ let tests = [ function(y: () => void, z: Function) { function x() {} - x.length = \\"foo\\"; // error, it's a number - y.length = \\"foo\\"; // error, it's a number - z.length = \\"foo\\"; // error, it's a number + x.length = "foo"; // error, it's a number + y.length = "foo"; // error, it's a number + z.length = "foo"; // error, it's a number x.name = 123; // error, it's a string y.name = 123; // error, it's a string @@ -392,11 +392,11 @@ var d: Function = () => 1; var e = (d.bind(1): Function)(); (e: number); (e: string); -" + `; exports[`rest.js 1`] = ` -"/* regression tests */ +/* regression tests */ function rest_array(...xs: Array): T { // Ok, arrays can be rest params return xs[0]; @@ -528,11 +528,11 @@ function return_rest_param>( return args; // Error: Array ~> number }; } -" + `; exports[`rest_type.js 1`] = ` -"/* regression tests */ +/* regression tests */ type rest_array = (...xs: Array) => T; // Ok, arrays can be rest params @@ -583,7 +583,7 @@ function test_unbound_rest(f: (x: T, ...xs: T) => void) { type string_rest_t = (...xs: string) => void; // Should be error but no way to check yet :( function test_string_rest(f: string_rest_t) { - f(\\"hello\\"); // Error - string ~> array - luckily this errors + f("hello"); // Error - string ~> array - luckily this errors } type Rest = Array; @@ -595,5 +595,5 @@ type rest_intersection = (...xs: { x: number } & [1, 2]) => number; // OK type empty_rest = >(...xs: T) => T; // OK (f: empty_rest) => (f(): empty); // Error Array ~> empty -" + `; diff --git a/tests/flow/funrec/__snapshots__/jsfmt.spec.js.snap b/tests/flow/funrec/__snapshots__/jsfmt.spec.js.snap index 7838f34c..a34d683c 100644 --- a/tests/flow/funrec/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/funrec/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`funrec.js 1`] = ` -"function bar(x) { return x; } +function bar(x) { return x; } function foo() { return function bound() { return bar(bound); @@ -16,5 +16,5 @@ function foo() { return bar(bound); }; } -" + `; diff --git a/tests/flow/generators/__snapshots__/jsfmt.spec.js.snap b/tests/flow/generators/__snapshots__/jsfmt.spec.js.snap index dbac50ad..ba54a2a8 100644 --- a/tests/flow/generators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/generators/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`class.js 1`] = ` -"class GeneratorExamples { +class GeneratorExamples { *stmt_yield(): Generator { yield 0; // ok - yield \\"\\"; // error: string ~> number + yield ""; // error: string ~> number } *stmt_next(): Generator { @@ -24,18 +24,18 @@ exports[`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 } @@ -43,7 +43,7 @@ exports[`class.js 1`] = ` *widen_yield() { yield 0; - yield \\"\\"; + yield ""; yield true; } @@ -56,7 +56,7 @@ exports[`class.js 1`] = ` *delegate_yield_generator() { function *inner() { - yield \\"\\"; + yield ""; } yield *inner(); @@ -64,7 +64,7 @@ exports[`class.js 1`] = ` *delegate_return_generator() { function *inner() { - return \\"\\"; + return ""; } var x: number = yield *inner(); // error: string ~> number @@ -101,31 +101,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 @@ -134,7 +134,7 @@ for (var x of examples.delegate_yield_iterable([])) { class GeneratorExamples { *stmt_yield(): Generator { yield 0; // ok - yield \\"\\"; // error: string ~> number + yield ""; // error: string ~> number } *stmt_next(): Generator { @@ -154,18 +154,18 @@ class GeneratorExamples { } *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 } @@ -173,7 +173,7 @@ class GeneratorExamples { *widen_yield() { yield 0; - yield \\"\\"; + yield ""; yield true; } @@ -186,7 +186,7 @@ class GeneratorExamples { *delegate_yield_generator() { function* inner() { - yield \\"\\"; + yield ""; } yield* inner(); @@ -194,7 +194,7 @@ class GeneratorExamples { *delegate_return_generator() { function* inner() { - return \\"\\"; + return ""; } var x: number = yield* inner(); // error: string ~> number @@ -233,45 +233,45 @@ for (var x of examples.infer_stmt()) { } // 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 } -" + `; exports[`class_failure.js 1`] = ` -"// generalization of failure in class.js +// generalization of failure in class.js class GeneratorExamples { *infer_stmt() { var x: boolean = yield 0; // error: number ~> boolean - return \\"\\"; + return ""; } } @@ -281,8 +281,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 } @@ -292,7 +292,7 @@ if (typeof infer_stmt_next === \\"undefined\\") { class GeneratorExamples { *infer_stmt() { var x: boolean = yield 0; // error: number ~> boolean - return \\"\\"; + return ""; } } @@ -304,18 +304,18 @@ for (var x of examples.infer_stmt()) { 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 } -" + `; exports[`generators.js 1`] = ` -"function *stmt_yield(): Generator { +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(); @@ -445,7 +445,7 @@ if (multiple_return_result.done) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function* stmt_yield(): Generator { yield 0; // ok - yield \\"\\"; // error: string ~> number + yield ""; // error: string ~> number } function* stmt_next(): Generator { @@ -465,43 +465,43 @@ 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 } @@ -513,11 +513,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(); @@ -528,7 +528,7 @@ for (var x of delegate_yield_generator()) { function* delegate_return_generator() { function* inner() { - return \\"\\"; + return ""; } var x: number = yield* inner(); // error: string ~> number @@ -538,7 +538,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; @@ -567,18 +567,18 @@ function* multiple_return(b) { if (b) { return 0; } else { - return \\"foo\\"; + return "foo"; } } let multiple_return_result = multiple_return().next(); if (multiple_return_result.done) { (multiple_return_result.value: void); // error: number|string ~> void } -" + `; exports[`refi.js 1`] = ` -"function *a(x: {a: void | string}): Generator { +function *a(x: {a: void | string}): Generator { if (!x.a) return; (x.a: string); // ok yield; @@ -641,18 +641,18 @@ function* d(x: void | string): Generator { yield* gen; (x: string); // ok } -" + `; exports[`return.js 1`] = ` -"function test1(gen: Generator) { +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 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 { @@ -662,7 +662,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); // error: number | void ~> string } @@ -674,7 +674,7 @@ function test1(gen: Generator) { (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 { @@ -684,15 +684,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 } -" + `; exports[`throw.js 1`] = ` -"function *catch_return() { +function *catch_return() { try { yield 0; } catch (e) { @@ -700,7 +700,7 @@ exports[`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 } @@ -713,7 +713,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 } @@ -726,7 +726,7 @@ function* catch_return() { } } -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 } @@ -739,18 +739,18 @@ 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 } -" + `; exports[`variance.js 1`] = ` -"declare var g1: Generator; +declare var g1: Generator; var g2: Generator = g1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare var g1: Generator; var g2: Generator = g1; -" + `; diff --git a/tests/flow/generics/__snapshots__/jsfmt.spec.js.snap b/tests/flow/generics/__snapshots__/jsfmt.spec.js.snap index 15013648..c491c911 100644 --- a/tests/flow/generics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/generics/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`generics.js 1`] = ` -"class C { +class C { x:X; constructor(x:X) { this.x = x; } get():X { return this.x; } @@ -38,7 +38,7 @@ class H extends G> { } var h1 = new H(); -h1.foo([\\"...\\"]); +h1.foo(["..."]); var h2:F>>> = h1; var obj : Object = {} // error, arity 0 @@ -91,15 +91,15 @@ 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\\"; + return "foo"; }; // error, arity 0 var fn: function = function() { - return \\"foo\\"; + return "foo"; }; // error, arity 0 -" + `; diff --git a/tests/flow/geolocation/__snapshots__/jsfmt.spec.js.snap b/tests/flow/geolocation/__snapshots__/jsfmt.spec.js.snap index 9d535483..0773988e 100644 --- a/tests/flow/geolocation/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/geolocation/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"/* @flow */ +/* @flow */ var geolocation = new Geolocation(); var id = geolocation.watchPosition( @@ -42,5 +42,5 @@ var id = geolocation.watchPosition( } ); geolocation.clearWatch(id); -" + `; diff --git a/tests/flow/get-def/__snapshots__/jsfmt.spec.js.snap b/tests/flow/get-def/__snapshots__/jsfmt.spec.js.snap index dd91c811..08954a8c 100644 --- a/tests/flow/get-def/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/get-def/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`example.js 1`] = ` -"/* @flow */ +/* @flow */ var lib = require('./library'); @@ -19,7 +19,7 @@ lib.bar(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var lib = require(\\"./library\\"); +var lib = require("./library"); function add(a: number, b: number): number { return a + b; @@ -32,38 +32,38 @@ add(lib.iTakeAString(42), 7); // D123456 lib.bar(); -" + `; exports[`imports.js 1`] = ` -"// @flow +// @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; -" + `; exports[`library.js 1`] = ` -"/* @flow */ +/* @flow */ module.exports = { @@ -88,5 +88,5 @@ module.exports = { return 42; } }; -" + `; diff --git a/tests/flow/get-def/helpers/__snapshots__/jsfmt.spec.js.snap b/tests/flow/get-def/helpers/__snapshots__/jsfmt.spec.js.snap index 569ef7c4..b9b34561 100644 --- a/tests/flow/get-def/helpers/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/get-def/helpers/__snapshots__/jsfmt.spec.js.snap @@ -1,29 +1,29 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`exports_default.js 1`] = ` -"// @flow +// @flow -const x = \\"foo\\"; +const x = "foo"; export default x; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const x = \\"foo\\"; +const x = "foo"; export default x; -" + `; exports[`exports_named.js 1`] = ` -"// @flow +// @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/flow/get-def2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/get-def2/__snapshots__/jsfmt.spec.js.snap index ac43726a..5d7f604b 100644 --- a/tests/flow/get-def2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/get-def2/__snapshots__/jsfmt.spec.js.snap @@ -1,20 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Parent.js 1`] = ` -"// @flow +// @flow var ParentFoo = {foo: 'bar'}; module.exports = {ParentFoo}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var ParentFoo = { foo: \\"bar\\" }; +var ParentFoo = { foo: "bar" }; module.exports = { ParentFoo }; -" + `; exports[`main.js 1`] = ` -"// @flow +// @flow var Parent = require('./Parent'); @@ -23,7 +23,7 @@ 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 @@ -40,14 +40,14 @@ import type {Foo} from './types'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @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 @@ -57,15 +57,15 @@ 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; +let foo = require("./Parent").ParentFoo.foo; foo; -import type { Foo } from \\"./types\\"; -" +import type { Foo } from "./types"; + `; exports[`override.js 1`] = ` -"// @flow +// @flow class C { override() { } @@ -92,43 +92,43 @@ class D extends C { } override() {} } -" + `; exports[`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"; ;
; -" + `; exports[`types.js 1`] = ` -"// @flow +// @flow export type Foo = {}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export type Foo = {}; -" + `; diff --git a/tests/flow/get-def2/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/get-def2/lib/__snapshots__/jsfmt.spec.js.snap index 85d8aec2..9b3b1016 100644 --- a/tests/flow/get-def2/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/get-def2/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx.js 1`] = ` -"declare var $React: $Exports<'react'>; // fake import +declare var $React: $Exports<'react'>; // fake import type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { @@ -9,12 +9,12 @@ type $JSXIntrinsics = { span: $JSXIntrinsic<{id: string, class: string}>, }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare var $React: $Exports<\\"react\\">; // fake import +declare var $React: $Exports<"react">; // fake import type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { div: $JSXIntrinsic<{ id: string }>, span: $JSXIntrinsic<{ id: string, class: string }> }; -" + `; diff --git a/tests/flow/get-imports/__snapshots__/jsfmt.spec.js.snap b/tests/flow/get-imports/__snapshots__/jsfmt.spec.js.snap index 09af19f6..a8122538 100644 --- a/tests/flow/get-imports/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/get-imports/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"// @flow +// @flow ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -" + `; exports[`b.js 1`] = ` -"/** +/** * @flow * @providesModule b */ @@ -18,17 +18,17 @@ require('./a'); * @flow * @providesModule b */ -require(\\"./a\\"); -" +require("./a"); + `; exports[`c.js 1`] = ` -"// @flow +// @flow require('./a.js'); require('b'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -require(\\"./a.js\\"); -require(\\"b\\"); -" +require("./a.js"); +require("b"); + `; diff --git a/tests/flow/getters_and_setters_disabled/__snapshots__/jsfmt.spec.js.snap b/tests/flow/getters_and_setters_disabled/__snapshots__/jsfmt.spec.js.snap index 818009cb..727a9576 100644 --- a/tests/flow/getters_and_setters_disabled/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/getters_and_setters_disabled/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`getters_and_setters.js 1`] = ` -"/** +/** * @flow */ @@ -45,10 +45,10 @@ var f = { this.c = x; }, c: 10, - get [\\"d\\"]() { - return \\"foo\\"; + get ["d"]() { + return "foo"; }, - set [\\"d\\"](x: number) {} + set ["d"](x: number) {} }; type T = { @@ -71,10 +71,10 @@ class Bar { this.c = x; } c: number; - get [\\"d\\"]() { - return \\"foo\\"; + get ["d"]() { + return "foo"; } - set [\\"d\\"](x: number) {} + set ["d"](x: number) {} } -" + `; diff --git a/tests/flow/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap b/tests/flow/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap index b97038c2..05f4c3b1 100644 --- a/tests/flow/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`class.js 1`] = ` -"/** +/** * @flow */ @@ -29,7 +29,7 @@ class Foo { 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) { } @@ -52,8 +52,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 @@ -105,7 +105,7 @@ class Foo { propOverriddenWithGetter: number; get propOverriddenWithGetter() { - return \\"hello\\"; + return "hello"; } propOverriddenWithSetter: number; @@ -131,18 +131,18 @@ 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 var testPropOverridenWithGetter: number = foo.propOverriddenWithGetter; // Error string ~> number foo.propOverriddenWithSetter = 123; // Error number ~> string -" + `; exports[`declare_class.js 1`] = ` -"/** +/** * @flow */ @@ -183,7 +183,7 @@ var testGetterWithError2: string = foo.goodGetterWithAnnotation; // Error number // Test setting properties with getters foo.goodSetterWithAnnotation = 123; -foo.goodSetterWithAnnotation = \\"hello\\"; // Error string ~> number +foo.goodSetterWithAnnotation = "hello"; // Error string ~> number var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter; // Error ?number ~> number @@ -231,17 +231,17 @@ var testGetterWithError2: string = foo.goodGetterWithAnnotation; // Error number // Test setting properties with getters foo.goodSetterWithAnnotation = 123; -foo.goodSetterWithAnnotation = \\"hello\\"; // Error string ~> number +foo.goodSetterWithAnnotation = "hello"; // Error string ~> number var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter; // Error ?number ~> number var testPropOverridenWithGetter: number = foo.propOverriddenWithGetter; // Error string ~> number foo.propOverriddenWithSetter = 123; // Error number ~> string -" + `; exports[`object.js 1`] = ` -"/** +/** * @flow */ @@ -291,8 +291,8 @@ 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 @@ -373,8 +373,8 @@ 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 @@ -386,11 +386,11 @@ obj.exampleOfOrderOfGetterAndSetter = new C(); // Error C ~> B // And this example shows the danger of using the setter's type. var testExampleOrOrderOfGetterAndSetterReordered: number = obj.exampleOfOrderOfGetterAndSetterReordered; // Error A ~> B -" + `; exports[`object_type.js 1`] = ` -"/** +/** * @flow */ @@ -430,7 +430,7 @@ function test(obj: T) { // Test setting properties with getters obj.goodSetterWithAnnotation = 123; - obj.goodSetterWithAnnotation = \\"hello\\"; // Error string ~> number + obj.goodSetterWithAnnotation = "hello"; // Error string ~> number var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; // Error ?number ~> number @@ -479,7 +479,7 @@ function test(obj: T) { // Test setting properties with getters obj.goodSetterWithAnnotation = 123; - obj.goodSetterWithAnnotation = \\"hello\\"; // Error string ~> number + obj.goodSetterWithAnnotation = "hello"; // Error string ~> number var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; // Error ?number ~> number @@ -493,15 +493,15 @@ function test(obj: T) { var testExampleOrOrderOfGetterAndSetterReordered: number = obj.exampleOfOrderOfGetterAndSetterReordered; // Error A ~> B } -" + `; exports[`react.js 1`] = ` -"/** +/** * @flow */ -import React from \\"react\\"; +import React from "react"; const Example = React.createClass({ propTypes: { @@ -513,14 +513,14 @@ const Example = React.createClass({ (); // error: property \`a\` not found (); // ok -(); // error: number ~> string +(); // error: number ~> string (); // error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow */ -import React from \\"react\\"; +import React from "react"; const Example = React.createClass({ propTypes: { @@ -536,13 +536,13 @@ const Example = React.createClass({ ; // error: property \`a\` not found ; // ok -; // error: number ~> string +; // error: number ~> string ; // error: number ~> string -" + `; exports[`variance.js 1`] = ` -"/* @flow */ +/* @flow */ class A {} class B extends A {} @@ -699,5 +699,5 @@ class Base { // ok: read/write invariant with get/set getset: B; }); -" + `; diff --git a/tests/flow/haste_cycle/__snapshots__/jsfmt.spec.js.snap b/tests/flow/haste_cycle/__snapshots__/jsfmt.spec.js.snap index 48d61ff5..d3ebf2a5 100644 --- a/tests/flow/haste_cycle/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/haste_cycle/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`API.js 1`] = ` -"// @flow +// @flow var OpenGraphObject = require('./models/OpenGraphObject.js'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var OpenGraphObject = require(\\"./models/OpenGraphObject.js\\"); -" +var OpenGraphObject = require("./models/OpenGraphObject.js"); + `; diff --git a/tests/flow/haste_cycle/models/__snapshots__/jsfmt.spec.js.snap b/tests/flow/haste_cycle/models/__snapshots__/jsfmt.spec.js.snap index baff21cd..42e2782f 100644 --- a/tests/flow/haste_cycle/models/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/haste_cycle/models/__snapshots__/jsfmt.spec.js.snap @@ -1,34 +1,34 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`OpenGraphAction.js 1`] = ` -"// @flow +// @flow var OpenGraphValueContainer = require('./OpenGraphValueContainer.js'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var OpenGraphValueContainer = require(\\"./OpenGraphValueContainer.js\\"); -" +var OpenGraphValueContainer = require("./OpenGraphValueContainer.js"); + `; exports[`OpenGraphObject.js 1`] = ` -"// @flow +// @flow var OpenGraphValueContainer = require('./OpenGraphValueContainer.js'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var OpenGraphValueContainer = require(\\"./OpenGraphValueContainer.js\\"); -" +var OpenGraphValueContainer = require("./OpenGraphValueContainer.js"); + `; exports[`OpenGraphValueContainer.js 1`] = ` -"// @flow +// @flow var OpenGraphObject = require('./OpenGraphObject.js'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var OpenGraphObject = require(\\"./OpenGraphObject.js\\"); -" +var OpenGraphObject = require("./OpenGraphObject.js"); + `; diff --git a/tests/flow/haste_dupe/__snapshots__/jsfmt.spec.js.snap b/tests/flow/haste_dupe/__snapshots__/jsfmt.spec.js.snap index 56742bec..099c5465 100644 --- a/tests/flow/haste_dupe/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/haste_dupe/__snapshots__/jsfmt.spec.js.snap @@ -1,41 +1,41 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`dupe1.js 1`] = ` -"/** +/** * Dupe provider 1/2 * @providesModule Dupe * @flow */ -module.exports = \\"dupe1\\"; +module.exports = "dupe1"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 1/2 * @providesModule Dupe * @flow */ -module.exports = \\"dupe1\\"; -" +module.exports = "dupe1"; + `; exports[`dupe2.js 1`] = ` -"/** +/** * Dupe provider 2/2 * @providesModule Dupe * @flow */ -module.exports = \\"dupe2\\"; +module.exports = "dupe2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 2/2 * @providesModule Dupe * @flow */ -module.exports = \\"dupe2\\"; -" +module.exports = "dupe2"; + `; exports[`requires_dupe.js 1`] = ` -"/** +/** * depends on doubly-provided module * @flow */ @@ -45,6 +45,6 @@ var dupe = require('Dupe'); * depends on doubly-provided module * @flow */ -var dupe = require(\\"Dupe\\"); -" +var dupe = require("Dupe"); + `; diff --git a/tests/flow/haste_name_reducers_defaults/__snapshots__/jsfmt.spec.js.snap b/tests/flow/haste_name_reducers_defaults/__snapshots__/jsfmt.spec.js.snap index 1d225042..09f3cee9 100644 --- a/tests/flow/haste_name_reducers_defaults/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/haste_name_reducers_defaults/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Module1.js 1`] = ` -"/* @flow */ +/* @flow */ var test = require('test'); @@ -11,16 +11,16 @@ module.exports = test; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var test = require(\\"test\\"); +var test = require("test"); (test: boolean); module.exports = test; -" + `; exports[`index.js 1`] = ` -"/* @flow */ +/* @flow */ (require('Module1'): boolean); (require('Module2').foo(): boolean); @@ -28,8 +28,8 @@ require('Module3'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -(require(\\"Module1\\"): boolean); -(require(\\"Module2\\").foo(): boolean); -require(\\"Module3\\"); -" +(require("Module1"): boolean); +(require("Module2").foo(): boolean); +require("Module3"); + `; diff --git a/tests/flow/haste_use_name_reducers/__snapshots__/jsfmt.spec.js.snap b/tests/flow/haste_use_name_reducers/__snapshots__/jsfmt.spec.js.snap index 67c6f6ad..52873954 100644 --- a/tests/flow/haste_use_name_reducers/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/haste_use_name_reducers/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"/* @flow */ +/* @flow */ (require('Module1'): boolean); require('Module2'); @@ -10,9 +10,9 @@ require('Module4'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -(require(\\"Module1\\"): boolean); -require(\\"Module2\\"); -require(\\"Module3\\"); -require(\\"Module4\\"); -" +(require("Module1"): boolean); +require("Module2"); +require("Module3"); +require("Module4"); + `; diff --git a/tests/flow/haste_use_name_reducers/dir1/__snapshots__/jsfmt.spec.js.snap b/tests/flow/haste_use_name_reducers/dir1/__snapshots__/jsfmt.spec.js.snap index b97604cc..1f1db203 100644 --- a/tests/flow/haste_use_name_reducers/dir1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/haste_use_name_reducers/dir1/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Module1.js 1`] = ` -"/* @flow */ +/* @flow */ require('test'); @@ -11,10 +11,10 @@ module.exports = new Impl(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -require(\\"test\\"); +require("test"); class Impl {} module.exports = new Impl(); -" + `; diff --git a/tests/flow/haste_use_name_reducers/dir2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/haste_use_name_reducers/dir2/__snapshots__/jsfmt.spec.js.snap index 0641de1a..fb421145 100644 --- a/tests/flow/haste_use_name_reducers/dir2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/haste_use_name_reducers/dir2/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Module2.ios.js 1`] = ` -"/* @flow */ +/* @flow */ require('test2'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -require(\\"test2\\"); -" +require("test2"); + `; diff --git a/tests/flow/ignore_package/__snapshots__/jsfmt.spec.js.snap b/tests/flow/ignore_package/__snapshots__/jsfmt.spec.js.snap index 8db463bf..960ffd10 100644 --- a/tests/flow/ignore_package/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/ignore_package/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`foo.js 1`] = ` -"/** @flow */ +/** @flow */ /* this require routes to nothing, because our node_modules/underscore directory has been excluded. If package.json files @@ -23,12 +23,12 @@ module.exports = foo; are being excluded properly, we'll get 'Required module not found'. */ -var _ = require(\\"underscore\\"); +var _ = require("underscore"); function foo(): string { return _.foo(); } module.exports = foo; -" + `; diff --git a/tests/flow/immutable_methods/__snapshots__/jsfmt.spec.js.snap b/tests/flow/immutable_methods/__snapshots__/jsfmt.spec.js.snap index c2f793b9..b6afa2af 100644 --- a/tests/flow/immutable_methods/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/immutable_methods/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"class A { +class A { foo(): A { return this; } } class B extends A { @@ -26,5 +26,5 @@ var a: A = new B(); a.foo = function(): C { return new C(); }; -" + `; diff --git a/tests/flow/implements/__snapshots__/jsfmt.spec.js.snap b/tests/flow/implements/__snapshots__/jsfmt.spec.js.snap index ebd37df5..a2b2e32f 100644 --- a/tests/flow/implements/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/implements/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* @noflow */ +/* @noflow */ interface IFoo { foo: string } @@ -68,5 +68,5 @@ interface IPoly { x: T } class C8 implements IPoly { x: T; } -" + `; diff --git a/tests/flow/import_type/__snapshots__/jsfmt.spec.js.snap b/tests/flow/import_type/__snapshots__/jsfmt.spec.js.snap index a7e0adbe..fefc6967 100644 --- a/tests/flow/import_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/import_type/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ExportCJSDefault_Class.js 1`] = ` -"/** +/** * @flow */ @@ -28,11 +28,11 @@ class ClassFoo3 { } module.exports = ClassFoo3; -" + `; exports[`ExportCJSNamed_Class.js 1`] = ` -"/** +/** * @flow */ @@ -79,11 +79,11 @@ exports.ClassFoo4 = ClassFoo4; exports.ClassFoo5 = ClassFoo5; exports.foo4Inst = new ClassFoo4(); exports.foo5Inst = new ClassFoo5(); -" + `; exports[`ExportDefault_Class.js 1`] = ` -"/** +/** * @flow */ @@ -106,11 +106,11 @@ class ClassFoo1 { export default ClassFoo1; export var foo1Inst = new ClassFoo1(); -" + `; exports[`ExportNamed_Alias.js 1`] = ` -"/** +/** * @flow */ @@ -137,11 +137,11 @@ export function givesAFoo3Obj(): AliasFoo3 { } }; } -" + `; exports[`ExportNamed_Class.js 1`] = ` -"/** +/** * @flow */ @@ -164,22 +164,22 @@ class ClassFoo2 { export { ClassFoo2 }; export var foo2Inst = new ClassFoo2(); -" + `; exports[`ExportsANumber.js 1`] = ` -"/* @ flow */ +/* @ flow */ export var numValue = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @ flow */ export var numValue = 42; -" + `; exports[`import_type.js 1`] = ` -"/** +/** * @flow */ @@ -187,8 +187,8 @@ exports[`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 @@ -198,8 +198,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 @@ -209,8 +209,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 @@ -218,8 +218,8 @@ 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 @@ -231,8 +231,8 @@ 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 @@ -249,7 +249,7 @@ var e3: typeof AliasFoo3 = givesAFoo3Obj(); // Error: Can't typeof a type alias // == 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 == // @@ -257,7 +257,7 @@ import type {numValue} from \\"./ExportsANumber\\"; // Error: Cannot import-type // env contexts. // //////////////////////////////////////////////////////////////////////// -import type ClassFoo6 from \\"./issue-359\\"; +import type ClassFoo6 from "./issue-359"; function foo() { ClassFoo6; // Error: Not a value binding } @@ -270,8 +270,8 @@ function foo() { // == 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 @@ -281,8 +281,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 @@ -292,8 +292,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 @@ -301,8 +301,8 @@ 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 @@ -314,8 +314,8 @@ 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 @@ -332,7 +332,7 @@ var e3: typeof AliasFoo3 = givesAFoo3Obj(); // Error: Can't typeof a type alias // == 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 == // @@ -340,15 +340,15 @@ import type { numValue } from \\"./ExportsANumber\\"; // Error: Cannot import-ty // env contexts. // //////////////////////////////////////////////////////////////////////// -import type ClassFoo6 from \\"./issue-359\\"; +import type ClassFoo6 from "./issue-359"; function foo() { ClassFoo6; // Error: Not a value binding } -" + `; exports[`issue-359.js 1`] = ` -"/* @flow */ +/* @flow */ class ClassFoo6 {}; @@ -359,5 +359,5 @@ export default ClassFoo6; class ClassFoo6 {} export default ClassFoo6; -" + `; diff --git a/tests/flow/import_typeof/__snapshots__/jsfmt.spec.js.snap b/tests/flow/import_typeof/__snapshots__/jsfmt.spec.js.snap index 61939382..79e7c73c 100644 --- a/tests/flow/import_typeof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/import_typeof/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ExportCJSDefault_Class.js 1`] = ` -"/** +/** * @flow */ @@ -28,22 +28,22 @@ class ClassFoo3 { } module.exports = ClassFoo3; -" + `; exports[`ExportCJSDefault_Number.js 1`] = ` -"/* @flow */ +/* @flow */ module.exports = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ module.exports = 42; -" + `; exports[`ExportCJSNamed_Class.js 1`] = ` -"/** +/** * @flow */ @@ -58,22 +58,22 @@ exports.ClassFoo4 = ClassFoo4; class ClassFoo4 {} exports.ClassFoo4 = ClassFoo4; -" + `; exports[`ExportCJSNamed_Number.js 1`] = ` -"/* @flow */ +/* @flow */ exports.num = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ exports.num = 42; -" + `; exports[`ExportDefault_Class.js 1`] = ` -"/** +/** * @flow */ @@ -94,22 +94,22 @@ class ClassFoo1 { } export default ClassFoo1; -" + `; exports[`ExportDefault_Number.js 1`] = ` -"/* @flow */ +/* @flow */ export default 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ export default 42; -" + `; exports[`ExportNamed_Alias.js 1`] = ` -"/** +/** * @flow */ @@ -136,11 +136,11 @@ export function givesAFoo3Obj(): AliasFoo3 { } }; } -" + `; exports[`ExportNamed_Class.js 1`] = ` -"/** +/** * @flow */ @@ -161,11 +161,11 @@ class ClassFoo2 { } export { ClassFoo2 }; -" + `; exports[`ExportNamed_Multi.js 1`] = ` -"// @flow +// @flow export var num = 42; export var str = 'asdf'; @@ -173,23 +173,23 @@ export var str = 'asdf'; // @flow export var num = 42; -export var str = \\"asdf\\"; -" +export var str = "asdf"; + `; exports[`ExportNamed_Number.js 1`] = ` -"/* @flow */ +/* @flow */ export var num = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ export var num = 42; -" + `; exports[`import_typeof.js 1`] = ` -"/** +/** * @flow */ @@ -197,8 +197,8 @@ exports[`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) @@ -208,8 +208,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) @@ -219,8 +219,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) @@ -229,8 +229,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) @@ -239,7 +239,7 @@ 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) == // @@ -253,7 +253,7 @@ import typeof {AliasFoo3} from \\"./ExportNamed_Alias\\"; // Error: Can't \`impo // == 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 @@ -262,7 +262,7 @@ 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 @@ -271,7 +271,7 @@ 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 @@ -280,7 +280,7 @@ 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 @@ -289,7 +289,7 @@ var i2: num_cjs_named = 'asdf'; // Error: string ~> number // == Import Typeof ModuleNamespaceObject == // /////////////////////////////////////////////// -import typeof * as ModuleNSObjT from \\"./ExportNamed_Multi\\"; +import typeof * as ModuleNSObjT from "./ExportNamed_Multi"; var j1: ModuleNSObjT = {num: 42, str: 'asdf'}; var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -301,8 +301,8 @@ var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string // == 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) @@ -312,8 +312,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) @@ -323,8 +323,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) @@ -333,8 +333,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) @@ -343,7 +343,7 @@ 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) == // @@ -357,44 +357,44 @@ import typeof { AliasFoo3 } from \\"./ExportNamed_Alias\\"; // Error: Can't \`im // == 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 -" + `; diff --git a/tests/flow/include/foo/batman/__snapshots__/jsfmt.spec.js.snap b/tests/flow/include/foo/batman/__snapshots__/jsfmt.spec.js.snap index fe5ba8d4..68aa1cee 100644 --- a/tests/flow/include/foo/batman/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/include/foo/batman/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`baz.js 1`] = ` -"/* @flow */ +/* @flow */ -var x: number = \\"not a number\\" // Error string ~> number +var x: number = "not a number" // Error string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var x: number = \\"not a number\\"; // Error string ~> number -" +var x: number = "not a number"; // Error string ~> number + `; diff --git a/tests/flow/include/included/__snapshots__/jsfmt.spec.js.snap b/tests/flow/include/included/__snapshots__/jsfmt.spec.js.snap index 9fb80d25..65378d44 100644 --- a/tests/flow/include/included/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/include/included/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"(123: string); +(123: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (123: string); -" + `; diff --git a/tests/flow/incremental/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental/__snapshots__/jsfmt.spec.js.snap index 50ce651a..bf84b4f9 100644 --- a/tests/flow/incremental/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"/* @providesModule IncrModuleA */ +/* @providesModule IncrModuleA */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule IncrModuleA */ -" + `; exports[`b.js 1`] = ` -"/* @providesModule IncrModuleB +/* @providesModule IncrModuleB @flow */ @@ -18,17 +18,17 @@ var A = require('IncrModuleA'); @flow */ -var A = require(\\"IncrModuleA\\"); -" +var A = require("IncrModuleA"); + `; exports[`dup_a.js 1`] = ` -"/* @providesModule IncrModuleA */ +/* @providesModule IncrModuleA */ var x:string = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule IncrModuleA */ var x: string = 0; -" + `; diff --git a/tests/flow/incremental_basic/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_basic/__snapshots__/jsfmt.spec.js.snap index c1edbeb0..32e43edf 100644 --- a/tests/flow/incremental_basic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_basic/__snapshots__/jsfmt.spec.js.snap @@ -1,38 +1,38 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"// @flow +// @flow var a: string = 0; module.exports = a; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow var a: string = 0; module.exports = a; -" + `; exports[`b.js 1`] = ` -"// @flow +// @flow 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; -" + `; exports[`c.js 1`] = ` -"// @flow +// @flow 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/flow/incremental_basic/tmp1/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_basic/tmp1/__snapshots__/jsfmt.spec.js.snap index d3082e1c..d3dc1033 100644 --- a/tests/flow/incremental_basic/tmp1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_basic/tmp1/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`b.js 1`] = ` -"// @flow +// @flow 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/flow/incremental_basic/tmp2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_basic/tmp2/__snapshots__/jsfmt.spec.js.snap index 52eea8e2..e8d2d335 100644 --- a/tests/flow/incremental_basic/tmp2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_basic/tmp2/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"// @flow +// @flow var a = 0; module.exports = a; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow var a = 0; module.exports = a; -" + `; diff --git a/tests/flow/incremental_basic/tmp3/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_basic/tmp3/__snapshots__/jsfmt.spec.js.snap index 31fd5536..2f52241a 100644 --- a/tests/flow/incremental_basic/tmp3/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_basic/tmp3/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`b.js 1`] = ` -"// @flow +// @flow 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/flow/incremental_cycle/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_cycle/__snapshots__/jsfmt.spec.js.snap index bb21e631..e8627ce7 100644 --- a/tests/flow/incremental_cycle/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_cycle/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"// @flow +// @flow class A { b: number; @@ -18,11 +18,11 @@ class A { } module.exports = A; -" + `; exports[`B.js 1`] = ` -"// @flow +// @flow var A = require ('./A'); import type C from './C'; @@ -33,19 +33,19 @@ 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; } module.exports = B; -" + `; exports[`C.js 1`] = ` -"// @flow +// @flow var A = require ('./A'); import type B from './B'; @@ -56,13 +56,13 @@ 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; } module.exports = C; -" + `; diff --git a/tests/flow/incremental_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap index ece381c8..0909e4fc 100644 --- a/tests/flow/incremental_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap @@ -1,22 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`B.js 1`] = ` -"// @flow +// @flow 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[`C.js 1`] = ` -"// @flow +// @flow var A = require ('./A'); import type { B } from './B' @@ -27,13 +27,13 @@ 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; } module.exports = C; -" + `; diff --git a/tests/flow/incremental_cycle/tmp2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_cycle/tmp2/__snapshots__/jsfmt.spec.js.snap index b1877e53..677deb91 100644 --- a/tests/flow/incremental_cycle/tmp2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_cycle/tmp2/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`B.js 1`] = ` -"// @flow +// @flow var A = require ('./A'); //import type C from './C'; export type B = string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var A = require(\\"./A\\"); +var A = require("./A"); //import type C from './C'; export type B = string; -" + `; diff --git a/tests/flow/incremental_cycle/tmp3/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_cycle/tmp3/__snapshots__/jsfmt.spec.js.snap index c680a7be..3ab4c9c8 100644 --- a/tests/flow/incremental_cycle/tmp3/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_cycle/tmp3/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`B.js 1`] = ` -"// @flow +// @flow var A = require ('./A'); import type C from './C'; @@ -9,9 +9,9 @@ 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/flow/incremental_cycle_break/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_cycle_break/__snapshots__/jsfmt.spec.js.snap index 91f744e3..6eccd48f 100644 --- a/tests/flow/incremental_cycle_break/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_cycle_break/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/** +/** * @providesModule A * @flow */ @@ -13,12 +13,12 @@ require('B'); * @flow */ -require(\\"B\\"); -" +require("B"); + `; exports[`B.js 1`] = ` -"/** +/** * @providesModule B * @flow */ @@ -28,6 +28,6 @@ require('A'); * @providesModule B * @flow */ -require(\\"A\\"); -" +require("A"); + `; diff --git a/tests/flow/incremental_cycle_break/tmp1/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_cycle_break/tmp1/__snapshots__/jsfmt.spec.js.snap index 0d57f9ff..97a939c0 100644 --- a/tests/flow/incremental_cycle_break/tmp1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_cycle_break/tmp1/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + `; diff --git a/tests/flow/incremental_delete/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_delete/__snapshots__/jsfmt.spec.js.snap index b3735dc5..f946878f 100644 --- a/tests/flow/incremental_delete/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_delete/__snapshots__/jsfmt.spec.js.snap @@ -1,78 +1,78 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"// @flow +// @flow var a: string = 0; module.exports = a; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow var a: string = 0; module.exports = a; -" + `; exports[`b.js 1`] = ` -"// @flow +// @flow 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; -" + `; exports[`c.js 1`] = ` -"// @flow +// @flow 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; -" + `; exports[`dupe1.js 1`] = ` -"/** +/** * Dupe provider 1/2 * @providesModule Dupe * @flow */ -module.exports = \\"dupe1\\"; +module.exports = "dupe1"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 1/2 * @providesModule Dupe * @flow */ -module.exports = \\"dupe1\\"; -" +module.exports = "dupe1"; + `; exports[`dupe2.js 1`] = ` -"/** +/** * Dupe provider 2/2 * @providesModule Dupe * @flow */ -module.exports = \\"dupe2\\"; +module.exports = "dupe2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 2/2 * @providesModule Dupe * @flow */ -module.exports = \\"dupe2\\"; -" +module.exports = "dupe2"; + `; exports[`requires_dupe.js 1`] = ` -"/** +/** * depends on doubly-provided module * @flow */ @@ -82,12 +82,12 @@ var dupe = require('Dupe'); * depends on doubly-provided module * @flow */ -var dupe = require(\\"Dupe\\"); -" +var dupe = require("Dupe"); + `; exports[`requires_unchecked.js 1`] = ` -"/** +/** * depends on an unchecked module, which will be deleted * @flow */ @@ -97,21 +97,21 @@ var unchecked = require('Unchecked'); * depends on an unchecked module, which will be deleted * @flow */ -var unchecked = require(\\"Unchecked\\"); -" +var unchecked = require("Unchecked"); + `; exports[`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/flow/incremental_duplicate_delete/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_duplicate_delete/__snapshots__/jsfmt.spec.js.snap index e5d93d64..41946f4a 100644 --- a/tests/flow/incremental_duplicate_delete/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_duplicate_delete/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/** +/** * @providesModule A * @flow */ @@ -10,5 +10,5 @@ exports[`A.js 1`] = ` * @providesModule A * @flow */ -" + `; diff --git a/tests/flow/incremental_haste_blacklist/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_haste_blacklist/__snapshots__/jsfmt.spec.js.snap index 9ff1237b..d96f2af0 100644 --- a/tests/flow/incremental_haste_blacklist/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_haste_blacklist/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/* @flow */ +/* @flow */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -" + `; exports[`index.js 1`] = ` -"/* @flow */ +/* @flow */ require('A'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -require(\\"A\\"); -" +require("A"); + `; diff --git a/tests/flow/incremental_haste_name_reducers_duplicate/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_haste_name_reducers_duplicate/__snapshots__/jsfmt.spec.js.snap index 9ff1237b..d96f2af0 100644 --- a/tests/flow/incremental_haste_name_reducers_duplicate/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_haste_name_reducers_duplicate/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/* @flow */ +/* @flow */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -" + `; exports[`index.js 1`] = ` -"/* @flow */ +/* @flow */ require('A'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -require(\\"A\\"); -" +require("A"); + `; diff --git a/tests/flow/incremental_json/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_json/__snapshots__/jsfmt.spec.js.snap index c7c3ed93..13e6aa49 100644 --- a/tests/flow/incremental_json/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_json/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/** +/** * @flow */ var data = require('./data'); @@ -10,7 +10,7 @@ var x: number = data.x; /** * @flow */ -var data = require(\\"./data\\"); +var data = require("./data"); var x: number = data.x; -" + `; diff --git a/tests/flow/incremental_mixed_naming_cycle/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_mixed_naming_cycle/__snapshots__/jsfmt.spec.js.snap index cdd9179c..7b6183a8 100644 --- a/tests/flow/incremental_mixed_naming_cycle/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_mixed_naming_cycle/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"/** +/** * @providesModule A * @flow */ @@ -16,15 +16,15 @@ module.exports = 'A'; * @flow */ -(require(\\"./b\\"): void); -(require(\\"C\\"): void); +(require("./b"): void); +(require("C"): void); + +module.exports = "A"; -module.exports = \\"A\\"; -" `; exports[`b.js 1`] = ` -"/** +/** * @providesModule B * @flow */ @@ -39,15 +39,15 @@ module.exports = 'B'; * @flow */ -(require(\\"A\\"): void); -(require(\\"D\\"): void); +(require("A"): void); +(require("D"): void); + +module.exports = "B"; -module.exports = \\"B\\"; -" `; exports[`c.js 1`] = ` -"/** +/** * @providesModule C * @flow */ @@ -62,15 +62,15 @@ module.exports = 'C'; * @flow */ -require(\\"Root\\"); -(require(\\"./b\\"): void); +require("Root"); +(require("./b"): void); + +module.exports = "C"; -module.exports = \\"C\\"; -" `; exports[`d.js 1`] = ` -"/** +/** * @providesModule D * @flow */ @@ -84,14 +84,14 @@ module.exports = 'D'; * @flow */ -(require(\\"./b\\"): void); +(require("./b"): void); + +module.exports = "D"; -module.exports = \\"D\\"; -" `; exports[`root.js 1`] = ` -"/** +/** * @providesModule Root * @flow */ @@ -103,6 +103,6 @@ module.exports = 'Root'; * @flow */ -module.exports = \\"Root\\"; -" +module.exports = "Root"; + `; diff --git a/tests/flow/incremental_mixed_naming_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_mixed_naming_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap index ee3cd71b..d53fcac1 100644 --- a/tests/flow/incremental_mixed_naming_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_mixed_naming_cycle/tmp1/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`root.js 1`] = ` -"/** +/** * @providesModule Root * @flow */ @@ -15,6 +15,6 @@ module.exports = 'Root'; */ // trivial edit (adding this comment) -module.exports = \\"Root\\"; -" +module.exports = "Root"; + `; diff --git a/tests/flow/incremental_non_flow_move/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_non_flow_move/__snapshots__/jsfmt.spec.js.snap index 8509cf83..c6969bdd 100644 --- a/tests/flow/incremental_non_flow_move/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_non_flow_move/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`foo.js 1`] = ` -"/* +/* * @providesModule Foo */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* * @providesModule Foo */ -" + `; exports[`test.js 1`] = ` -"/** +/** * @flow */ @@ -22,6 +22,6 @@ require('Foo'); * @flow */ -require(\\"Foo\\"); -" +require("Foo"); + `; diff --git a/tests/flow/incremental_path/dir/__snapshots__/jsfmt.spec.js.snap b/tests/flow/incremental_path/dir/__snapshots__/jsfmt.spec.js.snap index 7ffab376..ad99aa84 100644 --- a/tests/flow/incremental_path/dir/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/incremental_path/dir/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"// @flow +// @flow (require('b'): boolean); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -(require(\\"b\\"): boolean); -" +(require("b"): boolean); + `; diff --git a/tests/flow/indexer/__snapshots__/jsfmt.spec.js.snap b/tests/flow/indexer/__snapshots__/jsfmt.spec.js.snap index f06969d1..94e3c621 100644 --- a/tests/flow/indexer/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/indexer/__snapshots__/jsfmt.spec.js.snap @@ -1,90 +1,90 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"// No indexer should be fine +// 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 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" }; } -" + `; exports[`multiple.js 1`] = ` -"// @flow +// @flow let tests = [ function() { @@ -105,5 +105,5 @@ let tests = [ }); } ]; -" + `; diff --git a/tests/flow/init/__snapshots__/jsfmt.spec.js.snap b/tests/flow/init/__snapshots__/jsfmt.spec.js.snap index a0252be5..6ee4ba3d 100644 --- a/tests/flow/init/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/init/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`hoisted.js 1`] = ` -"/** +/** * test initialization tracking in the presence of hoisting * @flow */ @@ -94,11 +94,11 @@ function _for_of(arr: Array) { } f(); // error, possibly undefined } -" + `; exports[`hoisted2.js 1`] = ` -"/** +/** * test initialization tracking for vars * note: for try/catch/finally, see tests/try/init.js * @flow @@ -635,11 +635,11 @@ function for_in_post_init() { } var y: number = x; // error } -" + `; exports[`let.js 1`] = ` -"/** +/** * test initialization tracking for lets * @flow */ @@ -927,7 +927,7 @@ function switch_post_init2(i): number { bar = 3; break; default: - throw new Error(\\"Invalid state\\"); + throw new Error("Invalid state"); } return bar; // ok, definitely initialized } @@ -940,7 +940,7 @@ function switch_post_init2(i): number { bar = 3; break; default: - throw new Error(\\"Invalid state\\"); + throw new Error("Invalid state"); } return bar; // ok, definitely initialized } @@ -958,14 +958,14 @@ function sub_closure_init_reference() { // TDZ (...even though this is weird...) var z = z; } -" + `; exports[`nullable-init.js 1`] = ` -"var o: {x: ?number} = { x: null }; +var o: {x: ?number} = { x: null }; var a: Array = [null,null]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var o: { x: ?number } = { x: null }; var a: Array = [null, null]; -" + `; diff --git a/tests/flow/instanceof/__snapshots__/jsfmt.spec.js.snap b/tests/flow/instanceof/__snapshots__/jsfmt.spec.js.snap index 766182e0..70abd4cd 100644 --- a/tests/flow/instanceof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/instanceof/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`instanceof.js 1`] = ` -"/* @flow */ +/* @flow */ // x instancof t class X1 { foo: number; }; @@ -60,7 +60,7 @@ class C { if (this instanceof D) alert(this.s); else - alert(\\"nope\\"); + alert("nope"); } } @@ -68,7 +68,7 @@ class D extends C { s: string; constructor() { super(); - this.s = \\"yup\\"; + this.s = "yup"; } } @@ -105,13 +105,13 @@ function x(b) { 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 @@ -128,13 +128,13 @@ function y(b) { 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 @@ -151,20 +151,20 @@ function z(b) { 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 class C { m() { if (this instanceof D) alert(this.s); - else alert(\\"nope\\"); + else alert("nope"); } } @@ -172,7 +172,7 @@ class D extends C { s: string; constructor() { super(); - this.s = \\"yup\\"; + this.s = "yup"; } } @@ -191,5 +191,5 @@ function foo1(x: Array | number) { x[0] = 123; // error } } -" + `; diff --git a/tests/flow/integration/__snapshots__/jsfmt.spec.js.snap b/tests/flow/integration/__snapshots__/jsfmt.spec.js.snap index ee83f3ef..1a0b075b 100644 --- a/tests/flow/integration/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/integration/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bar.js 1`] = ` -"// @flow +// @flow ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -" + `; exports[`foo.js 1`] = ` -"// @flow +// @flow require('./bar'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -require(\\"./bar\\"); -" +require("./bar"); + `; diff --git a/tests/flow/interface/__snapshots__/jsfmt.spec.js.snap b/tests/flow/interface/__snapshots__/jsfmt.spec.js.snap index 7b4dd49c..47a2beae 100644 --- a/tests/flow/interface/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/interface/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`import.js 1`] = ` -"interface I { x: number } +interface I { x: number } export type J = I; // workaround for export interface ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ interface I { x: number } export type J = I; // workaround for export interface -" + `; exports[`indexer.js 1`] = ` -"// @flow +// @flow interface Ok { [key: string]: string; @@ -31,11 +31,11 @@ interface Bad { [k1: string]: string, [k2: number]: number // error: not supported (yet) } -" + `; exports[`interface.js 1`] = ` -"declare class C { x: number; } +declare class C { x: number; } var x: string = new C().x; @@ -60,16 +60,16 @@ function testInterfaceName(o: I) { (o.name: string); // error, name is static (o.constructor.name: string); // ok } -" + `; exports[`test.js 1`] = ` -"interface I { y: string } +interface I { y: string } interface I_ { x: number } interface J extends I, I_ { } interface K extends J { } -var k: K = { x: \\"\\", y: \\"\\" }; // error: x should be number +var k: K = { x: "", y: "" }; // error: x should be number (k.x: string); // error: x is number (k.y: string); @@ -82,7 +82,7 @@ interface A_ { x: X } interface B extends A, A_ { z: Z } interface E extends B { } -var e: E = { x: \\"\\", y: \\"\\", z: \\"\\" }; // error: x and z should be numbers +var e: E = { x: "", y: "", z: "" }; // error: x and z should be numbers (e.x: string); // error: x is number (e.y: string); (e.z: string); // error: z is number @@ -92,7 +92,7 @@ interface I_ { x: number } interface J extends I, I_ {} interface K extends J {} -var k: K = { x: \\"\\", y: \\"\\" }; // error: x should be number +var k: K = { x: "", y: "" }; // error: x should be number (k.x: string); // error: x is number (k.y: string); @@ -105,15 +105,15 @@ interface A_ { x: X } interface B extends A, A_ { z: Z } interface E extends B {} -var e: E = { x: \\"\\", y: \\"\\", z: \\"\\" }; // error: x and z should be numbers +var e: E = { x: "", y: "", z: "" }; // error: x and z should be numbers (e.x: string); // error: x is number (e.y: string); (e.z: string); // error: z is number -" + `; exports[`test2.js 1`] = ` -"import type { J } from './import'; +import type { J } from './import'; interface K { } interface L extends J, K { y: string } @@ -124,7 +124,7 @@ type M = { y: string } & J & { z: boolean } function bar(m: M) { m.x; m.y; m.z; } // OK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import type { J } from \\"./import\\"; +import type { J } from "./import"; interface K {} interface L extends J, K { y: string } @@ -142,11 +142,11 @@ function bar(m: M) { m.y; m.z; } // OK -" + `; exports[`test3.js 1`] = ` -"interface I { x: number, y : string } +interface I { x: number, y : string } interface J { y : number } interface K extends I, J { x: string } // error: x is number in I function foo(k: K) { @@ -161,11 +161,11 @@ function foo(k: K) { (k.x: number); // error: x is string in K (k.y: number); // error: y is string in I } -" + `; exports[`test4.js 1`] = ` -"interface I { foo(x: number): void; } +interface I { foo(x: number): void; } (function foo(x: number) { }: I); // error, property \`foo\` not found function declare class C { @@ -184,5 +184,5 @@ declare class C { } new C().bar((x: string) => {}); // error, number ~/~> string -" + `; diff --git a/tests/flow/intersection/__snapshots__/jsfmt.spec.js.snap b/tests/flow/intersection/__snapshots__/jsfmt.spec.js.snap index 3c195370..aa5a9bba 100644 --- a/tests/flow/intersection/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/intersection/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`intersection.js 1`] = ` -"function foo(x: $All): number { +function foo(x: $All): number { return x.type; } @@ -16,11 +16,11 @@ function foo(x: $All): number { function bar(x: Error & { type: number }): number { return x.type; } -" + `; exports[`objassign.js 1`] = ` -"/** +/** * Test intersection of objects flowing to spread assignment. * * Definitions in lib/lib.js @@ -43,11 +43,11 @@ let y: ObjAssignT = { ...x }; // should be fine declare var x: ObjAssignT; let y: ObjAssignT = { ...x }; // should be fine -" + `; exports[`pred.js 1`] = ` -"/** +/** * Test interaction of object intersections and predicates. * Definitions in lib/lib.js * @@ -99,11 +99,11 @@ function hasObjectMode_ok(options: DuplexStreamOptions): boolean { options.readableObjectMode || options.writableObjectMode); } -" + `; exports[`test_fun.js 1`] = ` -"/** +/** * Tests for intersections of function types. * * Note: Flow abuses intersection types to model @@ -166,11 +166,11 @@ var fun2: FG = fun1; // simpler variation declare var f: ((_: number) => void) & ((_: string) => void); var g: (_: number | string) => void = f; -" + `; exports[`test_obj.js 1`] = ` -"/** +/** * Tests for intersections of object types * * @noflow @@ -229,5 +229,5 @@ var d: D = c; // ok // dict type mismatch type E = { [key: string]: string }; var e: E = c; // error -" + `; diff --git a/tests/flow/intersection/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/intersection/lib/__snapshots__/jsfmt.spec.js.snap index c00b6ad0..e33a460d 100644 --- a/tests/flow/intersection/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/intersection/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`lib.js 1`] = ` -"// @flow +// @flow // defs used in tests, here to stress tvar machinery @@ -70,5 +70,5 @@ type B = { a: string, b: string }; type C = { [key: string]: number } & { [key: string]: number }; type D = { [key: string]: number }; -" + `; diff --git a/tests/flow/issues-11/__snapshots__/jsfmt.spec.js.snap b/tests/flow/issues-11/__snapshots__/jsfmt.spec.js.snap index 71da3bf2..d2c29a40 100644 --- a/tests/flow/issues-11/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/issues-11/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`export.js 1`] = ` -"/* @flow */ +/* @flow */ exports.x = 1; -exports.y = \\"\\"; +exports.y = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ exports.x = 1; -exports.y = \\"\\"; -" +exports.y = ""; + `; exports[`import.js 1`] = ` -"/* @flow */ +/* @flow */ 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/flow/iter/__snapshots__/jsfmt.spec.js.snap b/tests/flow/iter/__snapshots__/jsfmt.spec.js.snap index bf18c14a..d1b352ee 100644 --- a/tests/flow/iter/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/iter/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`iter.js 1`] = ` -"var a = [true,false]; +var a = [true,false]; function foo(x) { } for (var i=0;i<3;i++) { @@ -76,5 +76,5 @@ 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\`. } -" + `; diff --git a/tests/flow/iterable/__snapshots__/jsfmt.spec.js.snap b/tests/flow/iterable/__snapshots__/jsfmt.spec.js.snap index 72056d24..a4c1f46b 100644 --- a/tests/flow/iterable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/iterable/__snapshots__/jsfmt.spec.js.snap @@ -1,28 +1,28 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`array.js 1`] = ` -"/* @flow */ +/* @flow */ (([1, 2]: Array): Iterable); -([1,2,\\"hi\\"]: Iterable); +([1,2,"hi"]: Iterable); ([1,2,3]: Iterable<*>); -([\\"hi\\"]: Iterable); // Error string ~> number -([\\"hi\\", 1]: Iterable); // Error number ~> string +(["hi"]: Iterable); // Error string ~> number +(["hi", 1]: Iterable); // Error number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ (([1, 2]: Array): Iterable); -([1, 2, \\"hi\\"]: Iterable); +([1, 2, "hi"]: Iterable); ([1, 2, 3]: Iterable<*>); -([\\"hi\\"]: Iterable); // Error string ~> number -([\\"hi\\", 1]: Iterable); // Error number ~> string -" +(["hi"]: Iterable); // Error string ~> number +(["hi", 1]: Iterable); // Error number ~> string + `; exports[`caching_bug.js 1`] = ` -"/* @flow */ +/* @flow */ /** * I've hit a bug with the caching in flow_js.ml. Avik is removing that caching @@ -35,7 +35,7 @@ exports[`caching_bug.js 1`] = ` * Array ~> Iterable * * We shouldn't hit the cache because the union types are different, but we do - * anyway. I've fixed this temporarily by bumping the \\"meaningful\\" param to + * anyway. I've fixed this temporarily by bumping the "meaningful" param to * Hashtbl.hash_param */ @@ -57,7 +57,7 @@ function miss_the_cache(x: Array): Iterable { return x; * Array ~> Iterable * * We shouldn't hit the cache because the union types are different, but we do - * anyway. I've fixed this temporarily by bumping the \\"meaningful\\" param to + * anyway. I've fixed this temporarily by bumping the "meaningful" param to * Hashtbl.hash_param */ @@ -69,11 +69,11 @@ function fill_the_cache(x: Array): Iterable { function miss_the_cache(x: Array): Iterable { return x; } -" + `; exports[`iter.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(strs: Iterable): void { for (var s: string of strs) { @@ -96,19 +96,19 @@ function foo(strs: Iterable): void { var m: Map = new Map(); foo(m.keys()); -" + `; exports[`iterator_result.js 1`] = ` -"/* @flow */ +/* @flow */ function makeIterator(coin_flip: () => boolean ): Iterator { return { - \\"@@iterator\\"() { return makeIterator(coin_flip); }, + "@@iterator"() { return makeIterator(coin_flip); }, next(): IteratorResult { var done = coin_flip(); if (!done) { - return { done, value: \\"still going...\\" }; + return { done, value: "still going..." }; } else { return { done }; } @@ -118,11 +118,11 @@ function makeIterator(coin_flip: () => boolean ): Iterator { function makeIterator(coin_flip: () => boolean ): Iterator { return { - \\"@@iterator\\"() { return makeIterator(coin_flip); }, + "@@iterator"() { return makeIterator(coin_flip); }, next(): IteratorResult { var done = coin_flip(); if (done) { // Whoops, made a mistake and forgot to negate done - return { done, value: \\"still going...\\" }; // Error string ~> void + return { done, value: "still going..." }; // Error string ~> void } else { return { done }; // Error void ~> string } @@ -134,13 +134,13 @@ function makeIterator(coin_flip: () => boolean ): Iterator { function makeIterator(coin_flip: () => boolean): Iterator { return { - \\"@@iterator\\"() { + "@@iterator"() { return makeIterator(coin_flip); }, next(): IteratorResult { var done = coin_flip(); if (!done) { - return { done, value: \\"still going...\\" }; + return { done, value: "still going..." }; } else { return { done }; } @@ -150,25 +150,25 @@ function makeIterator(coin_flip: () => boolean): Iterator { function makeIterator(coin_flip: () => boolean): Iterator { return { - \\"@@iterator\\"() { + "@@iterator"() { return makeIterator(coin_flip); }, next(): IteratorResult { var done = coin_flip(); if (done) { // Whoops, made a mistake and forgot to negate done - return { done, value: \\"still going...\\" }; // Error string ~> void + return { done, value: "still going..." }; // Error string ~> void } else { return { done }; // Error void ~> string } } }; } -" + `; exports[`map.js 1`] = ` -"/* @flow */ +/* @flow */ function mapTest1(map: Map): Iterable<[string, number]> { return map; @@ -199,11 +199,11 @@ function mapTest3(map: Map): Iterable<*> { function mapTest4(map: Map): Iterable { return map; } -" + `; exports[`set.js 1`] = ` -"/* @flow */ +/* @flow */ function setTest1(set: Set): Iterable { return set; @@ -234,26 +234,26 @@ function setTest3(set: Set): Iterable<*> { function setTest4(set: Set): Iterable { return set; } -" + `; exports[`string.js 1`] = ` -"/* @flow */ +/* @flow */ -(\\"hi\\": Iterable); -(\\"hi\\": Iterable<*>); -(\\"hi\\": Iterable); // Error - string is a Iterable +("hi": Iterable); +("hi": Iterable<*>); +("hi": Iterable); // Error - string is a Iterable ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -(\\"hi\\": Iterable); -(\\"hi\\": Iterable<*>); -(\\"hi\\": Iterable); // Error - string is a Iterable -" +("hi": Iterable); +("hi": Iterable<*>); +("hi": Iterable); // Error - string is a Iterable + `; exports[`variance.js 1`] = ` -"/* @flow */ +/* @flow */ (([]: Array): Iterable); // ok, Iterable<+T> @@ -264,5 +264,5 @@ exports[`variance.js 1`] = ` (([]: Array): Iterable); // ok, Iterable<+T> (([]: Array).values(): Iterable); // ok, Iterator<+T> -" + `; diff --git a/tests/flow/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap b/tests/flow/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap index 207637c5..d8d03723 100644 --- a/tests/flow/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`main.js 1`] = ` -"// @flow +// @flow var React = require('react'); @@ -11,21 +11,21 @@ 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 =
; +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 -var React = require(\\"react\\"); +var React = require("react"); class CustomComponent extends React.Component { props: { @@ -33,24 +33,24 @@ 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 =
; +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 }> = ( -
+
); -" + `; exports[`strings.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); @@ -71,21 +71,21 @@ React.createElement('bad', {}); // This is fine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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 -" + `; diff --git a/tests/flow/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap b/tests/flow/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap index 4e1abc7c..057817db 100644 --- a/tests/flow/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`main.js 1`] = ` -"// @flow +// @flow var React = require('react'); @@ -11,17 +11,17 @@ 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 -var React = require(\\"react\\"); +var React = require("react"); class CustomComponent extends React.Component { props: { @@ -29,18 +29,18 @@ 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}> + `; exports[`strings.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); @@ -61,21 +61,21 @@ React.createElement(Str, {}); // Error: string ~> keys of JSXIntrinsics ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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: 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
; // Not an error but should be eventually -" + `; diff --git a/tests/flow/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap index 85d8aec2..9b3b1016 100644 --- a/tests/flow/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx.js 1`] = ` -"declare var $React: $Exports<'react'>; // fake import +declare var $React: $Exports<'react'>; // fake import type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { @@ -9,12 +9,12 @@ type $JSXIntrinsics = { span: $JSXIntrinsic<{id: string, class: string}>, }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare var $React: $Exports<\\"react\\">; // fake import +declare var $React: $Exports<"react">; // fake import type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { div: $JSXIntrinsic<{ id: string }>, span: $JSXIntrinsic<{ id: string, class: string }> }; -" + `; diff --git a/tests/flow/keys/__snapshots__/jsfmt.spec.js.snap b/tests/flow/keys/__snapshots__/jsfmt.spec.js.snap index aab3f39f..3d29e70d 100644 --- a/tests/flow/keys/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/keys/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`keys.js 1`] = ` -"/* @flow */ +/* @flow */ function testKeysOfObject(str: string, lit: 'hi') { (str: $Keys); // Any string should be fine @@ -49,48 +49,48 @@ function testKeysOfOtherObj(str: string, lit: 'hi') { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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 } -" + `; diff --git a/tests/flow/keyvalue/__snapshots__/jsfmt.spec.js.snap b/tests/flow/keyvalue/__snapshots__/jsfmt.spec.js.snap index 0d9ab028..f593bd52 100644 --- a/tests/flow/keyvalue/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/keyvalue/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`keyvalue.js 1`] = ` -"// @flow +// @flow let tests = [ function(x: { [key: number]: string }) { - (x[\\"\\"]: number); + (x[""]: number); } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -13,8 +13,8 @@ let tests = [ let tests = [ function(x: { [key: number]: string }) { - (x[\\"\\"]: number); + (x[""]: number); } ]; -" + `; diff --git a/tests/flow/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap b/tests/flow/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap index 59b6c9de..c0abab5e 100644 --- a/tests/flow/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @flow // Classes 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 @@ -27,13 +27,13 @@ class C { 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 @@ -52,7 +52,7 @@ class C { return 0; } foo(): string { - return \\"hello\\"; + return "hello"; } // last wins x: number; x: string; // last wins @@ -62,7 +62,7 @@ class C { bar: string; // field wins over method qux: number; qux(): string { - return \\"hello\\"; + return "hello"; } // method loses to field! } @@ -80,17 +80,17 @@ const o = { return 0; }, foo(): string { - return \\"hello\\"; + 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\\"; + return "hello"; } // last wins }; @@ -100,5 +100,5 @@ const o = { (o.x: boolean); // last wins (o.bar: boolean); // last wins (o.qux(): boolean); // last wins -" + `; diff --git a/tests/flow/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/lib/__snapshots__/jsfmt.spec.js.snap index 5ffc4ea5..52d04101 100644 --- a/tests/flow/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`libtest.js 1`] = ` -"var x:string = NaN +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'); @@ -16,13 +16,13 @@ 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/flow/lib_interfaces/declarations/__snapshots__/jsfmt.spec.js.snap b/tests/flow/lib_interfaces/declarations/__snapshots__/jsfmt.spec.js.snap index 1fe2466c..2cb45d77 100644 --- a/tests/flow/lib_interfaces/declarations/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/lib_interfaces/declarations/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`underscore.js 1`] = ` -"interface C { +interface C { foo(): CArrays; bar(): C; } @@ -16,5 +16,5 @@ interface C { interface CArrays extends C> { bar(): C } -" + `; diff --git a/tests/flow/libconfig/__snapshots__/jsfmt.spec.js.snap b/tests/flow/libconfig/__snapshots__/jsfmt.spec.js.snap index fdaf23df..9a23fa01 100644 --- a/tests/flow/libconfig/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/libconfig/__snapshots__/jsfmt.spec.js.snap @@ -1,24 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`libA.js 1`] = ` -"declare function foo(x: number): void; +declare function foo(x: number): void; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare function foo(x: number): void; -" + `; exports[`libB.js 1`] = ` -"declare function bar(x: string): void; +declare function bar(x: string): void; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare function bar(x: string): void; -" + `; exports[`libtest.js 1`] = ` -"foo(123); +foo(123); bar(123); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foo(123); bar(123); -" + `; diff --git a/tests/flow/libdef_ignored_module/__snapshots__/jsfmt.spec.js.snap b/tests/flow/libdef_ignored_module/__snapshots__/jsfmt.spec.js.snap index baa4e444..0e5a9b05 100644 --- a/tests/flow/libdef_ignored_module/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/libdef_ignored_module/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/* @flow */ +/* @flow */ -import foo from \\"foo\\"; +import foo from "foo"; (foo.bar : string); // error number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import foo from \\"foo\\"; +import foo from "foo"; (foo.bar: string); // error number ~> string -" + `; diff --git a/tests/flow/libdef_ignored_module/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/libdef_ignored_module/lib/__snapshots__/jsfmt.spec.js.snap index 81b463e9..dbf52a96 100644 --- a/tests/flow/libdef_ignored_module/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/libdef_ignored_module/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`foo.js 1`] = ` -"declare module foo { +declare module foo { declare var bar: number; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare module foo { declare var bar: number; } -" + `; diff --git a/tests/flow/liberr/__snapshots__/jsfmt.spec.js.snap b/tests/flow/liberr/__snapshots__/jsfmt.spec.js.snap index 5fe7539b..f1770ad0 100644 --- a/tests/flow/liberr/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/liberr/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"/** +/** * @flow */ // one error here, to verify lib errors sort to top. @@ -12,5 +12,5 @@ var x: string = 0; */ // one error here, to verify lib errors sort to top. var x: string = 0; -" + `; diff --git a/tests/flow/liberr/libs/__snapshots__/jsfmt.spec.js.snap b/tests/flow/liberr/libs/__snapshots__/jsfmt.spec.js.snap index 6f2a1e81..8b034fb5 100644 --- a/tests/flow/liberr/libs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/liberr/libs/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`type_error.js 1`] = ` -"// @flow +// @flow declare function foo(x: number): Array; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow declare function foo(x: number): Array; -" + `; diff --git a/tests/flow/libflow-typed/__snapshots__/jsfmt.spec.js.snap b/tests/flow/libflow-typed/__snapshots__/jsfmt.spec.js.snap index 2a046619..2b675602 100644 --- a/tests/flow/libflow-typed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/libflow-typed/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`libtest.js 1`] = ` -"/* @flow */ -const dino : Dinosaur = \\"Stegosaurus\\" +/* @flow */ +const dino : Dinosaur = "Stegosaurus" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -const dino: Dinosaur = \\"Stegosaurus\\"; -" +const dino: Dinosaur = "Stegosaurus"; + `; diff --git a/tests/flow/libflow-typed/flow-typed/__snapshots__/jsfmt.spec.js.snap b/tests/flow/libflow-typed/flow-typed/__snapshots__/jsfmt.spec.js.snap index 8b35367c..0dd98966 100644 --- a/tests/flow/libflow-typed/flow-typed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/libflow-typed/flow-typed/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`dino.js 1`] = ` -"declare type Dinosaur = \\"T-Rex\\" | \\"Apatosaurus\\"; +declare type Dinosaur = "T-Rex" | "Apatosaurus"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare type Dinosaur = \\"T-Rex\\" | \\"Apatosaurus\\"; -" +declare type Dinosaur = "T-Rex" | "Apatosaurus"; + `; diff --git a/tests/flow/librec/__snapshots__/jsfmt.spec.js.snap b/tests/flow/librec/__snapshots__/jsfmt.spec.js.snap index 9cd2cfe6..54871767 100644 --- a/tests/flow/librec/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/librec/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`libtest.js 1`] = ` -"foo(123); +foo(123); bar(123); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foo(123); bar(123); -" + `; diff --git a/tests/flow/librec/lib/A/__snapshots__/jsfmt.spec.js.snap b/tests/flow/librec/lib/A/__snapshots__/jsfmt.spec.js.snap index cf36e574..46f5ee52 100644 --- a/tests/flow/librec/lib/A/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/librec/lib/A/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`libA.js 1`] = ` -"declare function foo(x: number): void; +declare function foo(x: number): void; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare function foo(x: number): void; -" + `; diff --git a/tests/flow/librec/lib/B/__snapshots__/jsfmt.spec.js.snap b/tests/flow/librec/lib/B/__snapshots__/jsfmt.spec.js.snap index 0f8dde27..2d7aa79e 100644 --- a/tests/flow/librec/lib/B/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/librec/lib/B/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`libB.js 1`] = ` -"declare function bar(x: string): void; +declare function bar(x: string): void; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare function bar(x: string): void; -" + `; diff --git a/tests/flow/literal/__snapshots__/jsfmt.spec.js.snap b/tests/flow/literal/__snapshots__/jsfmt.spec.js.snap index 49b27455..53eace91 100644 --- a/tests/flow/literal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/literal/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`enum.js 1`] = ` -"var APIKeys = { +var APIKeys = { AGE: 'age', NAME: 'name', }; @@ -9,63 +9,63 @@ exports[`enum.js 1`] = ` module.exports = APIKeys; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var APIKeys = { - AGE: \\"age\\", - NAME: \\"name\\" + AGE: "age", + NAME: "name" }; module.exports = APIKeys; -" + `; exports[`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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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 -" + `; exports[`number.js 1`] = ` -"function test1(x: number): number { +function test1(x: number): number { return -x; } @@ -112,5 +112,5 @@ function test4(flip_times: number): number { } return x; } -" + `; diff --git a/tests/flow/locals/__snapshots__/jsfmt.spec.js.snap b/tests/flow/locals/__snapshots__/jsfmt.spec.js.snap index 7bcf8281..1ed8602b 100644 --- a/tests/flow/locals/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/locals/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`lex.js 1`] = ` -"function switch_scope(x: mixed) { - let a = \\"\\"; - let b = \\"\\"; +function switch_scope(x: mixed) { + let a = ""; + let b = ""; switch (x) { - case \\"foo\\": + case "foo": let a; a = 0; // doesn't add lower bound to outer a b = 0; @@ -18,8 +18,8 @@ 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 @@ -30,8 +30,8 @@ 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 b = 0; @@ -44,16 +44,16 @@ 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 b = 0; @@ -63,10 +63,10 @@ function for_of_scope(xs: number[]) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 b = 0; @@ -79,8 +79,8 @@ 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 @@ -91,8 +91,8 @@ 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 b = 0; @@ -105,16 +105,16 @@ 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 b = 0; @@ -122,11 +122,11 @@ function for_of_scope(xs: number[]) { (a: string); (b: string); // error: number ~> string } -" + `; exports[`locals.js 1`] = ` -"var x:string = 0; +var x:string = 0; var x:number = 1; //declare var T: $Type>; @@ -145,7 +145,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; } @@ -169,9 +169,9 @@ function sorry(really: boolean) { function foo0(b: boolean): number { var x = 0; if (b) { - var x = \\"\\"; // error: string ~> number + var x = ""; // error: string ~> number } return x; } -" + `; diff --git a/tests/flow/logical/__snapshots__/jsfmt.spec.js.snap b/tests/flow/logical/__snapshots__/jsfmt.spec.js.snap index 99ee49a6..ec7654fb 100644 --- a/tests/flow/logical/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/logical/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`logical.js 1`] = ` -"/* @flow */ +/* @flow */ /** * A falsy variable on the left side of && @@ -37,7 +37,7 @@ function logical2b(): number { * A literal on the left side of && */ function logical2c(): string { - return \\"\\" && 123; + return "" && 123; } /** @@ -169,7 +169,7 @@ function logical6b(): string { * A literal on the left side of || */ function logical6c(): number { - return \\"\\" || 123; + return "" || 123; } /** @@ -381,14 +381,14 @@ function logical12b(y: number): number { */ function logical13(x: number): Array<{x: string}> { return [ - {x: x && \\"bar\\"}, - {x: true && \\"bar\\"}, + {x: x && "bar"}, + {x: true && "bar"}, {x: true && false}, {x: false && false}, - {x: 1 && \\"bar\\"}, - {x: \\"foo\\" && \\"bar\\"}, - {x: \\"foo\\" && \\"bar\\"}, - {x: \\"foo\\" && \\"bar\\"}, + {x: 1 && "bar"}, + {x: "foo" && "bar"}, + {x: "foo" && "bar"}, + {x: "foo" && "bar"}, ]; } @@ -397,14 +397,14 @@ function logical13(x: number): Array<{x: string}> { */ function logical14(x: number): Array<{x: string}> { return [ - {x: x || \\"bar\\"}, - {x: false || \\"bar\\"}, + {x: x || "bar"}, + {x: false || "bar"}, {x: false || true}, {x: true || false}, - {x: 0 || \\"bar\\"}, - {x: \\"foo\\" || \\"bar\\"}, - {x: \\"foo\\" || \\"bar\\"}, - {x: \\"foo\\" || \\"bar\\"}, + {x: 0 || "bar"}, + {x: "foo" || "bar"}, + {x: "foo" || "bar"}, + {x: "foo" || "bar"}, ]; } @@ -524,7 +524,7 @@ function logical19b(x: { y: string, z: boolean }): boolean { function logical1a(): number { // expected \`: boolean\` var x = false; - return x && \\"123\\"; + return x && "123"; } /** @@ -532,7 +532,7 @@ function logical1a(): number { */ function logical1b(): string { var x = true; - return x && \\"123\\"; + return x && "123"; } /** @@ -540,77 +540,77 @@ function logical1b(): string { */ function logical2a(): number { // expected \`: boolean\` - return false && \\"123\\"; + return false && "123"; } /** * A literal on the left side of && */ function logical2b(): number { - return 0 && \\"123\\"; + return 0 && "123"; } /** * A literal on the left side of && */ function logical2c(): string { - return \\"\\" && 123; + return "" && 123; } /** * A literal on the left side of && */ function logical2d(): string { - return true && \\"123\\"; + return true && "123"; } /** * A literal on the left side of && */ function logical2e(): number { - return \\"foo\\" && 123; + return "foo" && 123; } /** * A literal on the left side of && */ function logical2f(): string { - return 123 && \\"foo\\"; + return 123 && "foo"; } /** * A literal on the left side of && */ function logical2g(): string { - return [1, 2, 3] && \\"foo\\"; + return [1, 2, 3] && "foo"; } /** * A literal on the left side of && */ function logical2h(x: { a: number }): string { - return x && \\"foo\\"; + return x && "foo"; } /** * A literal on the left side of && */ function logical2i(x: Object): string { - return x && \\"foo\\"; + return x && "foo"; } /** * A literal on the left side of && */ function logical2j(x: (a: number) => number): string { - return x && \\"foo\\"; + return x && "foo"; } /** * A literal on the left side of && */ function logical2k(x: Function): string { - return x && \\"foo\\"; + return x && "foo"; } /** @@ -645,7 +645,7 @@ function logical3c(): ?number { */ function logical4(x: boolean): string { // expected \`: boolean | string\` - return x && \\"123\\"; + return x && "123"; } /** @@ -677,21 +677,21 @@ function logical5c(): string { * A literal on the left side of || */ function logical6a(): string { - return false || \\"123\\"; + return false || "123"; } /** * A literal on the left side of || */ function logical6b(): string { - return 0 || \\"123\\"; + return 0 || "123"; } /** * A literal on the left side of || */ function logical6c(): number { - return \\"\\" || 123; + return "" || 123; } /** @@ -699,21 +699,21 @@ function logical6c(): number { */ function logical6d(): number { // expected \`: boolean\` - return true || \\"123\\"; + return true || "123"; } /** * A literal on the left side of || */ function logical6e(): string { - return \\"foo\\" || 123; + return "foo" || 123; } /** * A literal on the left side of || */ function logical6f(): number { - return 123 || \\"foo\\"; + return 123 || "foo"; } /** @@ -742,14 +742,14 @@ function logical7c(x: string): number { * A composite && and || */ function logical7d(x: number): string { - return (x && \\"foo\\") || \\"bar\\"; + return (x && "foo") || "bar"; } /** * A composite && and || */ function logical7e(x: number): string { - return (false && x) || \\"bar\\"; + return (false && x) || "bar"; } /** @@ -760,7 +760,7 @@ function logical7e(x: number): string { */ function logical8a(): number { var x = false; - return (x || 0) && \\"foo\\"; + return (x || 0) && "foo"; } /** @@ -770,7 +770,7 @@ function logical8a(): number { */ function logical8b(): string { var x = false; - return (x || 1) && \\"foo\\"; + return (x || 1) && "foo"; } /** @@ -780,7 +780,7 @@ function logical8b(): string { */ function logical8c(): string { var x = true; - return (x || 1) && \\"foo\\"; + return (x || 1) && "foo"; } /** @@ -788,7 +788,7 @@ function logical8c(): string { */ function logical8d(): number { var x = false; - return x || (0 && \\"foo\\"); + return x || (0 && "foo"); } /** @@ -796,7 +796,7 @@ function logical8d(): number { */ function logical8e(): string { var x = false; - return x || (1 && \\"foo\\"); + return x || (1 && "foo"); } /** @@ -805,7 +805,7 @@ function logical8e(): string { function logical8f(): string { // expected \`: boolean\` var x = true; - return x || (1 && \\"foo\\"); + return x || (1 && "foo"); } /** @@ -827,7 +827,7 @@ function logical9b(x: number, y: string): number | string { * A composite || and || */ function logical9c(x: number, y: boolean): string { - return \\"a\\" || x || y; + return "a" || x || y; } /** @@ -903,14 +903,14 @@ function logical12b(y: number): number { */ function logical13(x: number): Array<{ x: string }> { return [ - { x: x && \\"bar\\" }, - { x: true && \\"bar\\" }, + { x: x && "bar" }, + { x: true && "bar" }, { x: true && false }, { x: false && false }, - { x: 1 && \\"bar\\" }, - { x: \\"foo\\" && \\"bar\\" }, - { x: \\"foo\\" && \\"bar\\" }, - { x: \\"foo\\" && \\"bar\\" } + { x: 1 && "bar" }, + { x: "foo" && "bar" }, + { x: "foo" && "bar" }, + { x: "foo" && "bar" } ]; } @@ -919,14 +919,14 @@ function logical13(x: number): Array<{ x: string }> { */ function logical14(x: number): Array<{ x: string }> { return [ - { x: x || \\"bar\\" }, - { x: false || \\"bar\\" }, + { x: x || "bar" }, + { x: false || "bar" }, { x: false || true }, { x: true || false }, - { x: 0 || \\"bar\\" }, - { x: \\"foo\\" || \\"bar\\" }, - { x: \\"foo\\" || \\"bar\\" }, - { x: \\"foo\\" || \\"bar\\" } + { x: 0 || "bar" }, + { x: "foo" || "bar" }, + { x: "foo" || "bar" }, + { x: "foo" || "bar" } ]; } @@ -1037,5 +1037,5 @@ function logical19a(x: { y: string, z: boolean }): boolean { function logical19b(x: { y: string, z: boolean }): boolean { return x.y || x.z; // error: x.y is a string } -" + `; diff --git a/tests/flow/loners/__snapshots__/jsfmt.spec.js.snap b/tests/flow/loners/__snapshots__/jsfmt.spec.js.snap index fee0dc6b..7addc080 100644 --- a/tests/flow/loners/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/loners/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`loners.js 1`] = ` -"var o = { x: 5, y: \\"jello\\" }; +var o = { x: 5, y: "jello" }; var z = o.z; var export_o: { x: number; } = o; @@ -11,7 +11,7 @@ var export_f: (u: number) => number = f; //exports = export_o; module.exports = export_f; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var o = { x: 5, y: \\"jello\\" }; +var o = { x: 5, y: "jello" }; var z = o.z; var export_o: { x: number } = o; @@ -22,5 +22,5 @@ var export_f: (u: number) => number = f; //exports = export_o; module.exports = export_f; -" + `; diff --git a/tests/flow/match_failure/__snapshots__/jsfmt.spec.js.snap b/tests/flow/match_failure/__snapshots__/jsfmt.spec.js.snap index aaa2dfa0..4cdbcdb8 100644 --- a/tests/flow/match_failure/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/match_failure/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`disjoint_union.js 1`] = ` -"/* @flow */ +/* @flow */ type Shape = {type: 'rectangle', width: number, height: number} | @@ -13,29 +13,29 @@ function area(shape: Shape): number { } else if (shape.type === 'circle') { return Math.PI * Math.pow(shape.radius, 2); } - throw \\"unreachable\\"; // TODO: this shouldn't be needed + throw "unreachable"; // TODO: this shouldn't be needed } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ type Shape = - | { type: \\"rectangle\\", width: number, height: number } - | { type: \\"circle\\", radius: number }; + | { type: "rectangle", width: number, height: number } + | { type: "circle", radius: number }; function area(shape: Shape): number { - if (shape.type === \\"square\\") { + if (shape.type === "square") { // TODO: this should be an error return shape.width * shape.height; - } else if (shape.type === \\"circle\\") { + } else if (shape.type === "circle") { return Math.PI * Math.pow(shape.radius, 2); } - throw \\"unreachable\\"; // TODO: this shouldn't be needed + throw "unreachable"; // TODO: this shouldn't be needed } -" + `; exports[`enum.js 1`] = ` -"// @flow +// @flow type Binary = 0 | 1; @@ -45,7 +45,7 @@ function stringifyBinary(binary: Binary): string { } else if (binary === 2) { // oops return 'one'; } - throw \\"unreachable\\"; // TODO: this shouldn't be needed + throw "unreachable"; // TODO: this shouldn't be needed } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow @@ -54,12 +54,12 @@ type Binary = 0 | 1; function stringifyBinary(binary: Binary): string { if (binary === 0) { - return \\"zero\\"; + return "zero"; } else if (binary === 2) { // oops - return \\"one\\"; + return "one"; } - throw \\"unreachable\\"; // TODO: this shouldn't be needed + throw "unreachable"; // TODO: this shouldn't be needed } -" + `; diff --git a/tests/flow/method_properties/__snapshots__/jsfmt.spec.js.snap b/tests/flow/method_properties/__snapshots__/jsfmt.spec.js.snap index 3aab06e4..3f0b0557 100644 --- a/tests/flow/method_properties/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/method_properties/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`exports_optional_prop.js 1`] = ` -"// @flow +// @flow declare class Foo { bar?: () => string @@ -16,11 +16,11 @@ declare class Foo { } export { Foo }; -" + `; exports[`test.js 1`] = ` -"class C { +class C { C() { } foo() { } static bar() { } @@ -51,7 +51,7 @@ C.x; new C().foo.x; C.bar.x; -import { Foo } from \\"./exports_optional_prop\\"; +import { Foo } from "./exports_optional_prop"; const foo = new Foo(); (foo.bar(): string); // error, could be undefined @@ -59,5 +59,5 @@ function f(x) { (x.bar(): string); // error. caused by \`f(foo)\`; annotate x to track it down. } f(foo); -" + `; diff --git a/tests/flow/misc/__snapshots__/jsfmt.spec.js.snap b/tests/flow/misc/__snapshots__/jsfmt.spec.js.snap index 7ff636ea..fba7730f 100644 --- a/tests/flow/misc/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/misc/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -" + /* @providesModule A */ module.exports = {}; @@ -12,7 +12,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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -26,20 +26,20 @@ 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 -" + `; exports[`B.js 1`] = ` -" + /* @providesModule B */ var A = require('A').cls; function B() { - this.b = \\"...\\"; + this.b = "..."; } function f():number { return this.b; } @@ -51,10 +51,10 @@ module.exports = B; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule B */ -var A = require(\\"A\\").cls; +var A = require("A").cls; function B() { - this.b = \\"...\\"; + this.b = "..."; } function f(): number { @@ -65,11 +65,11 @@ B.prototype.s = 0; B.prototype.fn = f; module.exports = B; -" + `; exports[`C.js 1`] = ` -" + /* @providesModule C */ var B = require('B'); @@ -86,8 +86,8 @@ 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(); @@ -97,11 +97,11 @@ function C() { } module.exports = C; -" + `; exports[`D.js 1`] = ` -" + /* @providesModule D */ var f = require('A').fn; @@ -114,11 +114,11 @@ 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; @@ -130,12 +130,12 @@ o.i = true; var i = o.fn(); f(i); -module.exports = \\"D for dummy\\"; -" +module.exports = "D for dummy"; + `; exports[`E.js 1`] = ` -" + /* @providesModule E */ function h(x:number) { } @@ -155,11 +155,11 @@ var o = Object.create(proto); o.fn(false); module.exports = { obj: o }; -" + `; exports[`F.js 1`] = ` -"function fn2(x) { return x.length * 4; } +function fn2(x) { return x.length * 4; } fn2({length: 'hi'}); function foo(x: Array): string { @@ -169,29 +169,29 @@ 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; } -" + `; exports[`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/flow/missing_annotation/__snapshots__/jsfmt.spec.js.snap b/tests/flow/missing_annotation/__snapshots__/jsfmt.spec.js.snap index bd9af98b..e311d8d0 100644 --- a/tests/flow/missing_annotation/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/missing_annotation/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`array.js 1`] = ` -"// @flow +// @flow type Foo = {}; var f: Foo = {}; @@ -12,11 +12,11 @@ export var arr = [f]; type Foo = {}; var f: Foo = {}; export var arr = [f]; -" + `; exports[`async_return.js 1`] = ` -"// @flow +// @flow export async function foo() { return 123; @@ -27,11 +27,11 @@ export async function foo() { export async function foo() { return 123; } -" + `; exports[`infer.js 1`] = ` -"/* @flow */ +/* @flow */ var Foo = { a: function(arg) { // missing arg annotation @@ -142,17 +142,17 @@ var Foo = { }; var Bar = { - a: Foo.a(\\"Foo\\"), // no annotation required + a: Foo.a("Foo"), // no annotation required // object property types are inferred, so make sure that this doesn't cause // us to also infer the parameter's type. - b: Foo.b(\\"bar\\"), // no annotation required + b: Foo.b("bar"), // no annotation required - c: Foo.c(\\"bar\\"), // no annotation required + c: Foo.c("bar"), // no annotation required - d: Foo.d(\\"bar\\") // no annotation required + d: Foo.d("bar") // no annotation required }; (module.exports = Foo), Bar; -" + `; diff --git a/tests/flow/modified_lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/modified_lib/__snapshots__/jsfmt.spec.js.snap index 3c678d30..7ceb27b0 100644 --- a/tests/flow/modified_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/modified_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @flow import {bar} from 'foo'; @@ -9,8 +9,8 @@ bar(5); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { bar } from \\"foo\\"; +import { bar } from "foo"; bar(5); -" + `; diff --git a/tests/flow/modified_lib/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/modified_lib/lib/__snapshots__/jsfmt.spec.js.snap index 799ce5f9..6ee4ca81 100644 --- a/tests/flow/modified_lib/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/modified_lib/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/module_not_found_errors/src/__snapshots__/jsfmt.spec.js.snap b/tests/flow/module_not_found_errors/src/__snapshots__/jsfmt.spec.js.snap index 3348d752..6fecc199 100644 --- a/tests/flow/module_not_found_errors/src/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/module_not_found_errors/src/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"// @flow +// @flow require('module_completely_absent'); @@ -11,10 +11,10 @@ require('module_outside_of_root'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @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"); + `; diff --git a/tests/flow/module_redirect/__snapshots__/jsfmt.spec.js.snap b/tests/flow/module_redirect/__snapshots__/jsfmt.spec.js.snap index 5c4a9be3..4cf7e578 100644 --- a/tests/flow/module_redirect/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/module_redirect/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"declare module A { +declare module A { declare function foo(): string; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare module A { declare function foo(): string; } -" + `; exports[`B.js 1`] = ` -"/** +/** * @providesModule B * @flow */ @@ -24,12 +24,12 @@ module.exports = require('A'); * @flow */ -module.exports = require(\\"A\\"); -" +module.exports = require("A"); + `; exports[`C.js 1`] = ` -"/** +/** * @providesModule C * @flow */ @@ -41,12 +41,12 @@ module.exports = require('B'); * @flow */ -module.exports = require(\\"B\\"); -" +module.exports = require("B"); + `; exports[`D.js 1`] = ` -"/** +/** * @providesModule D * @flow */ @@ -60,8 +60,8 @@ var bar3: string = require('C'); * @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/flow/module_use_strict/__snapshots__/jsfmt.spec.js.snap b/tests/flow/module_use_strict/__snapshots__/jsfmt.spec.js.snap index b17c28da..1d53e21d 100644 --- a/tests/flow/module_use_strict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/module_use_strict/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @flow (01: number); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow (01: number); -" + `; diff --git a/tests/flow/modules/__snapshots__/jsfmt.spec.js.snap b/tests/flow/modules/__snapshots__/jsfmt.spec.js.snap index 1c45d361..8bc1b662 100644 --- a/tests/flow/modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/modules/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`cli.js 1`] = ` -"/* @flow */ +/* @flow */ var f = require('./lib'); @@ -9,29 +9,29 @@ var y:number = f(0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var f = require(\\"./lib\\"); +var f = require("./lib"); var y: number = f(0); -" + `; exports[`cli2.js 1`] = ` -"/* @flow */ +/* @flow */ var f = require('./lib'); -f(\\"...\\"); +f("..."); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var f = require(\\"./lib\\"); +var f = require("./lib"); + +f("..."); -f(\\"...\\"); -" `; exports[`lib.js 1`] = ` -"/* @flow */ +/* @flow */ function g(x:string) { } @@ -53,5 +53,5 @@ function f(x: number): number { } module.exports = f; -" + `; diff --git a/tests/flow/more_annot/__snapshots__/jsfmt.spec.js.snap b/tests/flow/more_annot/__snapshots__/jsfmt.spec.js.snap index 6862ec58..66b8f2fd 100644 --- a/tests/flow/more_annot/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/more_annot/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`client_object.js 1`] = ` -"var o = require('./object'); +var o = require('./object'); var a:number = o.w.z.y; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var o = require(\\"./object\\"); +var o = require("./object"); var a: number = o.w.z.y; -" + `; exports[`object.js 1`] = ` -"var o1 = { x: 0, y: \\"\\" }; +var o1 = { x: 0, y: "" }; var o2 = { z: o1 } var o3 = {}; @@ -22,7 +22,7 @@ o3.w = o2; module.exports = o3; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var o1 = { x: 0, y: \\"\\" }; +var o1 = { x: 0, y: "" }; var o2 = { z: o1 }; var o3 = {}; @@ -31,11 +31,11 @@ o3.w = o2; //declare var exports: { w: any }; module.exports = o3; -" + `; exports[`proto.js 1`] = ` -"function Foo() { this.x = 0; } +function Foo() { this.x = 0; } Foo.prototype.m = function() { } var o1: { x: number; m(): void } = new Foo(); @@ -50,11 +50,11 @@ Foo.prototype.m = function() {}; var o1: { x: number, m(): void } = new Foo(); var o2: Foo = new Foo(); -" + `; exports[`super.js 1`] = ` -"class C { m() { } } +class C { m() { } } class D extends C { } var d: { +m: () => void } = new D(); @@ -65,5 +65,5 @@ class C { class D extends C {} var d: { +m: () => void } = new D(); -" + `; diff --git a/tests/flow/more_classes/__snapshots__/jsfmt.spec.js.snap b/tests/flow/more_classes/__snapshots__/jsfmt.spec.js.snap index 0032363b..921907be 100644 --- a/tests/flow/more_classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/more_classes/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Bar.js 1`] = ` -" + /* @providesModule Bar */ var Qux = require('Qux'); @@ -15,7 +15,7 @@ class Bar { } bar(z:string,u:string):string { - new Qux().w = \\"?\\"; + new Qux().w = "?"; return z; } } @@ -24,7 +24,7 @@ module.exports = Bar; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Bar */ -var Qux = require(\\"Qux\\"); +var Qux = require("Qux"); class Bar { y: number; @@ -35,17 +35,17 @@ class Bar { } bar(z: string, u: string): string { - new Qux().w = \\"?\\"; + new Qux().w = "?"; return z; } } module.exports = Bar; -" + `; exports[`Foo.js 1`] = ` -" + /* @providesModule Foo */ var Bar = require('Bar'); @@ -59,7 +59,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); @@ -74,8 +74,8 @@ 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; @@ -85,7 +85,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); @@ -97,11 +97,11 @@ class Foo extends Qux { } module.exports = Foo; -" + `; exports[`Qux.js 1`] = ` -" + /* @providesModule Qux */ class Qux { @@ -127,5 +127,5 @@ class Qux { } module.exports = Qux; -" + `; diff --git a/tests/flow/more_generics/__snapshots__/jsfmt.spec.js.snap b/tests/flow/more_generics/__snapshots__/jsfmt.spec.js.snap index 723c1b20..e3f92033 100644 --- a/tests/flow/more_generics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/more_generics/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`poly.js 1`] = ` -"var foo1 = function(x:T):T { return x; } +var foo1 = function(x:T):T { return x; } function foo2(x:T):S { return x; } @@ -74,5 +74,5 @@ function foo8(x: U, y): U { /* foo8(0,void 0); */ -" + `; diff --git a/tests/flow/more_path/__snapshots__/jsfmt.spec.js.snap b/tests/flow/more_path/__snapshots__/jsfmt.spec.js.snap index 1e5eca43..12cc643d 100644 --- a/tests/flow/more_path/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/more_path/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Condition.js 1`] = ` -"/* @providesModule Condition */ +/* @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); @@ -27,7 +27,7 @@ class C { qux() { } } function foo() { - var c = \\"...\\"; + var c = "..."; c = new C(); if (bar()) { c.qux(); @@ -63,11 +63,11 @@ module.exports = true; 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); @@ -92,7 +92,7 @@ class C { } function foo() { - var c = \\"...\\"; + var c = "..."; c = new C(); if (bar()) { c.qux(); @@ -101,7 +101,7 @@ function foo() { function goofy() { var x = g(); - if (typeof x == \\"function\\") { + if (typeof x == "function") { x(); } else { // if (typeof x == 'number') { @@ -111,11 +111,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 { //f(y); @@ -123,18 +123,18 @@ function goofy2() { } module.exports = true; -" + `; exports[`FlowSA.js 1`] = ` -" + /* @providesModule FlowSA */ function check(x:string) { } function FlowSA() { var x = 0; - x = \\"...\\"; + x = "..."; check(x); } @@ -146,16 +146,16 @@ function check(x: string) {} function FlowSA() { var x = 0; - x = \\"...\\"; + x = "..."; check(x); } module.exports = FlowSA; -" + `; exports[`Sigma.js 1`] = ` -" + /* @providesModule Sigma */ class A { a() {} } @@ -194,7 +194,7 @@ function baz(x:D) { } } -module.exports = \\"sigma\\"; +module.exports = "sigma"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Sigma */ @@ -241,12 +241,12 @@ function baz(x: D) { } } -module.exports = \\"sigma\\"; -" +module.exports = "sigma"; + `; exports[`test.js 1`] = ` -"class BaseClass { +class BaseClass { baseProp: string; } @@ -275,5 +275,5 @@ function test(obj: BaseClass): string { } return obj.baseProp; } -" + `; diff --git a/tests/flow/more_react/__snapshots__/jsfmt.spec.js.snap b/tests/flow/more_react/__snapshots__/jsfmt.spec.js.snap index 2dbd729f..6afb885f 100644 --- a/tests/flow/more_react/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/more_react/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`API.react.js 1`] = ` -" + var app = require('JSX'); app.setProps({y:42}); // error, y:number but foo expects string in App.react @@ -10,18 +10,18 @@ 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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 -" + `; exports[`App.react.js 1`] = ` -" + /** * @providesModule App.react * @jsx React.DOM @@ -35,7 +35,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() { @@ -70,7 +70,7 @@ module.exports = App; * @jsx React.DOM */ -var React = require(\\"react\\"); +var React = require("react"); // expect args to be strings function foo(p: string, q: string): string { @@ -79,7 +79,7 @@ function foo(p: string, q: string): string { var App = React.createClass({ getDefaultProps: function(): { y: string } { - return { y: \\"\\" }; // infer props.y: string + return { y: "" }; // infer props.y: string }, getInitialState: function() { @@ -107,11 +107,11 @@ var App = React.createClass({ }); module.exports = App; -" + `; exports[`InitializedFields.js 1`] = ` -"/** +/** * @providesModule InitializedFields.react */ @@ -130,7 +130,7 @@ module.exports = App; * @providesModule InitializedFields.react */ -var React = require(\\"react\\"); +var React = require("react"); /** This is a regression test for a bug where we forgot to mark the fields of * react classes as initialized, when the class was created with createClass(). @@ -140,11 +140,11 @@ var App = React.createClass({ }); module.exports = App; -" + `; exports[`JSX.js 1`] = ` -" + /* @providesModule JSX */ var React = require('react'); @@ -159,24 +159,24 @@ 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 + {" "}// error, y: number but foo expects string in App.react Some text. ); module.exports = app; -" + `; exports[`checkPropTypes.js 1`] = ` -"/* @flow */ +/* @flow */ -import { PropTypes, checkPropTypes } from \\"react\\"; +import { PropTypes, checkPropTypes } from "react"; checkPropTypes({ foo: PropTypes.string }, { foo: 'foo' }, 'value', 'TestComponent'); // OK @@ -191,51 +191,51 @@ checkPropTypes({ foo: PropTypes.string }, { foo: 'foo' }, 'value', 'TestComponen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import { PropTypes, checkPropTypes } from \\"react\\"; +import { PropTypes, checkPropTypes } from "react"; checkPropTypes( { foo: PropTypes.string }, - { foo: \\"foo\\" }, - \\"value\\", - \\"TestComponent\\" + { foo: "foo" }, + "value", + "TestComponent" ); // OK -checkPropTypes({ foo: PropTypes.string }, { foo: \\"foo\\" }); // error: missing arguments -checkPropTypes({ foo: PropTypes.string }, { foo: \\"foo\\" }, \\"value\\"); // error: missing argument +checkPropTypes({ foo: PropTypes.string }, { foo: "foo" }); // error: missing arguments +checkPropTypes({ foo: PropTypes.string }, { foo: "foo" }, "value"); // error: missing argument checkPropTypes( { bar: PropTypes.string }, - { foo: \\"foo\\" }, - \\"value\\", - \\"TestComponent\\" + { foo: "foo" }, + "value", + "TestComponent" ); // error: property not found checkPropTypes( { foo: PropTypes.string }, - { foo: \\"foo\\" }, - \\"value\\", - \\"TestComponent\\", + { foo: "foo" }, + "value", + "TestComponent", () => 123 ); // error: number ~> string checkPropTypes( { foo: PropTypes.string }, - { foo: \\"foo\\" }, - \\"value\\", - \\"TestComponent\\", + { foo: "foo" }, + "value", + "TestComponent", () => null ); // OK checkPropTypes( { foo: PropTypes.string }, - { foo: \\"foo\\" }, - \\"value\\", - \\"TestComponent\\", + { foo: "foo" }, + "value", + "TestComponent", () => undefined ); // OK -" + `; exports[`propTypes.js 1`] = ` -"var React = require('React'); +var React = require('React'); var C = React.createClass({ propTypes: { @@ -251,7 +251,7 @@ var D = React.createClass({ ; // errors: properties \`name\` and \`title\` not found ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"React\\"); +var React = require("React"); var C = React.createClass({ propTypes: { @@ -266,5 +266,5 @@ var D = React.createClass({ }); ; // errors: properties \`name\` and \`title\` not found -" + `; diff --git a/tests/flow/more_statics/__snapshots__/jsfmt.spec.js.snap b/tests/flow/more_statics/__snapshots__/jsfmt.spec.js.snap index 9a4ec6d6..3bf3b58b 100644 --- a/tests/flow/more_statics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/more_statics/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`class_static.js 1`] = ` -"class B { - static foo(): string { return \\"\\"; } +class B { + static foo(): string { return ""; } } class C extends B { - static bar(): string { return \\"\\"; } + static bar(): string { return ""; } } var x: number = C.bar(); @@ -14,17 +14,17 @@ 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(); var y: number = C.foo(); -" + `; diff --git a/tests/flow/multiflow/__snapshots__/jsfmt.spec.js.snap b/tests/flow/multiflow/__snapshots__/jsfmt.spec.js.snap index 11ed0a49..bcf30ac4 100644 --- a/tests/flow/multiflow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/multiflow/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`apply.js 1`] = ` -"// @flow +// @flow function apply, Ret>( fn: (...Args) => Ret, @@ -51,22 +51,22 @@ function apply, Ret>( return fn(...args); } -function noRest(x: \\"hi\\", y: 123): true { +function noRest(x: "hi", y: 123): true { return true; } -apply(noRest, [\\"hi\\", 123]); // No error -apply(noRest, [\\"hi\\", 456]); // Error - 456 ~> 123 -apply(noRest, [\\"hi\\"]); // Error - too few args -apply(noRest, [\\"hi\\", 123, false]); // No error - too many args is fine +apply(noRest, ["hi", 123]); // No error +apply(noRest, ["hi", 456]); // Error - 456 ~> 123 +apply(noRest, ["hi"]); // Error - too few args +apply(noRest, ["hi", 123, false]); // No error - too many args is fine // withRest behaves the same as noRest except you can't pass too many args in -function withRest(...rest: [\\"hi\\", 123]): true { +function withRest(...rest: ["hi", 123]): true { return true; } -apply(withRest, [\\"hi\\", 123]); // No error -apply(withRest, [\\"hi\\", 456]); // Error - 456 ~> 123 -apply(withRest, [\\"hi\\"]); // Error - too few args -apply(withRest, [\\"hi\\", 123, false]); // Error - too many args +apply(withRest, ["hi", 123]); // No error +apply(withRest, ["hi", 456]); // Error - 456 ~> 123 +apply(withRest, ["hi"]); // Error - too few args +apply(withRest, ["hi", 123, false]); // Error - too many args // Same thing, but with types instead of functions declare var applyType: , Ret>( @@ -74,27 +74,27 @@ declare var applyType: , Ret>( args: Args ) => Ret; -function noRest(x: \\"hi\\", y: 123): true { +function noRest(x: "hi", y: 123): true { return true; } -applyType(noRest, [\\"hi\\", 123]); // No error -applyType(noRest, [\\"hi\\", 456]); // Error - 456 ~> 123 -applyType(noRest, [\\"hi\\"]); // Error - too few args -applyType(noRest, [\\"hi\\", 123, false]); // No error - too many args is fine +applyType(noRest, ["hi", 123]); // No error +applyType(noRest, ["hi", 456]); // Error - 456 ~> 123 +applyType(noRest, ["hi"]); // Error - too few args +applyType(noRest, ["hi", 123, false]); // No error - too many args is fine // withRest behaves the same as noRest except you can't pass too many args in -function withRest(...rest: [\\"hi\\", 123]): true { +function withRest(...rest: ["hi", 123]): true { return true; } -applyType(withRest, [\\"hi\\", 123]); // No error -applyType(withRest, [\\"hi\\", 456]); // Error - 456 ~> 123 -applyType(withRest, [\\"hi\\"]); // Error - too few args -applyType(withRest, [\\"hi\\", 123, false]); // Error - too many args -" +applyType(withRest, ["hi", 123]); // No error +applyType(withRest, ["hi", 456]); // Error - 456 ~> 123 +applyType(withRest, ["hi"]); // Error - too few args +applyType(withRest, ["hi", 123, false]); // Error - too many args + `; exports[`issue3443.js 1`] = ` -"// @flow +// @flow // Adapted from https://github.com/facebook/flow/issues/3443 @@ -131,11 +131,11 @@ function foo(...args) { foo(1, ...args); } foo(123); -" + `; exports[`jsx.js 1`] = ` -"/** +/** * @jsx JSX * @flow */ @@ -165,23 +165,23 @@ declare function JSX< declare function AcceptsWhatever(props: {} | null, children: any): string; (: number); // Error string ~> number -(Text: number); // Error string ~> number +(Text: number); // Error string ~> number declare function ExpectsProps(props: { name: string }, children: any): string; (); // Error - missing prop -(Text: number); // Error string ~> number +(Text: number); // Error string ~> number declare function ExpectsChildrenTuple(props: any, children: [string]): string; (); // Error - mising child (Hi); // No error ({123}); // Error: number ~> string -(Hi {\\"there\\"}); // Error: too many children +(Hi {"there"}); // Error: too many children declare function ExpectsChildrenArray(props: any, children: Array): string; (); // No error - 0 children is fine (Hi); // No error - 1 child is fine ({123}); // Error: number ~> string -(Hi {\\"there\\"}); // No error - 2 children is fine +(Hi {"there"}); // No error - 2 children is fine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @jsx JSX @@ -213,17 +213,17 @@ declare function JSX< declare function AcceptsWhatever(props: {} | null, children: any): string; (: number); // Error string ~> number -(Text: number); // Error string ~> number +(Text: number); // Error string ~> number declare function ExpectsProps(props: { name: string }, children: any): string; ; // Error - missing prop -(Text: number); // Error string ~> number +(Text: number); // Error string ~> number declare function ExpectsChildrenTuple(props: any, children: [string]): string; ; // Error - mising child Hi; // No error {123}; // Error: number ~> string -Hi {\\"there\\"}; // Error: too many children +Hi {"there"}; // Error: too many children declare function ExpectsChildrenArray( props: any, @@ -232,12 +232,12 @@ declare function ExpectsChildrenArray( ; // No error - 0 children is fine Hi; // No error - 1 child is fine {123}; // Error: number ~> string -Hi {\\"there\\"}; // No error - 2 children is fine -" +Hi {"there"}; // No error - 2 children is fine + `; exports[`spread.js 1`] = ` -"// @flow +// @flow function fun(x: 'hi', y: 123) {} fun(...['hi', 123]); // No error @@ -268,30 +268,30 @@ funWithRestArray('hi', ...arrOf123, 'bye', ...arrOf123); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -function fun(x: \\"hi\\", y: 123) {} -fun(...[\\"hi\\", 123]); // No error -fun(...[\\"hi\\"], ...[123]); // No error -fun(...[\\"hi\\"], ...[], ...[123]); // No error -fun(...[\\"hi\\"], ...[], ...[123], ...[true]); // No error -fun(...[\\"hi\\"], ...[true], ...[123]); // Error: true ~> 123 +function fun(x: "hi", y: 123) {} +fun(...["hi", 123]); // No error +fun(...["hi"], ...[123]); // No error +fun(...["hi"], ...[], ...[123]); // No error +fun(...["hi"], ...[], ...[123], ...[true]); // No error +fun(...["hi"], ...[true], ...[123]); // Error: true ~> 123 declare var arrOf123: Array<123>; -fun(\\"hi\\", ...arrOf123); // No error - ignore the fact arrOf123 could be empty +fun("hi", ...arrOf123); // No error - ignore the fact arrOf123 could be empty -function funWithRestArray(x: \\"hi\\", y: 123, ...rest: Array) {} -funWithRestArray(...[\\"hi\\", 123]); // No error -funWithRestArray(...[\\"hi\\"], ...[123]); // No error -funWithRestArray(...[\\"hi\\"], ...[], ...[123]); // No error -funWithRestArray(...[\\"hi\\"], ...[], ...[123], ...[456, 789]); // No error -funWithRestArray(...[\\"hi\\"], ...[true], ...[123]); // Error: true ~> 123 +function funWithRestArray(x: "hi", y: 123, ...rest: Array) {} +funWithRestArray(...["hi", 123]); // No error +funWithRestArray(...["hi"], ...[123]); // No error +funWithRestArray(...["hi"], ...[], ...[123]); // No error +funWithRestArray(...["hi"], ...[], ...[123], ...[456, 789]); // No error +funWithRestArray(...["hi"], ...[true], ...[123]); // Error: true ~> 123 -funWithRestArray(\\"hi\\", 123, ...arrOf123); // Ok -funWithRestArray(\\"hi\\", ...arrOf123); // No error - ignore the fact arrOf123 could be empty -funWithRestArray(\\"hi\\", ...arrOf123, ...arrOf123); // No error - ignore the fact arrOf123 could be empty +funWithRestArray("hi", 123, ...arrOf123); // Ok +funWithRestArray("hi", ...arrOf123); // No error - ignore the fact arrOf123 could be empty +funWithRestArray("hi", ...arrOf123, ...arrOf123); // No error - ignore the fact arrOf123 could be empty // 2 errors // 1. 'bye' ~> 123 in case the first spread is empty // 2. 'bye' ~> number in case the first spread is not empty -funWithRestArray(\\"hi\\", ...arrOf123, \\"bye\\", ...arrOf123); -" +funWithRestArray("hi", ...arrOf123, "bye", ...arrOf123); + `; diff --git a/tests/flow/multiflow_with_flowlib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/multiflow_with_flowlib/__snapshots__/jsfmt.spec.js.snap index 368b2379..aca9a267 100644 --- a/tests/flow/multiflow_with_flowlib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/multiflow_with_flowlib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`spread.js 1`] = ` -"declare var iterableOf123: Iterable<123>; +declare var iterableOf123: Iterable<123>; function fun(x: 'hi', y: 123) {} fun('hi', ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty @@ -17,18 +17,18 @@ funWithRestArray('hi', ...iterableOf123, ...iterableOf123); // No error - ignore funWithRestArray('hi', ...iterableOf123, 'bye', ...iterableOf123); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare var iterableOf123: Iterable<123>; -function fun(x: \\"hi\\", y: 123) {} -fun(\\"hi\\", ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty +function fun(x: "hi", y: 123) {} +fun("hi", ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty -function funWithRestArray(x: \\"hi\\", y: 123, ...rest: Array) {} +function funWithRestArray(x: "hi", y: 123, ...rest: Array) {} -funWithRestArray(\\"hi\\", 123, ...iterableOf123); // Ok -funWithRestArray(\\"hi\\", ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty -funWithRestArray(\\"hi\\", ...iterableOf123, ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty +funWithRestArray("hi", 123, ...iterableOf123); // Ok +funWithRestArray("hi", ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty +funWithRestArray("hi", ...iterableOf123, ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty // 2 errors // 1. 'bye' ~> 123 in case the first spread is empty // 2. 'bye' ~> number in case the first spread is not empty -funWithRestArray(\\"hi\\", ...iterableOf123, \\"bye\\", ...iterableOf123); -" +funWithRestArray("hi", ...iterableOf123, "bye", ...iterableOf123); + `; diff --git a/tests/flow/name_prop/__snapshots__/jsfmt.spec.js.snap b/tests/flow/name_prop/__snapshots__/jsfmt.spec.js.snap index 70594845..1c19aaf4 100644 --- a/tests/flow/name_prop/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/name_prop/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`class.js 1`] = ` -"class A {} +class A {} var test1 = A.bar; // Error bar doesn't exist var test2: string = A.name; @@ -22,11 +22,11 @@ var a = new A(); 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 -" + `; exports[`function.js 1`] = ` -"/* TODO - we currently say that a function's statics are an AnyObjT and +/* 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 */ @@ -35,5 +35,5 @@ exports[`function.js 1`] = ` * anything goes. When we start enforcing the statics properly, we'll need to * know that .name exists */ -" + `; diff --git a/tests/flow/namespace/__snapshots__/jsfmt.spec.js.snap b/tests/flow/namespace/__snapshots__/jsfmt.spec.js.snap index 3459fd94..642edaf0 100644 --- a/tests/flow/namespace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/namespace/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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[`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 { } @@ -22,13 +22,13 @@ 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 '...' type T = (x: number) => void; @@ -40,12 +40,12 @@ 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) }; -" `; diff --git a/tests/flow/new_react/__snapshots__/jsfmt.spec.js.snap b/tests/flow/new_react/__snapshots__/jsfmt.spec.js.snap index 2d460b7b..f7c65626 100644 --- a/tests/flow/new_react/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/new_react/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`FeedUFI.react.js 1`] = ` -"/** +/** * Copyright 2004-present Facebook. All Rights Reserved. * * @providesModule FeedUFI.react @@ -18,18 +18,18 @@ var FeedUFI = React.createClass({ feedback: any ) { var props = { - className: \\"\\", - key: \\"\\", + className: "", + key: "", feedback: {feedback}, - permalink: \\"\\", + permalink: "", }; var ignored = ; return ( ); }, @@ -51,22 +51,22 @@ module.exports = FeedUFI; * @flow */ -\\"use strict\\"; +"use strict"; -var UFILikeCount = require(\\"UFILikeCount.react\\"); -var React = require(\\"react\\"); +var UFILikeCount = require("UFILikeCount.react"); +var React = require("react"); var FeedUFI = React.createClass({ _renderLikeCount: function(feedback: any) { var props = { - className: \\"\\", - key: \\"\\", + className: "", + key: "", feedback: { feedback }, - permalink: \\"\\" + permalink: "" }; var ignored = ; return ( - + ); }, @@ -76,11 +76,11 @@ var FeedUFI = React.createClass({ }); module.exports = FeedUFI; -" + `; exports[`Mixin.js 1`] = ` -"/* @providesModule Mixin */ +/* @providesModule Mixin */ module.exports = { success: function() { } }; @@ -89,11 +89,11 @@ module.exports = { module.exports = { success: function() {} }; -" + `; exports[`UFILikeCount.react.js 1`] = ` -"/** +/** * Copyright 2004-present Facebook. All Rights Reserved. * * @providesModule UFILikeCount.react @@ -124,9 +124,9 @@ module.exports = UFILikeCount; * @flow */ -\\"use strict\\"; +"use strict"; -var React = require(\\"react\\"); +var React = require("react"); var UFILikeCount = React.createClass({ propTypes: { @@ -140,11 +140,11 @@ var UFILikeCount = React.createClass({ }); module.exports = UFILikeCount; -" + `; exports[`bad_default_props.js 1`] = ` -"var React = require('React'); +var React = require('React'); type T1 = { } type T2 = { x: number } @@ -175,7 +175,7 @@ class C6 extends React.Component { // OK, recommended props: T3; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"React\\"); +var React = require("React"); type T1 = {}; type T2 = { x: number }; @@ -211,11 +211,11 @@ class C6 extends React.Component { static defaultProps: T2; props: T3; } -" + `; exports[`classes.js 1`] = ` -"var React = require('React'); +var React = require('React'); type DefaultProps = { }; type Props = { x: number }; @@ -236,7 +236,7 @@ class Foo extends React.Component { constructor(props) { super(props); - this.state = { y: \\"\\" }; + this.state = { y: "" }; } setState(o: { y_: string }): void { } @@ -277,7 +277,7 @@ var FooLegacy = React.createClass({ }, getInitialState(): { y: string } { - return { y: \\"\\" }; + return { y: "" }; }, setState(o: { y_: string }): void { }, @@ -299,7 +299,7 @@ var foo_legacy: $jsx = ; FooLegacy.bar(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"React\\"); +var React = require("React"); type DefaultProps = {}; type Props = { x: number }; @@ -320,7 +320,7 @@ class Foo extends React.Component { constructor(props) { super(props); - this.state = { y: \\"\\" }; + this.state = { y: "" }; } setState(o: { y_: string }): void {} @@ -358,7 +358,7 @@ var FooLegacy = React.createClass({ }, getInitialState(): { y: string } { - return { y: \\"\\" }; + return { y: "" }; }, setState(o: { y_: string }): void {}, @@ -376,11 +376,11 @@ FooLegacy.defaultProps = 0; var foo_legacy: $jsx = ; FooLegacy.bar(); -" + `; exports[`import-react.js 1`] = ` -"/* @flow */ +/* @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 @@ -388,17 +388,17 @@ exports[`import-react.js 1`] = ` // 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\\"); +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 +; // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -408,22 +408,22 @@ class HelloMessage extends React.Component { // 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\\"); +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 -" +; // ok + `; exports[`new_react.js 1`] = ` -"var React = require('react'); +var React = require('react'); var Mixin = require('Mixin'); var C = React.createClass({ mixins: [Mixin], @@ -456,8 +456,8 @@ var element_ = ; var x: number = C.displayName; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"react\\"); -var Mixin = require(\\"Mixin\\"); +var React = require("react"); +var Mixin = require("Mixin"); var C = React.createClass({ mixins: [Mixin], propTypes: { @@ -489,11 +489,11 @@ var element = ; var element_ = ; var x: number = C.displayName; -" + `; exports[`propTypes.js 1`] = ` -"var React = require('react'); +var React = require('react'); var PropTypes = React.PropTypes; var C = React.createClass({ @@ -507,15 +507,15 @@ var C = React.createClass({ ; // error (label is required, value not required) var props: Array<{label: string, value?: number}> = [ {}, - {label:\\"\\",value:undefined}, + {label:"",value:undefined}, ]; // error (same as ^) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"react\\"); +var React = require("react"); var PropTypes = React.PropTypes; var C = React.createClass({ @@ -529,17 +529,17 @@ var C = React.createClass({ } }); -; // error (label is required, value not required) +; // error (label is required, value not required) var props: Array<{ label: string, value?: number }> = [ {}, - { label: \\"\\", value: undefined } + { label: "", value: undefined } ]; // error (same as ^) -" + `; exports[`props.js 1`] = ` -"var React = require('react'); +var React = require('react'); var TestProps = React.createClass({ propTypes: { @@ -567,7 +567,7 @@ var FooProps = React.createClass({ }); (element: $jsx); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"react\\"); +var React = require("react"); var TestProps = React.createClass({ propTypes: { x: React.PropTypes.string, @@ -575,7 +575,7 @@ var TestProps = React.createClass({ }, getDefaultProps: function() { - return { x: \\"\\", y: 0 }; + return { x: "", y: 0 }; }, test: function() { @@ -593,11 +593,11 @@ var FooProps = React.createClass({ propTypes: { w: React.PropTypes.string.isRequired } }); (element: $jsx); -" + `; exports[`props2.js 1`] = ` -"var React = require('react'); +var React = require('react'); var C = React.createClass({ propTypes: { foo: React.PropTypes.string.isRequired, @@ -615,7 +615,7 @@ var D = React.createClass({ } }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"react\\"); +var React = require("react"); var C = React.createClass({ propTypes: { foo: React.PropTypes.string.isRequired, @@ -632,11 +632,11 @@ var D = React.createClass({ return ; } }); -" + `; exports[`props3.js 1`] = ` -"var React = require('react'); +var React = require('react'); var TestProps = React.createClass({ // Do something illegal inside of propTypes and make sure Flow notices propTypes: { @@ -666,8 +666,8 @@ var TestProps = React.createClass({ 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, + oneOf: React.PropTypes.oneOf(["yes", "no"]), + oneOf_rec: React.PropTypes.oneOf(["yes", "no"]).isRequired, oneOfType: React.PropTypes.oneOfType( [React.PropTypes.string, React.PropTypes.number] ), @@ -689,7 +689,7 @@ var TestProps = React.createClass({ }, }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"react\\"); +var React = require("react"); var TestProps = React.createClass({ // Do something illegal inside of propTypes and make sure Flow notices propTypes: { @@ -719,8 +719,8 @@ var TestProps = React.createClass({ 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, + oneOf: React.PropTypes.oneOf(["yes", "no"]), + oneOf_rec: React.PropTypes.oneOf(["yes", "no"]).isRequired, oneOfType: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.number @@ -743,13 +743,13 @@ var TestProps = React.createClass({ bad_two: React.PropTypes.string.inRequired } }); -" + `; exports[`props4.js 1`] = ` -"// @flow +// @flow -import React from \\"React\\"; +import React from "React"; class JDiv extends React.Component { // static defaultProps: { }; @@ -770,13 +770,13 @@ class Example extends React.Component { } React.render( - , + , document.body ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import React from \\"React\\"; +import React from "React"; class JDiv extends React.Component { // static defaultProps: { }; @@ -796,12 +796,12 @@ class Example extends React.Component { } } -React.render(, document.body); -" +React.render(, document.body); + `; exports[`props5.js 1`] = ` -"var React = require('React'); +var React = require('React'); var C = React.createClass({ getDefaultProps: function() { @@ -811,7 +811,7 @@ var C = React.createClass({ module.exports = C; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"React\\"); +var React = require("React"); var C = React.createClass({ getDefaultProps: function() { @@ -820,11 +820,11 @@ var C = React.createClass({ }); module.exports = C; -" + `; exports[`state.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); @@ -850,7 +850,7 @@ var ReactClass = React.createClass({ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); +var React = require("react"); type State = { bar: ?{ qux: string } @@ -871,11 +871,11 @@ var ReactClass = React.createClass({ ); } }); -" + `; exports[`state2.js 1`] = ` -"// @flow +// @flow var React = require('react'); @@ -895,7 +895,7 @@ module.exports = Comp; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var React = require(\\"react\\"); +var React = require("react"); type FooState = { key: ?Object @@ -910,11 +910,11 @@ var Comp = React.createClass({ }); module.exports = Comp; -" + `; exports[`state3.js 1`] = ` -"var React = require('react'); +var React = require('react'); var TestState = React.createClass({ getInitialState: function(): { x: string; } { @@ -933,11 +933,11 @@ var TestState = React.createClass({ }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"react\\"); +var React = require("react"); var TestState = React.createClass({ getInitialState: function(): { x: string } { return { - x: \\"\\" + x: "" }; }, @@ -949,11 +949,11 @@ var TestState = React.createClass({ }); } }); -" + `; exports[`state4.js 1`] = ` -"var React = require('React'); +var React = require('React'); var C = React.createClass({ getInitialState: function(): { x: number } { @@ -967,7 +967,7 @@ var C = React.createClass({ }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"React\\"); +var React = require("React"); var C = React.createClass({ getInitialState: function(): { x: number } { @@ -979,11 +979,11 @@ var C = React.createClass({ return
{this.state.z}
; } }); -" + `; exports[`state5.js 1`] = ` -"var React = require('React'); +var React = require('React'); class C extends React.Component { foo(): number { @@ -991,12 +991,12 @@ class C extends React.Component { } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"React\\"); +var React = require("React"); class C extends React.Component { foo(): number { return this.state.x; // error: need to declare type of state } } -" + `; diff --git a/tests/flow/new_react/fakelib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/new_react/fakelib/__snapshots__/jsfmt.spec.js.snap index 5cd44b0b..d106e795 100644 --- a/tests/flow/new_react/fakelib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/new_react/fakelib/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`type_aliases.js 1`] = ` -"declare var $React: $Exports<'react'>; // fake import +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>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare var $React: $Exports<\\"react\\">; // fake import +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. @@ -19,5 +19,5 @@ type _ReactElement< C: $React.Component > = $React.Element; type $jsx = _ReactElement<*, *, *, C>; -" + `; diff --git a/tests/flow/new_spread/__snapshots__/jsfmt.spec.js.snap b/tests/flow/new_spread/__snapshots__/jsfmt.spec.js.snap index b59d4348..e2ee9190 100644 --- a/tests/flow/new_spread/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/new_spread/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`type.js 1`] = ` -"declare class T {} +declare class T {} declare var x: T; declare class U {} @@ -196,11 +196,11 @@ declare var o12: O12; type O13 = { ...{ p: T }, p: U }; declare var o13: O13; (o13: { p: U }); -" + `; exports[`type_any.js 1`] = ` -"type O1 = {...any}; +type O1 = {...any}; var o1: O1 = (0: mixed); // ok (o1: empty); // ok @@ -227,11 +227,11 @@ declare class Derived extends Base {} type O3 = { ...Derived }; var o3: O3 = (0: mixed); // ok (o3: empty); // ok -" + `; exports[`type_contra.js 1`] = ` -"declare class T {}; +declare class T {}; type O1 = {...{-p:T}}; declare var o1: O1; @@ -258,11 +258,11 @@ declare var o2: O2; (o2: { [string]: mixed }); // ok (o2: { [string]: T }); // error: unknown ~> T (o2.p: T); // errors: unknown ~> T -" + `; exports[`type_dict.js 1`] = ` -"declare class T {} +declare class T {} declare class U {} declare var o1: {...{[string]:T},...{p:U}}; @@ -339,22 +339,22 @@ declare var o11: { ...{| p: T |}, ...{| [string]: U |} }; declare var o12: { ...{| [string]: T |}, ...{| [string]: U |} }; (o12: {| [string]: T | U |}); // ok -" + `; exports[`type_generic.js 1`] = ` -"declare function spread(a: A, b: B): {...A, ...B}; +declare function spread(a: A, b: B): {...A, ...B}; (spread({p:0},{q:0}): {|+p:number,+q:number|}); // ok (spread({p:0},{q:0}): {|+p:empty,+q:empty|}); // number ~> empty (x2) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare function spread(a: A, b: B): { ...A, ...B }; (spread({ p: 0 }, { q: 0 }): {| +p: number, +q: number |}); // ok (spread({ p: 0 }, { q: 0 }): {| +p: empty, +q: empty |}); // number ~> empty (x2) -" + `; exports[`type_instance.js 1`] = ` -"class A {+p: string|number} +class A {+p: string|number} class B extends A {p: number} type O1 = {...B}; @@ -381,11 +381,11 @@ declare class C { [string]: number } type O2 = { ...C }; declare var o2: O2; (o2: { [string]: number }); // ok -" + `; exports[`type_intersection.js 1`] = ` -"declare class T {} +declare class T {} declare class U {} declare class A {} @@ -442,11 +442,11 @@ declare var o4: O4; type O5 = { ...{ [string]: A } & { [string]: B } }; declare var o5: O5; (o5: { [string]: B }); // ok: A&B = B -" + `; exports[`type_intersection_optional.js 1`] = ` -"declare class T {} +declare class T {} declare class U {} declare var o1: {...{p:T}&{p:U}}; @@ -577,11 +577,11 @@ declare var o20: { ...{ p?: T } & { q?: U } }; declare var o21: { ...{| p: T |} & { q: U } }; (o21: { p: T, q?: U }); // ok -" + `; exports[`type_optional.js 1`] = ` -"declare class T {} +declare class T {} declare class U {} declare var a: {...{ p :T },...{ p :U }}; (a: { p?:T|U }); @@ -642,11 +642,11 @@ declare var o: { ...{| p: T |}, ...{| p?: U |} }; (o: {| p: T | U |}); declare var p: { ...{| p?: T |}, ...{| p?: U |} }; (p: {| p?: T | U |}); -" + `; exports[`type_union.js 1`] = ` -"declare class T {} +declare class T {} declare var x: T; declare class U {} @@ -665,5 +665,5 @@ declare var y: U; type O1 = { ...{ p: T } | { q: U } }; declare var o1: O1; (o1: { p?: T } | { q?: U }); // ok -" + `; diff --git a/tests/flow/node_haste/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_haste/__snapshots__/jsfmt.spec.js.snap index 759c2163..4fbc6c22 100644 --- a/tests/flow/node_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_haste/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`client.js 1`] = ` -"var md5 = require('./md5'); +var md5 = require('./md5'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var md5 = require(\\"./md5\\"); -" +var md5 = require("./md5"); + `; exports[`md5.js 1`] = ` -"/* @providesModule md5 */ +/* @providesModule md5 */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule md5 */ -" + `; diff --git a/tests/flow/node_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap index b11a700f..fd13f7b3 100644 --- a/tests/flow/node_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_haste/external/_d3/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`min.js 1`] = ` -"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + `; diff --git a/tests/flow/node_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap index e8efa1c6..ec3c165d 100644 --- a/tests/flow/node_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_haste/foo/bar/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`client.js 1`] = ` -"var docblock = require('qux/docblock'); +var docblock = require('qux/docblock'); var min = require('d3/min.js'); var corge = require('qux/corge'); @@ -9,12 +9,12 @@ var corge = require('qux/corge'); // annotations - see node_modules/qux/docblock.js var unreachable = require('annotation'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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 // annotations - see node_modules/qux/docblock.js -var unreachable = require(\\"annotation\\"); -" +var unreachable = require("annotation"); + `; diff --git a/tests/flow/node_haste/ws/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_haste/ws/__snapshots__/jsfmt.spec.js.snap index 3959b3ee..cfcb94a5 100644 --- a/tests/flow/node_haste/ws/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_haste/ws/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + `; diff --git a/tests/flow/node_haste/ws/test/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_haste/ws/test/__snapshots__/jsfmt.spec.js.snap index 55142189..8f867398 100644 --- a/tests/flow/node_haste/ws/test/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_haste/ws/test/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`client.js 1`] = ` -"var ws = require('../'); +var ws = require('../'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var ws = require(\\"../\\"); -" +var ws = require("../"); + `; diff --git a/tests/flow/node_modules_with_symlinks/root/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_modules_with_symlinks/root/__snapshots__/jsfmt.spec.js.snap index 3320a050..8ab7a62f 100644 --- a/tests/flow/node_modules_with_symlinks/root/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_modules_with_symlinks/root/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`foo.js 1`] = ` -"var x = require('symlink_lib'); +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/flow/node_modules_with_symlinks/root/symlink_lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_modules_with_symlinks/root/symlink_lib/__snapshots__/jsfmt.spec.js.snap index 78c3adac..ded87712 100644 --- a/tests/flow/node_modules_with_symlinks/root/symlink_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_modules_with_symlinks/root/symlink_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"module.exports = { bar: \\"bar\\" }; +module.exports = { bar: "bar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = { bar: \\"bar\\" }; -" +module.exports = { bar: "bar" }; + `; diff --git a/tests/flow/node_modules_with_symlinks/symlink_lib_outside_root/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_modules_with_symlinks/symlink_lib_outside_root/__snapshots__/jsfmt.spec.js.snap index 78c3adac..ded87712 100644 --- a/tests/flow/node_modules_with_symlinks/symlink_lib_outside_root/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_modules_with_symlinks/symlink_lib_outside_root/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"module.exports = { bar: \\"bar\\" }; +module.exports = { bar: "bar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = { bar: \\"bar\\" }; -" +module.exports = { bar: "bar" }; + `; diff --git a/tests/flow/node_modules_without_json/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_modules_without_json/__snapshots__/jsfmt.spec.js.snap index a58cb5f2..27f6dfa7 100644 --- a/tests/flow/node_modules_without_json/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_modules_without_json/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @flow let foo = require('foo'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -let foo = require(\\"foo\\"); -" +let foo = require("foo"); + `; diff --git a/tests/flow/node_tests/assert/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/assert/__snapshots__/jsfmt.spec.js.snap index 978f1d31..05e1b9b0 100644 --- a/tests/flow/node_tests/assert/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/assert/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`assert.js 1`] = ` -"/* @flow */ +/* @flow */ -var assert = require(\\"assert\\") +var assert = require("assert") assert(true) // ok assert.ok(true) // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var assert = require(\\"assert\\"); +var assert = require("assert"); assert(true); // ok assert.ok(true); // ok -" + `; diff --git a/tests/flow/node_tests/basic/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/basic/__snapshots__/jsfmt.spec.js.snap index 536a7b06..4c14e847 100644 --- a/tests/flow/node_tests/basic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/basic/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bar.js 1`] = ` -"module.exports = \\"bar\\"; +module.exports = "bar"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = \\"bar\\"; -" +module.exports = "bar"; + `; exports[`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/flow/node_tests/basic_file/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/basic_file/__snapshots__/jsfmt.spec.js.snap index 3852de7d..c4012bfd 100644 --- a/tests/flow/node_tests/basic_file/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/basic_file/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bar.js 1`] = ` -"module.exports = \\"bar\\"; +module.exports = "bar"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = \\"bar\\"; -" +module.exports = "bar"; + `; exports[`foo.js 1`] = ` -"var x = require('./bar'); // bar.js does not work +var x = require('./bar'); // bar.js does not work console.log(x); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require(\\"./bar\\"); // bar.js does not work +var x = require("./bar"); // bar.js does not work console.log(x); -" + `; diff --git a/tests/flow/node_tests/basic_node_modules/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/basic_node_modules/__snapshots__/jsfmt.spec.js.snap index f761168d..cd29cd24 100644 --- a/tests/flow/node_tests/basic_node_modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/basic_node_modules/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/node_tests/basic_node_modules_with_path/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/basic_node_modules_with_path/__snapshots__/jsfmt.spec.js.snap index 4900c86d..8bbd864f 100644 --- a/tests/flow/node_tests/basic_node_modules_with_path/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/basic_node_modules_with_path/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/node_tests/basic_package/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/basic_package/__snapshots__/jsfmt.spec.js.snap index 7bd83213..cbdb3285 100644 --- a/tests/flow/node_tests/basic_package/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/basic_package/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require(\\"./bar_lib\\"); // 'bar_lib' does not work! +var x = require("./bar_lib"); // 'bar_lib' does not work! console.log(x); -" + `; diff --git a/tests/flow/node_tests/basic_package/bar_lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/basic_package/bar_lib/__snapshots__/jsfmt.spec.js.snap index e8f131d2..36d0a146 100644 --- a/tests/flow/node_tests/basic_package/bar_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/basic_package/bar_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bar.js 1`] = ` -"module.exports = \\"bar\\"; +module.exports = "bar"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = \\"bar\\"; -" +module.exports = "bar"; + `; diff --git a/tests/flow/node_tests/buffer/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/buffer/__snapshots__/jsfmt.spec.js.snap index 6f408435..706828b3 100644 --- a/tests/flow/node_tests/buffer/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/buffer/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`buffer.js 1`] = ` -"/* @flow */ +/* @flow */ let bool: boolean = false; let buffer: Buffer = new Buffer(0); @@ -26,10 +26,10 @@ bool = buffer.every((element: number) => false, buffer); buffer = buffer.fill(1); buffer = buffer.fill(1, 0, 0); -buffer = buffer.fill(\\"a\\"); -buffer = buffer.fill(\\"a\\", 0, 0); -buffer = buffer.fill(\\"a\\", 0, 0, \\"utf8\\"); -buffer = buffer.fill(\\"a\\", \\"utf8\\"); +buffer = buffer.fill("a"); +buffer = buffer.fill("a", 0, 0); +buffer = buffer.fill("a", 0, 0, "utf8"); +buffer = buffer.fill("a", "utf8"); maybeNum = buffer.find((element: number, index: number, array:Uint8Array) => false); maybeNum = buffer.find((element: number, index: number, array:Uint8Array) => false, buffer); @@ -51,7 +51,7 @@ buffer = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); const typedArray = new Uint8Array([0x34]); buffer = Buffer.from(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); buffer = Buffer.from(new Buffer(0)); -buffer = Buffer.from(\\"foo\\", \\"utf8\\"); +buffer = Buffer.from("foo", "utf8"); // This call to from() does type check ok, but should not. Unfortunately, Buffer // extends Uint8Array but gets rid of this signature to .from(). Understandably, @@ -84,10 +84,10 @@ bool = buffer.every((element: number) => false, buffer); buffer = buffer.fill(1); buffer = buffer.fill(1, 0, 0); -buffer = buffer.fill(\\"a\\"); -buffer = buffer.fill(\\"a\\", 0, 0); -buffer = buffer.fill(\\"a\\", 0, 0, \\"utf8\\"); -buffer = buffer.fill(\\"a\\", \\"utf8\\"); +buffer = buffer.fill("a"); +buffer = buffer.fill("a", 0, 0); +buffer = buffer.fill("a", 0, 0, "utf8"); +buffer = buffer.fill("a", "utf8"); maybeNum = buffer.find( (element: number, index: number, array: Uint8Array) => false @@ -126,7 +126,7 @@ buffer = Buffer.from( typedArray.byteLength ); buffer = Buffer.from(new Buffer(0)); -buffer = Buffer.from(\\"foo\\", \\"utf8\\"); +buffer = Buffer.from("foo", "utf8"); // This call to from() does type check ok, but should not. Unfortunately, Buffer // extends Uint8Array but gets rid of this signature to .from(). Understandably, @@ -137,5 +137,5 @@ buffer = Buffer.from( (a: number) => a + 1, {} ); // should error but doesn't -" + `; diff --git a/tests/flow/node_tests/child_process/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/child_process/__snapshots__/jsfmt.spec.js.snap index 965e74e9..ac58efac 100644 --- a/tests/flow/node_tests/child_process/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/child_process/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`exec.js 1`] = ` -"/* @flow */ +/* @flow */ var exec = require('child_process').exec; @@ -20,25 +20,25 @@ exec('ls', {maxBuffer: 100}, function(error, stdout, stderr) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var exec = require(\\"child_process\\").exec; +var exec = require("child_process").exec; // callback only. -exec(\\"ls\\", function(error, stdout, stderr) { +exec("ls", function(error, stdout, stderr) { console.info(stdout); }); // options only. -exec(\\"ls\\", { timeout: 250 }); +exec("ls", { timeout: 250 }); // options + callback. -exec(\\"ls\\", { maxBuffer: 100 }, function(error, stdout, stderr) { +exec("ls", { maxBuffer: 100 }, function(error, stdout, stderr) { console.info(stdout); }); -" + `; exports[`execFile.js 1`] = ` -"/* @flow */ +/* @flow */ var execFile = require('child_process').execFile; @@ -68,36 +68,36 @@ execFile('ls', ['-l'], {timeout: 250}, function(error, stdout, stderr) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var execFile = require(\\"child_process\\").execFile; +var execFile = require("child_process").execFile; // args only. -execFile(\\"ls\\", [\\"-lh\\"]); +execFile("ls", ["-lh"]); // callback only. -execFile(\\"ls\\", function(error, stdout, stderr) { +execFile("ls", function(error, stdout, stderr) { console.info(stdout); }); // options only. -execFile(\\"wc\\", { timeout: 250 }); +execFile("wc", { timeout: 250 }); // args + callback. -execFile(\\"ls\\", [\\"-l\\"], function(error, stdout, stderr) { +execFile("ls", ["-l"], function(error, stdout, stderr) { console.info(stdout); }); // args + options. -execFile(\\"ls\\", [\\"-l\\"], { timeout: 250 }); +execFile("ls", ["-l"], { timeout: 250 }); // Put it all together. -execFile(\\"ls\\", [\\"-l\\"], { timeout: 250 }, function(error, stdout, stderr) { +execFile("ls", ["-l"], { timeout: 250 }, function(error, stdout, stderr) { console.info(stdout); }); -" + `; exports[`execSync.js 1`] = ` -"/* @flow */ +/* @flow */ var execSync = require('child_process').execSync; @@ -110,19 +110,19 @@ var execSync = require('child_process').execSync; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var execSync = require(\\"child_process\\").execSync; +var execSync = require("child_process").execSync; + +(execSync("ls"): Buffer); // returns Buffer +(execSync("ls", { encoding: "buffer" }): Buffer); // returns Buffer +(execSync("ls", { encoding: "utf8" }): string); // returns string +execSync("ls", { timeout: "250" }); // error, no signatures match +execSync("ls", { stdio: "inherit" }); // error, no signatures match +execSync("ls", { stdio: ["inherit"] }); // error, no signatures match -(execSync(\\"ls\\"): Buffer); // returns Buffer -(execSync(\\"ls\\", { encoding: \\"buffer\\" }): Buffer); // returns Buffer -(execSync(\\"ls\\", { encoding: \\"utf8\\" }): string); // returns string -execSync(\\"ls\\", { timeout: \\"250\\" }); // error, no signatures match -execSync(\\"ls\\", { stdio: \\"inherit\\" }); // error, no signatures match -execSync(\\"ls\\", { stdio: [\\"inherit\\"] }); // error, no signatures match -" `; exports[`spawn.js 1`] = ` -"/* @flow */ +/* @flow */ var child_process = require('child_process'); @@ -130,7 +130,7 @@ var ls = child_process.spawn('ls'); var wc = child_process.spawn('wc', ['-l']); // args + options. -child_process.spawn('echo', ['-n', '\\"Testing...\\"'], {env: {TEST: 'foo'}}); +child_process.spawn('echo', ['-n', '"Testing..."'], {env: {TEST: 'foo'}}); // options only. child_process.spawn('echo', {env: {FOO: 2}}); @@ -155,33 +155,33 @@ wc.stderr.pipe(process.stderr); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var child_process = require(\\"child_process\\"); +var child_process = require("child_process"); -var ls = child_process.spawn(\\"ls\\"); -var wc = child_process.spawn(\\"wc\\", [\\"-l\\"]); +var ls = child_process.spawn("ls"); +var wc = child_process.spawn("wc", ["-l"]); // args + options. -child_process.spawn(\\"echo\\", [\\"-n\\", '\\"Testing...\\"'], { env: { TEST: \\"foo\\" } }); +child_process.spawn("echo", ["-n", '"Testing..."'], { env: { TEST: "foo" } }); // options only. -child_process.spawn(\\"echo\\", { env: { FOO: 2 } }); +child_process.spawn("echo", { env: { FOO: 2 } }); -ls.stdout.on(\\"data\\", function(data) { +ls.stdout.on("data", function(data) { wc.stdin.write(data); }); -ls.stderr.on(\\"data\\", function(data) { +ls.stderr.on("data", function(data) { console.warn(data); }); -ls.on(\\"close\\", function(code) { +ls.on("close", function(code) { if (code !== 0) { - console.warn(\\"\`ls\` exited with code %s\\", code); + console.warn("\`ls\` exited with code %s", code); } wc.stdin.end(); }); wc.stdout.pipe(process.stdout); wc.stderr.pipe(process.stderr); -" + `; diff --git a/tests/flow/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap index a08a576e..be812585 100644 --- a/tests/flow/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`crypto.js 1`] = ` -"/* @flow */ +/* @flow */ const crypto = require('crypto'); @@ -42,41 +42,41 @@ let tests = [ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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); + (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 } ]; -" + `; diff --git a/tests/flow/node_tests/fs/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/fs/__snapshots__/jsfmt.spec.js.snap index f200aa9d..eee7bcbc 100644 --- a/tests/flow/node_tests/fs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/fs/__snapshots__/jsfmt.spec.js.snap @@ -1,72 +1,72 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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 -" `; diff --git a/tests/flow/node_tests/json_file/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/json_file/__snapshots__/jsfmt.spec.js.snap index 71e06018..630c86a1 100644 --- a/tests/flow/node_tests/json_file/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/json_file/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @flow let data = require('./package/index.json'); (data.foo: void); // error, should be object literal @@ -27,26 +27,26 @@ let data4 = require('./json_array'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @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 + `; diff --git a/tests/flow/node_tests/json_file/package2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/json_file/package2/__snapshots__/jsfmt.spec.js.snap index b7ae926b..049760b2 100644 --- a/tests/flow/node_tests/json_file/package2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/json_file/package2/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`index.js 1`] = ` -"// @flow +// @flow module.exports = { foo: 123 @@ -12,5 +12,5 @@ module.exports = { module.exports = { foo: 123 }; -" + `; diff --git a/tests/flow/node_tests/os/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/os/__snapshots__/jsfmt.spec.js.snap index db73cfcc..570da9fa 100644 --- a/tests/flow/node_tests/os/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/os/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`userInfo.js 1`] = ` -"/* @flow */ +/* @flow */ var os = require('os'); @@ -19,18 +19,18 @@ var u3 = os.userInfo({encoding: 'buffer'}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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); -" + `; diff --git a/tests/flow/node_tests/package_file/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/package_file/__snapshots__/jsfmt.spec.js.snap index 93a7aa6e..71f8d275 100644 --- a/tests/flow/node_tests/package_file/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/package_file/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bar_lib.js 1`] = ` -"module.exports = \\"bar_lib\\"; +module.exports = "bar_lib"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = \\"bar_lib\\"; -" +module.exports = "bar_lib"; + `; exports[`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); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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); -" + `; diff --git a/tests/flow/node_tests/package_file/bar_lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/package_file/bar_lib/__snapshots__/jsfmt.spec.js.snap index 35ab1a61..d259cbaf 100644 --- a/tests/flow/node_tests/package_file/bar_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/package_file/bar_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bar.js 1`] = ` -"module.exports = 0; +module.exports = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ module.exports = 0; -" + `; diff --git a/tests/flow/node_tests/package_file_node_modules/foo/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/package_file_node_modules/foo/__snapshots__/jsfmt.spec.js.snap index 3715733f..56503667 100644 --- a/tests/flow/node_tests/package_file_node_modules/foo/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/package_file_node_modules/foo/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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); -" + `; diff --git a/tests/flow/node_tests/path_node_modules/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/path_node_modules/__snapshots__/jsfmt.spec.js.snap index 61bc8b8e..ee82dfe7 100644 --- a/tests/flow/node_tests/path_node_modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/path_node_modules/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/node_tests/path_node_modules_with_short_main/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/path_node_modules_with_short_main/__snapshots__/jsfmt.spec.js.snap index a9c2f03c..be97aa2f 100644 --- a/tests/flow/node_tests/path_node_modules_with_short_main/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/path_node_modules_with_short_main/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/node_tests/path_node_modules_without_main/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/path_node_modules_without_main/__snapshots__/jsfmt.spec.js.snap index a9c2f03c..be97aa2f 100644 --- a/tests/flow/node_tests/path_node_modules_without_main/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/path_node_modules_without_main/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/node_tests/path_package/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/path_package/__snapshots__/jsfmt.spec.js.snap index 023ba873..73d98524 100644 --- a/tests/flow/node_tests/path_package/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/path_package/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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/flow/node_tests/stream/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/stream/__snapshots__/jsfmt.spec.js.snap index d4e044de..570de5a5 100644 --- a/tests/flow/node_tests/stream/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/stream/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`stream.js 1`] = ` -"/* @flow */ +/* @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 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'); ls.stdout.pipe(ws).end(); @@ -41,25 +41,25 @@ new MyReadStream() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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 {} @@ -73,8 +73,8 @@ new MyReadStream() .pipe(new MyWriteStream()); new MyReadStream() - .on(\\"error\\", () => {}) + .on("error", () => {}) .pipe(new MyDuplex()) - .once(\\"close\\", () => {}); -" + .once("close", () => {}); + `; diff --git a/tests/flow/node_tests/timers/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/timers/__snapshots__/jsfmt.spec.js.snap index fdfad78c..c836650c 100644 --- a/tests/flow/node_tests/timers/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/timers/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`timers.js 1`] = ` -"// @flow +// @flow function setImmediateCallback(): number { return 0; @@ -16,5 +16,5 @@ function setImmediateCallback(): number { } setImmediate(setImmediateCallback); -" + `; diff --git a/tests/flow/node_tests/url/__snapshots__/jsfmt.spec.js.snap b/tests/flow/node_tests/url/__snapshots__/jsfmt.spec.js.snap index c9285b71..37b8df0c 100644 --- a/tests/flow/node_tests/url/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/node_tests/url/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`url.js 1`] = ` -"const url = require('url'); +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/flow/nullable/__snapshots__/jsfmt.spec.js.snap b/tests/flow/nullable/__snapshots__/jsfmt.spec.js.snap index f0aea86f..e921abef 100644 --- a/tests/flow/nullable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/nullable/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`maybe.js 1`] = ` -"// @flow +// @flow // unwrapping nested maybes should work (('foo': ?(?string)): ?string); // ok @@ -10,13 +10,13 @@ exports[`maybe.js 1`] = ` // @flow // unwrapping nested maybes should work -((\\"foo\\": ??string): ?string); // ok +(("foo": ??string): ?string); // ok ((123: ??number): ?string); // error (only num ~> string) -" + `; exports[`nullable.js 1`] = ` -"function foo():string { return null; } +function foo():string { return null; } function bar():?string { return null; } @@ -60,11 +60,11 @@ if (x != null) { } var array_of_nullable: Array = [null, 3]; -" + `; exports[`simple_nullable.js 1`] = ` -"function foo(x:?string) {} +function foo(x:?string) {} function bar(x:?number) {} foo('hmm'); bar('hmm'); @@ -74,10 +74,10 @@ fn({some: 'literal'}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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/flow/number_constants/__snapshots__/jsfmt.spec.js.snap b/tests/flow/number_constants/__snapshots__/jsfmt.spec.js.snap index 295ad2ef..2d7d48e8 100644 --- a/tests/flow/number_constants/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/number_constants/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`number_constants.js 1`] = ` -"var a: number = Number.MAX_SAFE_INTEGER; +var a: number = Number.MAX_SAFE_INTEGER; var b: string = Number.MAX_SAFE_INTEGER; var c: number = Number.MIN_SAFE_INTEGER; var d: string = Number.MIN_SAFE_INTEGER; @@ -26,5 +26,5 @@ var i: number = Number.NaN; var j: string = Number.NaN; var k: number = Number.EPSILON; var l: string = Number.EPSILON; -" + `; diff --git a/tests/flow/object-method/__snapshots__/jsfmt.spec.js.snap b/tests/flow/object-method/__snapshots__/jsfmt.spec.js.snap index 5d1dad11..0a2d4c77 100644 --- a/tests/flow/object-method/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/object-method/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`id.js 1`] = ` -"declare function id(_: X): X; +declare function id(_: X): X; module.exports = id; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare function id(_: X): X; module.exports = id; -" + `; exports[`subtype.js 1`] = ` -"interface Interface { +interface Interface { m(): void; } import type { ObjectType } from './test'; @@ -22,16 +22,16 @@ function subtypeCheck(x: Interface): ObjectType { return x; } interface Interface { m(): void } -import type { ObjectType } from \\"./test\\"; +import type { ObjectType } from "./test"; function subtypeCheck(x: Interface): ObjectType { return x; } -" + `; exports[`test.js 1`] = ` -"const id = require('./id'); +const id = require('./id'); export type ObjectType = { +m: () => void, @@ -45,7 +45,7 @@ module.exports = id( methodCaller ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -const id = require(\\"./id\\"); +const id = require("./id"); export type ObjectType = { +m: () => void @@ -56,11 +56,11 @@ function methodCaller(x: ObjectType) { } module.exports = id(methodCaller); -" + `; exports[`test2.js 1`] = ` -"/* @flow */ +/* @flow */ function f() { return this.p; @@ -95,11 +95,11 @@ var b = { a.f(); // okey-dokie b.f(); // error, property \`p\` not found -" + `; exports[`test3.js 1`] = ` -"/* @flow */ +/* @flow */ function foo() { this.m(); @@ -136,5 +136,5 @@ function qux(o: { f: () => void }) { } qux({ f: foo }); // error, since \`this\` is used non-trivially in \`foo\` -" + `; diff --git a/tests/flow/object_annot/__snapshots__/jsfmt.spec.js.snap b/tests/flow/object_annot/__snapshots__/jsfmt.spec.js.snap index 124de187..e9829134 100644 --- a/tests/flow/object_annot/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/object_annot/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"function foo(x: Array): Array { +function foo(x: Array): Array { return x.sort((a, b) => a.foo - b.foo); } @@ -18,5 +18,5 @@ function foo(x: Array): Array { function bar(x: Object): Array { return Object.keys(x); } -" + `; diff --git a/tests/flow/object_api/__snapshots__/jsfmt.spec.js.snap b/tests/flow/object_api/__snapshots__/jsfmt.spec.js.snap index 3ae8fd69..ffa10f4e 100644 --- a/tests/flow/object_api/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/object_api/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a.js 1`] = ` -"/* @flow */ +/* @flow */ module.exports = { a() {} };~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ module.exports = { a() {} }; -" + `; exports[`b.js 1`] = ` -"/* @flow */ +/* @flow */ var a = require('./a'); var b = Object.assign({ bar() {}, ...{} }, a); @@ -20,29 +20,29 @@ module.exports = b; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var a = require(\\"./a\\"); +var a = require("./a"); var b = Object.assign({ bar() {}, ...{} }, a); b.a(); // works here module.exports = b; -" + `; exports[`c.js 1`] = ` -"/* @flow */ +/* @flow */ var c = require('./b'); c.a(); c.foo();~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var c = require(\\"./b\\"); +var c = require("./b"); c.a(); c.foo(); -" + `; exports[`object_assign.js 1`] = ` -"/* @flow */ +/* @flow */ var export_ = Object.assign({}, { foo: function(param) { return param; } @@ -72,11 +72,11 @@ let anyObj: Object = {}; Object.assign(anyObj, anyObj); // makes sure this terminates module.exports = export_; -" + `; exports[`object_create.js 1`] = ` -"/* @flow */ +/* @flow */ class C { foo: string; } @@ -87,7 +87,7 @@ class C { foo: string; } (Object.create(new C): C); // error, object literals don't structurally match instances -({ foo: \\"foo\\" }: C); +({ foo: "foo" }: C); // error, object types don't structurally match instances type O = { foo: string; } @@ -107,17 +107,17 @@ class C { (Object.create(new C()): C); // error, object literals don't structurally match instances -({ foo: \\"foo\\" }: C); +({ foo: "foo" }: C); // error, object types don't structurally match instances type O = { foo: string }; declare var o: O; (o: C); -" + `; exports[`object_getprototypeof.js 1`] = ` -"// @flow +// @flow class Foo {} class Bar extends Foo {} @@ -140,11 +140,11 @@ let tests = [ (Object.getPrototypeOf(x): Foo); } ]; -" + `; exports[`object_keys.js 1`] = ` -"/* @flow */ +/* @flow */ var sealed = {one: 'one', two: 'two'}; (Object.keys(sealed): Array<'one'|'two'>); @@ -179,8 +179,8 @@ class Bar extends Foo { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var sealed = { one: \\"one\\", two: \\"two\\" }; -(Object.keys(sealed): Array<\\"one\\" | \\"two\\">); +var sealed = { one: "one", two: "two" }; +(Object.keys(sealed): Array<"one" | "two">); (Object.keys(sealed): void); // error, Array var unsealed = {}; @@ -201,19 +201,19 @@ class Foo { foo() {} } // constructor and foo not enumerable -(Object.keys(new Foo()): Array<\\"error\\">); // error: prop ~> error +(Object.keys(new Foo()): Array<"error">); // error: prop ~> error class Bar extends Foo { bar_prop: string; bar() {} } // only own enumerable props -(Object.keys(new Bar()): Array<\\"error\\">); // error: bar_prop ~> error -" +(Object.keys(new Bar()): Array<"error">); // error: bar_prop ~> error + `; exports[`object_missing.js 1`] = ` -"// @flow +// @flow let tests = [ function() { @@ -228,11 +228,11 @@ let tests = [ Object.doesNotExist(); } ]; -" + `; exports[`object_prototype.js 1`] = ` -"/* @flow */ +/* @flow */ function takesABool(x: boolean) {} function takesAString(x: string) {} @@ -361,7 +361,7 @@ var yValueOf : number = y.valueOf; // error takesAnObject(y.valueOf()); // ... on a literal -var strValueOf : string = (\\"foo\\").valueOf(); +var strValueOf : string = ("foo").valueOf(); var numValueOf : number = (123).valueOf(); var boolValueOf : boolean = (true).valueOf(); @@ -406,15 +406,15 @@ function takesAnObject(x: Object) {} class Foo {} -var a = { foo: \\"bar\\" }; -var b = { foo: \\"bar\\", ...{} }; +var a = { foo: "bar" }; +var b = { foo: "bar", ...{} }; var c = { - foo: \\"bar\\", + foo: "bar", toString: function(): number { return 123; } }; -var d: { [key: string]: string } = { foo: \\"bar\\" }; +var d: { [key: string]: string } = { foo: "bar" }; var x = new Date(); var y = new Foo(); @@ -433,7 +433,7 @@ takesAString(aToString2()); // set b.toString = function(): string { - return \\"foo\\"; + return "foo"; }; c.toString = function(): number { return 123; @@ -456,7 +456,7 @@ takesAString(y.toString()); (123).toString; (123).toString = function() {}; // error (123).toString(2); -(123).toString(\\"foo\\"); // error +(123).toString("foo"); // error (123).toString(null); // error // @@ -464,12 +464,12 @@ takesAString(y.toString()); // // call -takesABool(a.hasOwnProperty(\\"foo\\")); +takesABool(a.hasOwnProperty("foo")); // get var aHasOwnProperty: (prop: string) => boolean = a.hasOwnProperty; var aHasOwnProperty2 = a.hasOwnProperty; -takesABool(aHasOwnProperty2(\\"bar\\")); +takesABool(aHasOwnProperty2("bar")); // set b.hasOwnProperty = function() { @@ -479,23 +479,23 @@ b.hasOwnProperty = function() { // ... on a built-in instance var xHasOwnProperty: number = x.hasOwnProperty; // error var xHasOwnProperty2: (prop: string) => number = x.hasOwnProperty; // error -takesABool(x.hasOwnProperty(\\"foo\\")); +takesABool(x.hasOwnProperty("foo")); // ... on an instance var yHasOwnProperty: number = y.hasOwnProperty; // error -takesABool(y.hasOwnProperty(\\"foo\\")); +takesABool(y.hasOwnProperty("foo")); // // propertyIsEnumerable // // call -takesABool(a.propertyIsEnumerable(\\"foo\\")); +takesABool(a.propertyIsEnumerable("foo")); // get var aPropertyIsEnumerable: (prop: string) => boolean = a.propertyIsEnumerable; var aPropertyIsEnumerable2 = a.propertyIsEnumerable; -takesABool(aPropertyIsEnumerable2(\\"bar\\")); +takesABool(aPropertyIsEnumerable2("bar")); // set b.propertyIsEnumerable = function() { @@ -505,11 +505,11 @@ b.propertyIsEnumerable = function() { // ... on a built-in instance var xPropertyIsEnumerable: number = x.propertyIsEnumerable; // error var xPropertyIsEnumerable2: (prop: string) => number = x.propertyIsEnumerable; // error -takesABool(x.propertyIsEnumerable(\\"foo\\")); +takesABool(x.propertyIsEnumerable("foo")); // ... on an instance var yPropertyIsEnumerable: number = y.propertyIsEnumerable; // error -takesABool(y.propertyIsEnumerable(\\"foo\\")); +takesABool(y.propertyIsEnumerable("foo")); // // valueOf @@ -537,7 +537,7 @@ var yValueOf: number = y.valueOf; // error takesAnObject(y.valueOf()); // ... on a literal -var strValueOf: string = \\"foo\\".valueOf(); +var strValueOf: string = "foo".valueOf(); var numValueOf: number = (123).valueOf(); var boolValueOf: boolean = true.valueOf(); @@ -555,7 +555,7 @@ takesAString(aToLocaleString2()); // set b.toLocaleString = function() { - return \\"derp\\"; + return "derp"; }; // ... on a built-in instance @@ -573,5 +573,5 @@ takesAString(y.toLocaleString()); var k: Object = a.constructor; (123).constructor; -" + `; diff --git a/tests/flow/object_assign/__snapshots__/jsfmt.spec.js.snap b/tests/flow/object_assign/__snapshots__/jsfmt.spec.js.snap index 9856cd60..22d5b38b 100644 --- a/tests/flow/object_assign/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/object_assign/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/** +/** * @flow */ @@ -32,12 +32,12 @@ module.exports = { * @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\\"; + return "hi"; } }); @@ -48,7 +48,7 @@ var bad: number = Bad.foo(); class MyEventEmitter extends events$EventEmitter {} var Good = Object.assign({}, MyEventEmitter.prototype, { foo: function(): string { - return \\"hi\\"; + return "hi"; } }); // Calling Good.foo() in the same file doesn't error @@ -58,11 +58,11 @@ module.exports = { Bad: Bad, Good: Good }; -" + `; exports[`B.js 1`] = ` -"/** +/** * @flow */ @@ -84,7 +84,7 @@ A.js|8 col 23 error| object literal * @flow */ -var A = require(\\"./A.js\\"); +var A = require("./A.js"); var good: number = A.Good.foo(); @@ -97,40 +97,40 @@ B.js|12 col 1 error| call of method foo || Property not found in A.js|8 col 23 error| object literal */ -" + `; exports[`apply.js 1`] = ` -"// @flow +// @flow (Object.assign.apply(null, [{}, {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 }); -" + `; exports[`non_objects.js 1`] = ` -"/* @flow */ +/* @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[`spread.js 1`] = ` -"// @flow +// @flow declare var arrOfObjs: Array<{ foo: string }>; declare var roArrOfObjs: $ReadOnlyArray<{foo: string}>; @@ -156,16 +156,16 @@ declare var tup: [{ foo: string }, { bar: number }]; (Object.assign({}, ...roArrOfObjs): { foo: number }); // Error: string ~> number (Object.assign({}, ...tup): { foo: string, bar: boolean }); // Error: number ~> boolean -(Object.assign({}, ...[{ a: 1 }, { b: \\"foo\\" }], ...[{ c: true }]): { +(Object.assign({}, ...[{ a: 1 }, { b: "foo" }], ...[{ c: true }]): { a: number, b: true, c: boolean }); // Error: 'foo' => true -" + `; exports[`undefined.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); @@ -188,7 +188,7 @@ class MyReactThing extends React.Component { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); +var React = require("react"); type DefaultProps = { foo: number @@ -208,5 +208,5 @@ class MyReactThing extends React.Component { ; // works ; // also works -" + `; diff --git a/tests/flow/object_freeze/__snapshots__/jsfmt.spec.js.snap b/tests/flow/object_freeze/__snapshots__/jsfmt.spec.js.snap index 1994cb92..0a5d2962 100644 --- a/tests/flow/object_freeze/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/object_freeze/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`object_freeze.js 1`] = ` -"/* @flow */ +/* @flow */ var foo = Object.freeze({bar: '12345'}); foo.bar = '23456'; // error @@ -20,18 +20,18 @@ 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 */ -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 @@ -41,6 +41,6 @@ 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/flow/object_is/__snapshots__/jsfmt.spec.js.snap b/tests/flow/object_is/__snapshots__/jsfmt.spec.js.snap index bbb4af7e..63277d2c 100644 --- a/tests/flow/object_is/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/object_is/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`object_is.js 1`] = ` -"Object.is(1, 1); +Object.is(1, 1); Object.is(1, 2); Object.is(1, {}); Object.is(1, NaN); @@ -42,9 +42,9 @@ 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/flow/objects/__snapshots__/jsfmt.spec.js.snap b/tests/flow/objects/__snapshots__/jsfmt.spec.js.snap index 043f2a8b..4080fdef 100644 --- a/tests/flow/objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/objects/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`compatibility.js 1`] = ` -"let tests = [ +let tests = [ function(x: { x: { foo: string } }, y: { x: { bar: number } }) { x = y; // 2 errors: \`foo\` not found in y.x; \`bar\` not found in x.x }, @@ -60,14 +60,14 @@ let tests = [ x = y; // 2 errors: string !~> number; number !~> string } ]; -" + `; exports[`conversion.js 1`] = ` -"/* @flow */ +/* @flow */ (Object({foo: 'bar'}): {foo: string}); -(Object(\\"123\\"): String); +(Object("123"): String); (Object(123): Number); (Object(true): Boolean); (Object(null): {}); @@ -76,9 +76,9 @@ exports[`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) @@ -86,8 +86,8 @@ var z = Object(123); // error (next line makes this not match any signatures) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @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): {}); @@ -96,18 +96,18 @@ var z = Object(123); // error (next line makes this not match any signatures) (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) (z.charAt(0): string); -" + `; exports[`objects.js 1`] = ` -"/* @flow */ +/* @flow */ var x : {'123': string, bar: string} = {'123': 'val', bar: 'bar'}; (x.foo : string); // error, key doesn't exist @@ -128,27 +128,27 @@ y['bar'] = 'abc'; // error, property not found ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var x: { \\"123\\": string, bar: string } = { \\"123\\": \\"val\\", bar: \\"bar\\" }; +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["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"]: 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" + "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 -" `; exports[`unaliased_assign.js 1`] = ` -"/** +/** * test handling of unaliased value assignment. * * An unaliased object rvalue may be assigned to a supertype lvalue, @@ -162,17 +162,17 @@ exports[`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: "hey" }; obj.x = 10; // ok, by lvalue's given type } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -190,18 +190,18 @@ function assign_then_widen() { * @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: "hey" }; obj.x = 10; // ok, by lvalue's given type } -" + `; diff --git a/tests/flow/objmap/__snapshots__/jsfmt.spec.js.snap b/tests/flow/objmap/__snapshots__/jsfmt.spec.js.snap index c1720fda..90b77474 100644 --- a/tests/flow/objmap/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/objmap/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`objmap.js 1`] = ` -"declare function promiseAllByKey(o: O): Promise<$ObjMap>; +declare function promiseAllByKey(o: O): Promise<$ObjMap>; declare function keyMirror(o: O): $ObjMapi(k:K) => K>; var o = keyMirror({ @@ -28,15 +28,15 @@ var o = keyMirror({ BAR: null }); -(o.FOO: \\"FOO\\"); // ok -(o.FOO: \\"BAR\\"); // error, 'FOO' incompatible with 'BAR' +(o.FOO: "FOO"); // ok +(o.FOO: "BAR"); // error, 'FOO' incompatible with 'BAR' promiseAllByKey({ foo: Promise.resolve(0), - bar: \\"bar\\" + bar: "bar" }).then(o => { (o.foo: string); // error, number ~> string - (o.bar: \\"bar\\"); // ok + (o.bar: "bar"); // ok }); -" + `; diff --git a/tests/flow/optional/__snapshots__/jsfmt.spec.js.snap b/tests/flow/optional/__snapshots__/jsfmt.spec.js.snap index fb869555..370e8241 100644 --- a/tests/flow/optional/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/optional/__snapshots__/jsfmt.spec.js.snap @@ -1,29 +1,29 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`client_optional.js 1`] = ` -"var qux = require('./optional'); +var qux = require('./optional'); qux(0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var qux = require(\\"./optional\\"); +var qux = require("./optional"); qux(0); -" + `; exports[`default.js 1`] = ` -"function f(foo, bar = foo): [T, T] { +function f(foo, bar = foo): [T, T] { return [foo, bar]; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function f(foo, bar = foo): [T, T] { return [foo, bar]; } -" + `; exports[`generic.js 1`] = ` -"function x(x: T = 0) {} +function x(x: T = 0) {} class C { x(x: T = 0) {} @@ -34,39 +34,39 @@ function x(x: T = 0) {} class C { x(x: T = 0) {} } -" + `; exports[`loop.js 1`] = ` -"/* Regression test. Improper handling of OptionalT repositioning can cause - * reasons to grow \\"optional x\\" -> \\"optional optional x\\" -> \\"optional optional - * optional x\\", which thwarts reason-based caches that prevent nontermination. +/* Regression test. Improper handling of OptionalT repositioning can cause + * reasons to grow "optional x" -> "optional optional x" -> "optional optional + * optional x", which thwarts reason-based caches that prevent nontermination. */ function f(x:T,y?:T) { x = y } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* Regression test. Improper handling of OptionalT repositioning can cause - * reasons to grow \\"optional x\\" -> \\"optional optional x\\" -> \\"optional optional - * optional x\\", which thwarts reason-based caches that prevent nontermination. + * reasons to grow "optional x" -> "optional optional x" -> "optional optional + * optional x", which thwarts reason-based caches that prevent nontermination. */ function f(x: T, y?: T) { x = y; } -" + `; exports[`maybe.js 1`] = ` -"function foo(x?: string): ?string { +function foo(x?: string): ?string { return x; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x?: string): ?string { return x; } -" + `; exports[`nullable.js 1`] = ` -"/* @flow */ +/* @flow */ function optionalNullable1(x: {y?: ?number}) { if (x.y !== null && x.y !== undefined) { @@ -165,21 +165,21 @@ function optionalNullable8(x: { y?: ?number }) { x.y++; } } -" + `; exports[`optional.js 1`] = ` -"function bar(x?,y?) { x * 0; } +function bar(x?,y?) { x * 0; } bar(0); var foo:(x?:number)=>void = bar; foo(); -function qux(x=\\"hello\\",...y):string { foo(x); return y[0]; } +function qux(x="hello",...y):string { foo(x); return y[0]; } qux(0,0); // Error, number ~> string -qux(0,...[42, \\"\\"]); // Error, number ~> string -qux(0,...[\\"\\",42]); // No error +qux(0,...[42, ""]); // Error, number ~> string +qux(0,...["",42]); // No error module.exports = qux; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -191,21 +191,21 @@ bar(0); var foo: (x?: number) => void = bar; foo(); -function qux(x = \\"hello\\", ...y): string { +function qux(x = "hello", ...y): string { foo(x); return y[0]; } qux(0, 0); // Error, number ~> string -qux(0, ...[42, \\"\\"]); // Error, number ~> string -qux(0, ...[\\"\\", 42]); // No error +qux(0, ...[42, ""]); // Error, number ~> string +qux(0, ...["", 42]); // No error module.exports = qux; -" + `; exports[`optional_param.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x?: string): string { if (x == null) { return 'foo'; } return x; @@ -226,7 +226,7 @@ function testOptionalNullable(x?: ?string): string { return x; } -function testOptionalNullableDefault(x?: ?string = \\"hi\\"): string { +function testOptionalNullableDefault(x?: ?string = "hi"): string { if (x == null) { return 'foo'; } return x; } @@ -244,14 +244,14 @@ function testOptionalNullableFlowingToNullable(x?: ?string): ?string { /* @flow */ function foo(x?: string): string { if (x == null) { - return \\"foo\\"; + return "foo"; } return x; } function bar(obj: { x?: string }): string { if (obj.x == null) { - return \\"foo\\"; + return "foo"; } return obj.x; } @@ -265,21 +265,21 @@ function baz(bar?) { function testOptionalNullable(x?: ?string): string { if (x == null) { - return \\"foo\\"; + return "foo"; } return x; } -function testOptionalNullableDefault(x?: ?string = \\"hi\\"): string { +function testOptionalNullableDefault(x?: ?string = "hi"): string { if (x == null) { - return \\"foo\\"; + return "foo"; } return x; } function testOptionalNullableProperty(obj: { x?: ?string }): string { if (obj.x == null) { - return \\"foo\\"; + return "foo"; } return obj.x; } @@ -288,11 +288,11 @@ function testOptionalNullableFlowingToNullable(x?: ?string): ?string { var f = function(y: ?string) {}; f(x); } -" + `; exports[`optional_param2.js 1`] = ` -"declare class I { +declare class I { map( mapper: (value?: V) => M ): I; @@ -305,14 +305,14 @@ declare class I { } var i: I = new I(); var j: I = i.map(id => id); -" + `; exports[`optional_param3.js 1`] = ` -"function foo(x?: number) {} +function foo(x?: number) {} foo(undefined); // ok -function bar(x = \\"bar\\"): string { +function bar(x = "bar"): string { return x; } bar(undefined); // ok @@ -320,15 +320,15 @@ bar(undefined); // ok function foo(x?: number) {} foo(undefined); // ok -function bar(x = \\"bar\\"): string { +function bar(x = "bar"): string { return x; } bar(undefined); // ok -" + `; exports[`optional_param4.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x?: number, ...y: Array): [?number, Array] { return [x, y]; @@ -349,15 +349,15 @@ function foo(x?: number, ...y: Array): [?number, Array] { } foo(); // OK -foo(123), foo(123, \\"hello\\"); // OK // OK +foo(123), foo(123, "hello"); // OK // OK foo(true); // ERROR boolean ~> number foo(123, true); // ERROR boolean ~> string -" + `; exports[`undefined.js 1`] = ` -"var x; +var x; function foo(bar? = undefined) { x = bar; @@ -376,11 +376,11 @@ function foo(bar? = undefined) { function bar() { return x.duck; } -" + `; exports[`undefined2.js 1`] = ` -"var x; +var x; function foo(bar?) { x = bar; @@ -399,5 +399,5 @@ function foo(bar?) { function bar() { return x.duck; } -" + `; diff --git a/tests/flow/optional_props/__snapshots__/jsfmt.spec.js.snap b/tests/flow/optional_props/__snapshots__/jsfmt.spec.js.snap index bc57d645..1503daf8 100644 --- a/tests/flow/optional_props/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/optional_props/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"var x: { } = { foo: 0 }; +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 @@ -12,12 +12,12 @@ o.foo = 0; // future widening is constrained function bar(config: { foo?: number }) {} bar({}); -bar({foo: \\"\\"}); +bar({foo: ""}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 @@ -25,12 +25,12 @@ o.foo = 0; // future widening is constrained function bar(config: { foo?: number }) {} bar({}); -bar({ foo: \\"\\" }); -" +bar({ foo: "" }); + `; exports[`test2.js 1`] = ` -"var a: { foo?: string } = {}; +var a: { foo?: string } = {}; a.foo = undefined; // This is not an error a.foo = null; // But this is an error @@ -57,11 +57,11 @@ var d: { foo?: string } = { foo: null }; // But this is an error var e: { foo?: ?string } = { foo: undefined }; // This is fine var f: { foo?: ?string } = { foo: null }; // Also fine -" + `; exports[`test3.js 1`] = ` -"// @flow +// @flow /* object literals are sealed. this is simply a heuristic @@ -171,14 +171,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"; } } -" + `; exports[`test3_exact_annot.js 1`] = ` -"/* The logic that allows ({}: {p?:T}), described in test3.js, should _not_ also +/* The logic that allows ({}: {p?:T}), described in test3.js, should _not_ also fire for exact annotations. */ const a: {| a: number |} = { a: 1 }; @@ -193,11 +193,11 @@ const a: {| a: number |} = { a: 1 }; const b: { a: number, b?: number } = a; // error: property \`b\` not found b.b = 0; // because subsequent writes would widen the exact object (a.b: number); // error: property \`b\` not found -" + `; exports[`test3_failure.js 1`] = ` -"// generalization of failure in test3.js +// generalization of failure in test3.js class A { o: O; @@ -213,8 +213,8 @@ 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) } } -" + `; diff --git a/tests/flow/overload/__snapshots__/jsfmt.spec.js.snap b/tests/flow/overload/__snapshots__/jsfmt.spec.js.snap index 813dfaae..1a3f492a 100644 --- a/tests/flow/overload/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/overload/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`overload.js 1`] = ` -"/** +/** * tests of overload selection * * @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; @@ -23,11 +23,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 }; @@ -49,7 +49,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); */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -59,10 +59,10 @@ var z2:Array = new Dummy().dumber(bar2); * @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, @@ -75,11 +75,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 }; @@ -101,14 +101,14 @@ 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); */ -" + `; exports[`test.js 1`] = ` -"function foo() { +function foo() { var output = new FakeUint8Array(); output.set(new FakeUint8Array(), 0); // matches one of the overloads of set } @@ -117,11 +117,11 @@ function foo() { var output = new FakeUint8Array(); output.set(new FakeUint8Array(), 0); // matches one of the overloads of set } -" + `; exports[`test2.js 1`] = ` -"declare class Foo { +declare class Foo { bar(x: 'hmm'): number; bar(x: string): string; } @@ -130,17 +130,17 @@ var foo = new Foo; (foo.bar('hmmm'): number); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 + `; exports[`test3.js 1`] = ` -"// passing a union-like thing into an overload is ok +// passing a union-like thing into an overload is ok // if overload handles each branch of union-like thing // unions @@ -183,20 +183,20 @@ declare function h(x: void): void; declare function h(x: string): void; declare var x_h: { p?: string }; h(x_h.p); // ok -" + `; exports[`union.js 1`] = ` -"function foo (x: $Either,U>): Array { return []; } +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/flow/overload/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/overload/lib/__snapshots__/jsfmt.spec.js.snap index a4b3da9f..2e3a1eab 100644 --- a/tests/flow/overload/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/overload/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`lib.js 1`] = ` -"declare class FakeUint8Array { +declare class FakeUint8Array { set(index: number, value: number): void; set(array: FakeUint8Array | Array, offset?: number): void; } @@ -10,5 +10,5 @@ declare class FakeUint8Array { set(index: number, value: number): void, set(array: FakeUint8Array | Array, offset?: number): void } -" + `; diff --git a/tests/flow/parse/__snapshots__/jsfmt.spec.js.snap b/tests/flow/parse/__snapshots__/jsfmt.spec.js.snap index 9132e2ac..6c57c2db 100644 --- a/tests/flow/parse/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/parse/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`no_parse_error.js 1`] = ` -"/* +/* @flow */ @@ -17,12 +17,12 @@ var z: { @flow */ -var x = \\"Test\\"; +var x = "Test"; var y = 5 / x; var z: { type: number, y: string -} = { type: 1, y: \\"hey\\" }; -" +} = { type: 1, y: "hey" }; + `; diff --git a/tests/flow/parse_error_haste/__snapshots__/jsfmt.spec.js.snap b/tests/flow/parse_error_haste/__snapshots__/jsfmt.spec.js.snap index c29fce30..b24a521c 100644 --- a/tests/flow/parse_error_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/parse_error_haste/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Client.js 1`] = ` -"/** +/** * Client imports some but not all modules, * triggering/suppressing parse errors. * @flow */ // non-flow files should not show parse errors -var A = require(\\"Foo\\"); // non-Flow file @providesModule Foo -var B = require(\\"./NoProvides\\"); // non-Flow file +var A = require("Foo"); // non-Flow file @providesModule Foo +var B = require("./NoProvides"); // non-Flow file -var C = require(\\"./ParseError\\"); // Flow file +var C = require("./ParseError"); // Flow file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Client imports some but not all modules, @@ -20,9 +20,9 @@ var C = require(\\"./ParseError\\"); // Flow file */ // non-flow files should not show parse errors -var A = require(\\"Foo\\"); // non-Flow file @providesModule Foo -var B = require(\\"./NoProvides\\"); // non-Flow file +var A = require("Foo"); // non-Flow file @providesModule Foo +var B = require("./NoProvides"); // non-Flow file + +var C = require("./ParseError"); // Flow file -var C = require(\\"./ParseError\\"); // Flow file -" `; diff --git a/tests/flow/parse_error_node/__snapshots__/jsfmt.spec.js.snap b/tests/flow/parse_error_node/__snapshots__/jsfmt.spec.js.snap index 794d5d41..8b4a25ba 100644 --- a/tests/flow/parse_error_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/parse_error_node/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Client.js 1`] = ` -"/** +/** * Client imports some but not all modules, * triggering/suppressing parse errors. * @flow */ // non-flow files should not give parse errors -var A = require(\\"./Imported\\"); // non-Flow file @providesModule Foo +var A = require("./Imported"); // non-Flow file @providesModule Foo -var B = require(\\"./ParseError\\"); // Flow file +var B = require("./ParseError"); // Flow file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Client imports some but not all modules, @@ -19,8 +19,8 @@ var B = require(\\"./ParseError\\"); // Flow file */ // non-flow files should not give parse errors -var A = require(\\"./Imported\\"); // non-Flow file @providesModule Foo +var A = require("./Imported"); // non-Flow file @providesModule Foo + +var B = require("./ParseError"); // Flow file -var B = require(\\"./ParseError\\"); // Flow file -" `; diff --git a/tests/flow/path/__snapshots__/jsfmt.spec.js.snap b/tests/flow/path/__snapshots__/jsfmt.spec.js.snap index 96726736..25ff433f 100644 --- a/tests/flow/path/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/path/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`while.js 1`] = ` -"var x = 1; -while(typeof x == \\"number\\" || typeof x == \\"string\\") { +var x = 1; +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 = \\"\\"; + if (true) x = ""; } var z: number = x; -" + `; diff --git a/tests/flow/plsummit/__snapshots__/jsfmt.spec.js.snap b/tests/flow/plsummit/__snapshots__/jsfmt.spec.js.snap index 5c941a0a..d7a52ee0 100644 --- a/tests/flow/plsummit/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/plsummit/__snapshots__/jsfmt.spec.js.snap @@ -1,22 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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; -" + `; exports[`export_class.js 1`] = ` -"class C { +class C { x: number; constructor(x: number) { this.x = x; } } @@ -31,11 +31,11 @@ class C { } module.exports = C; -" + `; exports[`generics.js 1`] = ` -"/* @flow */ +/* @flow */ var r: number = 0; function foo(x: X): X { r = x; return x; } @@ -47,22 +47,22 @@ function foo(x: X): X { r = x; return x; } -" + `; exports[`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 = require("./export_class"); + +var c = new C(""); -var c = new C(\\"\\"); -" `; exports[`locals.js 1`] = ` -"/* @flow */ +/* @flow */ function foo() { var x = 0; @@ -70,7 +70,7 @@ function foo() { } function bar(x: ?string): number { - if (x == null) x = \\"\\"; + if (x == null) x = ""; return x.length; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -82,14 +82,14 @@ function foo() { } function bar(x: ?string): number { - if (x == null) x = \\"\\"; + if (x == null) x = ""; return x.length; } -" + `; exports[`objects.js 1`] = ` -"function C() { this.x = 0; } +function C() { this.x = 0; } C.prototype.foo = function() { return this.x; } var c = new C(); @@ -97,7 +97,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(); @@ -119,10 +119,10 @@ 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/flow/poly/__snapshots__/jsfmt.spec.js.snap b/tests/flow/poly/__snapshots__/jsfmt.spec.js.snap index 48d7a707..c48c6869 100644 --- a/tests/flow/poly/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/poly/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`annot.js 1`] = ` -"class A { } +class A { } new A; // OK, implicitly inferred type args class B extends A { } // OK, same as above @@ -26,11 +26,11 @@ function bar(): A<*> { // error, * can't be {} and {x: string} at the same time return (new A(): A<{}>) || (new A(): A<{ x: string }>); } -" + `; exports[`implicit_bounded_instantiation.js 1`] = ` -"// @flow +// @flow class Base {} class Middle extends Base {} @@ -71,11 +71,11 @@ a.meth(new Middle()); a.meth(new Child()); a.meth(42); // Error: number ~> Middle a.meth(new Base()); // Error: Base ~> Middle -" + `; exports[`issue-1029.js 1`] = ` -"// @flow +// @flow // naive unification causes combinatorial explosion here, // effectively hangs @@ -112,11 +112,11 @@ declare var bool: Box; declare function unbox(box: Box): A; unbox(bool); -" + `; exports[`poly.js 1`] = ` -"class Foo { +class Foo { x:T; constructor(x:T) { this.x = x; } } @@ -133,7 +133,7 @@ declare var Q: { var foo = new Foo(0); var x:string = foo.x; -var z:Foo = Q.bar(foo,\\"\\"); +var z:Foo = Q.bar(foo,""); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Foo { x: T; @@ -156,12 +156,12 @@ declare var Q: { var foo = new Foo(0); var x: string = foo.x; -var z: Foo = Q.bar(foo, \\"\\"); -" +var z: Foo = Q.bar(foo, ""); + `; exports[`test.js 1`] = ` -"class C { +class C { foo(x: X): X { return x; } foo_(x: X): number { return x; } bar(x: X): X { return x; } @@ -202,5 +202,5 @@ class D extends C { return x; } // OK (generalization) } -" + `; diff --git a/tests/flow/poly_class_export/__snapshots__/jsfmt.spec.js.snap b/tests/flow/poly_class_export/__snapshots__/jsfmt.spec.js.snap index db73d517..82ff0de6 100644 --- a/tests/flow/poly_class_export/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/poly_class_export/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"// @flow +// @flow class A { x: T @@ -16,11 +16,11 @@ class A { } module.exports = A; -" + `; exports[`B.js 1`] = ` -"// @flow +// @flow let A = require('./A'); @@ -34,7 +34,7 @@ module.exports = new B(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -let A = require(\\"./A\\"); +let A = require("./A"); class B extends A { constructor() { @@ -43,11 +43,11 @@ class B extends A { } module.exports = new B(); -" + `; exports[`C.js 1`] = ` -"// @flow +// @flow // This test exports a function whose return type is the class's \`this\` type. // It should be inferred (no annotation required). @@ -76,5 +76,5 @@ class Foo { export function f(x: Foo) { return x.foo(); } -" + `; diff --git a/tests/flow/poly_overload/decls/__snapshots__/jsfmt.spec.js.snap b/tests/flow/poly_overload/decls/__snapshots__/jsfmt.spec.js.snap index 84559bd9..d2292a22 100644 --- a/tests/flow/poly_overload/decls/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/poly_overload/decls/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`typescript-deferred.js 1`] = ` -"interface Some {} +interface Some {} interface Other { x: X; } interface None {} interface Nada { y: Y } @@ -34,5 +34,5 @@ interface B extends A { foo(s: Other, e: None): B, foo(s: Other, e: Nada): B } -" + `; diff --git a/tests/flow/predicates-abstract/__snapshots__/jsfmt.spec.js.snap b/tests/flow/predicates-abstract/__snapshots__/jsfmt.spec.js.snap index 80832bdb..0d742d4d 100644 --- a/tests/flow/predicates-abstract/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/predicates-abstract/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`filter.js 1`] = ` -"// @flow +// @flow // Filter the contents of an array @@ -12,7 +12,7 @@ const barr = my_filter(arr, is_string); (barr: Array); function is_string(x): %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow @@ -29,13 +29,13 @@ const barr = my_filter(arr, is_string); (barr: Array); function is_string(x): %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } -" + `; exports[`filter-union.js 1`] = ` -"// @flow +// @flow // Filter the contents of an array @@ -62,24 +62,24 @@ declare function my_filter>( cb: P ): Array<$Refine>; -type A = { kind: \\"A\\", u: number }; -type B = { kind: \\"B\\", v: string }; -type C = { kind: \\"C\\", y: boolean }; -type D = { kind: \\"D\\", x: boolean }; -type E = { kind: \\"E\\", y: boolean }; +type A = { kind: "A", u: number }; +type B = { kind: "B", v: string }; +type C = { kind: "C", y: boolean }; +type D = { kind: "D", x: boolean }; +type E = { kind: "E", y: boolean }; declare var ab: Array; -(my_filter(ab, (x): %checks => x.kind === \\"A\\"): Array); // OK -(my_filter(ab, (x): %checks => x.kind !== \\"A\\"): Array); // OK -" +(my_filter(ab, (x): %checks => x.kind === "A"): Array); // OK +(my_filter(ab, (x): %checks => x.kind !== "A"): Array); // OK + `; exports[`refine.js 1`] = ` -"// @flow +// @flow /* - $Pred is an \\"abstract predicate type\\", i.e. denotes a (function) type that + $Pred is an "abstract predicate type", i.e. denotes a (function) type that refines N variables. So if \`cb\` is a function, then it should be refining exactly N argument. It is abstract in that we do not need to specify: (a) which variables are going to be refined (just the number), or (b) what @@ -116,17 +116,17 @@ declare function refine2>(v: T, w: T, cb: P): $Refine; // { if (cb(v, w)) { return w; } else { throw new Error(); } } function is_string(x): boolean %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } function is_string_and_number(x, y): %checks { - return typeof x === \\"string\\" && typeof y === \\"number\\"; + return typeof x === "string" && typeof y === "number"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow /* - $Pred is an \\"abstract predicate type\\", i.e. denotes a (function) type that + $Pred is an "abstract predicate type", i.e. denotes a (function) type that refines N variables. So if \`cb\` is a function, then it should be refining exactly N argument. It is abstract in that we do not need to specify: (a) which variables are going to be refined (just the number), or (b) what @@ -166,17 +166,17 @@ declare function refine2>(v: T, w: T, cb: P): $Refine; // { if (cb(v, w)) { return w; } else { throw new Error(); } } function is_string(x): boolean %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } function is_string_and_number(x, y): %checks { - return typeof x === \\"string\\" && typeof y === \\"number\\"; + return typeof x === "string" && typeof y === "number"; } -" + `; exports[`sanity-filter.js 1`] = ` -"// @flow +// @flow declare function my_filter>(v: Array, cb: P): Array<$Refine>; @@ -192,11 +192,11 @@ const d = my_filter(c, is_string_regular); (d: Array); function is_string(x): boolean %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } function is_string_regular(x): boolean { - return typeof x === \\"string\\"; + return typeof x === "string"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow @@ -217,17 +217,17 @@ const d = my_filter(c, is_string_regular); (d: Array); function is_string(x): boolean %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } function is_string_regular(x): boolean { - return typeof x === \\"string\\"; + return typeof x === "string"; } -" + `; exports[`sanity-filter-union.js 1`] = ` -"// @flow +// @flow // Filter the contents of an array @@ -254,21 +254,21 @@ declare function my_filter>( cb: P ): Array<$Refine>; -type A = { kind: \\"A\\", u: number }; -type B = { kind: \\"B\\", v: string }; -type C = { kind: \\"C\\", y: boolean }; -type D = { kind: \\"D\\", x: boolean }; -type E = { kind: \\"E\\", y: boolean }; +type A = { kind: "A", u: number }; +type B = { kind: "B", v: string }; +type C = { kind: "C", y: boolean }; +type D = { kind: "D", x: boolean }; +type E = { kind: "E", y: boolean }; declare var ab: Array; -(my_filter(ab, (x): %checks => x.kind === \\"A\\"): Array); // ERROR -(my_filter(ab, (x): %checks => x.kind !== \\"A\\"): Array); // ERROR -" +(my_filter(ab, (x): %checks => x.kind === "A"): Array); // ERROR +(my_filter(ab, (x): %checks => x.kind !== "A"): Array); // ERROR + `; exports[`sanity-refine.js 1`] = ` -"// @flow +// @flow // Sanity check A: the refinment position index is outside of the allowed range declare function refine>(v: T, cb: P): $Refine; @@ -290,7 +290,7 @@ var e = refine3(c, d, e, is_string_and_number); (e: string); function is_string_and_number(x, y): %checks { - return typeof x === \\"string\\" && typeof y === \\"number\\"; + return typeof x === "string" && typeof y === "number"; } @@ -302,15 +302,15 @@ var e = refine(a, is_string_regular); // ERROR: is_string_regular is not a //////////////////////////////////////////////////////////////////////////////// function is_string(x): %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } function is_string_regular(x) { - return typeof x === \\"string\\"; + return typeof x === "string"; } function is_string_and_number(x, y): %checks { - return typeof x === \\"string\\" && typeof y === \\"number\\"; + return typeof x === "string" && typeof y === "number"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow @@ -339,7 +339,7 @@ var e = refine3(c, d, e, is_string_and_number); (e: string); function is_string_and_number(x, y): %checks { - return typeof x === \\"string\\" && typeof y === \\"number\\"; + return typeof x === "string" && typeof y === "number"; } // Sanity check C: expecting a predicate function but passed a non-predicate one @@ -350,15 +350,15 @@ var e = refine(a, is_string_regular); // ERROR: is_string_regular is not a //////////////////////////////////////////////////////////////////////////////// function is_string(x): %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } function is_string_regular(x) { - return typeof x === \\"string\\"; + return typeof x === "string"; } function is_string_and_number(x, y): %checks { - return typeof x === \\"string\\" && typeof y === \\"number\\"; + return typeof x === "string" && typeof y === "number"; } -" + `; diff --git a/tests/flow/predicates-declared/__snapshots__/jsfmt.spec.js.snap b/tests/flow/predicates-declared/__snapshots__/jsfmt.spec.js.snap index 50dc606c..8b749a3e 100644 --- a/tests/flow/predicates-declared/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/predicates-declared/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`function-bind.js 1`] = ` -"// @flow +// @flow // Sanity checks: // - use of bind in a position of a function predicate. @@ -39,7 +39,7 @@ class D { } declare var m: Function; -const x = \\"\\"; +const x = ""; if (m.bind(this)(x)) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow @@ -80,16 +80,16 @@ class D { } declare var m: Function; -const x = \\"\\"; +const x = ""; if (m.bind(this)(x)) { } -" + `; exports[`function-union.js 1`] = ` -"// @flow +// @flow -declare function f1(x: mixed): boolean %checks(typeof x === \\"string\\"); +declare function f1(x: mixed): boolean %checks(typeof x === "string"); declare function f2(x: mixed): boolean %checks(Array.isArray(x)); declare var cond: boolean; @@ -108,7 +108,7 @@ function foo(x: number | string | Array): number { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -declare function f1(x: mixed): boolean %checks(typeof x === \\"string\\"); +declare function f1(x: mixed): boolean %checks(typeof x === "string"); declare function f2(x: mixed): boolean %checks(Array.isArray(x)); declare var cond: boolean; @@ -123,14 +123,14 @@ function foo(x: number | string | Array): number { return 1; } } -" + `; exports[`is-string-decl.js 1`] = ` -"// @flow +// @flow -declare function is_string(x: mixed): boolean %checks(typeof x === \\"string\\"); -declare function is_number(x: mixed): boolean %checks(typeof x === \\"number\\"); +declare function is_string(x: mixed): boolean %checks(typeof x === "string"); +declare function is_number(x: mixed): boolean %checks(typeof x === "number"); // Feature check: function foo(x: string | Array): string { @@ -148,8 +148,8 @@ function foo(x: string | Array): string { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -declare function is_string(x: mixed): boolean %checks(typeof x === \\"string\\"); -declare function is_number(x: mixed): boolean %checks(typeof x === \\"number\\"); +declare function is_string(x: mixed): boolean %checks(typeof x === "string"); +declare function is_number(x: mixed): boolean %checks(typeof x === "number"); // Feature check: function foo(x: string | Array): string { @@ -164,11 +164,11 @@ function foo(x: string | Array): string { return x.join(); } } -" + `; exports[`logical-or.js 1`] = ` -"// @flow +// @flow // Sanity check: // - conditional functions do not affect behavior of conditional @@ -179,7 +179,7 @@ var s = 'a'; var n = r(s) || 1; (n: number); -var x = \\"\\"; +var x = ""; if (x = r(s) || 1) { (x: number); } @@ -198,11 +198,11 @@ function foo(x: mixed) { return 1; } // expressions (e.g. \`||\`) declare function r(x: string): number; -var s = \\"a\\"; +var s = "a"; var n = r(s) || 1; (n: number); -var x = \\"\\"; +var x = ""; if ((x = r(s) || 1)) { (x: number); } @@ -215,11 +215,11 @@ function foo(x: mixed) { foo(dollars) || 0; Number(dollars) || 0; -" + `; exports[`object-invariant.js 1`] = ` -"// @flow +// @flow // Sanity check: // - preserving \`havoc\` semantics @@ -235,13 +235,13 @@ type Invitee = { function f(_this: { m: ?Meeting }): string { if (!_this.m) { - return \\"0\\"; + return "0"; } if (_this.m.es.some((a) => a.fbid === 0)) { } - return \\"3\\"; + return "3"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow @@ -260,23 +260,23 @@ type Invitee = { function f(_this: { m: ?Meeting }): string { if (!_this.m) { - return \\"0\\"; + return "0"; } if (_this.m.es.some(a => a.fbid === 0)) { } - return \\"3\\"; + return "3"; } -" + `; exports[`orig-string-tag-check.js 1`] = ` -"// @flow +// @flow // The original first-order case function foo(x: string | Array): string { - if (typeof x === \\"string\\") { + if (typeof x === "string") { return x; // [ERROR] x: Array doesn't match return type } else { @@ -289,17 +289,17 @@ function foo(x: string | Array): string { // The original first-order case function foo(x: string | Array): string { - if (typeof x === \\"string\\") { + if (typeof x === "string") { return x; // [ERROR] x: Array doesn't match return type } else { return x.join(); // [ERROR] x: string doesn't have .join method } } -" + `; exports[`sanity-fall-through.js 1`] = ` -"// @flow +// @flow // Sanity check: // - we should still be getting an error at the second return statement @@ -308,7 +308,7 @@ declare function pred(x: T): boolean; function foo(s: Array): string { if (pred(s)) { - return \\"1\\"; + return "1"; } return 1; } @@ -322,15 +322,15 @@ declare function pred(x: T): boolean; function foo(s: Array): string { if (pred(s)) { - return \\"1\\"; + return "1"; } return 1; } -" + `; exports[`sanity-invalid-calls.js 1`] = ` -"// @flow +// @flow // Sanity check: // - invalid calls at predicate positions @@ -340,14 +340,14 @@ declare function pred(x: T): boolean; function foo(s: Array): string { if ((1)(s)) { - return \\"1\\"; + return "1"; } - if ((pred + 1)(\\"s\\")) { - return \\"1\\"; + if ((pred + 1)("s")) { + return "1"; } - return \\"1\\" + return "1" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow @@ -359,23 +359,23 @@ declare function pred(x: T): boolean; function foo(s: Array): string { if (1(s)) { - return \\"1\\"; + return "1"; } - if ((pred + 1)(\\"s\\")) { - return \\"1\\"; + if ((pred + 1)("s")) { + return "1"; } - return \\"1\\"; + return "1"; } -" + `; exports[`sanity-is-string-bug.js 1`] = ` -"// @flow +// @flow -declare function is_string(x: mixed): boolean %checks(typeof x === \\"string\\"); -declare function is_number(x: mixed): boolean %checks(typeof x === \\"number\\"); +declare function is_string(x: mixed): boolean %checks(typeof x === "string"); +declare function is_number(x: mixed): boolean %checks(typeof x === "number"); // Sanity check: // - Erroneous logic @@ -390,8 +390,8 @@ function bar(x: string | Array): string { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -declare function is_string(x: mixed): boolean %checks(typeof x === \\"string\\"); -declare function is_number(x: mixed): boolean %checks(typeof x === \\"number\\"); +declare function is_string(x: mixed): boolean %checks(typeof x === "string"); +declare function is_number(x: mixed): boolean %checks(typeof x === "number"); // Sanity check: // - Erroneous logic @@ -403,18 +403,18 @@ function bar(x: string | Array): string { return x.join(); // error: both string and Array can flow to x } } -" + `; exports[`sanity-parameter-mismatch.js 1`] = ` -"// @flow +// @flow // Sanity check: make sure the parameters are checked as usual declare function foo( input: mixed, types: string | Array -): boolean %checks(typeof input === \\"string\\" || Array.isArray(input)); +): boolean %checks(typeof input === "string" || Array.isArray(input)); foo(3, 3); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -425,27 +425,27 @@ foo(3, 3); declare function foo( input: mixed, types: string | Array -): boolean %checks(typeof input === \\"string\\" || Array.isArray(input)); +): boolean %checks(typeof input === "string" || Array.isArray(input)); foo(3, 3); -" + `; exports[`sanity-pred-with-body.js 1`] = ` -"// @flow +// @flow // Sanity check: // - predicate functions cannot have bodies (can only be declarations) -function pred(x: mixed): boolean %checks(typeof x === \\"string\\") { // error: cannot use pred type here - return typeof x === \\"string\\"; +function pred(x: mixed): boolean %checks(typeof x === "string") { // error: cannot use pred type here + return typeof x === "string"; } function foo(x: string | Array): string { if (pred(x)) { return x; } - return \\"1\\" + return "1" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow @@ -453,27 +453,27 @@ function foo(x: string | Array): string { // Sanity check: // - predicate functions cannot have bodies (can only be declarations) -function pred(x: mixed): boolean %checks(typeof x === \\"string\\") { +function pred(x: mixed): boolean %checks(typeof x === "string") { // error: cannot use pred type here - return typeof x === \\"string\\"; + return typeof x === "string"; } function foo(x: string | Array): string { if (pred(x)) { return x; } - return \\"1\\"; + return "1"; } -" + `; exports[`sanity-return-type.js 1`] = ` -"// @flow +// @flow declare function f2(x: mixed): string %checks(Array.isArray(x)); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow declare function f2(x: mixed): string %checks(Array.isArray(x)); -" + `; diff --git a/tests/flow/predicates-inferred/__snapshots__/jsfmt.spec.js.snap b/tests/flow/predicates-inferred/__snapshots__/jsfmt.spec.js.snap index 1bc595ec..a6e7426a 100644 --- a/tests/flow/predicates-inferred/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/predicates-inferred/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`sanity.js 1`] = ` -"// @flow +// @flow // Sanity check: shouldn't be allowed to declare a predicate AND use \`chekcs\` -function check(y): %checks(typeof y === \\"string\\") { - return typeof y === \\"number\\"; +function check(y): %checks(typeof y === "string") { + return typeof y === "number"; } declare var y: number | boolean; @@ -18,7 +18,7 @@ if (check(y)) { // Sanity: disallowed body function indirect_is_number(y): %checks { var y = 1; - return typeof y === \\"number\\"; + return typeof y === "number"; } function bak(z: string | number): number { @@ -33,8 +33,8 @@ function bak(z: string | number): number { // Sanity check: shouldn't be allowed to declare a predicate AND use \`chekcs\` -function check(y): %checks(typeof y === \\"string\\") { - return typeof y === \\"number\\"; +function check(y): %checks(typeof y === "string") { + return typeof y === "number"; } declare var y: number | boolean; @@ -46,7 +46,7 @@ if (check(y)) { // Sanity: disallowed body function indirect_is_number(y): %checks { var y = 1; - return typeof y === \\"number\\"; + return typeof y === "number"; } function bak(z: string | number): number { @@ -56,19 +56,19 @@ function bak(z: string | number): number { return z.length; } } -" + `; exports[`sanity-multi-params.js 1`] = ` -"// @flow +// @flow // Feature: multi params function multi_param(w,x,y,z): %checks { - return typeof z === \\"string\\"; + return typeof z === "string"; } function foo(x: string | Array): string { - if (multi_param(\\"1\\", \\"2\\", x, \\"3\\")) { + if (multi_param("1", "2", x, "3")) { return x; } else { return x.join(); @@ -79,21 +79,21 @@ function foo(x: string | Array): string { // Feature: multi params function multi_param(w, x, y, z): %checks { - return typeof z === \\"string\\"; + return typeof z === "string"; } function foo(x: string | Array): string { - if (multi_param(\\"1\\", \\"2\\", x, \\"3\\")) { + if (multi_param("1", "2", x, "3")) { return x; } else { return x.join(); } } -" + `; exports[`sanity-ordering.js 1`] = ` -"// @flow +// @flow declare var key: string; declare var obj: { page: ?Object; }; @@ -122,26 +122,26 @@ if (dotAccess(obj)) { } function dotAccess(head, create) { - const path = \\"path.location\\"; - const stack = path.split(\\".\\"); + const path = "path.location"; + const stack = path.split("."); do { const key = stack.shift(); head = head[key] || (create && (head[key] = {})); } while (stack.length && head); return head; } -" + `; exports[`sanity-unbound-var.js 1`] = ` -"// @flow +// @flow declare var y: mixed; // Sanity check: this should fail, because the preficate function // checks \`y\` instead of \`x\`. function err(x): %checks { - return typeof y === \\"string\\"; + return typeof y === "string"; } function foo(x: string | Array): string { @@ -159,7 +159,7 @@ declare var y: mixed; // Sanity check: this should fail, because the preficate function // checks \`y\` instead of \`x\`. function err(x): %checks { - return typeof y === \\"string\\"; + return typeof y === "string"; } function foo(x: string | Array): string { @@ -169,22 +169,22 @@ function foo(x: string | Array): string { return x.join(); } } -" + `; exports[`simple-predicate-func.js 1`] = ` -"// @flow +// @flow function is_string(y): %checks { - return typeof y === \\"string\\"; + return typeof y === "string"; } function is_bool(y): %checks { - return typeof y === \\"boolean\\"; + return typeof y === "boolean"; } function is_number(y): %checks { - return typeof y === \\"number\\"; + return typeof y === "number"; } // Feature check: @@ -224,11 +224,11 @@ function baz(z: string | number): number { // Feature: multi params function multi_param(w,x,y,z): %checks { - return typeof z === \\"string\\"; + return typeof z === "string"; } function foo(x: string | Array): string { - if (multi_param(\\"1\\", \\"2\\", \\"3\\", x)) { + if (multi_param("1", "2", "3", x)) { return x; } else { return x.join(); @@ -250,15 +250,15 @@ declare function from_two_strings(x: string, y: string): void; // @flow function is_string(y): %checks { - return typeof y === \\"string\\"; + return typeof y === "string"; } function is_bool(y): %checks { - return typeof y === \\"boolean\\"; + return typeof y === "boolean"; } function is_number(y): %checks { - return typeof y === \\"number\\"; + return typeof y === "number"; } // Feature check: @@ -298,11 +298,11 @@ function baz(z: string | number): number { // Feature: multi params function multi_param(w, x, y, z): %checks { - return typeof z === \\"string\\"; + return typeof z === "string"; } function foo(x: string | Array): string { - if (multi_param(\\"1\\", \\"2\\", \\"3\\", x)) { + if (multi_param("1", "2", "3", x)) { return x; } else { return x.join(); @@ -320,11 +320,11 @@ function two_strings(x, y): %checks { } declare function from_two_strings(x: string, y: string): void; -" + `; exports[`simple-predicate-func-post.js 1`] = ` -"// @flow +// @flow // Feature check: // The predicate function is defined after the conditional check @@ -343,7 +343,7 @@ function foo(x: string | Array): string { } function is_string(x): %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow @@ -365,7 +365,7 @@ function foo(x: string | Array): string { } function is_string(x): %checks { - return typeof x === \\"string\\"; + return typeof x === "string"; } -" + `; diff --git a/tests/flow/predicates-parsing/__snapshots__/jsfmt.spec.js.snap b/tests/flow/predicates-parsing/__snapshots__/jsfmt.spec.js.snap index c8c934b2..b048af11 100644 --- a/tests/flow/predicates-parsing/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/predicates-parsing/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`fail-0.js 1`] = ` -"// @flow +// @flow // Error: 'declare', 'checks' but missing predicate @@ -12,11 +12,11 @@ declare function f2(x: mixed): boolean %checks; // Error: 'declare', 'checks' but missing predicate declare function f2(x: mixed): boolean %checks; -" + `; exports[`fail-1.js 1`] = ` -"// @flow +// @flow // Error: no return statement @@ -27,11 +27,11 @@ function f6(x: mixed): %checks (x !== null) { } // Error: no return statement function f6(x: mixed): %checks(x !== null) {} -" + `; exports[`fail-2.js 1`] = ` -"// @flow +// @flow var a2 = (x: mixed): %checks (x !== null) => { // Error: body form var x = 1; return x; @@ -44,11 +44,11 @@ var a2 = (x: mixed): %checks(x !== null) => { var x = 1; return x; }; -" + `; exports[`fail-3.js 1`] = ` -"// @flow +// @flow // Cannot declare predicate with a function body is present. @@ -65,11 +65,11 @@ function f5(x: mixed): %checks(x !== null) { } var a2 = (x: mixed): %checks(x !== null) => x !== null; -" + `; exports[`pass.js 1`] = ` -"// @flow +// @flow declare function f1(x: mixed): boolean; @@ -126,5 +126,5 @@ type checks = any; declare function f(x: mixed): checks; typeof x === null; -" + `; diff --git a/tests/flow/private/__snapshots__/jsfmt.spec.js.snap b/tests/flow/private/__snapshots__/jsfmt.spec.js.snap index 363cb23b..cf1f8879 100644 --- a/tests/flow/private/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/private/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`private.js 1`] = ` -"class A { +class A { 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 { @@ -22,7 +22,7 @@ class A { __x: number; constructor() { this.x = 0; - this._x = \\"\\"; + this._x = ""; this.__x = 0; } } @@ -34,5 +34,5 @@ class B extends A { var __x: number = this.__x; } } -" + `; diff --git a/tests/flow/promises/__snapshots__/jsfmt.spec.js.snap b/tests/flow/promises/__snapshots__/jsfmt.spec.js.snap index f2d5f191..c69b2b5f 100644 --- a/tests/flow/promises/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/promises/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`all.js 1`] = ` -"// @flow +// @flow declare var pstr: Promise; declare var pnum: Promise; @@ -80,11 +80,11 @@ function test(val: Iterable>) { function tes2(val: Map>) { const r: Promise> = Promise.all(val.values()); } -" + `; exports[`covariance.js 1`] = ` -"/* @flow */ +/* @flow */ async function testAll() { /* This is a test case from https://github.com/facebook/flow/issues/1143 @@ -117,11 +117,11 @@ async function testRace() { const y: Promise = Promise.race(x); const z: ?string = await y; } -" + `; exports[`promise.js 1`] = ` -"/** +/** * @flow */ @@ -409,10 +409,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; @@ -453,10 +453,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; @@ -515,7 +515,7 @@ Promise.reject(Promise.resolve(0)).then(function(num) { // resolvedPromise.then():T -> then(T) Promise.resolve(0) .then(function(num) { - return \\"asdf\\"; + return "asdf"; }) .then(function(str) { var a: string = str; @@ -525,7 +525,7 @@ Promise.resolve(0) // resolvedPromise.then():Promise -> then(T) Promise.resolve(0) .then(function(num) { - return Promise.resolve(\\"asdf\\"); + return Promise.resolve("asdf"); }) .then(function(str) { var a: string = str; @@ -535,7 +535,7 @@ Promise.resolve(0) // resolvedPromise.then():Promise> -> then(T) Promise.resolve(0) .then(function(num) { - return Promise.resolve(Promise.resolve(\\"asdf\\")); + return Promise.resolve(Promise.resolve("asdf")); }) .then(function(str) { var a: string = str; @@ -545,7 +545,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; @@ -561,7 +561,7 @@ Promise.resolve(0) // rejectedPromise.catch():U -> then(U) Promise.reject(0) .catch(function(num) { - return \\"asdf\\"; + return "asdf"; }) .then(function(str) { var a: string = str; @@ -571,7 +571,7 @@ Promise.reject(0) // rejectedPromise.catch():Promise -> then(U) Promise.reject(0) .catch(function(num) { - return Promise.resolve(\\"asdf\\"); + return Promise.resolve("asdf"); }) .then(function(str) { var a: string = str; @@ -581,7 +581,7 @@ Promise.reject(0) // rejectedPromise.catch():Promise> -> then(U) Promise.reject(0) .catch(function(num) { - return Promise.resolve(Promise.resolve(\\"asdf\\")); + return Promise.resolve(Promise.resolve("asdf")); }) .then(function(str) { var a: string = str; @@ -595,11 +595,11 @@ Promise.resolve(0).catch(function(err) {}).then(function(num) { // TODO var b: string = num; // Error: string ~> number }); -" + `; exports[`resolve_global.js 1`] = ` -"/** +/** * test Promise name resolution * @flow */ @@ -656,7 +656,7 @@ class Promise {} */ async function foo(x: boolean) { if (x) { - return { bar: \\"baz\\" }; + return { bar: "baz" }; } else { return null; } @@ -682,11 +682,11 @@ async function bar() { async function baz(): Promise { return 0; } -" + `; exports[`resolve_void.js 1`] = ` -"// @flow +// @flow (Promise.resolve(): Promise); // error @@ -697,5 +697,5 @@ exports[`resolve_void.js 1`] = ` (Promise.resolve(): Promise); // error (Promise.resolve(undefined): Promise); // error -" + `; diff --git a/tests/flow/pure_component/__snapshots__/jsfmt.spec.js.snap b/tests/flow/pure_component/__snapshots__/jsfmt.spec.js.snap index cbf8baad..c6ce7d1e 100644 --- a/tests/flow/pure_component/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/pure_component/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"var React = require('react'); +var React = require('react'); class C extends React.PureComponent { props: { x: number }; } (); // error (\`x\` is a required prop) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\\"react\\"); +var React = require("react"); class C extends React.PureComponent { props: { x: number }; } ; // error (\`x\` is a required prop) -" + `; diff --git a/tests/flow/qualified/__snapshots__/jsfmt.spec.js.snap b/tests/flow/qualified/__snapshots__/jsfmt.spec.js.snap index 78ab0f04..5d01f604 100644 --- a/tests/flow/qualified/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/qualified/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`qualified.js 1`] = ` -"class C { } +class C { } var M = { C: C }; var x:M.C = 0; @@ -25,6 +25,6 @@ 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 + `; diff --git a/tests/flow/react/__snapshots__/jsfmt.spec.js.snap b/tests/flow/react/__snapshots__/jsfmt.spec.js.snap index 8c85795d..702c5b1c 100644 --- a/tests/flow/react/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/react/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ArityError.react.js 1`] = ` -"/** +/** * @providesModule ArityError.react */ var React = require('react'); @@ -16,7 +16,7 @@ module.exports = AudienceInsightsContainer; /** * @providesModule ArityError.react */ -var React = require(\\"react\\"); +var React = require("react"); var AudienceInsightsContainer = React.createClass({ renderComponent(AudienceInsights: ReactClass<*>) { return ; @@ -24,11 +24,11 @@ var AudienceInsightsContainer = React.createClass({ }); module.exports = AudienceInsightsContainer; -" + `; exports[`create_class.js 1`] = ` -"import React from \\"react\\"; +import React from "react"; const A = React.createClass({ mixins: [{ propTypes: { foo: React.PropTypes.string.isRequired } }], @@ -40,7 +40,7 @@ const A = React.createClass({ }); const B = React.createClass({ - p: \\"\\", + p: "", m() { this.p = 0; // error: number ~> string }, @@ -203,7 +203,7 @@ const L = React.createClass({ React.createClass({}); // error: spec must be [x] exact and [ ] sealed React.createClass(({}: {})); // error: spec must be [ ] exact and [x] sealed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import React from \\"react\\"; +import React from "react"; const A = React.createClass({ mixins: [{ propTypes: { foo: React.PropTypes.string.isRequired } }], @@ -215,7 +215,7 @@ const A = React.createClass({ }); const B = React.createClass({ - p: \\"\\", + p: "", m() { this.p = 0; // error: number ~> string }, @@ -381,11 +381,11 @@ const L = React.createClass({ React.createClass({}); // error: spec must be [x] exact and [ ] sealed React.createClass(({}: {})); // error: spec must be [ ] exact and [x] sealed -" + `; exports[`create_class_initial_state_sealed.js 1`] = ` -"import React from \\"react\\"; +import React from "react"; // initial state = None React.createClass({ @@ -472,7 +472,7 @@ React.createClass({ } }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import React from \\"react\\"; +import React from "react"; // initial state = None React.createClass({ @@ -562,11 +562,11 @@ React.createClass({ (this.state.baz: empty); // property \`baz\` not found } }); -" + `; exports[`create_class_statics_sealed.js 1`] = ` -"import React from \\"react\\"; +import React from "react"; // statics = None const A = React.createClass({ p: 0 }); @@ -621,7 +621,7 @@ const F = React.createClass({ (F.baz: empty); // number ~> empty (inflow below) F.baz = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import React from \\"react\\"; +import React from "react"; // statics = None const A = React.createClass({ p: 0 }); @@ -679,11 +679,11 @@ const F = React.createClass({ (F.bar: empty); // number ~> empty (F.baz: empty); // number ~> empty (inflow below) F.baz = 0; -" + `; exports[`createElement_string.js 1`] = ` -"// @flow +// @flow import React from 'react'; class Bar extends React.Component {} @@ -696,21 +696,21 @@ class Foo extends React.Component { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @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 ; } } -" + `; exports[`createElementRequiredProp_string.js 1`] = ` -"// @flow +// @flow import React from 'react'; class Bar extends React.Component { @@ -734,7 +734,7 @@ class Foo extends React.Component { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import React from \\"react\\"; +import React from "react"; class Bar extends React.Component { props: { @@ -751,34 +751,34 @@ 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 ; } } -" + `; exports[`import_react.js 1`] = ` -"/* @flow */ +/* @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 */ -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 -" + `; exports[`jsx_spread.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); var Foo = React.createClass({ @@ -792,7 +792,7 @@ var blah = ; // error bar, number given string expected ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); +var React = require("react"); var Foo = React.createClass({ propTypes: { bar: React.PropTypes.string.isRequired @@ -801,11 +801,11 @@ var Foo = React.createClass({ var props = { bar: 42 }; var blah = ; // error bar, number given string expected -" + `; exports[`proptype_any.js 1`] = ` -"const React = require(\\"react\\"); +const React = require("react"); var AnyExample = React.createClass({ propTypes: { @@ -825,7 +825,7 @@ var AnyFunExample = React.createClass({ (); // OK (); // OK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -const React = require(\\"react\\"); +const React = require("react"); var AnyExample = React.createClass({ propTypes: { @@ -844,11 +844,11 @@ var AnyFunExample = React.createClass({ ; // OK ; // OK -" + `; exports[`proptype_arrayOf.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); var Example = React.createClass({ @@ -862,7 +862,7 @@ var ok_numbers = var fail_missing = var fail_not_array = -var fail_mistyped_elems = +var fail_mistyped_elems = /* Since the \`number\` proptype argument is not required, React will actually allow \`null\` and \`undefined\` elements in the \`arr\` prop, but Flow has @@ -877,7 +877,7 @@ var OptionalExample = React.createClass({ (); // OK (); // OK -(); // error: string ~> number +(); // error: string ~> number var AnyExample = React.createClass({ propTypes: { @@ -896,7 +896,7 @@ var InvalidExample = React.createClass({ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); +var React = require("react"); var Example = React.createClass({ propTypes: { arr: React.PropTypes.arrayOf(React.PropTypes.number).isRequired @@ -908,7 +908,7 @@ var ok_numbers = ; var fail_missing = ; var fail_not_array = ; -var fail_mistyped_elems = ; +var fail_mistyped_elems = ; /* Since the \`number\` proptype argument is not required, React will actually allow \`null\` and \`undefined\` elements in the \`arr\` prop, but Flow has @@ -923,7 +923,7 @@ var OptionalExample = React.createClass({ ; // OK ; // OK -; // error: string ~> number +; // error: string ~> number var AnyExample = React.createClass({ propTypes: { @@ -939,11 +939,11 @@ var InvalidExample = React.createClass({ arr: React.PropTypes.arrayOf(0) // error: number not a prop type } }); -" + `; exports[`proptype_custom_validator.js 1`] = ` -"const React = require(\\"react\\"); +const React = require("react"); // Custom validator must match \`ReactPropsCheckType\` var Example = React.createClass({ @@ -962,7 +962,7 @@ var Example = React.createClass({ (); (); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -const React = require(\\"react\\"); +const React = require("react"); // Custom validator must match \`ReactPropsCheckType\` var Example = React.createClass({ @@ -980,11 +980,11 @@ var Example = React.createClass({ // Inferred prop type is optional \`any\` ; ; -" + `; exports[`proptype_func.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); var Example = React.createClass({ @@ -1001,7 +1001,7 @@ var fail_mistyped = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); +var React = require("react"); var Example = React.createClass({ propTypes: { func: React.PropTypes.func.isRequired @@ -1013,11 +1013,11 @@ var ok_args = {}} />; var ok_retval = 1} />; var fail_mistyped = ; -" + `; exports[`proptype_incompatible.js 1`] = ` -"const React = require(\\"react\\"); +const React = require("react"); var Example = React.createClass({ propTypes: { @@ -1028,7 +1028,7 @@ var Example = React.createClass({ (); // OK: don't cascade errors (); // OK: don't cascade errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -const React = require(\\"react\\"); +const React = require("react"); var Example = React.createClass({ propTypes: { @@ -1038,11 +1038,11 @@ var Example = React.createClass({ ; // OK: don't cascade errors ; // OK: don't cascade errors -" + `; exports[`proptype_instanceOf.js 1`] = ` -"/* @flow */ +/* @flow */ class A {} class B extends A {} @@ -1058,7 +1058,7 @@ var Example = React.createClass({ (); // error: A ~> B (); // OK (); // OK (C ~> B) -(); // error: string ~> B +(); // error: string ~> B class Poly {x:T} var PolyExample = React.createClass({ @@ -1090,7 +1090,7 @@ class A {} class B extends A {} class C extends B {} -var React = require(\\"react\\"); +var React = require("react"); var Example = React.createClass({ propTypes: { x: React.PropTypes.instanceOf(B) @@ -1100,7 +1100,7 @@ var Example = React.createClass({ ; // error: A ~> B ; // OK ; // OK (C ~> B) -; // error: string ~> B +; // error: string ~> B class Poly { x: T; @@ -1129,11 +1129,11 @@ var PolyDefaultExample = React.createClass({ (this.props.x.x: empty); // OK, T instantiated to \`any\` } }); -" + `; exports[`proptype_missing.js 1`] = ` -"/* @flow */ +/* @flow */ /* If you create a react component with createClass() but don't specify the * propTypes, what should the type of props be? @@ -1180,16 +1180,16 @@ var Foo = React.createClass({ * We may change this back to the empty object at some point and fix the * situations where it didn't used to error */ -var React = require(\\"react\\"); +var React = require("react"); var Foo = React.createClass({ getID(): string { // 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\\"; + case "a": + return "Bob"; default: - return \\"Alice\\"; + return "Alice"; } }, @@ -1198,11 +1198,11 @@ var Foo = React.createClass({ return
; } }); -" + `; exports[`proptype_object.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); var Example = React.createClass({ @@ -1212,13 +1212,13 @@ 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 @@ -1226,14 +1226,14 @@ var Example = React.createClass({ }); var ok_empty = ; -var ok_props = ; +var ok_props = ; var fail_mistyped = ; -" + `; exports[`proptype_objectOf.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); var Example = React.createClass({ @@ -1247,7 +1247,7 @@ var ok_numbers = var fail_missing = var fail_not_object = -var fail_mistyped_props = +var fail_mistyped_props = /* Since the \`number\` proptype argument is not required, React will actually allow \`null\` and \`undefined\` elements in the \`obj\` prop, but Flow has @@ -1262,7 +1262,7 @@ var OptionalExample = React.createClass({ (); // OK (); // OK -(); // error: string ~> number +(); // error: string ~> number var AnyExample = React.createClass({ propTypes: { @@ -1281,7 +1281,7 @@ var InvalidExample = React.createClass({ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); +var React = require("react"); var Example = React.createClass({ propTypes: { obj: React.PropTypes.objectOf(React.PropTypes.number).isRequired @@ -1293,7 +1293,7 @@ var ok_numbers = ; var fail_missing = ; var fail_not_object = ; -var fail_mistyped_props = ; +var fail_mistyped_props = ; /* Since the \`number\` proptype argument is not required, React will actually allow \`null\` and \`undefined\` elements in the \`obj\` prop, but Flow has @@ -1308,7 +1308,7 @@ var OptionalExample = React.createClass({ ; // OK ; // OK -; // error: string ~> number +; // error: string ~> number var AnyExample = React.createClass({ propTypes: { @@ -1324,24 +1324,24 @@ var InvalidExample = React.createClass({ obj: React.PropTypes.objectOf(0) // error: number not a prop type } }); -" + `; exports[`proptype_oneOf.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); var Example = React.createClass({ propTypes: { - str: React.PropTypes.oneOf([\\"foo\\", \\"bar\\"]), + str: React.PropTypes.oneOf(["foo", "bar"]), num: React.PropTypes.oneOf([0, 1, 2]), bool: React.PropTypes.oneOf([true]), - mixed: React.PropTypes.oneOf([\\"foo\\", 0, true]), + mixed: React.PropTypes.oneOf(["foo", 0, true]), }, }); -(); // OK -(); // error: 'baz' not in enum +(); // OK +(); // error: 'baz' not in enum (); // OK (); // error: 3 not in enum @@ -1349,9 +1349,9 @@ var Example = React.createClass({ (); // OK (); // error: false ~> true -(); // OK +(); // OK (); // OK -(); // error: 'baz' not in enum +(); // error: 'baz' not in enum var RequiredExample = React.createClass({ propTypes: { @@ -1379,7 +1379,7 @@ var AnyArrayExample = React.createClass({ var AnyElemExample = React.createClass({ propTypes: { - any: React.PropTypes.oneOf([\\"foo\\", (0:any)]), + any: React.PropTypes.oneOf(["foo", (0:any)]), }, }); @@ -1395,7 +1395,7 @@ var DynamicArrayExample = React.createClass({ var DynamicElemExample = React.createClass({ propTypes: { - dyn: React.PropTypes.oneOf([\\"foo\\", (\\"\\": string)]), + dyn: React.PropTypes.oneOf(["foo", ("": string)]), }, }); @@ -1418,18 +1418,18 @@ var NonLiteralElemExample = React.createClass({ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); +var React = require("react"); var Example = React.createClass({ propTypes: { - str: React.PropTypes.oneOf([\\"foo\\", \\"bar\\"]), + str: React.PropTypes.oneOf(["foo", "bar"]), num: React.PropTypes.oneOf([0, 1, 2]), bool: React.PropTypes.oneOf([true]), - mixed: React.PropTypes.oneOf([\\"foo\\", 0, true]) + mixed: React.PropTypes.oneOf(["foo", 0, true]) } }); -; // OK -; // error: 'baz' not in enum +; // OK +; // error: 'baz' not in enum ; // OK ; // error: 3 not in enum @@ -1437,9 +1437,9 @@ var Example = React.createClass({ ; // OK ; // error: false ~> true -; // OK +; // OK ; // OK -; // error: 'baz' not in enum +; // error: 'baz' not in enum var RequiredExample = React.createClass({ propTypes: { @@ -1467,7 +1467,7 @@ var AnyArrayExample = React.createClass({ var AnyElemExample = React.createClass({ propTypes: { - any: React.PropTypes.oneOf([\\"foo\\", (0: any)]) + any: React.PropTypes.oneOf(["foo", (0: any)]) } }); @@ -1483,7 +1483,7 @@ var DynamicArrayExample = React.createClass({ var DynamicElemExample = React.createClass({ propTypes: { - dyn: React.PropTypes.oneOf([\\"foo\\", (\\"\\": string)]) + dyn: React.PropTypes.oneOf(["foo", ("": string)]) } }); @@ -1503,11 +1503,11 @@ var NonLiteralElemExample = React.createClass({ } }); ; // OK, result is unknown/any -" + `; exports[`proptype_oneOfType.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); var Example = React.createClass({ @@ -1518,7 +1518,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)}
@@ -1527,7 +1527,7 @@ var Example = React.createClass({ }); var ok_number = ; -var ok_string = ; +var ok_string = ; var fail_missing = ; var fail_bool = ; @@ -1546,7 +1546,7 @@ var OptionalExample = React.createClass({ }); (); // OK -(); // OK +(); // OK (); // error: number ~> string var EmptyExample = React.createClass({ @@ -1613,7 +1613,7 @@ var InvalidElemExample = React.createClass({ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); +var React = require("react"); var Example = React.createClass({ propTypes: { prop: React.PropTypes.oneOfType([ @@ -1622,7 +1622,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)}
; @@ -1631,7 +1631,7 @@ var Example = React.createClass({ }); var ok_number = ; -var ok_string = ; +var ok_string = ; var fail_missing = ; var fail_bool = ; @@ -1648,7 +1648,7 @@ var OptionalExample = React.createClass({ }); ; // OK -; // OK +; // OK ; // error: number ~> string var EmptyExample = React.createClass({ @@ -1709,20 +1709,20 @@ var InvalidElemExample = React.createClass({ }); ; // OK, don't cascade errors -" + `; exports[`proptype_shape.js 1`] = ` -"/* Shape should be a sealed, inexact object just like a type annotation. The +/* Shape should be a sealed, inexact object just like a type annotation. The * below component's \`foo\` property should be equivalent to \`{ bar: string }\`, * which would forbid reads/writes on an unknown \`baz\` property. * - * If you see a single \\"number incompatible with string\\" error instead of two - * separate \\"property \`baz\` not found\\" errors, this is broken and we are + * If you see a single "number incompatible with string" error instead of two + * separate "property \`baz\` not found" errors, this is broken and we are * treating the shape like an unsealed object and performing shadow read/writes. */ -import React from \\"react\\"; +import React from "react"; React.createClass({ propTypes: { @@ -1753,12 +1753,12 @@ React.createClass({ * below component's \`foo\` property should be equivalent to \`{ bar: string }\`, * which would forbid reads/writes on an unknown \`baz\` property. * - * If you see a single \\"number incompatible with string\\" error instead of two - * separate \\"property \`baz\` not found\\" errors, this is broken and we are + * If you see a single "number incompatible with string" error instead of two + * separate "property \`baz\` not found" errors, this is broken and we are * treating the shape like an unsealed object and performing shadow read/writes. */ -import React from \\"react\\"; +import React from "react"; React.createClass({ propTypes: { @@ -1784,11 +1784,11 @@ React.createClass({ (this.props.foo.bar: empty); // OK } }); -" + `; exports[`proptypes_builtins.js 1`] = ` -"import React from \\"react\\"; +import React from "react"; type NoFun = mixed => empty; @@ -1816,7 +1816,7 @@ type NoFun = mixed => empty; // error: ReactPropsChainableTypeChecker ~> empty (React.PropTypes.shape : NoFun); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import React from \\"react\\"; +import React from "react"; type NoFun = mixed => empty; @@ -1843,20 +1843,20 @@ type NoFun = mixed => empty; // error: mixed ~> object type // error: ReactPropsChainableTypeChecker ~> empty (React.PropTypes.shape: NoFun); -" + `; exports[`proptypes_sealed.js 1`] = ` -"/* propTypes should be a sealed, inexact object just like a type annotation. The +/* propTypes should be a sealed, inexact object just like a type annotation. The * below component's propTypes should be equivalent to \`{ bar: string }\`, which * would forbid reads/writes on an unknown \`baz\` property. * - * If you see a single \\"number incompatible with string\\" error instead of two - * separate \\"property \`baz\` not found\\" errors, this is broken and we are + * If you see a single "number incompatible with string" error instead of two + * separate "property \`baz\` not found" errors, this is broken and we are * treating propTypes like an unsealed object and performing shadow read/writes. */ -import React from \\"react\\"; +import React from "react"; React.createClass({ propTypes: { @@ -1876,12 +1876,12 @@ React.createClass({ * below component's propTypes should be equivalent to \`{ bar: string }\`, which * would forbid reads/writes on an unknown \`baz\` property. * - * If you see a single \\"number incompatible with string\\" error instead of two - * separate \\"property \`baz\` not found\\" errors, this is broken and we are + * If you see a single "number incompatible with string" error instead of two + * separate "property \`baz\` not found" errors, this is broken and we are * treating propTypes like an unsealed object and performing shadow read/writes. */ -import React from \\"react\\"; +import React from "react"; React.createClass({ propTypes: { @@ -1896,5 +1896,5 @@ React.createClass({ this.props.baz = 0; } }); -" + `; diff --git a/tests/flow/react_functional/__snapshots__/jsfmt.spec.js.snap b/tests/flow/react_functional/__snapshots__/jsfmt.spec.js.snap index 6511f9e8..73945c73 100644 --- a/tests/flow/react_functional/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/react_functional/__snapshots__/jsfmt.spec.js.snap @@ -1,32 +1,32 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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 -" + `; diff --git a/tests/flow/react_modules/__snapshots__/jsfmt.spec.js.snap b/tests/flow/react_modules/__snapshots__/jsfmt.spec.js.snap index 3e35ff12..8e0c7500 100644 --- a/tests/flow/react_modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/react_modules/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`createclass-callsite.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); var Hello = require('./createclass-module'); @@ -29,8 +29,8 @@ var Callsite = React.createClass({ module.exports = Callsite; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); -var Hello = require(\\"./createclass-module\\"); +var React = require("react"); +var Hello = require("./createclass-module"); var HelloLocal = React.createClass({ propTypes: { @@ -54,11 +54,11 @@ var Callsite = React.createClass({ }); module.exports = Callsite; -" + `; exports[`createclass-module.js 1`] = ` -"/* @flow */ +/* @flow */ var React = require('react'); var Hello = React.createClass({ @@ -74,7 +74,7 @@ var Hello = React.createClass({ module.exports = Hello; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\\"react\\"); +var React = require("react"); var Hello = React.createClass({ propTypes: { @@ -87,11 +87,11 @@ var Hello = React.createClass({ }); module.exports = Hello; -" + `; exports[`es6class-proptypes-callsite.js 1`] = ` -"/* @flow */ +/* @flow */ import React from 'react'; import Hello from './es6class-proptypes-module'; @@ -119,8 +119,8 @@ class Callsite extends React.Component { module.exports = Callsite; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import React from \\"react\\"; -import Hello from \\"./es6class-proptypes-module\\"; +import React from "react"; +import Hello from "./es6class-proptypes-module"; class HelloLocal extends React.Component { defaultProps = {}; @@ -144,11 +144,11 @@ class Callsite extends React.Component { } module.exports = Callsite; -" + `; exports[`es6class-proptypes-module.js 1`] = ` -"/* @flow */ +/* @flow */ import React from 'react'; class Hello extends React.Component { @@ -165,7 +165,7 @@ class Hello extends React.Component { module.exports = Hello; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import React from \\"react\\"; +import React from "react"; class Hello extends React.Component { defaultProps = {}; @@ -179,11 +179,11 @@ class Hello extends React.Component { } module.exports = Hello; -" + `; exports[`es6class-types-callsite.js 1`] = ` -"/* @flow */ +/* @flow */ import React from 'react'; import Hello from './es6class-types-module'; @@ -211,8 +211,8 @@ class Callsite extends React.Component { module.exports = Callsite; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import React from \\"react\\"; -import Hello from \\"./es6class-types-module\\"; +import React from "react"; +import Hello from "./es6class-types-module"; type Props = { name: string }; @@ -236,11 +236,11 @@ class Callsite extends React.Component { } module.exports = Callsite; -" + `; exports[`es6class-types-module.js 1`] = ` -"/* @flow */ +/* @flow */ import React from 'react'; type Props = {name: string}; @@ -257,7 +257,7 @@ class Hello extends React.Component<{}, Props, void>{ module.exports = Hello; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import React from \\"react\\"; +import React from "react"; type Props = { name: string }; @@ -271,5 +271,5 @@ class Hello extends React.Component<{}, Props, void> { } module.exports = Hello; -" + `; diff --git a/tests/flow/rec/__snapshots__/jsfmt.spec.js.snap b/tests/flow/rec/__snapshots__/jsfmt.spec.js.snap index 45268ba2..70993eb1 100644 --- a/tests/flow/rec/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/rec/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`issue-598.js 1`] = ` -"/* @flow */ +/* @flow */ type F
= { foo(x: A): F } declare function foo(x: any): F; @@ -48,11 +48,11 @@ function identity(val: A): Functor { } }; } -" + `; exports[`issue-1228.js 1`] = ` -"/* @flow */ +/* @flow */ type Task = { chain(next:(input:value) => Task): @@ -72,11 +72,11 @@ type Task = { function id(x: Task): Task { return x; } -" + `; exports[`test.js 1`] = ` -"class P { x: X; } // this is like Promise +class P { x: X; } // this is like Promise type Pstar = X | Pstar>; // this is like Promise* @@ -111,11 +111,11 @@ pstar = p; // OK pstar = (new P(): P>); // OK (pstar.x: string); // error -" + `; exports[`test2.js 1`] = ` -"var a = []; // Array ~> a +var a = []; // Array ~> a function bar() { a = a.concat([]); // terminate despite expanding types: // a ~> .concat(Array) @@ -176,11 +176,11 @@ class D {} class B extends D {} class C extends B {} ((new C(): C): D); // error: number ~/~ string -" + `; exports[`test3.js 1`] = ` -"type I = () => I>; +type I = () => I>; type J = () => J>; function foo(x: I): J { @@ -213,18 +213,18 @@ function bar(x: P): () => P { // P = () => { x: P } // () => P = () => () => { x: P } } -" + `; exports[`test4.js 1`] = ` -"type T = T // cycle in type alias should not cause non-termination +type T = T // cycle in type alias should not cause non-termination ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type T = T; // cycle in type alias should not cause non-termination -" + `; exports[`test5.js 1`] = ` -"/* @flow */ +/* @flow */ type NestedArray = Array>; @@ -245,5 +245,5 @@ function flatten(arrArg: NestedArray) { arr = Array.prototype.concat.apply([], arr); } } -" + `; diff --git a/tests/flow/recheck-haste/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck-haste/__snapshots__/jsfmt.spec.js.snap index ad48c9c4..5b00be43 100644 --- a/tests/flow/recheck-haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck-haste/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A1.js 1`] = ` -"/** +/** * @providesModule A * @flow */ @@ -10,22 +10,22 @@ exports[`A1.js 1`] = ` * @providesModule A * @flow */ -" + `; exports[`A3.js 1`] = ` -"// @flow +// @flow require('A'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -require(\\"A\\"); -" +require("A"); + `; exports[`B1.js 1`] = ` -"/** +/** * @flow */ @@ -36,13 +36,13 @@ require('B3'); * @flow */ -require(\\"B2\\"); -require(\\"B3\\"); -" +require("B2"); +require("B3"); + `; exports[`B3.js 1`] = ` -"/** +/** * @providesModule B3 * @flow */ @@ -54,6 +54,6 @@ require('B2'); * @flow */ -require(\\"B2\\"); -" +require("B2"); + `; diff --git a/tests/flow/recheck-haste/dir1B/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck-haste/dir1B/__snapshots__/jsfmt.spec.js.snap index 97784a4a..38d2e910 100644 --- a/tests/flow/recheck-haste/dir1B/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck-haste/dir1B/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`B2.js 1`] = ` -"/** +/** * @providesModule B2 * @flow */ @@ -13,6 +13,6 @@ require('B3'); * @flow */ -require(\\"B3\\"); -" +require("B3"); + `; diff --git a/tests/flow/recheck-haste/tmp1A/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck-haste/tmp1A/__snapshots__/jsfmt.spec.js.snap index f7da4e1f..ecf04791 100644 --- a/tests/flow/recheck-haste/tmp1A/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck-haste/tmp1A/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A2.js 1`] = ` -"/** +/** * @providesModule B * @flow */ @@ -10,5 +10,5 @@ exports[`A2.js 1`] = ` * @providesModule B * @flow */ -" + `; diff --git a/tests/flow/recheck-haste/tmp2A/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck-haste/tmp2A/__snapshots__/jsfmt.spec.js.snap index a0752a65..ebae28a2 100644 --- a/tests/flow/recheck-haste/tmp2A/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck-haste/tmp2A/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A3.js 1`] = ` -"// @flow +// @flow require('B'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -require(\\"B\\"); -" +require("B"); + `; diff --git a/tests/flow/recheck/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/__snapshots__/jsfmt.spec.js.snap index 3e2a6c89..276f013e 100644 --- a/tests/flow/recheck/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a1.js 1`] = ` -"// @flow +// @flow function foo(x: number): string { return 5; } @@ -18,26 +18,26 @@ function foo(x: number): string { foo(0); module.exports = foo; -" + `; exports[`a2.js 1`] = ` -"// @flow +// @flow const foo = require('./a1'); -module.exports = foo(\\"\\"); +module.exports = foo(""); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const foo = require(\\"./a1\\"); +const foo = require("./a1"); + +module.exports = foo(""); -module.exports = foo(\\"\\"); -" `; exports[`a3.js 1`] = ` -"// @flow +// @flow const five = require('./a2'); @@ -45,14 +45,14 @@ const five = require('./a2'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const five = require(\\"./a2\\"); +const five = require("./a2"); (five + five: string); -" + `; exports[`b0.js 1`] = ` -"// @flow +// @flow class C { x: C; } class E { x: C; } @@ -69,13 +69,13 @@ class E { } module.exports = { C, E }; -" + `; exports[`b1.js 1`] = ` -"// @flow +// @flow -import { C, E } from \\"./b0\\"; +import { C, E } from "./b0"; function foo() { return C; } function bar() { return E; } let X = foo(); @@ -85,7 +85,7 @@ module.exports = { C, D }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C, E } from \\"./b0\\"; +import { C, E } from "./b0"; function foo() { return C; } @@ -96,50 +96,50 @@ let X = foo(); class F extends X {} class D extends F {} module.exports = { C, D }; -" + `; exports[`b2.js 1`] = ` -"// @flow +// @flow -module.exports = require(\\"./b1\\"); +module.exports = require("./b1"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -module.exports = require(\\"./b1\\"); -" +module.exports = require("./b1"); + `; exports[`b3.js 1`] = ` -"// @flow +// @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); -" + `; exports[`c1.js 1`] = ` -"// @flow +// @flow export function foo(props: { x: number }) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export function foo(props: { x: number }) {} -" + `; exports[`c2.js 1`] = ` -"// @flow +// @flow -import { foo } from \\"./c1\\"; +import { foo } from "./c1"; export function bar(props: { x: number }) { foo({ x: 0 }); @@ -147,31 +147,31 @@ export function bar(props: { x: number }) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { foo } from \\"./c1\\"; +import { foo } from "./c1"; export function bar(props: { x: number }) { foo({ x: 0 }); } -" + `; exports[`c3.js 1`] = ` -"// @flow +// @flow -import { bar } from \\"./c2\\"; +import { bar } from "./c2"; bar({ x: 0 }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { bar } from \\"./c2\\"; +import { bar } from "./c2"; bar({ x: 0 }); -" + `; exports[`d1.js 1`] = ` -"// @flow +// @flow export class A {} export class B {} @@ -182,24 +182,24 @@ export var x = new A; export class A {} export class B {} export var x = new A(); -" + `; exports[`d2.js 1`] = ` -"// @flow +// @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; -" + `; exports[`e1.js 1`] = ` -"// @flow +// @flow export type Action = | { type: 'FOO' } @@ -210,14 +210,14 @@ export const LIFE = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export type Action = { type: \\"FOO\\" } | { type: \\"BAR\\" }; +export type Action = { type: "FOO" } | { type: "BAR" }; export const LIFE = 42; -" + `; exports[`e2.js 1`] = ` -"// @flow +// @flow import type { Action } from './e1'; @@ -231,20 +231,20 @@ import { LIFE } from './e1'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @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); -" + `; exports[`f1.js 1`] = ` -"// @flow +// @flow type T = { x: number }; type S = { x: string }; @@ -265,35 +265,35 @@ declare var b: S; declare var c: T; module.exports = { a, b, c }; -" + `; exports[`f2.js 1`] = ` -"// @flow +// @flow 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 }); -" + `; exports[`g1.js 1`] = ` -"// @flow +// @flow export class C { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export class C {} -" + `; exports[`g2.js 1`] = ` -"// @flow +// @flow import { C } from './g1'; @@ -303,16 +303,16 @@ module.exports = { D }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C } from \\"./g1\\"; +import { C } from "./g1"; class D extends C {} module.exports = { D }; -" + `; exports[`g3.js 1`] = ` -"// @flow +// @flow import { C } from './g1'; import { D } from './g2'; @@ -321,37 +321,37 @@ import { D } from './g2'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C } from \\"./g1\\"; -import { D } from \\"./g2\\"; +import { C } from "./g1"; +import { D } from "./g2"; (new D(): C); -" + `; exports[`h1.js 1`] = ` -"// @flow +// @flow export type Foo = number; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export type Foo = number; -" + `; exports[`h2.js 1`] = ` -"// @flow +// @flow import type { Foo } from './h1'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import type { Foo } from \\"./h1\\"; -" +import type { Foo } from "./h1"; + `; exports[`i1.js 1`] = ` -"// @flow +// @flow const foo: { p: number } = { p: 0 }; @@ -362,11 +362,11 @@ module.exports = foo; const foo: { p: number } = { p: 0 }; module.exports = foo; -" + `; exports[`i2.js 1`] = ` -"// @flow +// @flow const foo = require('./i1'); @@ -374,14 +374,14 @@ foo.p = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const foo = require(\\"./i1\\"); +const foo = require("./i1"); foo.p = 0; -" + `; exports[`j1.js 1`] = ` -"// @flow +// @flow const foo: { [string]: number } = {}; @@ -392,11 +392,11 @@ module.exports = foo; const foo: { [string]: number } = {}; module.exports = foo; -" + `; exports[`j2.js 1`] = ` -"// @flow +// @flow const foo = require('./j1'); @@ -404,8 +404,8 @@ foo.p = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const foo = require(\\"./j1\\"); +const foo = require("./j1"); foo.p = 0; -" + `; diff --git a/tests/flow/recheck/tmp1a/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1a/__snapshots__/jsfmt.spec.js.snap index a7bf1066..ed92771b 100644 --- a/tests/flow/recheck/tmp1a/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1a/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a1.js 1`] = ` -"// @flow +// @flow function foo(x: number): number { return 5; } @@ -18,5 +18,5 @@ function foo(x: number): number { foo(0); module.exports = foo; -" + `; diff --git a/tests/flow/recheck/tmp1b/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1b/__snapshots__/jsfmt.spec.js.snap index 4d9305e8..c32ec9d3 100644 --- a/tests/flow/recheck/tmp1b/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1b/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`b1.js 1`] = ` -"// @flow +// @flow -import { C, E } from \\"./b0\\"; +import { C, E } from "./b0"; function foo() { return C; } function bar() { return E; } let X = bar(); @@ -13,7 +13,7 @@ module.exports = { C, D }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C, E } from \\"./b0\\"; +import { C, E } from "./b0"; function foo() { return C; } @@ -24,5 +24,5 @@ let X = bar(); class F extends X {} class D extends F {} module.exports = { C, D }; -" + `; diff --git a/tests/flow/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap index e04c0c1d..8955d766 100644 --- a/tests/flow/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`c2.js 1`] = ` -"// @flow +// @flow -import { foo } from \\"./c1\\"; +import { foo } from "./c1"; export function bar(props: { y: number }) { foo({ y: 0 }); @@ -11,10 +11,10 @@ export function bar(props: { y: number }) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { foo } from \\"./c1\\"; +import { foo } from "./c1"; export function bar(props: { y: number }) { foo({ y: 0 }); } -" + `; diff --git a/tests/flow/recheck/tmp1d/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1d/__snapshots__/jsfmt.spec.js.snap index 0146cfd6..56c71211 100644 --- a/tests/flow/recheck/tmp1d/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1d/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`d1.js 1`] = ` -"// @flow +// @flow export class A {} export class B {} @@ -12,5 +12,5 @@ export var x = new B; export class A {} export class B {} export var x = new B(); -" + `; diff --git a/tests/flow/recheck/tmp1e/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1e/__snapshots__/jsfmt.spec.js.snap index 338e2c12..8c73318c 100644 --- a/tests/flow/recheck/tmp1e/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1e/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`e2.js 1`] = ` -"// @flow +// @flow import type { Action } from './e1'; @@ -15,14 +15,14 @@ import { LIFE } from './e1'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @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/flow/recheck/tmp1f/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1f/__snapshots__/jsfmt.spec.js.snap index 6553b542..b2666b44 100644 --- a/tests/flow/recheck/tmp1f/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1f/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`f1.js 1`] = ` -"// @flow +// @flow type T = { x: number }; type S = { x: string }; @@ -22,5 +22,5 @@ declare var b: S; declare var c: S; module.exports = { a, b, c }; -" + `; diff --git a/tests/flow/recheck/tmp1g/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1g/__snapshots__/jsfmt.spec.js.snap index e96b4760..f173e9c8 100644 --- a/tests/flow/recheck/tmp1g/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1g/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`g1.js 1`] = ` -"// @flow +// @flow export class C { } export var extra = null; @@ -10,5 +10,5 @@ export var extra = null; export class C {} export var extra = null; -" + `; diff --git a/tests/flow/recheck/tmp1h/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1h/__snapshots__/jsfmt.spec.js.snap index 2a51a4a3..2ff68259 100644 --- a/tests/flow/recheck/tmp1h/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1h/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`h1.js 1`] = ` -"// @flow +// @flow export type Bar = number; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export type Bar = number; -" + `; diff --git a/tests/flow/recheck/tmp1i/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1i/__snapshots__/jsfmt.spec.js.snap index dbbf8c37..bc2da56e 100644 --- a/tests/flow/recheck/tmp1i/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1i/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`i1.js 1`] = ` -"// @flow +// @flow const foo: { +p: number } = { p: 0 }; @@ -12,5 +12,5 @@ module.exports = foo; const foo: { +p: number } = { p: 0 }; module.exports = foo; -" + `; diff --git a/tests/flow/recheck/tmp1j/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp1j/__snapshots__/jsfmt.spec.js.snap index bd75dd96..be609418 100644 --- a/tests/flow/recheck/tmp1j/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp1j/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`j1.js 1`] = ` -"// @flow +// @flow const foo: { +[string]: number } = {}; @@ -12,5 +12,5 @@ module.exports = foo; const foo: { +[string]: number } = {}; module.exports = foo; -" + `; diff --git a/tests/flow/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap index c5c79c97..7b76f2ab 100644 --- a/tests/flow/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`a1.js 1`] = ` -"// @flow +// @flow function foo(x: number): number { return 5; } -foo(\\"\\"); +foo(""); module.exports = foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -15,8 +15,8 @@ function foo(x: number): number { return 5; } -foo(\\"\\"); +foo(""); module.exports = foo; -" + `; diff --git a/tests/flow/recheck/tmp2b/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp2b/__snapshots__/jsfmt.spec.js.snap index 570b1b19..a6f298f2 100644 --- a/tests/flow/recheck/tmp2b/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp2b/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`b0.js 1`] = ` -"// @flow +// @flow class C { x: C; } class E extends C { x: C; } @@ -18,5 +18,5 @@ class E extends C { } module.exports = { C, E }; -" + `; diff --git a/tests/flow/recheck/tmp2c/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp2c/__snapshots__/jsfmt.spec.js.snap index e6791e86..7b2a356d 100644 --- a/tests/flow/recheck/tmp2c/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp2c/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`c1.js 1`] = ` -"// @flow +// @flow export function foo(props: { y: number }) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export function foo(props: { y: number }) {} -" + `; diff --git a/tests/flow/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap index 6465844d..c7744996 100644 --- a/tests/flow/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`e1.js 1`] = ` -"// @flow +// @flow export type Action = | { type: 'QUX' } @@ -12,8 +12,8 @@ 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/flow/recheck/tmp2f/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp2f/__snapshots__/jsfmt.spec.js.snap index 30f154f4..78e8e50b 100644 --- a/tests/flow/recheck/tmp2f/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp2f/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`f1.js 1`] = ` -"// @flow +// @flow type T = { x: number }; type S = { x: string }; @@ -22,5 +22,5 @@ declare var b: S; declare var c: T; module.exports = { a, b, c }; -" + `; diff --git a/tests/flow/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap index 4b6f3ecb..087c3da3 100644 --- a/tests/flow/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`e1.js 1`] = ` -"// @flow +// @flow export type Action = | { type: 'QUX' } @@ -12,14 +12,14 @@ export const LIFE = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export type Action = { type: \\"QUX\\" } | { type: \\"BAR\\" }; +export type Action = { type: "QUX" } | { type: "BAR" }; export const LIFE = 0; -" + `; exports[`e2.js 1`] = ` -"// @flow +// @flow import type { Action } from './e1'; @@ -33,14 +33,14 @@ import { LIFE } from './e1'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @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/flow/recheck/tmp3f/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp3f/__snapshots__/jsfmt.spec.js.snap index ab6afe32..2754e7f9 100644 --- a/tests/flow/recheck/tmp3f/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp3f/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`f1.js 1`] = ` -"// @flow +// @flow type T = { x: number }; type S = { x: string }; @@ -22,5 +22,5 @@ declare var b: S; declare var c: T; module.exports = { a, b, c: a }; -" + `; diff --git a/tests/flow/recheck/tmp4f/__snapshots__/jsfmt.spec.js.snap b/tests/flow/recheck/tmp4f/__snapshots__/jsfmt.spec.js.snap index 4e7f58b3..10d1fe99 100644 --- a/tests/flow/recheck/tmp4f/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/recheck/tmp4f/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`f1.js 1`] = ` -"// @flow +// @flow type T = { x: number }; type S = { x: string }; @@ -22,5 +22,5 @@ declare var b: S; declare var c: T; module.exports = { a, b, c: b }; -" + `; diff --git a/tests/flow/record/__snapshots__/jsfmt.spec.js.snap b/tests/flow/record/__snapshots__/jsfmt.spec.js.snap index 5a1baaf0..f58a0d63 100644 --- a/tests/flow/record/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/record/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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 @@ -26,10 +26,10 @@ class D extends C<{foo: number, bar: string}> { type AnyKey = $Keys; var o3: {[key: AnyKey]: number} = { foo: 0 }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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 @@ -50,5 +50,5 @@ class D extends C<{ foo: number, bar: string }> { type AnyKey = $Keys; var o3: { [key: AnyKey]: number } = { foo: 0 }; -" + `; diff --git a/tests/flow/refi/__snapshots__/jsfmt.spec.js.snap b/tests/flow/refi/__snapshots__/jsfmt.spec.js.snap index e371d8f0..3e40c2f0 100644 --- a/tests/flow/refi/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/refi/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bound.js 1`] = ` -"// refinements of bound vars (closed-over locals) +// 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 = [ @@ -40,7 +40,7 @@ var tests = // requires further remedial work in Env function() { if (x != null) { - alert(\\"\\"); + alert(""); var y : string = x; // not ok } }, @@ -58,18 +58,18 @@ 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 }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 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 = [ function() { @@ -105,7 +105,7 @@ var tests = [ // requires further remedial work in Env function() { if (x != null) { - alert(\\"\\"); + alert(""); var y : string = x; // not ok } }, @@ -124,62 +124,62 @@ 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 } ]; -" + `; exports[`heap.js 1`] = ` -"var tests = +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 @@ -187,13 +187,13 @@ exports[`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 @@ -201,17 +201,17 @@ exports[`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 { @@ -222,7 +222,7 @@ exports[`heap.js 1`] = ` function() { var x : {y: ?string} = {y: null}; if (!x.y) { - x.y = \\"foo\\"; + x.y = "foo"; } (x.y: string); }, @@ -231,7 +231,7 @@ exports[`heap.js 1`] = ` var x : {y: ?string} = {y: null}; if (x.y) { } else { - x.y = \\"foo\\"; + x.y = "foo"; } (x.y: string); }, @@ -247,27 +247,27 @@ exports[`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 }, @@ -275,7 +275,7 @@ exports[`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; @@ -285,11 +285,11 @@ exports[`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 @@ -298,11 +298,11 @@ exports[`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 @@ -311,7 +311,7 @@ exports[`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 { @@ -341,7 +341,7 @@ exports[`heap.js 1`] = ` let x: { foo: ?string } = { foo: null }; if (!x.foo) { if (false) {} - x.foo = \\"foo\\"; + x.foo = "foo"; } (x.foo: string); }, @@ -350,7 +350,7 @@ exports[`heap.js 1`] = ` let x: { foo: ?string } = { foo: null }; if (!x.foo) { while(false) {} - x.foo = \\"foo\\"; + x.foo = "foo"; } (x.foo: string); }, @@ -359,13 +359,13 @@ exports[`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 @@ -375,19 +375,19 @@ exports[`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 @@ -395,13 +395,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; // 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 @@ -409,15 +409,15 @@ 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; // 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 @@ -425,14 +425,14 @@ var tests = [ }, 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 @@ -440,17 +440,17 @@ var tests = [ }, 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 { @@ -461,7 +461,7 @@ var tests = [ function() { var x: { y: ?string } = { y: null }; if (!x.y) { - x.y = \\"foo\\"; + x.y = "foo"; } (x.y: string); }, @@ -470,7 +470,7 @@ var tests = [ var x: { y: ?string } = { y: null }; if (x.y) { } else { - x.y = \\"foo\\"; + x.y = "foo"; } (x.y: string); }, @@ -486,27 +486,27 @@ 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); // 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 }, @@ -514,7 +514,7 @@ var tests = [ function() { var x: { y: ?string } = { y: null }; if (!x.y) { - x.y = \\"foo\\"; + x.y = "foo"; } if (x.y) { x.y = null; @@ -524,11 +524,11 @@ 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"; } // 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 @@ -537,11 +537,11 @@ 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"; } // 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 @@ -550,7 +550,7 @@ var tests = [ function() { var x: { y: ?string } = { y: null }; - var z: string = \\"foo\\"; + var z: string = "foo"; if (x.y) { x.y = z; } else { @@ -560,13 +560,13 @@ var tests = [ }, function(x: string) { - if (x === \\"a\\") { + if (x === "a") { } - (x: \\"b\\"); // error (but only once, string !~> 'b'; 'a' is irrelevant) + (x: "b"); // error (but only once, string !~> 'b'; 'a' is irrelevant) }, function(x: mixed) { - if (typeof x.bar === \\"string\\") { + if (typeof x.bar === "string") { } // error, so \`x.bar\` refinement is empty (x: string & number); }, @@ -583,7 +583,7 @@ var tests = [ if (!x.foo) { if (false) { } - x.foo = \\"foo\\"; + x.foo = "foo"; } (x.foo: string); }, @@ -593,7 +593,7 @@ var tests = [ if (!x.foo) { while (false) { } - x.foo = \\"foo\\"; + x.foo = "foo"; } (x.foo: string); }, @@ -603,27 +603,27 @@ var tests = [ 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 } } ]; -" + `; exports[`lex.js 1`] = ` -"function block_scope(x: string | number) { +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 } @@ -632,7 +632,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 } @@ -640,19 +640,19 @@ 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 } @@ -660,7 +660,7 @@ function try_scope_catch(x: string | number) { 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 } @@ -669,7 +669,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 } @@ -677,77 +677,77 @@ 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 } -" + `; exports[`local.js 1`] = ` -"var paths = +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 @@ -755,17 +755,17 @@ exports[`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 { @@ -776,7 +776,7 @@ exports[`local.js 1`] = ` function() { var x : ?string = null; if (!x) { - x = \\"xxx\\"; + x = "xxx"; } var y : string = x; }, @@ -784,19 +784,19 @@ exports[`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 @@ -804,13 +804,13 @@ var paths = [ }, 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 @@ -818,22 +818,22 @@ var paths = [ }, 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 @@ -841,17 +841,17 @@ var paths = [ }, 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 { @@ -862,41 +862,41 @@ var paths = [ function() { var x: ?string = null; if (!x) { - x = \\"xxx\\"; + x = "xxx"; } var y: string = x; } ]; -" + `; exports[`null_tests.js 1`] = ` -"var null_tests = +var null_tests = [ // 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 } @@ -904,21 +904,21 @@ exports[`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 } @@ -926,21 +926,21 @@ exports[`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 } @@ -948,21 +948,21 @@ exports[`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 } @@ -977,12 +977,12 @@ class C { if (this.p != null) return this.p; else - return \\"\\"; + return ""; } ensure1(): string { if (this.p == null) - return \\"\\"; + return ""; return this.p; } @@ -990,12 +990,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; } } @@ -1007,50 +1007,50 @@ 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 ""; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var null_tests = [ // 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 } @@ -1058,7 +1058,7 @@ var null_tests = [ // expr == null function() { - var x: ?string = \\"xxx\\"; + var x: ?string = "xxx"; if (x == null) { } else { var y: string = x; // ok @@ -1066,7 +1066,7 @@ var null_tests = [ }, function() { - var x: { p: ?string } = { p: \\"xxx\\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p == null) { } else { var y: string = x.p; // ok @@ -1074,7 +1074,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 { var y: string = x.p.q; // ok @@ -1083,21 +1083,21 @@ var null_tests = [ // 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 } @@ -1105,7 +1105,7 @@ var null_tests = [ // expr === null function() { - var x: ?string = \\"xxx\\"; + var x: ?string = "xxx"; if (x === null) { } else { var y: string | void = x; // ok @@ -1113,7 +1113,7 @@ var null_tests = [ }, 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 @@ -1121,7 +1121,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 { var y: string | void = x.p.q; // ok @@ -1135,21 +1135,21 @@ class C { ensure0(): string { if (this.p != null) return this.p; - else return \\"\\"; + else return ""; } ensure1(): string { - if (this.p == null) return \\"\\"; + if (this.p == null) return ""; return this.p; } ensure2(): string | void { if (this.p !== null) return this.p; - else return \\"\\"; + else return ""; } ensure3(): string | void { - if (this.p === null) return \\"\\"; + if (this.p === null) return ""; return this.p; } } @@ -1158,27 +1158,27 @@ class C { class D extends C { ensure100(): string { if (super.p != null) return super.p; - else return \\"\\"; + else return ""; } ensure101(): string { - if (super.p == null) return \\"\\"; + if (super.p == null) return ""; else return super.p; } ensure103(): string { if (super.p != null) { - alert(\\"\\"); + alert(""); return super.p; // not ok } - return \\"\\"; + return ""; } } -" + `; exports[`switch.js 1`] = ` -"// @flow +// @flow function foo(a,b,c) { switch (c) { case a.x.y: // OK @@ -1218,7 +1218,7 @@ function exhaustion2(x, y): number { * Currently tvars are always shared between clones - we'd * have to rework envs pretty extensively to avoid it. * - foo = \\"\\"; + foo = ""; */ case 1: foo = 3; @@ -1263,7 +1263,7 @@ function exhaustion1(x): number { foo = 3; break; default: - throw new Error(\\"Invalid state\\"); + throw new Error("Invalid state"); } return foo; // no error } @@ -1282,13 +1282,13 @@ function exhaustion2(x, y): number { * 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 } @@ -1301,107 +1301,107 @@ function exhaustion3(x): number { foo = 3; break; default: - throw new Error(\\"Invalid state\\"); + throw new Error("Invalid state"); } return foo; // no error } -" + `; exports[`typeof_tests.js 1`] = ` -"var null_tests = +var null_tests = [ // 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 } }, @@ -1412,29 +1412,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; } @@ -1443,53 +1443,53 @@ class A { var null_tests = [ // 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\\") { + 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\\") { + 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\\") { + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + if (typeof x.p.q != "string") { } else { var y: string = x.p.q; // ok } @@ -1497,46 +1497,46 @@ var null_tests = [ // 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\\") { + 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\\") { + 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\\") { + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + if (typeof x.p.q !== "string") { } else { var y: string = x.p.q; // ok } @@ -1548,57 +1548,57 @@ class A { p: ?string; ensure0(): string { - if (typeof this.p == \\"string\\") return this.p; - else return \\"\\"; + if (typeof this.p == "string") return this.p; + else 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\\") return this.p; - else return \\"\\"; + if (typeof this.p === "string") return this.p; + else return ""; } ensure3(): string | void { - if (typeof this.p !== \\"string\\") return \\"\\"; + if (typeof this.p !== "string") return ""; else return this.p; } } -" + `; exports[`undef_tests.js 1`] = ` -"var undef_tests = +var undef_tests = [ // NOTE: not (yet?) supporting non-strict eq test for undefined // 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 } @@ -1606,21 +1606,21 @@ exports[`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 } @@ -1635,12 +1635,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; } @@ -1651,28 +1651,28 @@ var undef_tests = [ // 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 } @@ -1680,7 +1680,7 @@ var undef_tests = [ // expr === undefined function() { - var x: ?string = \\"xxx\\"; + var x: ?string = "xxx"; if (x === undefined || x === null) { } else { var y: string = x; // ok @@ -1688,7 +1688,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 { var y: string = x.p; // ok @@ -1696,7 +1696,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 { var y: string = x.p.q; // ok @@ -1710,46 +1710,46 @@ class A { ensure0(): string { if (this.p !== undefined && this.p !== null) return this.p; - else return \\"\\"; + else return ""; } ensure1(): string { - if (this.p === undefined || this.p === null) return \\"\\"; + if (this.p === undefined || this.p === null) return ""; else return this.p; } } -" + `; exports[`void_tests.js 1`] = ` -"var void_tests = +var void_tests = [ // NOTE: not (yet?) supporting non-strict eq test for undefined // 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 } @@ -1757,21 +1757,21 @@ exports[`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 } @@ -1786,12 +1786,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; } @@ -1802,28 +1802,28 @@ var void_tests = [ // 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 } @@ -1831,7 +1831,7 @@ var void_tests = [ // expr === void(...) function() { - var x: ?string = \\"xxx\\"; + var x: ?string = "xxx"; if (x === void 0 || x === null) { } else { var y: string = x; // ok @@ -1839,7 +1839,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 { var y: string = x.p; // ok @@ -1847,7 +1847,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 { var y: string = x.p.q; // ok @@ -1861,13 +1861,13 @@ class A { ensure0(): string { if (this.p !== void 0 && this.p !== null) return this.p; - else return \\"\\"; + else return ""; } ensure1(): string { - if (this.p === void 0 || this.p === null) return \\"\\"; + if (this.p === void 0 || this.p === null) return ""; else return this.p; } } -" + `; diff --git a/tests/flow/refinements/__snapshots__/jsfmt.spec.js.snap b/tests/flow/refinements/__snapshots__/jsfmt.spec.js.snap index 368090f0..5dbb9739 100644 --- a/tests/flow/refinements/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/refinements/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`assignment.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x : ?number) { var y; @@ -68,11 +68,11 @@ function bar2(x: Bar) { y.doStuff(); } } -" + `; exports[`ast_node.js 1`] = ` -"type Node1 = { +type Node1 = { kind: 'Node1', prop1?: string }; @@ -85,21 +85,21 @@ type Node2 = { export type ASTNode = Node1 | Node2; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Node1 = { - kind: \\"Node1\\", + kind: "Node1", prop1?: string }; type Node2 = { - kind: \\"Node2\\", + kind: "Node2", prop2?: string }; export type ASTNode = Node1 | Node2; -" + `; exports[`bool.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x: ?bool) { if (x === false) { @@ -192,11 +192,11 @@ let tests = [ return x.result; // error } ]; -" + `; exports[`computed_string_literal.js 1`] = ` -"// @flow +// @flow type A = { 'b_c': ?string @@ -219,7 +219,7 @@ function testLiteralProperty(a: A) { // @flow type A = { - \\"b_c\\": ?string + "b_c": ?string }; function stuff(str: string) {} @@ -231,15 +231,15 @@ function testProperty(a: A) { } function testLiteralProperty(a: A) { - if (a[\\"b_c\\"]) { - stuff(a[\\"b_c\\"]); + if (a["b_c"]) { + stuff(a["b_c"]); } } -" + `; exports[`cond_prop.js 1`] = ` -"/* @flow */ +/* @flow */ type Type = Name | ListType | NonNullType; type Name = {kind: 'Name', value: string, type: void }; @@ -262,7 +262,7 @@ let tests = [ function(x: { done: true, result: string } | { foo: string }) { if (x.done) { - return x.result; // error, consider { foo: \\"herp\\", done: \\"derp\\" } + return x.result; // error, consider { foo: "herp", done: "derp" } } return x.result; // error }, @@ -274,7 +274,7 @@ let tests = [ function testAlwaysTruthyProp(t: T) { if (t.foo) { - (t.bar: string); // error, consider { baz: \\"x\\", quux: \\"y\\", foo: \\"boom\\" } + (t.bar: string); // error, consider { baz: "x", quux: "y", foo: "boom" } } else { (t.quux: string); // ok. since foo is an object (always truthy), the // else case completely rules out the first branch of @@ -284,9 +284,9 @@ let tests = [ function testSometimesTruthyProp(t: T) { if (t.bar) { - (t.foo: Object); // error, consider { baz: \\"x\\", quux: \\"y\\", bar: \\"boom\\" } + (t.foo: Object); // error, consider { baz: "x", quux: "y", bar: "boom" } } else { - (t.quux: string); // error, consider { foo: {}, bar: \\"\\" } + (t.quux: string); // error, consider { foo: {}, bar: "" } } } }, @@ -295,13 +295,13 @@ let tests = [ /* @flow */ type Type = Name | ListType | NonNullType; -type Name = { kind: \\"Name\\", value: string, type: void }; -type ListType = { kind: \\"ListType\\", type: Type }; -type NonNullType = { kind: \\"NonNullType\\", type: Name | ListType | BadType }; +type Name = { kind: "Name", value: string, type: void }; +type ListType = { kind: "ListType", type: Type }; +type NonNullType = { kind: "NonNullType", type: Name | ListType | BadType }; type BadType = {}; function getTypeASTName(typeAST: Type): string { - if (!typeAST.type) throw new Error(\\"Must be wrapping type\\"); // OK + if (!typeAST.type) throw new Error("Must be wrapping type"); // OK return getTypeASTName(typeAST.type); // error, BadType not a subtype of Type } @@ -315,7 +315,7 @@ let tests = [ function(x: { done: true, result: string } | { foo: string }) { if (x.done) { - return x.result; // error, consider { foo: \\"herp\\", done: \\"derp\\" } + return x.result; // error, consider { foo: "herp", done: "derp" } } return x.result; // error }, @@ -325,7 +325,7 @@ let tests = [ function testAlwaysTruthyProp(t: T) { if (t.foo) { - (t.bar: string); // error, consider { baz: \\"x\\", quux: \\"y\\", foo: \\"boom\\" } + (t.bar: string); // error, consider { baz: "x", quux: "y", foo: "boom" } } else { (t.quux: string); // ok. since foo is an object (always truthy), the // else case completely rules out the first branch of @@ -335,31 +335,31 @@ let tests = [ function testSometimesTruthyProp(t: T) { if (t.bar) { - (t.foo: Object); // error, consider { baz: \\"x\\", quux: \\"y\\", bar: \\"boom\\" } + (t.foo: Object); // error, consider { baz: "x", quux: "y", bar: "boom" } } else { - (t.quux: string); // error, consider { foo: {}, bar: \\"\\" } + (t.quux: string); // error, consider { foo: {}, bar: "" } } } } ]; -" + `; exports[`constants.js 1`] = ` -"/* @flow */ +/* @flow */ export const SUCCESS: 'SUCCESS' = 'SUCCESS'; export const ERROR: 'ERROR' = 'ERROR'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -export const SUCCESS: \\"SUCCESS\\" = \\"SUCCESS\\"; -export const ERROR: \\"ERROR\\" = \\"ERROR\\"; -" +export const SUCCESS: "SUCCESS" = "SUCCESS"; +export const ERROR: "ERROR" = "ERROR"; + `; exports[`eq.js 1`] = ` -"/* @flow */ +/* @flow */ let tests = [ function(x: string, y: number) { @@ -404,31 +404,31 @@ let tests = [ } // ok }, - function(x: { y: \\"foo\\" } | { y: \\"bar\\" }) { + function(x: { y: "foo" } | { y: "bar" }) { if (x.y == 123) { } // error if (x.y === 123) { } // ok } ]; -" + `; exports[`exists.js 1`] = ` -"declare class Foo { +declare class Foo { foo: string; } function foo0(x: ?string): string { - return x && x || \\"\\"; + return x && x || ""; } function foo1(x: ?Foo): string { - return x && x.foo || \\"\\"; + return x && x.foo || ""; } function foo2(x: ?Class): string { - return x && new x().foo || \\"\\"; + return x && new x().foo || ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare class Foo { @@ -436,21 +436,21 @@ declare class Foo { } function foo0(x: ?string): string { - return (x && x) || \\"\\"; + return (x && x) || ""; } function foo1(x: ?Foo): string { - return (x && x.foo) || \\"\\"; + return (x && x.foo) || ""; } function foo2(x: ?Class): string { - return (x && new x().foo) || \\"\\"; + return (x && new x().foo) || ""; } -" + `; exports[`func_call.js 1`] = ` -"// @flow +// @flow let tests = [ function(x: { y?: string }, z: () => string) { @@ -475,11 +475,11 @@ let tests = [ } } ]; -" + `; exports[`hasOwnProperty.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x:{y?:() => void}) { x.y(); // error: could be undefined @@ -505,28 +505,28 @@ function bar(x:Object) { function foo(x: { y?: () => void }) { x.y(); // error: could be undefined - if (x.hasOwnProperty(\\"y\\")) { + if (x.hasOwnProperty("y")) { x.y(); // error: still could be undefined } - if (x.hasOwnProperty(\\"z\\")) { + if (x.hasOwnProperty("z")) { x.z(); // error: unreachable, but we don't help you here } } function bar(x: Object) { x.y(); // treated as \`any\`, so allowed - if (x.hasOwnProperty(\\"y\\")) { + if (x.hasOwnProperty("y")) { x.y(); // still treated as \`any\`, so allowed } - if (x.hasOwnProperty(\\"z\\")) { + if (x.hasOwnProperty("z")) { x.z(); // also treated as \`any\`, so allowed } } -" + `; exports[`heap_defassign.js 1`] = ` -"// @flow +// @flow type Obj = { p: number | string } @@ -625,13 +625,13 @@ function def_assign_function_havoc(obj: Obj) { function def_assign_setprop_havoc(obj: Obj, obj2: Obj) { obj.p = 10; // (obj.p : number) - obj2.p = \\"hey\\"; // clears refi + obj2.p = "hey"; // clears refi var x: number = obj.p; // error, obj.p : number | string } function def_assign_index_havoc(obj: Obj, obj2: Obj) { obj.p = 10; // (obj.p : number) - obj2[\\"p\\"] = \\"hey\\"; // clears refi + obj2["p"] = "hey"; // clears refi var x: number = obj.p; // error, obj.p : number | string } @@ -663,10 +663,10 @@ function def_assign_within_try(b: boolean, obj: Obj) { obj.p = 10; // (obj.p : number) try { f(); // clears refi and might throw - obj.p = \\"hey\\"; + obj.p = "hey"; } catch (e) { f(); // clears refi and might throw - obj.p = \\"hey\\"; + obj.p = "hey"; } finally { // NOTE: the values understood to flow to obj.p at this point // include the number 42 written downstream; @@ -692,25 +692,25 @@ type Obj2 = { q: number | string }; function def_assign_setprop_nohavoc(obj: Obj, obj2: Obj2) { obj.p = 10; // (obj.p : number) - obj2.q = \\"hey\\"; // doesn't clear refi of .p + obj2.q = "hey"; // doesn't clear refi of .p var x: number = obj.p; // still ok } -" + `; exports[`lib.js 1`] = ` -"/* @flow */ +/* @flow */ declare var BAZ: {stuff?: (x: number) => void} | void; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ declare var BAZ: { stuff?: (x: number) => void } | void; -" + `; exports[`missing-property-cond.js 1`] = ` -"// @flow +// @flow function foo1(o: { x: number }) { if (o.p1) { // OK, this is an idiomatic way of testing property existence @@ -819,13 +819,13 @@ function foo6(o: mixed) { } function foo7(o: mixed) { - if (typeof o.bar === \\"string\\") { + if (typeof o.bar === "string") { } // error - if (o && typeof o.bar === \\"string\\") { + if (o && typeof o.bar === "string") { } // ok - if (o != null && typeof o.bar === \\"string\\") { + if (o != null && typeof o.bar === "string") { } // ok - if (o !== null && o !== undefined && typeof o.bar === \\"string\\") { + if (o !== null && o !== undefined && typeof o.bar === "string") { } // ok } @@ -843,66 +843,66 @@ type Foo9Expected = { function foo9() { const actual = {}; if (actual.foo === undefined) { - actual.foo = \\"foo\\"; + actual.foo = "foo"; } (actual: Foo9Expected); } -" + `; exports[`mixed.js 1`] = ` -"/* @flow */ +/* @flow */ function takesNumber(x: number) {} function takesString(x: string) {} function num(x: mixed) { - if (typeof x === \\"number\\") { + if (typeof x === "number") { takesString(x); // error (!x: false); // error: we don't know the truthiness of x } - if (typeof x === \\"number\\" && x) { + if (typeof x === "number" && x) { (!x: false); // ok } - if (x && typeof x === \\"number\\") { + if (x && typeof x === "number") { (!x: false); // ok } } function str(x: mixed) { - if (typeof x === \\"string\\") { + if (typeof x === "string") { takesNumber(x); // error (!x: false); // error: we don't know the truthiness of x } - if (typeof x === \\"string\\" && x) { + if (typeof x === "string" && x) { (!x: false); // ok } - if (x && typeof x === \\"string\\") { + if (x && typeof x === "string") { (!x: false); // ok } } function bool(x: mixed) { - if (typeof x === \\"boolean\\") { + if (typeof x === "boolean") { takesString(x); // error (x: true); // error: we don't know the truthiness of x } - if (typeof x === \\"boolean\\" && x) { + if (typeof x === "boolean" && x) { (x: true); // ok } - if (x && typeof x === \\"boolean\\") { + if (x && typeof x === "boolean") { (x: true); // ok } } function fun(x: mixed) { - if (typeof x === \\"function\\") { + if (typeof x === "function") { takesString(x); // error } } function obj0(x: mixed) { - if (typeof x === \\"object\\") { + if (typeof x === "object") { takesString(x); // error } } @@ -914,7 +914,7 @@ function obj1(x: mixed) { } function undef(x: mixed) { - if (typeof x === \\"undefined\\") { + if (typeof x === "undefined") { takesString(x); // error } } @@ -944,7 +944,7 @@ function false_(x: mixed) { } function obj2(x: mixed) { - if (typeof x === \\"object\\") { + if (typeof x === "object") { (x: { [key: string]: mixed } | null); if (x !== null) { (x['foo']: string); // error, mixed @@ -953,16 +953,16 @@ function obj2(x: mixed) { } function obj2(x: mixed) { - if (typeof x === \\"object\\" && x) { + if (typeof x === "object" && x) { (x: Object); } - if (x && typeof x === \\"object\\") { + if (x && typeof x === "object") { (x: Object); } - if (x != null && typeof x === \\"object\\") { + if (x != null && typeof x === "object") { (x: Object); } - if (x !== null && typeof x === \\"object\\") { + if (x !== null && typeof x === "object") { (x: Object); } } @@ -979,52 +979,52 @@ function takesNumber(x: number) {} function takesString(x: string) {} function num(x: mixed) { - if (typeof x === \\"number\\") { + if (typeof x === "number") { takesString(x); // error (!x: false); // error: we don't know the truthiness of x } - if (typeof x === \\"number\\" && x) { + if (typeof x === "number" && x) { (!x: false); // ok } - if (x && typeof x === \\"number\\") { + if (x && typeof x === "number") { (!x: false); // ok } } function str(x: mixed) { - if (typeof x === \\"string\\") { + if (typeof x === "string") { takesNumber(x); // error (!x: false); // error: we don't know the truthiness of x } - if (typeof x === \\"string\\" && x) { + if (typeof x === "string" && x) { (!x: false); // ok } - if (x && typeof x === \\"string\\") { + if (x && typeof x === "string") { (!x: false); // ok } } function bool(x: mixed) { - if (typeof x === \\"boolean\\") { + if (typeof x === "boolean") { takesString(x); // error (x: true); // error: we don't know the truthiness of x } - if (typeof x === \\"boolean\\" && x) { + if (typeof x === "boolean" && x) { (x: true); // ok } - if (x && typeof x === \\"boolean\\") { + if (x && typeof x === "boolean") { (x: true); // ok } } function fun(x: mixed) { - if (typeof x === \\"function\\") { + if (typeof x === "function") { takesString(x); // error } } function obj0(x: mixed) { - if (typeof x === \\"object\\") { + if (typeof x === "object") { takesString(x); // error } } @@ -1036,7 +1036,7 @@ function obj1(x: mixed) { } function undef(x: mixed) { - if (typeof x === \\"undefined\\") { + if (typeof x === "undefined") { takesString(x); // error } } @@ -1066,25 +1066,25 @@ function false_(x: mixed) { } function obj2(x: mixed) { - if (typeof x === \\"object\\") { + if (typeof x === "object") { (x: { [key: string]: mixed } | null); if (x !== null) { - (x[\\"foo\\"]: string); // error, mixed + (x["foo"]: string); // error, mixed } } } function obj2(x: mixed) { - if (typeof x === \\"object\\" && x) { + if (typeof x === "object" && x) { (x: Object); } - if (x && typeof x === \\"object\\") { + if (x && typeof x === "object") { (x: Object); } - if (x != null && typeof x === \\"object\\") { + if (x != null && typeof x === "object") { (x: Object); } - if (x !== null && typeof x === \\"object\\") { + if (x !== null && typeof x === "object") { (x: Object); } } @@ -1094,18 +1094,18 @@ function arr0(x: mixed) { takesString(x[0]); // error } } -" + `; exports[`node1.js 1`] = ` -"module.exports = 'Node1'; +module.exports = 'Node1'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = \\"Node1\\"; -" +module.exports = "Node1"; + `; exports[`not.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x: ?bool) { if (!x) { @@ -1210,11 +1210,11 @@ let tests = [ (!x: false); // ok, classes are always truthy } ]; -" + `; exports[`null.js 1`] = ` -"/* @flow */ +/* @flow */ function null_bogus_comparison() { if (100 * null) { @@ -1235,11 +1235,11 @@ function null_bogus_comparison() { return; } } -" + `; exports[`number.js 1`] = ` -"// @flow +// @flow type Mode = 0 | 1 | 2; @@ -1326,7 +1326,7 @@ let tests = [ function(n: number): Mode { if (n !== 0 && n !== 1 && n !== 2) { - throw new Error(\\"Wrong number passed\\"); + throw new Error("Wrong number passed"); } return n; }, @@ -1448,7 +1448,7 @@ let tests = [ function(n: number): Mode { if (n !== 0 && n !== 1 && n !== 2) { - throw new Error(\\"Wrong number passed\\"); + throw new Error("Wrong number passed"); } return n; }, @@ -1482,91 +1482,91 @@ let tests = [ } } ]; -" + `; exports[`property.js 1`] = ` -"/* @flow */ +/* @flow */ function a(x: {[key: string]: ?string}, y: string): string { if (x[y]) { return x[y]; } - return \\"\\"; + return ""; } function b(x: {y: {[key: string]: ?string}}, z: string): string { if (x.y[z]) { return x.y[z]; } - return \\"\\"; + return ""; } function c(x: {[key: string]: ?string}, y: {z: string}): string { if (x[y.z]) { return x[y.z]; } - return \\"\\"; + return ""; } function d(x: {y: {[key: string]: ?string}}, a: {b: string}): string { if (x.y[a.b]) { return x.y[a.b]; } - return \\"\\"; + return ""; } function a_array(x: Array, y: number): string { if (x[y]) { return x[y]; } - return \\"\\"; + return ""; } function b_array(x: {y: Array}, z: number): string { if (x.y[z]) { return x.y[z]; } - return \\"\\"; + return ""; } function c_array(x: Array, y: {z: number}): string { if (x[y.z]) { return x[y.z]; } - return \\"\\"; + return ""; } function d_array(x: {y: Array}, a: {b: number}): string { if (x.y[a.b]) { return x.y[a.b]; } - return \\"\\"; + return ""; } function e_array(x: Array): string { if (x[0]) { return x[0]; } - return \\"\\"; + return ""; } // --- name-sensitive havoc --- function c2(x: {[key: string]: ?string}, y: {z: string}): string { if (x[y.z]) { - y.z = \\"HEY\\"; + y.z = "HEY"; return x[y.z]; // error } - return \\"\\"; + return ""; } function c3(x: {[key: string]: ?string}, y: {z: string, a: string}): string { if (x[y.z]) { - y.a = \\"HEY\\"; + y.a = "HEY"; return x[y.z]; // ok } - return \\"\\"; + return ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -1575,73 +1575,73 @@ function a(x: { [key: string]: ?string }, y: string): string { if (x[y]) { return x[y]; } - return \\"\\"; + return ""; } function b(x: { y: { [key: string]: ?string } }, z: string): string { if (x.y[z]) { return x.y[z]; } - return \\"\\"; + return ""; } function c(x: { [key: string]: ?string }, y: { z: string }): string { if (x[y.z]) { return x[y.z]; } - return \\"\\"; + return ""; } function d(x: { y: { [key: string]: ?string } }, a: { b: string }): string { if (x.y[a.b]) { return x.y[a.b]; } - return \\"\\"; + return ""; } function a_array(x: Array, y: number): string { if (x[y]) { return x[y]; } - return \\"\\"; + return ""; } function b_array(x: { y: Array }, z: number): string { if (x.y[z]) { return x.y[z]; } - return \\"\\"; + return ""; } function c_array(x: Array, y: { z: number }): string { if (x[y.z]) { return x[y.z]; } - return \\"\\"; + return ""; } function d_array(x: { y: Array }, a: { b: number }): string { if (x.y[a.b]) { return x.y[a.b]; } - return \\"\\"; + return ""; } function e_array(x: Array): string { if (x[0]) { return x[0]; } - return \\"\\"; + return ""; } // --- name-sensitive havoc --- function c2(x: { [key: string]: ?string }, y: { z: string }): string { if (x[y.z]) { - y.z = \\"HEY\\"; + y.z = "HEY"; return x[y.z]; // error } - return \\"\\"; + return ""; } function c3( @@ -1649,18 +1649,18 @@ function c3( y: { z: string, a: string } ): string { if (x[y.z]) { - y.a = \\"HEY\\"; + y.a = "HEY"; return x[y.z]; // ok } - return \\"\\"; + return ""; } -" + `; exports[`refinements.js 1`] = ` -"function foo(b) { +function foo(b) { var x = b? 0 : null; - while (typeof x == \\"string\\" || typeof x == \\"number\\") { + while (typeof x == "string" || typeof x == "number") { var y:string = x; x = false; } @@ -1681,10 +1681,10 @@ function qux() { var x = 0; try { maybe_throw(); - x = \\"hello\\"; + x = "hello"; } catch (e) { maybe_throw(); - x = \\"hello\\"; + x = "hello"; } finally { // NOTE: the values understood to flow to x at this point // include the number 42 written downstream; @@ -1698,7 +1698,7 @@ function qux() { function corge(b) { for (var x = b? 0 : null; - typeof x == \\"string\\" || typeof x == \\"number\\"; + typeof x == "string" || typeof x == "number"; x = false) { var y:string = x; } @@ -1739,7 +1739,7 @@ function global_in_conditional2(x: number) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(b) { var x = b ? 0 : null; - while (typeof x == \\"string\\" || typeof x == \\"number\\") { + while (typeof x == "string" || typeof x == "number") { var y: string = x; x = false; } @@ -1760,10 +1760,10 @@ function qux() { var x = 0; try { maybe_throw(); - x = \\"hello\\"; + x = "hello"; } catch (e) { maybe_throw(); - x = \\"hello\\"; + x = "hello"; } finally { // NOTE: the values understood to flow to x at this point // include the number 42 written downstream; @@ -1778,7 +1778,7 @@ function qux() { function corge(b) { for ( var x = b ? 0 : null; - typeof x == \\"string\\" || typeof x == \\"number\\"; + typeof x == "string" || typeof x == "number"; x = false ) { var y: string = x; @@ -1817,13 +1817,13 @@ function global_in_conditional2(x: number) { } } } -" + `; exports[`string.js 1`] = ` -"// @flow +// @flow -type Mode = \\"a\\" | \\"b\\" | \\"c\\"; +type Mode = "a" | "b" | "c"; let tests = [ function(x: string) { @@ -1908,38 +1908,38 @@ let tests = [ function(str: string): Mode { var ch = str[0]; - if (ch !== \\"a\\" && ch !== \\"b\\" && ch !== \\"c\\") { - throw new Error(\\"Wrong string passed\\"); + if (ch !== "a" && ch !== "b" && ch !== "c") { + throw new Error("Wrong string passed"); } return ch; }, function(s: string): ?Mode { - if (s === \\"a\\") { + if (s === "a") { return s; - } else if (s === \\"d\\") { + } else if (s === "d") { return s; // error } }, function(mode: Mode) { switch (mode) { - case \\"a\\": - (mode: \\"a\\"); + case "a": + (mode: "a"); break; - case \\"b\\": - case \\"c\\": - (mode: \\"b\\" | \\"c\\"); + case "b": + case "c": + (mode: "b" | "c"); break; } }, - function(x: string): \\"\\" { + function(x: string): "" { if (x) { return x; // error } else { - return x; // no error, inferred to be \\"\\" + return x; // no error, inferred to be "" } }, @@ -1957,73 +1957,73 @@ let tests = [ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -type Mode = \\"a\\" | \\"b\\" | \\"c\\"; +type Mode = "a" | "b" | "c"; let tests = [ function(x: string) { - if (x === \\"foo\\") { + if (x === "foo") { (x: void); // error } - (x: \\"foo\\"); // error + (x: "foo"); // error }, function(x: string) { - if (x !== \\"foo\\") { - (x: \\"foo\\"); // error + if (x !== "foo") { + (x: "foo"); // error } (x: void); // error }, - function(x: \\"bar\\"): \\"foo\\" { - if (x === \\"foo\\") { + function(x: "bar"): "foo" { + if (x === "foo") { return x; // unreachable, no error } - return \\"foo\\"; + return "foo"; }, - function(x: \\"foo\\"): string { - if (x === \\"bar\\") { + function(x: "foo"): string { + if (x === "bar") { return x; } return x; }, - function(x: \\"foo\\") { - if (x !== \\"bar\\") { - (x: \\"foo\\"); + function(x: "foo") { + if (x !== "bar") { + (x: "foo"); } - (x: \\"foo\\"); + (x: "foo"); }, - function(x: \\"foo\\"): string { - if (x === \\"foo\\") { + function(x: "foo"): string { + if (x === "foo") { return x; } return x; }, - function(x: \\"foo\\" | \\"bar\\") { - if (x === \\"foo\\") { - (x: \\"foo\\"); + function(x: "foo" | "bar") { + if (x === "foo") { + (x: "foo"); (x: void); // error } - if (x === \\"bar\\") { - (x: \\"bar\\"); + if (x === "bar") { + (x: "bar"); (x: void); // error } }, - function(x: { foo: string }): \\"foo\\" { - if (x.foo === \\"foo\\") { + function(x: { foo: string }): "foo" { + if (x.foo === "foo") { return x.foo; } return x.foo; // error }, function( - x: { kind: \\"foo\\", foo: string } | { kind: \\"bar\\", bar: string } + x: { kind: "foo", foo: string } | { kind: "bar", bar: string } ): string { - if (x.kind === \\"foo\\") { + if (x.kind === "foo") { return x.foo; } else { return x.bar; @@ -2044,62 +2044,62 @@ let tests = [ function(str: string): Mode { var ch = str[0]; - if (ch !== \\"a\\" && ch !== \\"b\\" && ch !== \\"c\\") { - throw new Error(\\"Wrong string passed\\"); + if (ch !== "a" && ch !== "b" && ch !== "c") { + throw new Error("Wrong string passed"); } return ch; }, function(s: string): ?Mode { - if (s === \\"a\\") { + if (s === "a") { return s; - } else if (s === \\"d\\") { + } else if (s === "d") { return s; // error } }, function(mode: Mode) { switch (mode) { - case \\"a\\": - (mode: \\"a\\"); + case "a": + (mode: "a"); break; - case \\"b\\": - case \\"c\\": - (mode: \\"b\\" | \\"c\\"); + case "b": + case "c": + (mode: "b" | "c"); break; } }, - function(x: string): \\"\\" { + function(x: string): "" { if (x) { return x; // error } else { - return x; // no error, inferred to be \\"\\" + return x; // no error, inferred to be "" } }, // Simple template literals are ok - function(x: string): \\"foo\\" { + function(x: string): "foo" { if (x === \`foo\`) { return x; } if (\`foo\` === x) { return x; } - return \\"foo\\"; + return "foo"; } ]; -" + `; exports[`super_member.js 1`] = ` -"/* @flow */ +/* @flow */ class A { prop: string; method(): string { - return \\"A\\"; + return "A"; } } @@ -2108,7 +2108,7 @@ class B { if (super.prop) { // super.prop doesn't exist return super.prop; // error, unknown type passed to string expected } - return \\"B\\"; + return "B"; } } @@ -2117,7 +2117,7 @@ class C extends A { if (super.prop) { return super.prop; // OK } - return \\"C\\"; + return "C"; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2126,7 +2126,7 @@ class C extends A { class A { prop: string; method(): string { - return \\"A\\"; + return "A"; } } @@ -2136,7 +2136,7 @@ class B { // super.prop doesn't exist return super.prop; // error, unknown type passed to string expected } - return \\"B\\"; + return "B"; } } @@ -2145,14 +2145,14 @@ class C extends A { if (super.prop) { return super.prop; // OK } - return \\"C\\"; + return "C"; } } -" + `; exports[`switch.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(text: string | number): string { switch (typeof text) { @@ -2212,57 +2212,57 @@ function corge(text: string | number | Array): string { function foo(text: string | number): string { switch (typeof text) { - case \\"string\\": + case "string": return text; - case \\"number\\": + case "number": return text; // error, should return string default: - return \\"wat\\"; + return "wat"; } } function bar(text: string | number): string { switch (typeof text) { - case \\"string\\": + case "string": return text[0]; default: - return text++ + \\"\\"; + return text++ + ""; } } function baz1(text: string | number): string { switch (typeof text) { - case \\"number\\": - case \\"string\\": + case "number": + case "string": return text[0]; // error, [0] on number default: - return \\"wat\\"; + return "wat"; } } function baz2(text: string | number): string { switch (typeof text) { - case \\"string\\": - case \\"number\\": + case "string": + case "number": return text[0]; // error, [0] on number default: - return \\"wat\\"; + return "wat"; } } function corge(text: string | number | Array): string { switch (typeof text) { - case \\"object\\": + case "object": return text[0]; - case \\"string\\": - case \\"number\\": // using ++ since it isn't valid on arrays or strings. // should only error for string since Array was filtered out. - return text++ + \\"\\"; + case "string": + case "number": // using ++ since it isn't valid on arrays or strings. // should only error for string since Array was filtered out. + return text++ + ""; default: - return \\"wat\\"; + return "wat"; } } -" + `; exports[`tagged_union.js 1`] = ` -"// example 1 +// example 1 type Type = Name | ListType; type Name = {kind: 'Name', value: string}; @@ -2278,7 +2278,7 @@ function getTypeASTName(typeAST: Type): string { // example 2 import type {ASTNode} from './ast_node'; -var Node = require('./node1'); // Node = \\"Node1\\" +var Node = require('./node1'); // Node = "Node1" function foo(x: ASTNode) { if (x.kind === Node) { return x.prop1.charAt(0); // typeAST: Node1, but x.prop1 may be undefined @@ -2309,12 +2309,12 @@ function qux(x: Breakfast) { // example 4 function list(n) { - if (n > 0) return { kind: \\"cons\\", next: list(n-1) }; - return { kind: \\"nil\\" }; + if (n > 0) return { kind: "cons", next: list(n-1) }; + return { kind: "nil" }; } function length(l) { switch (l.kind) { - case \\"cons\\": return 1 + length(l.next); + case "cons": return 1 + length(l.next); default: return 0; } } @@ -2342,7 +2342,7 @@ kind({ kind: EnumKind.A, A: 1 }); type Citizen = { citizen: true }; type NonCitizen = { citizen: false, nationality: string } function nationality(x: Citizen | NonCitizen) { - if (x.citizen) return \\"Shire\\" + if (x.citizen) return "Shire" else return x.nationality; } @@ -2534,11 +2534,11 @@ let tests = [ // example 1 type Type = Name | ListType; -type Name = { kind: \\"Name\\", value: string }; -type ListType = { kind: \\"ListType\\", name: string }; +type Name = { kind: "Name", value: string }; +type ListType = { kind: "ListType", name: string }; function getTypeASTName(typeAST: Type): string { - if (typeAST.kind === \\"Name\\") { + if (typeAST.kind === "Name") { return typeAST.value; // OK, since typeAST: Name } else { return typeAST.name; // OK, since typeAST: ListType @@ -2546,8 +2546,8 @@ function getTypeASTName(typeAST: Type): string { } // example 2 -import type { ASTNode } from \\"./ast_node\\"; -var Node = require(\\"./node1\\"); // Node = \\"Node1\\" +import type { ASTNode } from "./ast_node"; +var Node = require("./node1"); // Node = "Node1" function foo(x: ASTNode) { if (x.kind === Node) { return x.prop1.charAt(0); // typeAST: Node1, but x.prop1 may be undefined @@ -2556,22 +2556,22 @@ function foo(x: ASTNode) { } // example 3 -type Apple = { kind: \\"Fruit\\", taste: \\"Bad\\" }; -type Orange = { kind: \\"Fruit\\", taste: \\"Good\\" }; -type Broccoli = { kind: \\"Veg\\", taste: \\"Bad\\", raw: \\"No\\" }; -type Carrot = { kind: \\"Veg\\", taste: \\"Good\\", raw: \\"Maybe\\" }; +type Apple = { kind: "Fruit", taste: "Bad" }; +type Orange = { kind: "Fruit", taste: "Good" }; +type Broccoli = { kind: "Veg", taste: "Bad", raw: "No" }; +type Carrot = { kind: "Veg", taste: "Good", raw: "Maybe" }; type Breakfast = Apple | Orange | Broccoli | Carrot; function bar(x: Breakfast) { - if (x.kind === \\"Fruit\\") { - (x.taste: \\"Good\\"); - } else (x.raw: \\"No\\"); // error, Apple.taste = Bad // error, Carrot.raw = Maybe + if (x.kind === "Fruit") { + (x.taste: "Good"); + } else (x.raw: "No"); // error, Apple.taste = Bad // error, Carrot.raw = Maybe } function qux(x: Breakfast) { - if (x.taste === \\"Good\\") { - (x.raw: \\"Yes\\" | \\"No\\"); // 2 errors: + if (x.taste === "Good") { + (x.raw: "Yes" | "No"); // 2 errors: // Orange.raw doesn't exist // Carrot.raw is neither Yes nor No } @@ -2579,12 +2579,12 @@ function qux(x: Breakfast) { // example 4 function list(n) { - if (n > 0) return { kind: \\"cons\\", next: list(n - 1) }; - return { kind: \\"nil\\" }; + if (n > 0) return { kind: "cons", next: list(n - 1) }; + return { kind: "nil" }; } function length(l) { switch (l.kind) { - case \\"cons\\": + case "cons": return 1 + length(l.next); default: return 0; @@ -2616,7 +2616,7 @@ kind({ kind: EnumKind.A, A: 1 }); type Citizen = { citizen: true }; type NonCitizen = { citizen: false, nationality: string }; function nationality(x: Citizen | NonCitizen) { - if (x.citizen) return \\"Shire\\"; + if (x.citizen) return "Shire"; else return x.nationality; } @@ -2703,8 +2703,8 @@ let tests = [ // sentinel props become the RHS function(x: { str: string, num: number, bool: boolean }) { - if (x.str === \\"str\\") { - (x.str: \\"not str\\"); // error: 'str' !~> 'not str' + if (x.str === "str") { + (x.str: "not str"); // error: 'str' !~> 'not str' } if (x.num === 123) { (x.num: 456); // error: 123 !~> 456 @@ -2713,7 +2713,7 @@ let tests = [ (x.bool: false); // error: true !~> false } // even if it doesn't exist... - if (x.badStr === \\"bad\\") { + if (x.badStr === "bad") { (x.badStr: empty); // error: 'bad' !~> empty } if (x.badNum === 123) { @@ -2725,7 +2725,7 @@ let tests = [ }, // type mismatch - function(x: { foo: 123, y: string } | { foo: \\"foo\\", z: string }) { + function(x: { foo: 123, y: string } | { foo: "foo", z: string }) { if (x.foo === 123) { (x.y: string); x.z; // error @@ -2733,7 +2733,7 @@ let tests = [ (x.z: string); x.y; // error } - if (x.foo === \\"foo\\") { + if (x.foo === "foo") { (x.z: string); x.y; // error } else { @@ -2743,7 +2743,7 @@ let tests = [ }, // type mismatch, but one is not a literal - function(x: { foo: number, y: string } | { foo: \\"foo\\", z: string }) { + function(x: { foo: number, y: string } | { foo: "foo", z: string }) { if (x.foo === 123) { (x.y: string); // ok, because 123 !== 'foo' x.z; // error @@ -2752,7 +2752,7 @@ let tests = [ x.z; // error: could still be either case (if foo was a different number) } - if (x.foo === \\"foo\\") { + if (x.foo === "foo") { (x.z: string); x.y; // error } else { @@ -2771,7 +2771,7 @@ let tests = [ x.z; // error: could still be either case (if foo was a different number) } - if (x.foo === \\"foo\\") { + if (x.foo === "foo") { (x.z: string); x.y; // error } else { @@ -2792,7 +2792,7 @@ let tests = [ }, // null - function(x: { foo: null, y: string } | { foo: \\"foo\\", z: string }) { + function(x: { foo: null, y: string } | { foo: "foo", z: string }) { if (x.foo === null) { (x.y: string); x.z; // error @@ -2800,7 +2800,7 @@ let tests = [ (x.z: string); x.y; // error } - if (x.foo === \\"foo\\") { + if (x.foo === "foo") { (x.z: string); x.y; // error } else { @@ -2810,7 +2810,7 @@ let tests = [ }, // void - function(x: { foo: void, y: string } | { foo: \\"foo\\", z: string }) { + function(x: { foo: void, y: string } | { foo: "foo", z: string }) { if (x.foo === undefined) { (x.y: string); x.z; // error @@ -2818,7 +2818,7 @@ let tests = [ (x.z: string); x.y; // error } - if (x.foo === \\"foo\\") { + if (x.foo === "foo") { (x.z: string); x.y; // error } else { @@ -2827,11 +2827,11 @@ let tests = [ } } ]; -" + `; exports[`tagged_union_import.js 1`] = ` -"/* @flow */ +/* @flow */ import { SUCCESS, ERROR } from './constants' @@ -2857,7 +2857,7 @@ function handleStatus(status: Success | Error) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import { SUCCESS, ERROR } from \\"./constants\\"; +import { SUCCESS, ERROR } from "./constants"; type Success = { type: typeof SUCCESS, @@ -2878,21 +2878,21 @@ function handleStatus(status: Success | Error) { console.log(\`Errored: \${status.error}\`); } } -" + `; exports[`typeof.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x: bool | number) { - if (typeof x === \\"boolean\\") { + if (typeof x === "boolean") { x[0]; // error for boolean, not number } } function bar(): number { var x = null; - if (typeof x === \\"object\\") { + if (typeof x === "object") { return x; // error, null } return 0; @@ -2916,21 +2916,21 @@ function fn1() { } function anyfun(x: number | Function): number { - if (typeof x === \\"function\\") { + if (typeof x === "function") { return 0; } return x; // OK, x refined to \`number\` } function anyobj(x: number | Object): number { - if (typeof x === \\"object\\") { + if (typeof x === "object") { return 0; } return x; // OK, x refined to \`number\` } function testInvalidValue(x: mixed) { - if (typeof x === \\"foo\\") { // error + if (typeof x === "foo") { // error return 0; } } @@ -2950,14 +2950,14 @@ function testInvalidTemplateLiteral(x: string | number) { /* @flow */ function foo(x: boolean | number) { - if (typeof x === \\"boolean\\") { + if (typeof x === "boolean") { x[0]; // error for boolean, not number } } function bar(): number { var x = null; - if (typeof x === \\"object\\") { + if (typeof x === "object") { return x; // error, null } return 0; @@ -2965,35 +2965,35 @@ function bar(): number { /* refining globals */ function fn0() { - if (typeof BAZ !== \\"undefined\\" && typeof BAZ.stuff === \\"function\\") { + if (typeof BAZ !== "undefined" && typeof BAZ.stuff === "function") { BAZ.stuff(123); } BAZ.stuff(123); // error, refinement is gone } function fn1() { BAZ.stuff; // error, could be undefined - if (typeof BAZ !== \\"undefined\\" && typeof BAZ.stuff === \\"function\\") { + if (typeof BAZ !== "undefined" && typeof BAZ.stuff === "function") { BAZ.stuff(123); // ok BAZ.stuff(123); // error, refinement is gone } } function anyfun(x: number | Function): number { - if (typeof x === \\"function\\") { + if (typeof x === "function") { return 0; } return x; // OK, x refined to \`number\` } function anyobj(x: number | Object): number { - if (typeof x === \\"object\\") { + if (typeof x === "object") { return 0; } return x; // OK, x refined to \`number\` } function testInvalidValue(x: mixed) { - if (typeof x === \\"foo\\") { + if (typeof x === "foo") { // error return 0; } @@ -3011,11 +3011,11 @@ function testInvalidTemplateLiteral(x: string | number) { return 0; } } -" + `; exports[`undef.js 1`] = ` -"/* @flow */ +/* @flow */ function undef_var(x: ?number) { if (x !== null && x !== undefined) { @@ -3176,11 +3176,11 @@ function undef_bogus_comparison() { return; } } -" + `; exports[`union.js 1`] = ` -"/* @flow */ +/* @flow */ type thing = number | bool @@ -3223,11 +3223,11 @@ function baz(x: ?thing) { x[0]; // error on number } } -" + `; exports[`void.js 1`] = ` -"/* @flow */ +/* @flow */ function void_var(x: ?number) { if (x !== null && x !== void(0)) { @@ -3317,7 +3317,7 @@ function void_bogus_comparison() { } function void_redefined_undefined(x: ?number) { - var undefined = \\"foo\\"; + var undefined = "foo"; if (x !== null && x !== void(0)) { var y = x * 1000; } @@ -3413,10 +3413,10 @@ function void_bogus_comparison() { } function void_redefined_undefined(x: ?number) { - var undefined = \\"foo\\"; + var undefined = "foo"; if (x !== null && x !== void 0) { var y = x * 1000; } } -" + `; diff --git a/tests/flow/reflection/__snapshots__/jsfmt.spec.js.snap b/tests/flow/reflection/__snapshots__/jsfmt.spec.js.snap index d12812a6..a6cfa5ea 100644 --- a/tests/flow/reflection/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/reflection/__snapshots__/jsfmt.spec.js.snap @@ -1,22 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`type.js 1`] = ` -"declare var a: number; -var b: typeof a = \\"...\\"; -var c: typeof a = \\"...\\"; +declare var a: number; +var b: typeof a = "..."; +var c: typeof a = "..."; type T = number; -var x:T = \\"...\\"; +var x:T = "..."; // 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 = "..."; // what about recursive unions? -" + `; diff --git a/tests/flow/regexp/__snapshots__/jsfmt.spec.js.snap b/tests/flow/regexp/__snapshots__/jsfmt.spec.js.snap index e4cca008..7a8c3c7e 100644 --- a/tests/flow/regexp/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/regexp/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`regexp.js 1`] = ` -"var patt=/Hello/g -var match:number = patt.test(\\"Hello world!\\"); +var patt=/Hello/g +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/flow/replace/__snapshots__/jsfmt.spec.js.snap b/tests/flow/replace/__snapshots__/jsfmt.spec.js.snap index 097f768c..4eff9196 100644 --- a/tests/flow/replace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/replace/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"var a = 0; +var a = 0; function foo(x) { } -foo(\\"\\"); +foo(""); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var a = 0; function foo(x) {} -foo(\\"\\"); -" +foo(""); + `; diff --git a/tests/flow/require/__snapshots__/jsfmt.spec.js.snap b/tests/flow/require/__snapshots__/jsfmt.spec.js.snap index 55c09fec..4b552290 100644 --- a/tests/flow/require/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/require/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`B.js 1`] = ` -"/* @flow */ +/* @flow */ exports.numberValue = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ exports.numberValue = 42; -" + `; exports[`C.js 1`] = ` -"/* @flow */ +/* @flow */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -" + `; exports[`E.js 1`] = ` -"/* @flow */ +/* @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 @@ -39,12 +39,12 @@ module.exports = { numberValue: 42 }; -exports = { stringValue: \\"\\" }; -" +exports = { stringValue: "" }; + `; exports[`ProvidesModuleA.js 1`] = ` -"/** +/** * @providesModule A * @flow */ @@ -57,11 +57,11 @@ exports.numberValue = 42; */ exports.numberValue = 42; -" + `; exports[`ProvidesModuleD.js 1`] = ` -"/** +/** * @providesModule D * @flow */ @@ -70,24 +70,24 @@ exports[`ProvidesModuleD.js 1`] = ` * @providesModule D * @flow */ -" + `; exports[`not_builtin_require.js 1`] = ` -"// @flow +// @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"); + `; exports[`not_builtin_require2.js 1`] = ` -"// @flow +// @flow type require = number; var a: require = 42; @@ -96,30 +96,30 @@ var a: require = 42; type require = number; var a: require = 42; -" + `; exports[`require.js 1`] = ` -"/* @flow */ +/* @flow */ 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'); @@ -134,7 +134,7 @@ require(\`./E\`); // template literals are ok... 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(null, "DoesNotExist"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -142,34 +142,34 @@ 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 // 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(null, "DoesNotExist"); + `; diff --git a/tests/flow/requireLazy/__snapshots__/jsfmt.spec.js.snap b/tests/flow/requireLazy/__snapshots__/jsfmt.spec.js.snap index 153913e9..3e7a2455 100644 --- a/tests/flow/requireLazy/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/requireLazy/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/** +/** * @providesModule A * @flow */ module.exports = { numberValueA: 1, - stringValueA: \\"someString\\" + stringValueA: "someString" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @@ -18,20 +18,20 @@ module.exports = { module.exports = { numberValueA: 1, - stringValueA: \\"someString\\" + stringValueA: "someString" }; -" + `; exports[`B.js 1`] = ` -"/** +/** * @providesModule B * @flow */ module.exports = { numberValueB: 1, - stringValueB: \\"someString\\" + stringValueB: "someString" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @@ -41,13 +41,13 @@ module.exports = { module.exports = { numberValueB: 1, - stringValueB: \\"someString\\" + stringValueB: "someString" }; -" + `; exports[`requireLazy.js 1`] = ` -"/** +/** * @flow */ @@ -74,7 +74,7 @@ requireLazy(['A']); // Error: No calback expression * @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 @@ -91,6 +91,6 @@ 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 + `; diff --git a/tests/flow/return/__snapshots__/jsfmt.spec.js.snap b/tests/flow/return/__snapshots__/jsfmt.spec.js.snap index e9aba62c..eab7e9f0 100644 --- a/tests/flow/return/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/return/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`function_return.js 1`] = ` -"class C { +class C { foo() { } bar() { return; } fn(x:number) { return x; } @@ -78,18 +78,18 @@ module.exports = C; //function fn(x:number) { return x; } //module.exports = fn; -" + `; exports[`void.js 1`] = ` -"/* This is a regression test. At one point we incorrectly inferred the return +/* This is a regression test. At one point we incorrectly inferred the return type of functions that have an explicit \`undefined\` to be only \`undefined\` -- ignoring other possible exits. */ function f(b) { if (b) { return undefined; } else { - return \\"nope\\"; + return "nope"; } } @@ -102,10 +102,10 @@ function f(b) { if (b) { return undefined; } else { - return \\"nope\\"; + return "nope"; } } (f(true): void); // error: string ~> void -" + `; diff --git a/tests/flow/return_new/__snapshots__/jsfmt.spec.js.snap b/tests/flow/return_new/__snapshots__/jsfmt.spec.js.snap index e6005991..17ccfe07 100644 --- a/tests/flow/return_new/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/return_new/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"function Foo() { return {}; } +function Foo() { return {}; } var foo: number = new Foo(); // error (returns object literal above) function Bar() { return 0; } @@ -49,24 +49,24 @@ type C = { x: T }; function makeC(x: T): C { return { x }; } -(new makeC(\\"x\\"): C); // normally you wouldn't use \`new\`, but you can +(new makeC("x"): C); // normally you wouldn't use \`new\`, but you can // unions should be split before deciding if object-like function makeUnion(): number | { x: string } { - return { x: \\"x\\" }; + return { x: "x" }; } (new makeUnion(): { x: string }); // error: \`number\` returns {}, missing prop x -" + `; exports[`test2.js 1`] = ` -"declare class D { +declare class D { constructor(): { x: number }; // OK y: any; } 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 @@ -78,10 +78,10 @@ declare class D { } 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 module.exports = D; -" + `; diff --git a/tests/flow/seal/__snapshots__/jsfmt.spec.js.snap b/tests/flow/seal/__snapshots__/jsfmt.spec.js.snap index 67d69318..7f5cba04 100644 --- a/tests/flow/seal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/seal/__snapshots__/jsfmt.spec.js.snap @@ -1,26 +1,26 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`imp.js 1`] = ` -"/* @flow */ +/* @flow */ var imp = require('./obj_annot'); -imp({ name: \\"imp\\" }); +imp({ name: "imp" }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var imp = require(\\"./obj_annot\\"); -imp({ name: \\"imp\\" }); -" +var imp = require("./obj_annot"); +imp({ name: "imp" }); + `; exports[`obj_annot.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(param: { name: string; }): number { return param.id; } -foo({ name: \\"test\\" }); +foo({ name: "test" }); module.exports = foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -30,8 +30,8 @@ function foo(param: { name: string }): number { return param.id; } -foo({ name: \\"test\\" }); +foo({ name: "test" }); module.exports = foo; -" + `; diff --git a/tests/flow/sealed/__snapshots__/jsfmt.spec.js.snap b/tests/flow/sealed/__snapshots__/jsfmt.spec.js.snap index 35e16075..3535a6af 100644 --- a/tests/flow/sealed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/sealed/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`function.js 1`] = ` -"/* @flow */ +/* @flow */ function Bar(x: number) { this.x = x; @@ -24,18 +24,18 @@ Bar.prototype.getY = function(): string { }; module.exports = Bar; -" + `; exports[`proto.js 1`] = ` -"function Foo() { } +function Foo() { } var o = new Foo(); 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; } } @@ -52,7 +52,7 @@ Foo.prototype.m = function() { }; var y: number = o.m(); -o.x = \\"...\\"; +o.x = "..."; Foo.prototype = { m: function() { @@ -63,11 +63,11 @@ Foo.prototype = { var export_o: { x: any } = o; // awkward type cast module.exports = export_o; -" + `; exports[`sealed.js 1`] = ` -"var o = require('./proto'); +var o = require('./proto'); o.z = 0; var x:string = o.x; @@ -79,16 +79,16 @@ a.y = 'abc'; // error, needs to be declared in Bar's constructor (a.getX(): number); (a.getY(): string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -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); -" + `; diff --git a/tests/flow/sealed_objects/__snapshots__/jsfmt.spec.js.snap b/tests/flow/sealed_objects/__snapshots__/jsfmt.spec.js.snap index 167bc1be..a7a9fbd5 100644 --- a/tests/flow/sealed_objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/sealed_objects/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"var o1 = { x: 0 }; +var o1 = { x: 0 }; 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) @@ -25,13 +25,13 @@ var o1 = { x: 0 }; 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 }: { [_: any]: any, x: number }); -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) @@ -43,5 +43,5 @@ var o7: { x: number, y?: string } = ({ x: 0, y: 0 }: { [_: any]: number, x: number }); // error -" + `; diff --git a/tests/flow/shape/__snapshots__/jsfmt.spec.js.snap b/tests/flow/shape/__snapshots__/jsfmt.spec.js.snap index b727c503..e4047fe2 100644 --- a/tests/flow/shape/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/shape/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`shadow.js 1`] = ` -"var o = {}; +var o = {}; (o.p: string); (o: $Shape<{p:string}>); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var o = {}; (o.p: string); (o: $Shape<{ p: string }>); -" + `; exports[`test.js 1`] = ` -"type Foo = { +type Foo = { field: number, } @@ -27,5 +27,5 @@ type Foo = { var x: { field?: number } = {}; var y: $Shape = x; (y.field: number); -" + `; diff --git a/tests/flow/simple_arrays/__snapshots__/jsfmt.spec.js.snap b/tests/flow/simple_arrays/__snapshots__/jsfmt.spec.js.snap index 8a765087..6f6fdd7d 100644 --- a/tests/flow/simple_arrays/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/simple_arrays/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`array.js 1`] = ` -"/* @flow */ +/* @flow */ var a = []; for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } @@ -28,7 +28,7 @@ for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } else { - a[i] = \\"\\"; + a[i] = ""; } } @@ -51,11 +51,11 @@ bar(0); function baz(i: number): string { return a[i]; } -" + `; exports[`array2.js 1`] = ` -"/* @flow */ +/* @flow */ var a = []; for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } @@ -70,12 +70,12 @@ for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } else { - a[i] = \\"\\"; + a[i] = ""; } } function foo(i: number): string { return a[i]; } -" + `; diff --git a/tests/flow/singleton/__snapshots__/jsfmt.spec.js.snap b/tests/flow/singleton/__snapshots__/jsfmt.spec.js.snap index 5e59ed37..6b9d8869 100644 --- a/tests/flow/singleton/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/singleton/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`boolean.js 1`] = ` -"/* @flow */ +/* @flow */ function veryOptimistic(isThisAwesome: true): boolean { return isThisAwesome; @@ -76,11 +76,11 @@ function alwaysFalsy(x: boolean): false { return x; } } -" + `; exports[`number.js 1`] = ` -"/* @flow */ +/* @flow */ function highlander(howMany: 1): number { return howMany; // there can be only one! @@ -126,24 +126,24 @@ bar(3); // error type ComparatorResult = -1 | 0 | 1; function sort(fn: (x: any, y: any) => ComparatorResult) {} sort((x, y) => -1); -" + `; exports[`string.js 1`] = ` -"/* @flow */ +/* @flow */ -type NoSpaces = \\"foobar\\" -(\\"foobar\\": NoSpaces); +type NoSpaces = "foobar" +("foobar": NoSpaces); -type HasSpaces = \\"foo bar\\" -(\\"foo bar\\": HasSpaces); +type HasSpaces = "foo bar" +("foo bar": HasSpaces); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -type NoSpaces = \\"foobar\\"; -(\\"foobar\\": NoSpaces); +type NoSpaces = "foobar"; +("foobar": NoSpaces); + +type HasSpaces = "foo bar"; +("foo bar": HasSpaces); -type HasSpaces = \\"foo bar\\"; -(\\"foo bar\\": HasSpaces); -" `; diff --git a/tests/flow/spread/__snapshots__/jsfmt.spec.js.snap b/tests/flow/spread/__snapshots__/jsfmt.spec.js.snap index d71f81b7..9dd619f4 100644 --- a/tests/flow/spread/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/spread/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"function parseTimestamp(timestamp: string): number { +function parseTimestamp(timestamp: string): number { return 0; } @@ -58,17 +58,17 @@ function parseGroup( } function parseTimeframe(line: string): { begin: number, end: number } { - var timestamps = line.split(\\"-->\\"); + var timestamps = line.split("-->"); return { begin: parseTimestamp(timestamps[0].trim()), end: parseTimestamp(timestamps[1].trim()) }; } -" + `; exports[`test2.js 1`] = ` -"/** +/** * @flow */ @@ -87,12 +87,12 @@ function foo(o) { } function bar(_: { foo: number }) {} foo({ foo: 42 }); -" + `; exports[`test3.js 1`] = ` -"var p = { y: \\"\\" }; -var q = { z: \\"\\" }; +var p = { y: "" }; +var q = { z: "" }; var o = { x: 5, ...p, @@ -109,8 +109,8 @@ var s = { }; var t: boolean = s.y; // error, string or number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var p = { y: \\"\\" }; -var q = { z: \\"\\" }; +var p = { y: "" }; +var q = { z: "" }; var o = { x: 5, ...p, @@ -126,11 +126,11 @@ var s = { ...r }; var t: boolean = s.y; // error, string or number -" + `; exports[`test4.js 1`] = ` -"/* @flow */ +/* @flow */ function test(...nums: Array) {} test(0, ...[1, 2, 3]); @@ -139,11 +139,11 @@ test(0, ...[1, 2, 3]); function test(...nums: Array) {} test(0, ...[1, 2, 3]); -" + `; exports[`test5.js 1`] = ` -"/* @flow */ +/* @flow */ declare function map( obj: {[key: string]: Tv}, @@ -194,11 +194,11 @@ function test( }; }); } -" + `; exports[`test6.js 1`] = ` -"var o = { +var o = { foo: 'bar' }; o = {...o}; @@ -220,30 +220,30 @@ for (var i = 0; i < 10; i++) { (q: {foo: string}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var o = { - foo: \\"bar\\" + foo: "bar" }; o = { ...o }; (o: { foo: string }); var p = { - foo: \\"bar\\" + foo: "bar" }; (p: { foo: string, abc: string }); // error, p doesn't have \`abc\` yet -p = { ...p, abc: \\"def\\" }; +p = { ...p, abc: "def" }; (p: { foo: string, abc: string }); var q = { - foo: \\"bar\\" + foo: "bar" }; for (var i = 0; i < 10; i++) { q = { ...q }; } (q: { foo: string }); -" + `; exports[`test7.js 1`] = ` -"// @flow +// @flow let tests = [ function(x: Object) { @@ -260,5 +260,5 @@ let tests = [ ({ ...x }: void); // error, Object } ]; -" + `; diff --git a/tests/flow/static_overload/__snapshots__/jsfmt.spec.js.snap b/tests/flow/static_overload/__snapshots__/jsfmt.spec.js.snap index 4c45c87f..d38c26d9 100644 --- a/tests/flow/static_overload/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/static_overload/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"var x: number = StaticOverload.foo(0); +var x: number = StaticOverload.foo(0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var x: number = StaticOverload.foo(0); -" + `; diff --git a/tests/flow/static_overload/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/static_overload/lib/__snapshots__/jsfmt.spec.js.snap index e35773db..6e4861fb 100644 --- a/tests/flow/static_overload/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/static_overload/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`lib.js 1`] = ` -"declare class StaticOverload { +declare class StaticOverload { static foo(x: number): number; static foo(x: string): string; } @@ -10,5 +10,5 @@ declare class StaticOverload { static foo(x: number): number, static foo(x: string): string } -" + `; diff --git a/tests/flow/statics/__snapshots__/jsfmt.spec.js.snap b/tests/flow/statics/__snapshots__/jsfmt.spec.js.snap index 32ee59fa..81acb947 100644 --- a/tests/flow/statics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/statics/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`class_statics.js 1`] = ` -"class C { +class C { static f(x:number) { } static x:string; } @@ -23,11 +23,11 @@ C.g(0); var x: number = C.x; C.x = 0; -" + `; exports[`funstatics.js 1`] = ` -"function C() { } +function C() { } C.prototype.f = function() { return C.g(0); } C.g = function(x) { return x; }; @@ -42,5 +42,5 @@ C.g = function(x) { }; var x: string = new C().f(); -" + `; diff --git a/tests/flow/strict/__snapshots__/jsfmt.spec.js.snap b/tests/flow/strict/__snapshots__/jsfmt.spec.js.snap index 5467e378..b269275a 100644 --- a/tests/flow/strict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/strict/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`annot.js 1`] = ` -"var A = require('./unknown_class'); +var A = require('./unknown_class'); class B extends A { foo(x:A):A { return x; } @@ -11,7 +11,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 { @@ -24,11 +24,11 @@ class B extends A { } module.exports = B; -" + `; exports[`fun.js 1`] = ` -"/** +/** * @flow */ @@ -57,11 +57,11 @@ function f(x: number) { var x: string = f(0); module.exports = f; -" + `; exports[`obj.js 1`] = ` -"/** +/** * @flow */ @@ -86,5 +86,5 @@ var o = { x: 0 }; var x: string = o.x; module.exports = o; -" + `; diff --git a/tests/flow/strict_requires/__snapshots__/jsfmt.spec.js.snap b/tests/flow/strict_requires/__snapshots__/jsfmt.spec.js.snap index 26b6e55c..0293bb5f 100644 --- a/tests/flow/strict_requires/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/strict_requires/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/* @flow */ +/* @flow */ module.exports = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ module.exports = 0; -" + `; exports[`B.js 1`] = ` -"/* @flow */ -module.exports = { foo: \\"\\" } +/* @flow */ +module.exports = { foo: "" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -module.exports = { foo: \\"\\" }; -" +module.exports = { foo: "" }; + `; exports[`C.js 1`] = ` -"/* @flow */ +/* @flow */ var o = { A: require('./A'), ...require('./B'), @@ -28,24 +28,24 @@ module.exports = o; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ var o = { - A: require(\\"./A\\"), - ...require(\\"./B\\") + A: require("./A"), + ...require("./B") }; module.exports = o; -" + `; exports[`D.js 1`] = ` -"/* @flow */ +/* @flow */ 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/flow/structural_subtyping/__snapshots__/jsfmt.spec.js.snap b/tests/flow/structural_subtyping/__snapshots__/jsfmt.spec.js.snap index 5a351643..26d0f395 100644 --- a/tests/flow/structural_subtyping/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/structural_subtyping/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`builtin.js 1`] = ` -"/** +/** * @flow */ @@ -23,14 +23,14 @@ interface IHasLength { } var lengthTest1: IHasLength = []; -var lengthTest2: IHasLength = \\"hello\\"; +var lengthTest2: IHasLength = "hello"; var lengthTest3: IHasLength = 123; // number doesn't have length var lengthTest4: IHasLength = true; // bool doesn't have length -" + `; exports[`class.js 1`] = ` -"/** +/** * @flow */ @@ -77,11 +77,11 @@ interface IHasYString { var testInstance1: IHasXString = new ClassWithXString(); var testInstance2: IHasXNumber = new ClassWithXString(); // Error wrong type var testInstance3: IHasYString = new ClassWithXString(); // Error missing prop -" + `; exports[`obj.js 1`] = ` -"/** +/** * @flow */ @@ -110,7 +110,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); @@ -122,22 +122,22 @@ function propTest5(y: { [key: string]: string }) { function propTest6(y: { [key: string]: number }) { (y: IHasXString); // error: string != number } -" + `; exports[`optional.js 1`] = ` -"/* @flow */ +/* @flow */ interface HasOptional { a: string, 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 */ @@ -146,10 +146,10 @@ 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 + `; diff --git a/tests/flow/suggest/__snapshots__/jsfmt.spec.js.snap b/tests/flow/suggest/__snapshots__/jsfmt.spec.js.snap index dae74cf9..d5f168a8 100644 --- a/tests/flow/suggest/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/suggest/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`lib.js 1`] = ` -"/* @flow */ +/* @flow */ function bar(w: number): number { return w; } @@ -14,32 +14,32 @@ function bar(w: number): number { } module.exports = bar; -" + `; exports[`suggest.js 1`] = ` -"/* @flow */ +/* @flow */ 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/flow/super/__snapshots__/jsfmt.spec.js.snap b/tests/flow/super/__snapshots__/jsfmt.spec.js.snap index fb64d97a..03ef5b1b 100644 --- a/tests/flow/super/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/super/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`constructor.js 1`] = ` -"class A { x: number; } +class A { x: number; } class B { x: number; @@ -286,7 +286,7 @@ class L extends L_ { // object, then the child does too. class M_ { constructor() { - return { foo: \\"foo\\" }; + return { foo: "foo" }; } } class M extends M_ { @@ -312,11 +312,11 @@ class N extends N_ { } (new N_(): N_); (new N(): N); -" + `; exports[`import.js 1`] = ` -"class D { +class D { foo(): number { return 0; } } module.exports = D; @@ -327,11 +327,11 @@ class D { } } module.exports = D; -" + `; exports[`super.js 1`] = ` -" + class A { constructor(x:number) { } static staticMethod(x:string): string { return x; } @@ -368,7 +368,7 @@ class B extends A { } static anotherStatic() { - (super.staticMethod(\\"foo\\"): number); // error, string !~> number + (super.staticMethod("foo"): number); // error, string !~> number super.doesntExist(); // error, A doesn't have a doesntExist method } @@ -377,18 +377,18 @@ class B extends A { return super.g; } } -" + `; exports[`test.js 1`] = ` -"var D = require('./import'); +var D = require('./import'); class C extends D { constructor() { return super(); } foo() { return super.foo(); } } module.exports = C; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var D = require(\\"./import\\"); +var D = require("./import"); class C extends D { constructor() { return super(); @@ -398,5 +398,5 @@ class C extends D { } } module.exports = C; -" + `; diff --git a/tests/flow/suppress/__snapshots__/jsfmt.spec.js.snap b/tests/flow/suppress/__snapshots__/jsfmt.spec.js.snap index 003dc2d7..6a15fbf5 100644 --- a/tests/flow/suppress/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/suppress/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"// $FlowFixMe +// $FlowFixMe var test1: string = 123; // This error should be suppressed // $FlowIssue @@ -50,20 +50,20 @@ var test5: string = 123; // This error should be suppressed * $FlowNewLine */ var test6: string = 123; -" + `; exports[`B.js 1`] = ` -"// $FlowFixMe +// $FlowFixMe var test1: string = library_num; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // $FlowFixMe var test1: string = library_num; -" + `; exports[`C.js 1`] = ` -"function takesAString(x: string): void {} +function takesAString(x: string): void {} function runTest(y: number): void { takesAString( @@ -80,11 +80,11 @@ function runTest(y: number): void { y ); } -" + `; exports[`D.js 1`] = ` -"declare var x: { +declare var x: { x: { foo: string } }; declare var y: { @@ -101,12 +101,12 @@ declare var y: { x: { bar: number } }; x = y; -" + `; exports[`lib.js 1`] = ` -"declare var library_num: number; +declare var library_num: number; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare var library_num: number; -" + `; diff --git a/tests/flow/suppress_incremental/__snapshots__/jsfmt.spec.js.snap b/tests/flow/suppress_incremental/__snapshots__/jsfmt.spec.js.snap index a1f78c9b..54dab2b1 100644 --- a/tests/flow/suppress_incremental/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/suppress_incremental/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @flow (123: number); // no errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow (123: number); // no errors -" + `; diff --git a/tests/flow/suppress_traces/__snapshots__/jsfmt.spec.js.snap b/tests/flow/suppress_traces/__snapshots__/jsfmt.spec.js.snap index 2c91ea6b..2c6452bb 100644 --- a/tests/flow/suppress_traces/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/suppress_traces/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`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 @@ -33,6 +33,6 @@ function foo(x: string) { return bar(); } -var a: string = foo(\\"hi\\"); // error number ~> string -" +var a: string = foo("hi"); // error number ~> string + `; diff --git a/tests/flow/switch/__snapshots__/jsfmt.spec.js.snap b/tests/flow/switch/__snapshots__/jsfmt.spec.js.snap index 23d0e5c9..a940965c 100644 --- a/tests/flow/switch/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/switch/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`more_switch.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x): number { switch (x) { @@ -36,7 +36,7 @@ function foo(x): number { case 1: return 1; default: - throw new Error(\\"hi\\"); + throw new Error("hi"); } } @@ -57,15 +57,15 @@ function baz(x): number { case 1: return 1; default: - throw new Error(\\"hi\\"); + throw new Error("hi"); } return 2; } -" + `; exports[`switch.js 1`] = ` -"/** +/** * @flow */ function foo( @@ -87,7 +87,7 @@ function bar() { } function qux(b) { - var x = b? 0: \\"\\"; + var x = b? 0: ""; switch('qux') { case '': x = 0; @@ -100,16 +100,16 @@ 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; @@ -117,27 +117,27 @@ 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; } } -" + `; exports[`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; @@ -153,15 +153,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; } @@ -181,11 +181,11 @@ function baz(x: mixed): number { * @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; @@ -201,15 +201,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; } @@ -224,11 +224,11 @@ function baz(x: mixed): number { return a + b; // error, string ~/> number } -" + `; exports[`trailing_cases.js 1`] = ` -"/** +/** * trailing cases are allowed - spot checks that we handle them as usual * @flow */ @@ -246,7 +246,7 @@ function f1(i) { x = -1; break; case 2: - x = \\"2\\"; + x = "2"; break; } @@ -327,7 +327,7 @@ function f1(i) { x = -1; break; case 2: - x = \\"2\\"; + x = "2"; break; } @@ -369,7 +369,7 @@ function foo(x): number { switch (x) { case 0: default: - throw new Error(\\"hi\\"); + throw new Error("hi"); case 1: return 1; } @@ -390,11 +390,11 @@ function baz(x): number { case 0: break; default: - throw new Error(\\"hi\\"); + throw new Error("hi"); case 1: return 1; } return 2; } -" + `; diff --git a/tests/flow/symbol/__snapshots__/jsfmt.spec.js.snap b/tests/flow/symbol/__snapshots__/jsfmt.spec.js.snap index f5c0c068..25f1f8c0 100644 --- a/tests/flow/symbol/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/symbol/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`symbol.js 1`] = ` -"var FOO = Symbol(); +var FOO = Symbol(); var BAR = Symbol('bar'); // TODO: Expected error var WAT = Symbol('foo', 'bar'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var FOO = Symbol(); -var BAR = Symbol(\\"bar\\"); +var BAR = Symbol("bar"); // TODO: Expected error -var WAT = Symbol(\\"foo\\", \\"bar\\"); -" +var WAT = Symbol("foo", "bar"); + `; diff --git a/tests/flow/symlink/__snapshots__/jsfmt.spec.js.snap b/tests/flow/symlink/__snapshots__/jsfmt.spec.js.snap index d1f261a3..f11001a0 100644 --- a/tests/flow/symlink/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/symlink/__snapshots__/jsfmt.spec.js.snap @@ -1,24 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bar.js 1`] = ` -"export type Foo = { x: number; } +export type Foo = { x: number; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export type Foo = { x: number }; -" + `; exports[`foo.js 1`] = ` -"export type Foo = { x: number; } +export type Foo = { x: number; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export type Foo = { x: number }; -" + `; exports[`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/flow/tagged-unions/__snapshots__/jsfmt.spec.js.snap b/tests/flow/tagged-unions/__snapshots__/jsfmt.spec.js.snap index d83426a0..73b7dbb5 100644 --- a/tests/flow/tagged-unions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/tagged-unions/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`classes.js 1`] = ` -"// @flow +// @flow class Foo { type: 'foo'; @@ -36,24 +36,24 @@ 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\\") { + } else if (x.type === "bar") { return bar(x); } else { - return \\"unknown\\"; + return "unknown"; } } @@ -64,11 +64,11 @@ function foo(x: Foo): string { function bar(x: Bar): string { return x.bar; } -" + `; exports[`interfaces-neg.js 1`] = ` -"/* @flow */ +/* @flow */ declare interface IDataBase { id: string, @@ -76,22 +76,22 @@ 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); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -103,29 +103,29 @@ 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); } -" + `; exports[`interfaces-pos.js 1`] = ` -"/* @flow */ +/* @flow */ declare interface IDataBase { id: string, @@ -133,22 +133,22 @@ 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); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -160,29 +160,29 @@ 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); } -" + `; exports[`type-decls-neg.js 1`] = ` -"/* @flow */ +/* @flow */ type DataBase = { id: string, @@ -192,24 +192,24 @@ 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); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -223,31 +223,31 @@ 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); } -" + `; exports[`type-decls-pos.js 1`] = ` -"/* @flow */ +/* @flow */ type DataBase = { id: string, @@ -257,24 +257,24 @@ 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); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -288,25 +288,25 @@ 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); } -" + `; diff --git a/tests/flow/taint/__snapshots__/jsfmt.spec.js.snap b/tests/flow/taint/__snapshots__/jsfmt.spec.js.snap index 8dd7bb74..8d777d00 100644 --- a/tests/flow/taint/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/taint/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`adder.js 1`] = ` -"// @flow +// @flow function f(x : $Tainted, y : $Tainted) { var z : $Tainted = x + y; @@ -64,11 +64,11 @@ function f6(x: string, y: $Tainted) { function f7(x: $Tainted, y: $Tainted) { var z: string = x + y; } -" + `; exports[`any_object.js 1`] = ` -"// @flow +// @flow let tests = [ // setting a property @@ -106,7 +106,7 @@ let tests = [ // getting a property function() { - let obj: Object = { foo: \\"foo\\" }; + let obj: Object = { foo: "foo" }; (obj.foo: $Tainted); // ok }, @@ -119,11 +119,11 @@ let tests = [ foo(x); // error, taint ~> any } ]; -" + `; exports[`call-object-property.js 1`] = ` -"// @flow +// @flow function foo(x : $Tainted, o : Object) { // Error @@ -174,11 +174,11 @@ function f_foo2(f1: Function, o: { t: $Tainted }) { function f_foo3(f1: Function, o1: Object, o2: { t: $Tainted }) { f1(o1)(o2.t); } -" + `; exports[`comparator.js 1`] = ` -"// @flow +// @flow // Should cause an error. function f(x : $Tainted, y : $Tainted) { var z : $Tainted = x < y; @@ -215,11 +215,11 @@ function f2(x: $Tainted, y: number) { function f3(x: $Tainted, y: string) { var z: boolean = x < y; } -" + `; exports[`function.js 1`] = ` -"// @flow +// @flow let tests = [ // flows any to each param @@ -248,11 +248,11 @@ let tests = [ z(y); } ]; -" + `; exports[`globals.js 1`] = ` -"// @flow +// @flow class A { f(x : $Tainted) { @@ -277,11 +277,11 @@ class A { window.fakeLocation = x; } } -" + `; exports[`lib.js 1`] = ` -"declare class FakeLocation { +declare class FakeLocation { assign(url: string): void; } @@ -306,11 +306,11 @@ declare function doStuff(x: $Tainted): void; declare var fakeDocument: FakeDocument; declare var fakeLocation: FakeLocation; -" + `; exports[`taint1.js 1`] = ` -"/* +/* * * @flow */ @@ -331,11 +331,11 @@ class A { var also_tainted: $Tainted = tainted; } } -" + `; exports[`taint2.js 1`] = ` -"/* +/* * * @flow */ @@ -356,11 +356,11 @@ class A { fakeDocument.location.assign(tainted); } } -" + `; exports[`taint3.js 1`] = ` -"/* +/* * * @flow */ @@ -385,16 +385,16 @@ class A { var loc: string = safe; } } -" + `; exports[`taint4.js 1`] = ` -"/* +/* * * @flow */ -var safe : string = \\"safe\\"; +var safe : string = "safe"; // This should be allowed. var tainted : $Tainted = safe @@ -408,7 +408,7 @@ function f(x : $Tainted) { * @flow */ -var safe: string = \\"safe\\"; +var safe: string = "safe"; // This should be allowed. var tainted: $Tainted = safe; @@ -416,11 +416,11 @@ function f(x: $Tainted) { // Should cause error. var y: any = x; } -" + `; exports[`use-types.js 1`] = ` -"/* +/* * @flow */ @@ -485,5 +485,5 @@ function foo5(a: $Tainted>) { function foo6(a: $Tainted>) { var trusted: $Tainted = a[0]; } -" + `; diff --git a/tests/flow/template/__snapshots__/jsfmt.spec.js.snap b/tests/flow/template/__snapshots__/jsfmt.spec.js.snap index e5055b8c..52ff5319 100644 --- a/tests/flow/template/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/template/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`template.js 1`] = ` -"/* @flow */ +/* @flow */ (\`foo\`: string); // ok (\`bar\`: 'bar'); // ok @@ -36,7 +36,7 @@ let tests = [ /* @flow */ (\`foo\`: string); // ok -(\`bar\`: \\"bar\\"); // ok +(\`bar\`: "bar"); // ok (\`baz\`: number); // error \`foo \${123} bar\`; // ok, number can be appended to string @@ -46,23 +46,23 @@ 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 } ]; -" + `; diff --git a/tests/flow/this/__snapshots__/jsfmt.spec.js.snap b/tests/flow/this/__snapshots__/jsfmt.spec.js.snap index f7a61987..19a79789 100644 --- a/tests/flow/this/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/this/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`This.js 1`] = ` -"/* @providesModule This */ +/* @providesModule This */ function F() { this.x = 0; } F.prototype.m = function() { this.y = 0; } @@ -9,17 +9,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 @@ -34,7 +34,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 @@ -54,7 +54,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 @@ -74,17 +74,17 @@ F.prototype.m = function() { 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 @@ -99,7 +99,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 @@ -121,18 +121,18 @@ 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 (this: void); module.exports = true; -" + `; exports[`arrows.js 1`] = ` -"class C { +class C { foo() { return () => { return this.bar(); }; // OK, since this: C } @@ -155,7 +155,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 })(); } } @@ -188,9 +188,9 @@ 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 })(); } } -" + `; diff --git a/tests/flow/this_ctor/__snapshots__/jsfmt.spec.js.snap b/tests/flow/this_ctor/__snapshots__/jsfmt.spec.js.snap index 5b8bde35..4a7a41f5 100644 --- a/tests/flow/this_ctor/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/this_ctor/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"class A { +class A { n: number; constructor(n: number) { this.n = n; @@ -34,5 +34,5 @@ class A { var a1 = new A(1); var a2: A = new a1.constructor(2); var a3: A = a2.clone(); -" + `; diff --git a/tests/flow/this_type/__snapshots__/jsfmt.spec.js.snap b/tests/flow/this_type/__snapshots__/jsfmt.spec.js.snap index aa3f60ed..bcdccb5b 100644 --- a/tests/flow/this_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/this_type/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`class_expr.js 1`] = ` -"/* @flow */ +/* @flow */ // issue #1191 const Thing = class Thing { @@ -18,11 +18,11 @@ const Thing = class Thing { this.x = 123; // error: property not found (must be declared) } }; -" + `; exports[`contra.js 1`] = ` -"// Counterexample with contravariant this type +// Counterexample with contravariant this type class C { next: this; // error (see below for exploit): \`this\` should only appear in @@ -139,11 +139,11 @@ class Misc { in_generator(_: Generator) {} inout_generator: Generator; } -" + `; exports[`export.js 1`] = ` -"export class A1 { +export class A1 { foo(): this { return this; } bar(): this { return this; } } @@ -178,11 +178,11 @@ export class A2 { } export class A3 extends A2 {} -" + `; exports[`generics.js 1`] = ` -"class Generic { +class Generic { clone(): Generic { return this; } } @@ -206,11 +206,11 @@ class ImplicitNumber extends Implicit { } (new ImplicitNumber().val: string); // error: number ~> string -" + `; exports[`import.js 1`] = ` -"// Check that imports are handled properly with this types +// Check that imports are handled properly with this types import { A1 } from './export'; import type { A2 } from './export'; @@ -235,9 +235,9 @@ class B3 extends A3 { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 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 { @@ -259,11 +259,11 @@ class B3 extends A3 { (new B3().bar(): A2<*>); // OK ((new B3().bar(): B3): A2); // error ((new B3(): A2).qux(0): string); // error -" + `; exports[`interface.js 1`] = ` -"interface I { xs: Array; } +interface I { xs: Array; } interface J { f(): J; } class C { xs: Array; @@ -286,36 +286,36 @@ function foo(c: C): I { function bar(c: C): J { return c; } -" + `; exports[`lib_client.js 1`] = ` -"(new DoublyLinkedList().prev(): DoublyLinkedList); +(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, ""); } } -" + `; exports[`self.js 1`] = ` -"class A { +class A { 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 @@ -334,11 +334,11 @@ class A { return this.bar(); } // OK (don't cascade errors) } -" + `; exports[`statics.js 1`] = ` -"// supporting \`this\` type in statics +// supporting \`this\` type in statics class A { static make(): this { // factory method, whose return type \`this\` (still) @@ -374,11 +374,11 @@ class B extends A {} // inherits statics method too, with \`this\` bound to the (B.make(): B); // OK (B.make(): A); // OK (A.make(): B); // error -" + `; exports[`test.js 1`] = ` -"// Examples without \`this\` types (compare with examples below) +// Examples without \`this\` types (compare with examples below) class Base { foo() { return this; } @@ -547,5 +547,5 @@ class InheritOverride2 extends Override2 {} (new InheritOverride2().bar_caller(): InheritOverride2); // exploits error above (new Override2(): Base2).corge(new Base2()); // exploits error above -" + `; diff --git a/tests/flow/this_type/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/this_type/lib/__snapshots__/jsfmt.spec.js.snap index 9c1e4860..0fc1f6ee 100644 --- a/tests/flow/this_type/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/this_type/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`decl.js 1`] = ` -"// The following declare classes use \`this\` types effectively to avoid type +// The following declare classes use \`this\` types effectively to avoid type // errors in ../lib_client.js. If support for \`this\` types in declare classes // is disabled for perf reasons, these will produce warnings. @@ -12,7 +12,7 @@ declare class DoublyLinkedList extends LinkedList { prev(): this; } -declare module \\"mini-immutable\\" { +declare module "mini-immutable" { declare class Map { set(key: K, value: V): this; // more precise than Map (see below) } @@ -32,7 +32,7 @@ declare class DoublyLinkedList extends LinkedList { prev(): this } -declare module \\"mini-immutable\\" { +declare module "mini-immutable" { declare class Map { set(key: K, value: V): this // more precise than Map (see below) } @@ -40,5 +40,5 @@ declare module \\"mini-immutable\\" { // inherits set method returning OrderedMap instead of Map } } -" + `; diff --git a/tests/flow/throw/__snapshots__/jsfmt.spec.js.snap b/tests/flow/throw/__snapshots__/jsfmt.spec.js.snap index 04dc7390..da8e2aea 100644 --- a/tests/flow/throw/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/throw/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/** +/** * @flow */ @@ -41,10 +41,10 @@ function g(a: ?string) { function h(x: number): string { if (x) { - return \\"foo\\"; + return "foo"; } else { throw new Error(); } } -" + `; diff --git a/tests/flow/traces/__snapshots__/jsfmt.spec.js.snap b/tests/flow/traces/__snapshots__/jsfmt.spec.js.snap index c0561d93..eee95a93 100644 --- a/tests/flow/traces/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/traces/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Traces.js 1`] = ` -"// arg/param type mismatch on arg 0 +// arg/param type mismatch on arg 0 function g0(y:string) { } function f0(x) { g0(x) } f0(0); @@ -9,7 +9,7 @@ f0(0); // ...on arg n function g1(a:string, b:string) { } function f1(x, y) { g1(x, y) } -f1(\\"hey\\", 0); +f1("hey", 0); // h/o call with function expr function g2(ylam: (s:string) => number) { } @@ -34,7 +34,7 @@ function g1(a: string, b: string) {} function f1(x, y) { g1(x, y); } -f1(\\"hey\\", 0); +f1("hey", 0); // h/o call with function expr function g2(ylam: (s: string) => number) {} @@ -54,11 +54,11 @@ function double(n) { return n * 2; } f3(double); -" + `; exports[`Traces2.js 1`] = ` -"// @flow +// @flow var React = require('react'); @@ -72,15 +72,15 @@ var B = React.createClass({ function f(b): React.Element<*> { if (b) { - return ; + return ; } else { - return ; + return ; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var React = require(\\"react\\"); +var React = require("react"); var A = React.createClass({ propTypes: { foo: React.PropTypes.string.isRequired } @@ -92,10 +92,10 @@ var B = React.createClass({ function f(b): React.Element<*> { if (b) { - return ; + return ; } else { - return ; + return ; } } -" + `; diff --git a/tests/flow/traits/__snapshots__/jsfmt.spec.js.snap b/tests/flow/traits/__snapshots__/jsfmt.spec.js.snap index 3c216765..252f7dd1 100644 --- a/tests/flow/traits/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/traits/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"declare class Foo extends Qux mixins Bar { +declare class Foo extends Qux mixins Bar { // KeyedCollection <: Collection // ...KeyedIterable } @@ -43,14 +43,14 @@ declare class Baz { (new Foo().x: number); // error: Qux wins (new Foo().y: string); // error: Bar wins (new Foo().z: number); // error: Qux wins -" + `; exports[`test2.js 1`] = ` -"declare interface I { } +declare interface I { } declare class C mixins I { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare interface I {} declare class C {} -" + `; diff --git a/tests/flow/try/__snapshots__/jsfmt.spec.js.snap b/tests/flow/try/__snapshots__/jsfmt.spec.js.snap index 8004b039..f10c004d 100644 --- a/tests/flow/try/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/try/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`abnormals.js 1`] = ` -"/* @flow */ +/* @flow */ /* This test documents an issue we used to have with merging the environment of * the try block and the catch block. The error variable, when inspected and in @@ -32,11 +32,11 @@ function foo() { } } } -" + `; exports[`init.js 1`] = ` -"/*** +/*** * test initialization tracking of hoisted stuff * @flow */ @@ -341,11 +341,11 @@ function f(b) { } catch (e) {} var y: number = x; // error } -" + `; exports[`return.js 1`] = ` -"/** +/** * @flow */ @@ -368,16 +368,16 @@ function bar(): string { 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(); @@ -394,11 +394,11 @@ function quux(): string { function bliffl(): string { try { - throw new Error(\\"foo\\"); + throw new Error("foo"); } catch (e) { - return \\"foo\\"; + return "foo"; } finally { - return \\"bar\\"; + return "bar"; } } @@ -418,67 +418,67 @@ function corge(): string { 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 { try { 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 } -" + `; exports[`test.js 1`] = ` -"/*** +/*** * test env state tracking thru try/catch/finally * @flow */ @@ -487,7 +487,7 @@ function foo() { var x = 0; var y; try { - x = \\"\\"; + x = ""; } catch(e) { x = false; throw -1; @@ -530,7 +530,7 @@ function foo() { var x = 0; var y; try { - x = \\"\\"; + x = ""; } catch (e) { x = false; throw -1; @@ -547,7 +547,7 @@ function bar(response) { try { payload = JSON.parse(response); } catch (e) { - throw new Error(\\"...\\"); + throw new Error("..."); } // here via [try] only. if (payload.error) { @@ -564,5 +564,5 @@ function qux() { } x(); // unreachable } -" + `; diff --git a/tests/flow/tuples/__snapshots__/jsfmt.spec.js.snap b/tests/flow/tuples/__snapshots__/jsfmt.spec.js.snap index ad8242a2..87489696 100644 --- a/tests/flow/tuples/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/tuples/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`array.js 1`] = ` -"// @flow +// @flow function foo(x: Array): [number, ?number] { return x; // Error, can't enforce arity when flowing array to tuple @@ -20,11 +20,11 @@ function foo(x: Array): [number, ?number] { function foo(x: Array): [number, ?number] { return [x[0], x[1]]; // OK. This is unsound, but at least arity is enforced } -" + `; exports[`optional.js 1`] = ` -"// @flow +// @flow ([0, undefined]: [number, ?string]); // Ok, correct arity ([0]: [number, ?string]); // Error, arity is enforced @@ -37,11 +37,11 @@ exports[`optional.js 1`] = ` ([0]: [number, ?string]); // Error, arity is enforced ([]: [?number, string]); // error, since second element is not marked optional -" + `; exports[`too-few.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(a: [Object, Object]) {} @@ -52,11 +52,11 @@ foo([ {} ]); // error, too few elements in array passed to a tuple function foo(a: [Object, Object]) {} foo([{}]); // error, too few elements in array passed to a tuple -" + `; exports[`tuples.js 1`] = ` -"var a: [] = []; +var a: [] = []; var b: [] = [123]; // Error - arity mismatch var c: [number] = []; // nope var d: [number, string] = [123,'duck']; @@ -66,8 +66,8 @@ var f: [number, string] = [123, 456]; var a: [] = []; var b: [] = [123]; // Error - arity mismatch var c: [number] = []; // nope -var d: [number, string] = [123, \\"duck\\"]; -var e: [number, string] = [123, \\"duck\\"]; +var d: [number, string] = [123, "duck"]; +var e: [number, string] = [123, "duck"]; var f: [number, string] = [123, 456]; -" + `; diff --git a/tests/flow/type-at-pos/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type-at-pos/__snapshots__/jsfmt.spec.js.snap index ae361d06..52dcb245 100644 --- a/tests/flow/type-at-pos/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type-at-pos/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`destructuring.js 1`] = ` -"// @flow +// @flow let [x, y] = [1, 2]; @@ -40,11 +40,11 @@ export const X = { let [a, b] = this.returnsATuple(); } }; -" + `; exports[`function_expressions.js 1`] = ` -"// @flow +// @flow // TODO: type-at-pos between the ()'s should be () => void // class X { @@ -93,11 +93,11 @@ const d = { return x; } }; -" + `; exports[`generics.js 1`] = ` -"// @flow +// @flow class C { } var cn: C = new C; @@ -152,11 +152,11 @@ on; type Mono = C; var mn: Mono = new C(); // error: application of non-poly type mn; -" + `; exports[`import.js 1`] = ` -"// @flow +// @flow var num = 42; function bar() { } bar(); @@ -167,11 +167,11 @@ var num = 42; function bar() {} bar(); module.exports = num; -" + `; exports[`object_special_cases.js 1`] = ` -"/* @flow */ +/* @flow */ let tests = [ function() { @@ -185,14 +185,14 @@ let tests = [ let tests = [ function() { let x = {}; - Object.defineProperty(x, \\"foo\\", { value: \\"\\" }); + Object.defineProperty(x, "foo", { value: "" }); } ]; -" + `; exports[`optional.js 1`] = ` -"// @flow +// @flow function foo(x?: string) { return x; @@ -223,11 +223,11 @@ function bar(obj: { x?: string }) { function qux(x?) { return x; } -" + `; exports[`predicates.js 1`] = ` -"/* @flow */ +/* @flow */ let x = 0; if (x == null) {} @@ -243,71 +243,71 @@ if (x == undefined) { } if (Array.isArray(x)) { } -" + `; exports[`react.js 1`] = ` -"import React from \\"react\\"; +import React from "react"; React.createElement; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import React from \\"react\\"; +import React from "react"; React.createElement; -" + `; exports[`templates.js 1`] = ` -"/* @flow */ +/* @flow */ \`foo bar\`; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ \`foo bar\`; -" + `; exports[`test.js 1`] = ` -"// @flow +// @flow var str = require('./import'); function foo() { } foo(); str type Point = [number, string]; -const x:Point = [1, \\"foo\\"]; -type MyStr = \\"cool\\"; -const y:MyStr = \\"cool\\"; +const x:Point = [1, "foo"]; +type MyStr = "cool"; +const y:MyStr = "cool"; type MyBool = true; const z:MyBool = true; type MyNum = 42; const w:MyNum = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var str = require(\\"./import\\"); +var str = require("./import"); function foo() {} foo(); str; type Point = [number, string]; -const x: Point = [1, \\"foo\\"]; -type MyStr = \\"cool\\"; -const y: MyStr = \\"cool\\"; +const x: Point = [1, "foo"]; +type MyStr = "cool"; +const y: MyStr = "cool"; type MyBool = true; const z: MyBool = true; type MyNum = 42; const w: MyNum = 42; -" + `; exports[`trycatch.js 1`] = ` -"// @flow +// @flow try { - throw \\"foo\\"; + throw "foo"; } catch (e) {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow try { - throw \\"foo\\"; + throw "foo"; } catch (e) {} -" + `; diff --git a/tests/flow/type-destructors/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type-destructors/__snapshots__/jsfmt.spec.js.snap index 81bf2922..c039c377 100644 --- a/tests/flow/type-destructors/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type-destructors/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`non_maybe_type.js 1`] = ` -"// @flow +// @flow function foo(x: ?string): $NonMaybeType { if (x != null) { return x; } @@ -27,11 +27,11 @@ function foo(x: ?string): $NonMaybeType { (0: $NonMaybeType); // error (0: $NonMaybeType); // ok (0: $NonMaybeType); // ok -" + `; exports[`property_type.js 1`] = ` -"type Malformed = $PropertyType; +type Malformed = $PropertyType; type Obj = { x: string }; type Obj_Prop_x = $PropertyType; @@ -46,26 +46,26 @@ function foo(o: Obj): $PropertyType { 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; } -" + `; exports[`union.js 1`] = ` -"var x0: $NonMaybeType = 0; // ok, number ~> number|string +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 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 + `; diff --git a/tests/flow/type-printer/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type-printer/__snapshots__/jsfmt.spec.js.snap index 235c4fd7..6a4aa9ef 100644 --- a/tests/flow/type-printer/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type-printer/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`printBinaryExpression.js 1`] = ` -"'use babel'; +'use babel'; /* @flow */ /* @@ -22,7 +22,7 @@ function printBinaryExpression( module.exports = printBinaryExpression; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -\\"use babel\\"; +"use babel"; /* @flow */ /* @@ -33,18 +33,18 @@ module.exports = printBinaryExpression; * the root directory of this source tree. */ -import type { BinaryExpression } from \\"./types\\"; +import type { BinaryExpression } from "./types"; function printBinaryExpression(node: BinaryExpression) { console.log(node); } module.exports = printBinaryExpression; -" + `; exports[`types.js 1`] = ` -"/** +/** * @flow */ @@ -5094,7 +5094,7 @@ export type JSXSpreadAttribute = { * @flow */ -\\"use strict\\"; +"use strict"; /* * Flow types for the Babylon AST. @@ -5104,7 +5104,7 @@ export type JSXSpreadAttribute = { export type Comment = | { - type: \\"CommentLine\\", + type: "CommentLine", _CommentLine: void, value: string, end: number, @@ -5115,7 +5115,7 @@ export type Comment = start: number } | { - type: \\"CommentBlock\\", + type: "CommentBlock", _CommentBlock: void, value: string, end: number, @@ -5128,7 +5128,7 @@ export type Comment = export type Declaration = | { - type: \\"ClassBody\\", + type: "ClassBody", _ClassBody: void, body: Array, end: number, @@ -5142,7 +5142,7 @@ export type Declaration = trailingComments: ?Array } | { - type: \\"ClassDeclaration\\", + type: "ClassDeclaration", _ClassDeclaration: void, body: ClassBody, id: ?Identifier, @@ -5161,7 +5161,7 @@ export type Declaration = trailingComments: ?Array } | { - type: \\"FunctionDeclaration\\", + type: "FunctionDeclaration", _FunctionDeclaration: void, body: BlockStatement, id: Identifier, @@ -5184,11 +5184,11 @@ export type Declaration = 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, @@ -5203,10 +5203,10 @@ export type Declaration = 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 = trailingComments: ?Array } | { - type: \\"ClassProperty\\", + type: "ClassProperty", _ClassProperty: void, computed: boolean, key: Node, @@ -5239,7 +5239,7 @@ export type Declaration = export type Expression = | { - type: \\"ArrayExpression\\", + type: "ArrayExpression", _ArrayExpression: void, elements: Array, end: number, @@ -5253,7 +5253,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"AssignmentExpression\\", + type: "AssignmentExpression", _AssignmentExpression: void, left: Pattern, operator: AssignmentOperator, @@ -5269,7 +5269,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"AwaitExpression\\", + type: "AwaitExpression", _AwaitExpression: void, all: boolean, argument: ?Expression, @@ -5284,7 +5284,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"BinaryExpression\\", + type: "BinaryExpression", _BinaryExpression: void, left: Expression, operator: BinaryOperator, @@ -5300,7 +5300,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"BindExpression\\", + type: "BindExpression", _BindExpression: void, callee: Node, object: Node, @@ -5315,7 +5315,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"CallExpression\\", + type: "CallExpression", _CallExpression: void, arguments: Array, callee: Expression, @@ -5330,7 +5330,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"ClassExpression\\", + type: "ClassExpression", _ClassExpression: void, body: ClassBody, id: ?Identifier, @@ -5349,7 +5349,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"ComprehensionExpression\\", + type: "ComprehensionExpression", _ComprehensionExpression: void, body: Expression, blocks: Array, @@ -5365,7 +5365,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"ConditionalExpression\\", + type: "ConditionalExpression", _ConditionalExpression: void, alternate: Expression, consequent: Expression, @@ -5381,7 +5381,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"DoExpression\\", + type: "DoExpression", _DoExpression: void, body: Statement, end: number, @@ -5395,7 +5395,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"FunctionExpression\\", + type: "FunctionExpression", _FunctionExpression: void, body: BlockStatement, id: ?Identifier, @@ -5418,7 +5418,7 @@ export type Expression = typeParameters: ?TypeParameterDeclaration } | { - type: \\"Identifier\\", + type: "Identifier", _Identifier: void, name: string, typeAnnotation: ?TypeAnnotation, @@ -5433,7 +5433,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"Literal\\", + type: "Literal", _Literal: void, raw: string, regex: ?{ pattern: string, flags: string }, @@ -5449,7 +5449,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"LogicalExpression\\", + type: "LogicalExpression", _LogicalExpression: void, left: Expression, operator: LogicalOperator, @@ -5465,7 +5465,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"MemberExpression\\", + type: "MemberExpression", _MemberExpression: void, computed: boolean, object: Expression, @@ -5481,7 +5481,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"NewExpression\\", + type: "NewExpression", _NewExpression: void, arguments: Array, callee: Expression, @@ -5496,7 +5496,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"ObjectExpression\\", + type: "ObjectExpression", _ObjectExpression: void, properties: Array, end: number, @@ -5510,7 +5510,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"SequenceExpression\\", + type: "SequenceExpression", _SequenceExpression: void, expression: Array, end: number, @@ -5524,7 +5524,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"TaggedTemplateExpression\\", + type: "TaggedTemplateExpression", _TaggedTemplateExpression: void, quasi: TemplateLiteral, tag: Expression, @@ -5539,7 +5539,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"TemplateLiteral\\", + type: "TemplateLiteral", _TemplateLiteral: void, expressions: Array, quasis: Array, @@ -5554,7 +5554,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"ThisExpression\\", + type: "ThisExpression", _ThisExpression: void, end: number, innerComments: ?Array, @@ -5567,7 +5567,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"UnaryExpression\\", + type: "UnaryExpression", _UnaryExpression: void, argument: Expression, operator: UnaryOperator, @@ -5583,7 +5583,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"UpdateExpression\\", + type: "UpdateExpression", _UpdateExpression: void, argument: Expression, operator: UpdateOperator, @@ -5599,7 +5599,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"YieldExpression\\", + type: "YieldExpression", _YieldExpression: void, argument: ?Expression, delegate: boolean, @@ -5614,7 +5614,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"TypeCastExpression\\", + type: "TypeCastExpression", _TypeCastExpression: void, expression: Expression, typeAnnotation: TypeAnnotation, @@ -5629,7 +5629,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"JSXElement\\", + type: "JSXElement", _JSXElement: void, children: Array, closingElement: ?JSXClosingElement, @@ -5645,7 +5645,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"JSXEmptyExpression\\", + type: "JSXEmptyExpression", _JSXEmptyExpression: void, end: number, innerComments: ?Array, @@ -5658,7 +5658,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"JSXExpressionContainer\\", + type: "JSXExpressionContainer", _JSXExpressionContainer: void, expression: Expression, end: number, @@ -5672,7 +5672,7 @@ export type Expression = trailingComments: ?Array } | { - type: \\"JSXMemberExpression\\", + type: "JSXMemberExpression", _JSXMemberExpression: void, computed: boolean, object: Node, @@ -5690,7 +5690,7 @@ export type Expression = export type Function = | { - type: \\"ArrowFunctionExpression\\", + type: "ArrowFunctionExpression", _ArrowFunctionExpression: void, body: Node, id: ?Identifier, @@ -5713,7 +5713,7 @@ export type Function = typeParameters: ?TypeParameterDeclaration } | { - type: \\"FunctionDeclaration\\", + type: "FunctionDeclaration", _FunctionDeclaration: void, body: BlockStatement, id: Identifier, @@ -5736,7 +5736,7 @@ export type Function = typeParameters: ?TypeParameterDeclaration } | { - type: \\"FunctionExpression\\", + type: "FunctionExpression", _FunctionExpression: void, body: BlockStatement, id: ?Identifier, @@ -5761,7 +5761,7 @@ export type Function = export type Node = | { - type: \\"ArrayExpression\\", + type: "ArrayExpression", _ArrayExpression: void, elements: Array, end: number, @@ -5775,7 +5775,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ArrayPattern\\", + type: "ArrayPattern", _ArrayPattern: void, elements: Array, typeAnnotation: ?TypeAnnotation, @@ -5790,7 +5790,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ArrowFunctionExpression\\", + type: "ArrowFunctionExpression", _ArrowFunctionExpression: void, body: Node, id: ?Identifier, @@ -5813,7 +5813,7 @@ export type Node = typeParameters: ?TypeParameterDeclaration } | { - type: \\"AssignmentExpression\\", + type: "AssignmentExpression", _AssignmentExpression: void, left: Pattern, operator: AssignmentOperator, @@ -5829,7 +5829,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"AssignmentPattern\\", + type: "AssignmentPattern", _AssignmentPattern: void, left: Pattern, right: Expression, @@ -5844,7 +5844,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"AwaitExpression\\", + type: "AwaitExpression", _AwaitExpression: void, all: boolean, argument: ?Expression, @@ -5859,7 +5859,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"BinaryExpression\\", + type: "BinaryExpression", _BinaryExpression: void, left: Expression, operator: BinaryOperator, @@ -5875,7 +5875,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"BindExpression\\", + type: "BindExpression", _BindExpression: void, callee: Node, object: Node, @@ -5890,7 +5890,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"BlockStatement\\", + type: "BlockStatement", _BlockStatement: void, body: Array, end: number, @@ -5904,7 +5904,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"BreakStatement\\", + type: "BreakStatement", _BreakStatement: void, label: ?Identifier, end: number, @@ -5918,7 +5918,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"CallExpression\\", + type: "CallExpression", _CallExpression: void, arguments: Array, callee: Expression, @@ -5933,7 +5933,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"CatchClause\\", + type: "CatchClause", _CatchClause: void, body: BlockStatement, param: Pattern, @@ -5948,7 +5948,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ClassBody\\", + type: "ClassBody", _ClassBody: void, body: Array, end: number, @@ -5962,7 +5962,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ClassDeclaration\\", + type: "ClassDeclaration", _ClassDeclaration: void, body: ClassBody, id: ?Identifier, @@ -5981,7 +5981,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ClassExpression\\", + type: "ClassExpression", _ClassExpression: void, body: ClassBody, id: ?Identifier, @@ -6000,7 +6000,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ComprehensionBlock\\", + type: "ComprehensionBlock", _ComprehensionBlock: void, each: boolean, left: Pattern, @@ -6016,7 +6016,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ComprehensionExpression\\", + type: "ComprehensionExpression", _ComprehensionExpression: void, body: Expression, blocks: Array, @@ -6032,7 +6032,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ConditionalExpression\\", + type: "ConditionalExpression", _ConditionalExpression: void, alternate: Expression, consequent: Expression, @@ -6048,7 +6048,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ContinueStatement\\", + type: "ContinueStatement", _ContinueStatement: void, label: ?Identifier, end: number, @@ -6062,7 +6062,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"Decorator\\", + type: "Decorator", _Decorator: void, expression: Expression, end: number, @@ -6076,7 +6076,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"DebuggerStatement\\", + type: "DebuggerStatement", _DebuggerStatement: void, end: number, innerComments: ?Array, @@ -6089,7 +6089,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"DoWhileStatement\\", + type: "DoWhileStatement", _DoWhileStatement: void, body: Statement, test: Expression, @@ -6104,7 +6104,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"DoExpression\\", + type: "DoExpression", _DoExpression: void, body: Statement, end: number, @@ -6118,7 +6118,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"EmptyStatement\\", + type: "EmptyStatement", _EmptyStatement: void, end: number, innerComments: ?Array, @@ -6131,7 +6131,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ExpressionStatement\\", + type: "ExpressionStatement", _ExpressionStatement: void, expression: Expression, end: number, @@ -6145,7 +6145,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"File\\", + type: "File", _File: void, program: Program, end: number, @@ -6159,7 +6159,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ForInStatement\\", + type: "ForInStatement", _ForInStatement: void, body: Statement, left: Node, @@ -6175,7 +6175,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ForOfStatement\\", + type: "ForOfStatement", _ForOfStatement: void, body: Statement, left: Node, @@ -6191,7 +6191,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ForStatement\\", + type: "ForStatement", _ForStatement: void, init: ?Node, test: ?Expression, @@ -6208,7 +6208,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"FunctionDeclaration\\", + type: "FunctionDeclaration", _FunctionDeclaration: void, body: BlockStatement, id: Identifier, @@ -6231,7 +6231,7 @@ export type Node = typeParameters: ?TypeParameterDeclaration } | { - type: \\"FunctionExpression\\", + type: "FunctionExpression", _FunctionExpression: void, body: BlockStatement, id: ?Identifier, @@ -6254,7 +6254,7 @@ export type Node = typeParameters: ?TypeParameterDeclaration } | { - type: \\"Identifier\\", + type: "Identifier", _Identifier: void, name: string, typeAnnotation: ?TypeAnnotation, @@ -6269,7 +6269,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"IfStatement\\", + type: "IfStatement", _IfStatement: void, alternate: ?Statement, consequent: Statement, @@ -6285,7 +6285,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ImportDefaultSpecifier\\", + type: "ImportDefaultSpecifier", _ImportDefaultSpecifier: void, local: Node, end: number, @@ -6299,7 +6299,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ImportNamespaceSpecifier\\", + type: "ImportNamespaceSpecifier", _ImportNamespaceSpecifier: void, local: Node, end: number, @@ -6313,7 +6313,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ImportDeclaration\\", + type: "ImportDeclaration", _ImportDeclaration: void, specifiers: Array, source: Literal, @@ -6328,7 +6328,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ImportSpecifier\\", + type: "ImportSpecifier", _ImportSpecifier: void, imported: Node, local: Node, @@ -6343,7 +6343,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"LabeledStatement\\", + type: "LabeledStatement", _LabeledStatement: void, body: Statement, label: Identifier, @@ -6358,7 +6358,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"Literal\\", + type: "Literal", _Literal: void, raw: string, regex: ?{ pattern: string, flags: string }, @@ -6374,7 +6374,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"LogicalExpression\\", + type: "LogicalExpression", _LogicalExpression: void, left: Expression, operator: LogicalOperator, @@ -6390,7 +6390,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"MemberExpression\\", + type: "MemberExpression", _MemberExpression: void, computed: boolean, object: Expression, @@ -6406,7 +6406,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"MetaProperty\\", + type: "MetaProperty", _MetaProperty: void, meta: Node, property: Node, @@ -6421,11 +6421,11 @@ export type Node = 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, @@ -6440,7 +6440,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"NewExpression\\", + type: "NewExpression", _NewExpression: void, arguments: Array, callee: Expression, @@ -6455,7 +6455,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"Noop\\", + type: "Noop", _Noop: void, end: number, innerComments: ?Array, @@ -6468,7 +6468,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ObjectExpression\\", + type: "ObjectExpression", _ObjectExpression: void, properties: Array, end: number, @@ -6482,7 +6482,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ObjectPattern\\", + type: "ObjectPattern", _ObjectPattern: void, properties: Array, typeAnnotation: ?TypeAnnotation, @@ -6497,7 +6497,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"Program\\", + type: "Program", _Program: void, body: Array, end: number, @@ -6511,11 +6511,11 @@ export type Node = 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, @@ -6531,7 +6531,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"RestElement\\", + type: "RestElement", _RestElement: void, argument: Pattern, typeAnnotation: ?TypeAnnotation, @@ -6546,7 +6546,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ReturnStatement\\", + type: "ReturnStatement", _ReturnStatement: void, argument: ?Expression, end: number, @@ -6560,7 +6560,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"SequenceExpression\\", + type: "SequenceExpression", _SequenceExpression: void, expression: Array, end: number, @@ -6574,7 +6574,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"SpreadElement\\", + type: "SpreadElement", _SpreadElement: void, argument: Expression, end: number, @@ -6588,7 +6588,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"SpreadProperty\\", + type: "SpreadProperty", _SpreadProperty: void, argument: Expression, end: number, @@ -6602,7 +6602,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"Super\\", + type: "Super", _Super: void, end: number, innerComments: ?Array, @@ -6615,7 +6615,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"SwitchCase\\", + type: "SwitchCase", _SwitchCase: void, consequent: Array, test: ?Expression, @@ -6630,7 +6630,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"SwitchStatement\\", + type: "SwitchStatement", _SwitchStatement: void, cases: Array, discriminant: Expression, @@ -6646,7 +6646,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TaggedTemplateExpression\\", + type: "TaggedTemplateExpression", _TaggedTemplateExpression: void, quasi: TemplateLiteral, tag: Expression, @@ -6661,7 +6661,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TemplateElement\\", + type: "TemplateElement", _TemplateElement: void, tail: boolean, value: { cooked: string, raw: string }, @@ -6676,7 +6676,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TemplateLiteral\\", + type: "TemplateLiteral", _TemplateLiteral: void, expressions: Array, quasis: Array, @@ -6691,7 +6691,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ThisExpression\\", + type: "ThisExpression", _ThisExpression: void, end: number, innerComments: ?Array, @@ -6704,7 +6704,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ThrowStatement\\", + type: "ThrowStatement", _ThrowStatement: void, argument: Expression, end: number, @@ -6718,7 +6718,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TryStatement\\", + type: "TryStatement", _TryStatement: void, block: BlockStatement, finalizer: ?BlockStatement, @@ -6736,7 +6736,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"UnaryExpression\\", + type: "UnaryExpression", _UnaryExpression: void, argument: Expression, operator: UnaryOperator, @@ -6752,7 +6752,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"UpdateExpression\\", + type: "UpdateExpression", _UpdateExpression: void, argument: Expression, operator: UpdateOperator, @@ -6768,10 +6768,10 @@ export type Node = trailingComments: ?Array } | { - type: \\"VariableDeclaration\\", + type: "VariableDeclaration", _VariableDeclaration: void, declarations: Array, - kind: \\"var\\" | \\"let\\" | \\"const\\", + kind: "var" | "let" | "const", end: number, innerComments: ?Array, leadingComments: ?Array, @@ -6783,7 +6783,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"VariableDeclarator\\", + type: "VariableDeclarator", _VariableDeclarator: void, id: Pattern, init: ?Expression, @@ -6798,7 +6798,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"WhileStatement\\", + type: "WhileStatement", _WhileStatement: void, body: Statement, test: Expression, @@ -6813,7 +6813,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"WithStatement\\", + type: "WithStatement", _WithStatement: void, body: Statement, object: Expression, @@ -6828,7 +6828,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"YieldExpression\\", + type: "YieldExpression", _YieldExpression: void, argument: ?Expression, delegate: boolean, @@ -6843,7 +6843,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ExportAllDeclaration\\", + type: "ExportAllDeclaration", _ExportAllDeclaration: void, exported: Node, source: Node, @@ -6858,7 +6858,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ExportDefaultDeclaration\\", + type: "ExportDefaultDeclaration", _ExportDefaultDeclaration: void, declaration: Node, end: number, @@ -6872,7 +6872,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ExportNamedDeclaration\\", + type: "ExportNamedDeclaration", _ExportNamedDeclaration: void, declaration: Node, source: Literal, @@ -6888,7 +6888,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ExportDefaultSpecifier\\", + type: "ExportDefaultSpecifier", _ExportDefaultSpecifier: void, exported: Node, end: number, @@ -6902,7 +6902,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ExportNamespaceSpecifier\\", + type: "ExportNamespaceSpecifier", _ExportNamespaceSpecifier: void, exported: Node, end: number, @@ -6916,7 +6916,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ExportSpecifier\\", + type: "ExportSpecifier", _ExportSpecifier: void, local: Node, exported: Node, @@ -6931,7 +6931,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"AnyTypeAnnotation\\", + type: "AnyTypeAnnotation", _AnyTypeAnnotation: void, end: number, innerComments: ?Array, @@ -6944,7 +6944,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ArrayTypeAnnotation\\", + type: "ArrayTypeAnnotation", _ArrayTypeAnnotation: void, elementType: Type, end: number, @@ -6958,7 +6958,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"BooleanLiteralTypeAnnotation\\", + type: "BooleanLiteralTypeAnnotation", _BooleanLiteralTypeAnnotation: void, raw: string, value: boolean, @@ -6973,7 +6973,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"BooleanTypeAnnotation\\", + type: "BooleanTypeAnnotation", _BooleanTypeAnnotation: void, end: number, innerComments: ?Array, @@ -6986,7 +6986,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ClassImplements\\", + type: "ClassImplements", _ClassImplements: void, id: Identifier, typeParameters: ?TypeParameterInstantiation, @@ -7002,7 +7002,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ClassProperty\\", + type: "ClassProperty", _ClassProperty: void, computed: boolean, key: Node, @@ -7021,7 +7021,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"DeclareClass\\", + type: "DeclareClass", _DeclareClass: void, body: ObjectTypeAnnotation, extends: Array, @@ -7038,7 +7038,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"DeclareFunction\\", + type: "DeclareFunction", _DeclareFunction: void, id: Identifier, end: number, @@ -7052,7 +7052,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"DeclareModule\\", + type: "DeclareModule", _DeclareModule: void, body: BlockStatement, id: Node, @@ -7067,7 +7067,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"DeclareVariable\\", + type: "DeclareVariable", _DeclareVariable: void, id: Identifier, end: number, @@ -7081,7 +7081,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"FunctionTypeAnnotation\\", + type: "FunctionTypeAnnotation", _FunctionTypeAnnotation: void, params: Array, rest: ?FunctionTypeParam, @@ -7098,7 +7098,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"FunctionTypeParam\\", + type: "FunctionTypeParam", _FunctionTypeParam: void, name: Identifier, optional: boolean, @@ -7114,7 +7114,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"GenericTypeAnnotation\\", + type: "GenericTypeAnnotation", _GenericTypeAnnotation: void, id: Node, typeParameters: ?TypeParameterInstantiation, @@ -7129,7 +7129,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"InterfaceExtends\\", + type: "InterfaceExtends", _InterfaceExtends: void, id: Identifier, typeParameters: ?TypeParameterInstantiation, @@ -7144,7 +7144,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"InterfaceDeclaration\\", + type: "InterfaceDeclaration", _InterfaceDeclaration: void, body: ObjectTypeAnnotation, extends: Array, @@ -7161,7 +7161,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"IntersectionTypeAnnotation\\", + type: "IntersectionTypeAnnotation", _IntersectionTypeAnnotation: void, types: Array, end: number, @@ -7175,7 +7175,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"MixedTypeAnnotation\\", + type: "MixedTypeAnnotation", _MixedTypeAnnotation: void, end: number, innerComments: ?Array, @@ -7188,7 +7188,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"NullableTypeAnnotation\\", + type: "NullableTypeAnnotation", _NullableTypeAnnotation: void, typeAnnotation: Type, end: number, @@ -7202,7 +7202,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"NumberLiteralTypeAnnotation\\", + type: "NumberLiteralTypeAnnotation", _NumberLiteralTypeAnnotation: void, raw: string, value: number, @@ -7217,7 +7217,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"NumberTypeAnnotation\\", + type: "NumberTypeAnnotation", _NumberTypeAnnotation: void, end: number, innerComments: ?Array, @@ -7230,7 +7230,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"StringLiteralTypeAnnotation\\", + type: "StringLiteralTypeAnnotation", _StringLiteralTypeAnnotation: void, raw: string, value: string, @@ -7245,7 +7245,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"StringTypeAnnotation\\", + type: "StringTypeAnnotation", _StringTypeAnnotation: void, end: number, innerComments: ?Array, @@ -7258,7 +7258,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TupleTypeAnnotation\\", + type: "TupleTypeAnnotation", _TupleTypeAnnotation: void, types: Array, end: number, @@ -7272,7 +7272,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TypeofTypeAnnotation\\", + type: "TypeofTypeAnnotation", _TypeofTypeAnnotation: void, argument: Type, end: number, @@ -7286,7 +7286,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TypeAlias\\", + type: "TypeAlias", _TypeAlias: void, id: Identifier, right: Type, @@ -7302,7 +7302,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TypeAnnotation\\", + type: "TypeAnnotation", _TypeAnnotation: void, typeAnnotation: Type, end: number, @@ -7316,7 +7316,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TypeCastExpression\\", + type: "TypeCastExpression", _TypeCastExpression: void, expression: Expression, typeAnnotation: TypeAnnotation, @@ -7331,7 +7331,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TypeParameterDeclaration\\", + type: "TypeParameterDeclaration", _TypeParameterDeclaration: void, params: Array, end: number, @@ -7345,7 +7345,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"TypeParameterInstantiation\\", + type: "TypeParameterInstantiation", _TypeParameterInstantiation: void, params: Array, end: number, @@ -7359,7 +7359,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ObjectTypeAnnotation\\", + type: "ObjectTypeAnnotation", _ObjectTypeAnnotation: void, callProperties: Array, indexers: Array, @@ -7375,7 +7375,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ObjectTypeCallProperty\\", + type: "ObjectTypeCallProperty", _ObjectTypeCallProperty: void, static: boolean, value: FunctionTypeAnnotation, @@ -7390,7 +7390,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ObjectTypeIndexer\\", + type: "ObjectTypeIndexer", _ObjectTypeIndexer: void, id: Identifier, key: Type, @@ -7406,7 +7406,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"ObjectTypeProperty\\", + type: "ObjectTypeProperty", _ObjectTypeProperty: void, key: Node, optional: boolean, @@ -7422,7 +7422,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"QualifiedTypeIdentifier\\", + type: "QualifiedTypeIdentifier", _QualifiedTypeIdentifier: void, id: Identifier, qualification: Node, @@ -7437,7 +7437,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"UnionTypeAnnotation\\", + type: "UnionTypeAnnotation", _UnionTypeAnnotation: void, types: Array, end: number, @@ -7451,7 +7451,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"VoidTypeAnnotation\\", + type: "VoidTypeAnnotation", _VoidTypeAnnotation: void, end: number, innerComments: ?Array, @@ -7464,7 +7464,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXAttribute\\", + type: "JSXAttribute", _JSXAttribute: void, name: Node, value: ?Node, @@ -7479,7 +7479,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXClosingElement\\", + type: "JSXClosingElement", _JSXClosingElement: void, name: Node, end: number, @@ -7493,7 +7493,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXElement\\", + type: "JSXElement", _JSXElement: void, children: Array, closingElement: ?JSXClosingElement, @@ -7509,7 +7509,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXEmptyExpression\\", + type: "JSXEmptyExpression", _JSXEmptyExpression: void, end: number, innerComments: ?Array, @@ -7522,7 +7522,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXExpressionContainer\\", + type: "JSXExpressionContainer", _JSXExpressionContainer: void, expression: Expression, end: number, @@ -7536,7 +7536,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXIdentifier\\", + type: "JSXIdentifier", _JSXIdentifier: void, name: string, end: number, @@ -7550,7 +7550,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXMemberExpression\\", + type: "JSXMemberExpression", _JSXMemberExpression: void, computed: boolean, object: Node, @@ -7566,7 +7566,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXNamespacedName\\", + type: "JSXNamespacedName", _JSXNamespacedName: void, name: JSXIdentifier, namespace: JSXIdentifier, @@ -7581,7 +7581,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXOpeningElement\\", + type: "JSXOpeningElement", _JSXOpeningElement: void, attributes: Array, name: Array, @@ -7597,7 +7597,7 @@ export type Node = trailingComments: ?Array } | { - type: \\"JSXSpreadAttribute\\", + type: "JSXSpreadAttribute", _JSXSpreadAttribute: void, argument: Expression, end: number, @@ -7613,7 +7613,7 @@ export type Node = export type Pattern = | { - type: \\"ArrayPattern\\", + type: "ArrayPattern", _ArrayPattern: void, elements: Array, typeAnnotation: ?TypeAnnotation, @@ -7628,7 +7628,7 @@ export type Pattern = trailingComments: ?Array } | { - type: \\"AssignmentPattern\\", + type: "AssignmentPattern", _AssignmentPattern: void, left: Pattern, right: Expression, @@ -7643,7 +7643,7 @@ export type Pattern = trailingComments: ?Array } | { - type: \\"Identifier\\", + type: "Identifier", _Identifier: void, name: string, typeAnnotation: ?TypeAnnotation, @@ -7658,7 +7658,7 @@ export type Pattern = trailingComments: ?Array } | { - type: \\"ObjectPattern\\", + type: "ObjectPattern", _ObjectPattern: void, properties: Array, typeAnnotation: ?TypeAnnotation, @@ -7673,7 +7673,7 @@ export type Pattern = trailingComments: ?Array } | { - type: \\"RestElement\\", + type: "RestElement", _RestElement: void, argument: Pattern, typeAnnotation: ?TypeAnnotation, @@ -7690,7 +7690,7 @@ export type Pattern = export type Statement = | { - type: \\"BlockStatement\\", + type: "BlockStatement", _BlockStatement: void, body: Array, end: number, @@ -7704,7 +7704,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"BreakStatement\\", + type: "BreakStatement", _BreakStatement: void, label: ?Identifier, end: number, @@ -7718,7 +7718,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"ContinueStatement\\", + type: "ContinueStatement", _ContinueStatement: void, label: ?Identifier, end: number, @@ -7732,7 +7732,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"DoWhileStatement\\", + type: "DoWhileStatement", _DoWhileStatement: void, body: Statement, test: Expression, @@ -7747,7 +7747,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"EmptyStatement\\", + type: "EmptyStatement", _EmptyStatement: void, end: number, innerComments: ?Array, @@ -7760,7 +7760,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"ExpressionStatement\\", + type: "ExpressionStatement", _ExpressionStatement: void, expression: Expression, end: number, @@ -7774,7 +7774,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"ForInStatement\\", + type: "ForInStatement", _ForInStatement: void, body: Statement, left: Node, @@ -7790,7 +7790,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"ForOfStatement\\", + type: "ForOfStatement", _ForOfStatement: void, body: Statement, left: Node, @@ -7806,7 +7806,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"ForStatement\\", + type: "ForStatement", _ForStatement: void, init: ?Node, test: ?Expression, @@ -7823,7 +7823,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"IfStatement\\", + type: "IfStatement", _IfStatement: void, alternate: ?Statement, consequent: Statement, @@ -7839,7 +7839,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"LabeledStatement\\", + type: "LabeledStatement", _LabeledStatement: void, body: Statement, label: Identifier, @@ -7854,7 +7854,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"ReturnStatement\\", + type: "ReturnStatement", _ReturnStatement: void, argument: ?Expression, end: number, @@ -7868,7 +7868,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"SwitchStatement\\", + type: "SwitchStatement", _SwitchStatement: void, cases: Array, discriminant: Expression, @@ -7884,7 +7884,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"ThrowStatement\\", + type: "ThrowStatement", _ThrowStatement: void, argument: Expression, end: number, @@ -7898,7 +7898,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"TryStatement\\", + type: "TryStatement", _TryStatement: void, block: BlockStatement, finalizer: ?BlockStatement, @@ -7916,7 +7916,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"WhileStatement\\", + type: "WhileStatement", _WhileStatement: void, body: Statement, test: Expression, @@ -7931,7 +7931,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"WithStatement\\", + type: "WithStatement", _WithStatement: void, body: Statement, object: Expression, @@ -7946,7 +7946,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"DeclareClass\\", + type: "DeclareClass", _DeclareClass: void, body: ObjectTypeAnnotation, extends: Array, @@ -7963,7 +7963,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"DeclareFunction\\", + type: "DeclareFunction", _DeclareFunction: void, id: Identifier, end: number, @@ -7977,7 +7977,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"DeclareModule\\", + type: "DeclareModule", _DeclareModule: void, body: BlockStatement, id: Node, @@ -7992,7 +7992,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"DeclareVariable\\", + type: "DeclareVariable", _DeclareVariable: void, id: Identifier, end: number, @@ -8006,7 +8006,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"InterfaceDeclaration\\", + type: "InterfaceDeclaration", _InterfaceDeclaration: void, body: ObjectTypeAnnotation, extends: Array, @@ -8023,7 +8023,7 @@ export type Statement = trailingComments: ?Array } | { - type: \\"TypeAlias\\", + type: "TypeAlias", _TypeAlias: void, id: Identifier, right: Type, @@ -8041,7 +8041,7 @@ export type Statement = export type Type = | { - type: \\"AnyTypeAnnotation\\", + type: "AnyTypeAnnotation", _AnyTypeAnnotation: void, end: number, innerComments: ?Array, @@ -8054,7 +8054,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"ArrayTypeAnnotation\\", + type: "ArrayTypeAnnotation", _ArrayTypeAnnotation: void, elementType: Type, end: number, @@ -8068,7 +8068,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"BooleanLiteralTypeAnnotation\\", + type: "BooleanLiteralTypeAnnotation", _BooleanLiteralTypeAnnotation: void, raw: string, value: boolean, @@ -8083,7 +8083,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"BooleanTypeAnnotation\\", + type: "BooleanTypeAnnotation", _BooleanTypeAnnotation: void, end: number, innerComments: ?Array, @@ -8096,7 +8096,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"FunctionTypeAnnotation\\", + type: "FunctionTypeAnnotation", _FunctionTypeAnnotation: void, params: Array, rest: ?FunctionTypeParam, @@ -8113,7 +8113,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"GenericTypeAnnotation\\", + type: "GenericTypeAnnotation", _GenericTypeAnnotation: void, id: Node, typeParameters: ?TypeParameterInstantiation, @@ -8128,7 +8128,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"IntersectionTypeAnnotation\\", + type: "IntersectionTypeAnnotation", _IntersectionTypeAnnotation: void, types: Array, end: number, @@ -8142,7 +8142,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"MixedTypeAnnotation\\", + type: "MixedTypeAnnotation", _MixedTypeAnnotation: void, end: number, innerComments: ?Array, @@ -8155,7 +8155,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"NullableTypeAnnotation\\", + type: "NullableTypeAnnotation", _NullableTypeAnnotation: void, typeAnnotation: Type, end: number, @@ -8169,7 +8169,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"NumberLiteralTypeAnnotation\\", + type: "NumberLiteralTypeAnnotation", _NumberLiteralTypeAnnotation: void, raw: string, value: number, @@ -8184,7 +8184,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"NumberTypeAnnotation\\", + type: "NumberTypeAnnotation", _NumberTypeAnnotation: void, end: number, innerComments: ?Array, @@ -8197,7 +8197,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"StringLiteralTypeAnnotation\\", + type: "StringLiteralTypeAnnotation", _StringLiteralTypeAnnotation: void, raw: string, value: string, @@ -8212,7 +8212,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"StringTypeAnnotation\\", + type: "StringTypeAnnotation", _StringTypeAnnotation: void, end: number, innerComments: ?Array, @@ -8225,7 +8225,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"TupleTypeAnnotation\\", + type: "TupleTypeAnnotation", _TupleTypeAnnotation: void, types: Array, end: number, @@ -8239,7 +8239,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"ObjectTypeAnnotation\\", + type: "ObjectTypeAnnotation", _ObjectTypeAnnotation: void, callProperties: Array, indexers: Array, @@ -8255,7 +8255,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"UnionTypeAnnotation\\", + type: "UnionTypeAnnotation", _UnionTypeAnnotation: void, types: Array, end: number, @@ -8269,7 +8269,7 @@ export type Type = trailingComments: ?Array } | { - type: \\"VoidTypeAnnotation\\", + type: "VoidTypeAnnotation", _VoidTypeAnnotation: void, end: number, innerComments: ?Array, @@ -8285,7 +8285,7 @@ export type Type = // Concrete Types. Nothing can extend these. export type CommentLine = { - type: \\"CommentLine\\", + type: "CommentLine", _CommentLine: void, value: string, end: number, @@ -8297,7 +8297,7 @@ export type CommentLine = { }; export type CommentBlock = { - type: \\"CommentBlock\\", + type: "CommentBlock", _CommentBlock: void, value: string, end: number, @@ -8311,7 +8311,7 @@ export type CommentBlock = { // Babel concrete types. export type ArrayExpression = { - type: \\"ArrayExpression\\", + type: "ArrayExpression", _ArrayExpression: void, elements: Array, end: number, @@ -8326,7 +8326,7 @@ export type ArrayExpression = { }; export type ArrayPattern = { - type: \\"ArrayPattern\\", + type: "ArrayPattern", _ArrayPattern: void, elements: Array, typeAnnotation: ?TypeAnnotation, @@ -8342,7 +8342,7 @@ export type ArrayPattern = { }; export type ArrowFunctionExpression = { - type: \\"ArrowFunctionExpression\\", + type: "ArrowFunctionExpression", _ArrowFunctionExpression: void, body: Node, id: ?Identifier, @@ -8366,21 +8366,21 @@ export type ArrowFunctionExpression = { }; type AssignmentOperator = - | \\"=\\" - | \\"+=\\" - | \\"-=\\" - | \\"*=\\" - | \\"/=\\" - | \\"%=\\" - | \\"<<=\\" - | \\">>=\\" - | \\">>>=\\" - | \\"|=\\" - | \\"^=\\" - | \\"&=\\"; + | "=" + | "+=" + | "-=" + | "*=" + | "/=" + | "%=" + | "<<=" + | ">>=" + | ">>>=" + | "|=" + | "^=" + | "&="; export type AssignmentExpression = { - type: \\"AssignmentExpression\\", + type: "AssignmentExpression", _AssignmentExpression: void, left: Pattern, operator: AssignmentOperator, @@ -8397,7 +8397,7 @@ export type AssignmentExpression = { }; export type AssignmentPattern = { - type: \\"AssignmentPattern\\", + type: "AssignmentPattern", _AssignmentPattern: void, left: Pattern, right: Expression, @@ -8413,7 +8413,7 @@ export type AssignmentPattern = { }; export type AwaitExpression = { - type: \\"AwaitExpression\\", + type: "AwaitExpression", _AwaitExpression: void, all: boolean, argument: ?Expression, @@ -8429,31 +8429,31 @@ export type AwaitExpression = { }; type BinaryOperator = - | \\"==\\" - | \\"!=\\" - | \\"===\\" - | \\"!==\\" - | \\"<\\" - | \\"<=\\" - | \\">\\" - | \\">=\\" - | \\"<<\\" - | \\">>\\" - | \\">>>\\" - | \\"+\\" - | \\"-\\" - | \\"*\\" - | \\"/\\" - | \\"%\\" - | \\"&\\" - | \\"|\\" - | \\"^\\" - | \\"in\\" - | \\"instanceof\\" - | \\"..\\"; + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "<<" + | ">>" + | ">>>" + | "+" + | "-" + | "*" + | "/" + | "%" + | "&" + | "|" + | "^" + | "in" + | "instanceof" + | ".."; export type BinaryExpression = { - type: \\"BinaryExpression\\", + type: "BinaryExpression", _BinaryExpression: void, left: Expression, operator: BinaryOperator, @@ -8471,7 +8471,7 @@ export type BinaryExpression = { // TODO: What is this? export type BindExpression = { - type: \\"BindExpression\\", + type: "BindExpression", _BindExpression: void, callee: Node, object: Node, @@ -8487,7 +8487,7 @@ export type BindExpression = { }; export type BlockStatement = { - type: \\"BlockStatement\\", + type: "BlockStatement", _BlockStatement: void, body: Array, end: number, @@ -8502,7 +8502,7 @@ export type BlockStatement = { }; export type BreakStatement = { - type: \\"BreakStatement\\", + type: "BreakStatement", _BreakStatement: void, label: ?Identifier, end: number, @@ -8517,7 +8517,7 @@ export type BreakStatement = { }; export type CallExpression = { - type: \\"CallExpression\\", + type: "CallExpression", _CallExpression: void, arguments: Array, callee: Expression, @@ -8533,7 +8533,7 @@ export type CallExpression = { }; export type CatchClause = { - type: \\"CatchClause\\", + type: "CatchClause", _CatchClause: void, body: BlockStatement, param: Pattern, @@ -8549,7 +8549,7 @@ export type CatchClause = { }; export type ClassBody = { - type: \\"ClassBody\\", + type: "ClassBody", _ClassBody: void, body: Array, end: number, @@ -8564,7 +8564,7 @@ export type ClassBody = { }; export type ClassDeclaration = { - type: \\"ClassDeclaration\\", + type: "ClassDeclaration", _ClassDeclaration: void, body: ClassBody, id: ?Identifier, @@ -8584,7 +8584,7 @@ export type ClassDeclaration = { }; export type ClassExpression = { - type: \\"ClassExpression\\", + type: "ClassExpression", _ClassExpression: void, body: ClassBody, id: ?Identifier, @@ -8604,7 +8604,7 @@ export type ClassExpression = { }; export type ComprehensionBlock = { - type: \\"ComprehensionBlock\\", + type: "ComprehensionBlock", _ComprehensionBlock: void, each: boolean, left: Pattern, @@ -8621,7 +8621,7 @@ export type ComprehensionBlock = { }; export type ComprehensionExpression = { - type: \\"ComprehensionExpression\\", + type: "ComprehensionExpression", _ComprehensionExpression: void, body: Expression, blocks: Array, @@ -8638,7 +8638,7 @@ export type ComprehensionExpression = { }; export type ConditionalExpression = { - type: \\"ConditionalExpression\\", + type: "ConditionalExpression", _ConditionalExpression: void, alternate: Expression, consequent: Expression, @@ -8655,7 +8655,7 @@ export type ConditionalExpression = { }; export type ContinueStatement = { - type: \\"ContinueStatement\\", + type: "ContinueStatement", _ContinueStatement: void, label: ?Identifier, end: number, @@ -8671,7 +8671,7 @@ export type ContinueStatement = { // TODO: Make this correct. export type Decorator = { - type: \\"Decorator\\", + type: "Decorator", _Decorator: void, expression: Expression, end: number, @@ -8686,7 +8686,7 @@ export type Decorator = { }; export type DebuggerStatement = { - type: \\"DebuggerStatement\\", + type: "DebuggerStatement", _DebuggerStatement: void, end: number, innerComments: ?Array, @@ -8700,7 +8700,7 @@ export type DebuggerStatement = { }; export type DoWhileStatement = { - type: \\"DoWhileStatement\\", + type: "DoWhileStatement", _DoWhileStatement: void, body: Statement, test: Expression, @@ -8717,7 +8717,7 @@ export type DoWhileStatement = { // TODO: Make this correct. export type DoExpression = { - type: \\"DoExpression\\", + type: "DoExpression", _DoExpression: void, body: Statement, end: number, @@ -8732,7 +8732,7 @@ export type DoExpression = { }; export type EmptyStatement = { - type: \\"EmptyStatement\\", + type: "EmptyStatement", _EmptyStatement: void, end: number, innerComments: ?Array, @@ -8746,7 +8746,7 @@ export type EmptyStatement = { }; export type ExpressionStatement = { - type: \\"ExpressionStatement\\", + type: "ExpressionStatement", _ExpressionStatement: void, expression: Expression, end: number, @@ -8761,7 +8761,7 @@ export type ExpressionStatement = { }; export type File = { - type: \\"File\\", + type: "File", _File: void, program: Program, end: number, @@ -8776,7 +8776,7 @@ export type File = { }; export type ForInStatement = { - type: \\"ForInStatement\\", + type: "ForInStatement", _ForInStatement: void, body: Statement, left: Node, @@ -8794,7 +8794,7 @@ export type ForInStatement = { // TODO: Make this correct. export type ForOfStatement = { - type: \\"ForOfStatement\\", + type: "ForOfStatement", _ForOfStatement: void, body: Statement, left: Node, @@ -8811,7 +8811,7 @@ export type ForOfStatement = { }; export type ForStatement = { - type: \\"ForStatement\\", + type: "ForStatement", _ForStatement: void, init: ?Node, test: ?Expression, @@ -8829,7 +8829,7 @@ export type ForStatement = { }; export type FunctionDeclaration = { - type: \\"FunctionDeclaration\\", + type: "FunctionDeclaration", _FunctionDeclaration: void, body: BlockStatement, id: Identifier, @@ -8853,7 +8853,7 @@ export type FunctionDeclaration = { }; export type FunctionExpression = { - type: \\"FunctionExpression\\", + type: "FunctionExpression", _FunctionExpression: void, body: BlockStatement, id: ?Identifier, @@ -8877,7 +8877,7 @@ export type FunctionExpression = { }; export type Identifier = { - type: \\"Identifier\\", + type: "Identifier", _Identifier: void, name: string, typeAnnotation: ?TypeAnnotation, @@ -8893,7 +8893,7 @@ export type Identifier = { }; export type IfStatement = { - type: \\"IfStatement\\", + type: "IfStatement", _IfStatement: void, alternate: ?Statement, consequent: Statement, @@ -8911,7 +8911,7 @@ export type IfStatement = { // TODO: Make this correct. export type ImportDefaultSpecifier = { - type: \\"ImportDefaultSpecifier\\", + type: "ImportDefaultSpecifier", _ImportDefaultSpecifier: void, local: Node, end: number, @@ -8927,7 +8927,7 @@ export type ImportDefaultSpecifier = { // TODO: Make this correct. export type ImportNamespaceSpecifier = { - type: \\"ImportNamespaceSpecifier\\", + type: "ImportNamespaceSpecifier", _ImportNamespaceSpecifier: void, local: Node, end: number, @@ -8943,7 +8943,7 @@ export type ImportNamespaceSpecifier = { // TODO: Make this correct. export type ImportDeclaration = { - type: \\"ImportDeclaration\\", + type: "ImportDeclaration", _ImportDeclaration: void, specifiers: Array, source: Literal, @@ -8960,7 +8960,7 @@ export type ImportDeclaration = { // TODO: Make this correct. export type ImportSpecifier = { - type: \\"ImportSpecifier\\", + type: "ImportSpecifier", _ImportSpecifier: void, imported: Node, local: Node, @@ -8976,7 +8976,7 @@ export type ImportSpecifier = { }; export type LabeledStatement = { - type: \\"LabeledStatement\\", + type: "LabeledStatement", _LabeledStatement: void, body: Statement, label: Identifier, @@ -8992,7 +8992,7 @@ export type LabeledStatement = { }; export type Literal = { - type: \\"Literal\\", + type: "Literal", _Literal: void, raw: string, regex: ?{ pattern: string, flags: string }, @@ -9008,10 +9008,10 @@ export type Literal = { trailingComments: ?Array }; -type LogicalOperator = \\"||\\" | \\"&&\\"; +type LogicalOperator = "||" | "&&"; export type LogicalExpression = { - type: \\"LogicalExpression\\", + type: "LogicalExpression", _LogicalExpression: void, left: Expression, operator: LogicalOperator, @@ -9028,7 +9028,7 @@ export type LogicalExpression = { }; export type MemberExpression = { - type: \\"MemberExpression\\", + type: "MemberExpression", _MemberExpression: void, computed: boolean, object: Expression, @@ -9046,7 +9046,7 @@ export type MemberExpression = { // TODO: Make this correct. export type MetaProperty = { - type: \\"MetaProperty\\", + type: "MetaProperty", _MetaProperty: void, meta: Node, property: Node, @@ -9062,11 +9062,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, @@ -9082,7 +9082,7 @@ export type MethodDefinition = { }; export type NewExpression = { - type: \\"NewExpression\\", + type: "NewExpression", _NewExpression: void, arguments: Array, callee: Expression, @@ -9098,7 +9098,7 @@ export type NewExpression = { }; export type Noop = { - type: \\"Noop\\", + type: "Noop", _Noop: void, end: number, innerComments: ?Array, @@ -9112,7 +9112,7 @@ export type Noop = { }; export type ObjectExpression = { - type: \\"ObjectExpression\\", + type: "ObjectExpression", _ObjectExpression: void, properties: Array, end: number, @@ -9127,7 +9127,7 @@ export type ObjectExpression = { }; export type ObjectPattern = { - type: \\"ObjectPattern\\", + type: "ObjectPattern", _ObjectPattern: void, properties: Array, typeAnnotation: ?TypeAnnotation, @@ -9143,7 +9143,7 @@ export type ObjectPattern = { }; export type Program = { - type: \\"Program\\", + type: "Program", _Program: void, body: Array, end: number, @@ -9158,11 +9158,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, @@ -9179,7 +9179,7 @@ export type Property = { }; export type RestElement = { - type: \\"RestElement\\", + type: "RestElement", _RestElement: void, argument: Pattern, typeAnnotation: ?TypeAnnotation, @@ -9195,7 +9195,7 @@ export type RestElement = { }; export type ReturnStatement = { - type: \\"ReturnStatement\\", + type: "ReturnStatement", _ReturnStatement: void, argument: ?Expression, end: number, @@ -9210,7 +9210,7 @@ export type ReturnStatement = { }; export type SequenceExpression = { - type: \\"SequenceExpression\\", + type: "SequenceExpression", _SequenceExpression: void, expression: Array, end: number, @@ -9225,7 +9225,7 @@ export type SequenceExpression = { }; export type SpreadElement = { - type: \\"SpreadElement\\", + type: "SpreadElement", _SpreadElement: void, argument: Expression, end: number, @@ -9240,7 +9240,7 @@ export type SpreadElement = { }; export type SpreadProperty = { - type: \\"SpreadProperty\\", + type: "SpreadProperty", _SpreadProperty: void, argument: Expression, end: number, @@ -9255,7 +9255,7 @@ export type SpreadProperty = { }; export type Super = { - type: \\"Super\\", + type: "Super", _Super: void, end: number, innerComments: ?Array, @@ -9269,7 +9269,7 @@ export type Super = { }; export type SwitchCase = { - type: \\"SwitchCase\\", + type: "SwitchCase", _SwitchCase: void, consequent: Array, test: ?Expression, @@ -9285,7 +9285,7 @@ export type SwitchCase = { }; export type SwitchStatement = { - type: \\"SwitchStatement\\", + type: "SwitchStatement", _SwitchStatement: void, cases: Array, discriminant: Expression, @@ -9302,7 +9302,7 @@ export type SwitchStatement = { }; export type TaggedTemplateExpression = { - type: \\"TaggedTemplateExpression\\", + type: "TaggedTemplateExpression", _TaggedTemplateExpression: void, quasi: TemplateLiteral, tag: Expression, @@ -9318,7 +9318,7 @@ export type TaggedTemplateExpression = { }; export type TemplateElement = { - type: \\"TemplateElement\\", + type: "TemplateElement", _TemplateElement: void, tail: boolean, value: { cooked: string, raw: string }, @@ -9334,7 +9334,7 @@ export type TemplateElement = { }; export type TemplateLiteral = { - type: \\"TemplateLiteral\\", + type: "TemplateLiteral", _TemplateLiteral: void, expressions: Array, quasis: Array, @@ -9350,7 +9350,7 @@ export type TemplateLiteral = { }; export type ThisExpression = { - type: \\"ThisExpression\\", + type: "ThisExpression", _ThisExpression: void, end: number, innerComments: ?Array, @@ -9364,7 +9364,7 @@ export type ThisExpression = { }; export type ThrowStatement = { - type: \\"ThrowStatement\\", + type: "ThrowStatement", _ThrowStatement: void, argument: Expression, end: number, @@ -9379,7 +9379,7 @@ export type ThrowStatement = { }; export type TryStatement = { - type: \\"TryStatement\\", + type: "TryStatement", _TryStatement: void, block: BlockStatement, finalizer: ?BlockStatement, @@ -9397,10 +9397,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, @@ -9416,10 +9416,10 @@ export type UnaryExpression = { trailingComments: ?Array }; -type UpdateOperator = \\"++\\" | \\"--\\"; +type UpdateOperator = "++" | "--"; export type UpdateExpression = { - type: \\"UpdateExpression\\", + type: "UpdateExpression", _UpdateExpression: void, argument: Expression, operator: UpdateOperator, @@ -9436,10 +9436,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, @@ -9452,7 +9452,7 @@ export type VariableDeclaration = { }; export type VariableDeclarator = { - type: \\"VariableDeclarator\\", + type: "VariableDeclarator", _VariableDeclarator: void, id: Pattern, init: ?Expression, @@ -9468,7 +9468,7 @@ export type VariableDeclarator = { }; export type WhileStatement = { - type: \\"WhileStatement\\", + type: "WhileStatement", _WhileStatement: void, body: Statement, test: Expression, @@ -9484,7 +9484,7 @@ export type WhileStatement = { }; export type WithStatement = { - type: \\"WithStatement\\", + type: "WithStatement", _WithStatement: void, body: Statement, object: Expression, @@ -9500,7 +9500,7 @@ export type WithStatement = { }; export type YieldExpression = { - type: \\"YieldExpression\\", + type: "YieldExpression", _YieldExpression: void, argument: ?Expression, delegate: boolean, @@ -9517,7 +9517,7 @@ export type YieldExpression = { // TODO: Make this correct. export type ExportAllDeclaration = { - type: \\"ExportAllDeclaration\\", + type: "ExportAllDeclaration", _ExportAllDeclaration: void, exported: Node, source: Node, @@ -9534,7 +9534,7 @@ export type ExportAllDeclaration = { // TODO: Make this correct. export type ExportDefaultDeclaration = { - type: \\"ExportDefaultDeclaration\\", + type: "ExportDefaultDeclaration", _ExportDefaultDeclaration: void, declaration: Node, end: number, @@ -9550,7 +9550,7 @@ export type ExportDefaultDeclaration = { // TODO: Make this correct. export type ExportNamedDeclaration = { - type: \\"ExportNamedDeclaration\\", + type: "ExportNamedDeclaration", _ExportNamedDeclaration: void, declaration: Node, source: Literal, @@ -9568,7 +9568,7 @@ export type ExportNamedDeclaration = { // TODO: Make this correct. export type ExportDefaultSpecifier = { - type: \\"ExportDefaultSpecifier\\", + type: "ExportDefaultSpecifier", _ExportDefaultSpecifier: void, exported: Node, end: number, @@ -9584,7 +9584,7 @@ export type ExportDefaultSpecifier = { // TODO: Make this correct. export type ExportNamespaceSpecifier = { - type: \\"ExportNamespaceSpecifier\\", + type: "ExportNamespaceSpecifier", _ExportNamespaceSpecifier: void, exported: Node, end: number, @@ -9600,7 +9600,7 @@ export type ExportNamespaceSpecifier = { // TODO: Make this correct. export type ExportSpecifier = { - type: \\"ExportSpecifier\\", + type: "ExportSpecifier", _ExportSpecifier: void, local: Node, exported: Node, @@ -9616,7 +9616,7 @@ export type ExportSpecifier = { }; export type AnyTypeAnnotation = { - type: \\"AnyTypeAnnotation\\", + type: "AnyTypeAnnotation", _AnyTypeAnnotation: void, end: number, innerComments: ?Array, @@ -9630,7 +9630,7 @@ export type AnyTypeAnnotation = { }; export type ArrayTypeAnnotation = { - type: \\"ArrayTypeAnnotation\\", + type: "ArrayTypeAnnotation", _ArrayTypeAnnotation: void, elementType: Type, end: number, @@ -9645,7 +9645,7 @@ export type ArrayTypeAnnotation = { }; export type BooleanLiteralTypeAnnotation = { - type: \\"BooleanLiteralTypeAnnotation\\", + type: "BooleanLiteralTypeAnnotation", _BooleanLiteralTypeAnnotation: void, raw: string, value: boolean, @@ -9661,7 +9661,7 @@ export type BooleanLiteralTypeAnnotation = { }; export type BooleanTypeAnnotation = { - type: \\"BooleanTypeAnnotation\\", + type: "BooleanTypeAnnotation", _BooleanTypeAnnotation: void, end: number, innerComments: ?Array, @@ -9675,7 +9675,7 @@ export type BooleanTypeAnnotation = { }; export type ClassImplements = { - type: \\"ClassImplements\\", + type: "ClassImplements", _ClassImplements: void, id: Identifier, typeParameters: ?TypeParameterInstantiation, @@ -9692,7 +9692,7 @@ export type ClassImplements = { }; export type ClassProperty = { - type: \\"ClassProperty\\", + type: "ClassProperty", _ClassProperty: void, computed: boolean, key: Node, @@ -9712,7 +9712,7 @@ export type ClassProperty = { }; export type DeclareClass = { - type: \\"DeclareClass\\", + type: "DeclareClass", _DeclareClass: void, body: ObjectTypeAnnotation, extends: Array, @@ -9731,7 +9731,7 @@ export type DeclareClass = { // TODO: Make this correct. export type DeclareFunction = { - type: \\"DeclareFunction\\", + type: "DeclareFunction", _DeclareFunction: void, id: Identifier, end: number, @@ -9746,7 +9746,7 @@ export type DeclareFunction = { }; export type DeclareModule = { - type: \\"DeclareModule\\", + type: "DeclareModule", _DeclareModule: void, body: BlockStatement, id: Node, @@ -9763,7 +9763,7 @@ export type DeclareModule = { // TODO: Make this correct. export type DeclareVariable = { - type: \\"DeclareVariable\\", + type: "DeclareVariable", _DeclareVariable: void, id: Identifier, end: number, @@ -9778,7 +9778,7 @@ export type DeclareVariable = { }; export type FunctionTypeAnnotation = { - type: \\"FunctionTypeAnnotation\\", + type: "FunctionTypeAnnotation", _FunctionTypeAnnotation: void, params: Array, rest: ?FunctionTypeParam, @@ -9796,7 +9796,7 @@ export type FunctionTypeAnnotation = { }; export type FunctionTypeParam = { - type: \\"FunctionTypeParam\\", + type: "FunctionTypeParam", _FunctionTypeParam: void, name: Identifier, optional: boolean, @@ -9813,7 +9813,7 @@ export type FunctionTypeParam = { }; export type GenericTypeAnnotation = { - type: \\"GenericTypeAnnotation\\", + type: "GenericTypeAnnotation", _GenericTypeAnnotation: void, id: Node, typeParameters: ?TypeParameterInstantiation, @@ -9829,7 +9829,7 @@ export type GenericTypeAnnotation = { }; export type InterfaceExtends = { - type: \\"InterfaceExtends\\", + type: "InterfaceExtends", _InterfaceExtends: void, id: Identifier, typeParameters: ?TypeParameterInstantiation, @@ -9845,7 +9845,7 @@ export type InterfaceExtends = { }; export type InterfaceDeclaration = { - type: \\"InterfaceDeclaration\\", + type: "InterfaceDeclaration", _InterfaceDeclaration: void, body: ObjectTypeAnnotation, extends: Array, @@ -9863,7 +9863,7 @@ export type InterfaceDeclaration = { }; export type IntersectionTypeAnnotation = { - type: \\"IntersectionTypeAnnotation\\", + type: "IntersectionTypeAnnotation", _IntersectionTypeAnnotation: void, types: Array, end: number, @@ -9878,7 +9878,7 @@ export type IntersectionTypeAnnotation = { }; export type MixedTypeAnnotation = { - type: \\"MixedTypeAnnotation\\", + type: "MixedTypeAnnotation", _MixedTypeAnnotation: void, end: number, innerComments: ?Array, @@ -9892,7 +9892,7 @@ export type MixedTypeAnnotation = { }; export type NullableTypeAnnotation = { - type: \\"NullableTypeAnnotation\\", + type: "NullableTypeAnnotation", _NullableTypeAnnotation: void, typeAnnotation: Type, end: number, @@ -9907,7 +9907,7 @@ export type NullableTypeAnnotation = { }; export type NumberLiteralTypeAnnotation = { - type: \\"NumberLiteralTypeAnnotation\\", + type: "NumberLiteralTypeAnnotation", _NumberLiteralTypeAnnotation: void, raw: string, value: number, @@ -9923,7 +9923,7 @@ export type NumberLiteralTypeAnnotation = { }; export type NumberTypeAnnotation = { - type: \\"NumberTypeAnnotation\\", + type: "NumberTypeAnnotation", _NumberTypeAnnotation: void, end: number, innerComments: ?Array, @@ -9937,7 +9937,7 @@ export type NumberTypeAnnotation = { }; export type StringLiteralTypeAnnotation = { - type: \\"StringLiteralTypeAnnotation\\", + type: "StringLiteralTypeAnnotation", _StringLiteralTypeAnnotation: void, raw: string, value: string, @@ -9953,7 +9953,7 @@ export type StringLiteralTypeAnnotation = { }; export type StringTypeAnnotation = { - type: \\"StringTypeAnnotation\\", + type: "StringTypeAnnotation", _StringTypeAnnotation: void, end: number, innerComments: ?Array, @@ -9967,7 +9967,7 @@ export type StringTypeAnnotation = { }; export type TupleTypeAnnotation = { - type: \\"TupleTypeAnnotation\\", + type: "TupleTypeAnnotation", _TupleTypeAnnotation: void, types: Array, end: number, @@ -9982,7 +9982,7 @@ export type TupleTypeAnnotation = { }; export type TypeofTypeAnnotation = { - type: \\"TypeofTypeAnnotation\\", + type: "TypeofTypeAnnotation", _TypeofTypeAnnotation: void, argument: Type, end: number, @@ -9997,7 +9997,7 @@ export type TypeofTypeAnnotation = { }; export type TypeAlias = { - type: \\"TypeAlias\\", + type: "TypeAlias", _TypeAlias: void, id: Identifier, right: Type, @@ -10014,7 +10014,7 @@ export type TypeAlias = { }; export type TypeAnnotation = { - type: \\"TypeAnnotation\\", + type: "TypeAnnotation", _TypeAnnotation: void, typeAnnotation: Type, end: number, @@ -10029,7 +10029,7 @@ export type TypeAnnotation = { }; export type TypeCastExpression = { - type: \\"TypeCastExpression\\", + type: "TypeCastExpression", _TypeCastExpression: void, expression: Expression, typeAnnotation: TypeAnnotation, @@ -10045,7 +10045,7 @@ export type TypeCastExpression = { }; export type TypeParameterDeclaration = { - type: \\"TypeParameterDeclaration\\", + type: "TypeParameterDeclaration", _TypeParameterDeclaration: void, params: Array, end: number, @@ -10060,7 +10060,7 @@ export type TypeParameterDeclaration = { }; export type TypeParameterInstantiation = { - type: \\"TypeParameterInstantiation\\", + type: "TypeParameterInstantiation", _TypeParameterInstantiation: void, params: Array, end: number, @@ -10075,7 +10075,7 @@ export type TypeParameterInstantiation = { }; export type ObjectTypeAnnotation = { - type: \\"ObjectTypeAnnotation\\", + type: "ObjectTypeAnnotation", _ObjectTypeAnnotation: void, callProperties: Array, indexers: Array, @@ -10092,7 +10092,7 @@ export type ObjectTypeAnnotation = { }; export type ObjectTypeCallProperty = { - type: \\"ObjectTypeCallProperty\\", + type: "ObjectTypeCallProperty", _ObjectTypeCallProperty: void, static: boolean, value: FunctionTypeAnnotation, @@ -10108,7 +10108,7 @@ export type ObjectTypeCallProperty = { }; export type ObjectTypeIndexer = { - type: \\"ObjectTypeIndexer\\", + type: "ObjectTypeIndexer", _ObjectTypeIndexer: void, id: Identifier, key: Type, @@ -10125,7 +10125,7 @@ export type ObjectTypeIndexer = { }; export type ObjectTypeProperty = { - type: \\"ObjectTypeProperty\\", + type: "ObjectTypeProperty", _ObjectTypeProperty: void, key: Node, optional: boolean, @@ -10142,7 +10142,7 @@ export type ObjectTypeProperty = { }; export type QualifiedTypeIdentifier = { - type: \\"QualifiedTypeIdentifier\\", + type: "QualifiedTypeIdentifier", _QualifiedTypeIdentifier: void, id: Identifier, qualification: Node, @@ -10158,7 +10158,7 @@ export type QualifiedTypeIdentifier = { }; export type UnionTypeAnnotation = { - type: \\"UnionTypeAnnotation\\", + type: "UnionTypeAnnotation", _UnionTypeAnnotation: void, types: Array, end: number, @@ -10173,7 +10173,7 @@ export type UnionTypeAnnotation = { }; export type VoidTypeAnnotation = { - type: \\"VoidTypeAnnotation\\", + type: "VoidTypeAnnotation", _VoidTypeAnnotation: void, end: number, innerComments: ?Array, @@ -10187,7 +10187,7 @@ export type VoidTypeAnnotation = { }; export type JSXAttribute = { - type: \\"JSXAttribute\\", + type: "JSXAttribute", _JSXAttribute: void, name: Node, value: ?Node, @@ -10203,7 +10203,7 @@ export type JSXAttribute = { }; export type JSXClosingElement = { - type: \\"JSXClosingElement\\", + type: "JSXClosingElement", _JSXClosingElement: void, name: Node, end: number, @@ -10218,7 +10218,7 @@ export type JSXClosingElement = { }; export type JSXElement = { - type: \\"JSXElement\\", + type: "JSXElement", _JSXElement: void, children: Array, closingElement: ?JSXClosingElement, @@ -10235,7 +10235,7 @@ export type JSXElement = { }; export type JSXEmptyExpression = { - type: \\"JSXEmptyExpression\\", + type: "JSXEmptyExpression", _JSXEmptyExpression: void, end: number, innerComments: ?Array, @@ -10249,7 +10249,7 @@ export type JSXEmptyExpression = { }; export type JSXExpressionContainer = { - type: \\"JSXExpressionContainer\\", + type: "JSXExpressionContainer", _JSXExpressionContainer: void, expression: Expression, end: number, @@ -10264,7 +10264,7 @@ export type JSXExpressionContainer = { }; export type JSXIdentifier = { - type: \\"JSXIdentifier\\", + type: "JSXIdentifier", _JSXIdentifier: void, name: string, end: number, @@ -10279,7 +10279,7 @@ export type JSXIdentifier = { }; export type JSXMemberExpression = { - type: \\"JSXMemberExpression\\", + type: "JSXMemberExpression", _JSXMemberExpression: void, computed: boolean, object: Node, @@ -10296,7 +10296,7 @@ export type JSXMemberExpression = { }; export type JSXNamespacedName = { - type: \\"JSXNamespacedName\\", + type: "JSXNamespacedName", _JSXNamespacedName: void, name: JSXIdentifier, namespace: JSXIdentifier, @@ -10312,7 +10312,7 @@ export type JSXNamespacedName = { }; export type JSXOpeningElement = { - type: \\"JSXOpeningElement\\", + type: "JSXOpeningElement", _JSXOpeningElement: void, attributes: Array, name: Array, @@ -10329,7 +10329,7 @@ export type JSXOpeningElement = { }; export type JSXSpreadAttribute = { - type: \\"JSXSpreadAttribute\\", + type: "JSXSpreadAttribute", _JSXSpreadAttribute: void, argument: Expression, end: number, @@ -10342,5 +10342,5 @@ export type JSXSpreadAttribute = { start: number, trailingComments: ?Array }; -" + `; diff --git a/tests/flow/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap index 7c6d8407..c7a4116e 100644 --- a/tests/flow/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/** +/** * Test nonstrict type param arity checking, * as enabled by * @@ -35,7 +35,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 @@ -108,7 +108,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 @@ -150,5 +150,5 @@ function singleton(x: T): Array { } var num_array: Array = singleton(0); // ok, type arg inferred -" + `; diff --git a/tests/flow/type_args_strict/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type_args_strict/__snapshots__/jsfmt.spec.js.snap index 120231d4..393b005b 100644 --- a/tests/flow/type_args_strict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type_args_strict/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/** +/** * Test strict type param arity checking. * * Full type argument lists are required in type expressions, @@ -34,7 +34,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 @@ -106,7 +106,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 @@ -148,5 +148,5 @@ function singleton(x: T): Array { } var num_array: Array = singleton(0); // ok, type arg inferred -" + `; diff --git a/tests/flow/type_only_vars/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type_only_vars/__snapshots__/jsfmt.spec.js.snap index 83e83b75..82cc6343 100644 --- a/tests/flow/type_only_vars/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type_only_vars/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`A.js 1`] = ` -"/** +/** * @flow */ @@ -28,57 +28,57 @@ module.exports = { Foo: Foo, Bar: Bar }; -" + `; exports[`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 */ -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"; + `; exports[`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 Foo = A.Foo; @@ -98,10 +98,10 @@ var b: Foo = new A.Foo(); * @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; @@ -114,16 +114,16 @@ var o = Baz; var a: Foo = new Foo(); var b: Foo = new A.Foo(); (new A.Bar(): Baz); -" + `; exports[`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'); @@ -140,10 +140,10 @@ var a: Foo = new actualA.Foo(); * @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 var m = A; @@ -153,11 +153,11 @@ var o = Baz; // But using it in a type should still work var a: Foo = new actualA.Foo(); (new actualA.Bar(): Baz); -" + `; exports[`type_alias.js 1`] = ` -"/** +/** * @flow */ @@ -184,5 +184,5 @@ var x = Foo; var a: Foo = 123; var b: Array = [123]; type c = Foo; -" + `; diff --git a/tests/flow/type_param_defaults/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type_param_defaults/__snapshots__/jsfmt.spec.js.snap index 8819ac4e..699384aa 100644 --- a/tests/flow/type_param_defaults/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type_param_defaults/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`classes.js 1`] = ` -"/* @flow */ +/* @flow */ class A { p: T; @@ -81,7 +81,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); @@ -95,8 +95,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 @@ -105,9 +105,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 @@ -120,7 +120,7 @@ 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 @@ -130,7 +130,7 @@ 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"); + `; diff --git a/tests/flow/type_param_scope/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type_param_scope/__snapshots__/jsfmt.spec.js.snap index 8353f461..c9b6fabe 100644 --- a/tests/flow/type_param_scope/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type_param_scope/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`class.js 1`] = ` -"class C { +class C { a(x:T, a:A) { this.b(x); // ok this.b(a); // error: A ~> incompatible instance of T @@ -18,11 +18,11 @@ class C { b(x: T) {} } -" + `; exports[`default_params.js 1`] = ` -"function f(a:T) { +function f(a:T) { function g(b:U, c:T = a) { function h(d:U = b) {} h(); // ok @@ -47,11 +47,11 @@ function f(a: T) { g(0, 0); // error: number ~> T } f(0); // ok -" + `; exports[`method_shadow.js 1`] = ` -"// Ensure method type params properly shadow outer type params. Subclass ensures +// Ensure method type params properly shadow outer type params. Subclass ensures // the generated insttype has the correct tvars. Should behave the same for // classes, interfaces, and declared classes. @@ -93,7 +93,7 @@ class G { declare var g: G; g.m(0); // ok g.m(true); // err, bool ~> number|string -(g.m(\\"\\"): G); // err, string ~> number +(g.m(""): G); // err, string ~> number // Shadow bounds incompatible with parent @@ -156,7 +156,7 @@ class G { declare var g: G; g.m(0); // ok g.m(true); // err, bool ~> number|string -(g.m(\\"\\"): G); // err, string ~> number +(g.m(""): G); // err, string ~> number // Shadow bounds incompatible with parent @@ -166,5 +166,5 @@ class H { this.x = x; // err, m's T != H's T } } -" + `; diff --git a/tests/flow/type_param_variance/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type_param_variance/__snapshots__/jsfmt.spec.js.snap index a42199cd..84d49482 100644 --- a/tests/flow/type_param_variance/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type_param_variance/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`promise.js 1`] = ` -"/** +/** * At the moment, all type params are invariant with * the exception of the single param to the Promise class, * which is covariant. @@ -44,7 +44,7 @@ run() 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; } @@ -56,5 +56,5 @@ async function run() { } run(); -" + `; diff --git a/tests/flow/type_param_variance2/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type_param_variance2/__snapshots__/jsfmt.spec.js.snap index e4179252..2f016e87 100644 --- a/tests/flow/type_param_variance2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type_param_variance2/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`promise.js 1`] = ` -"/** +/** * Here the definition of Promise is routed to the class Promise * in the user-specified library libs/Promise.js * @@ -38,7 +38,7 @@ run() 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; } @@ -50,5 +50,5 @@ async function run() { } run(); -" + `; diff --git a/tests/flow/type_param_variance2/libs/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type_param_variance2/libs/__snapshots__/jsfmt.spec.js.snap index 680f303f..46fec2dd 100644 --- a/tests/flow/type_param_variance2/libs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type_param_variance2/libs/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Promise.js 1`] = ` -"// Copyright 2004-present Facebook. All Rights Reserved. +// Copyright 2004-present Facebook. All Rights Reserved. // These annotations are copy/pasted from the built-in Flow definitions for // Native Promises (https://phabricator.fb.com/P19792689), @@ -92,5 +92,5 @@ declare class Promise { promisesByKey: T ): Promise<{ [key: $Keys]: any }> } -" + `; diff --git a/tests/flow/typeapp_perf/__snapshots__/jsfmt.spec.js.snap b/tests/flow/typeapp_perf/__snapshots__/jsfmt.spec.js.snap index 8ed5aa97..9c1bb65b 100644 --- a/tests/flow/typeapp_perf/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/typeapp_perf/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test1.js 1`] = ` -"/* This test ensures that the code below does not take a long time to check. If +/* This test ensures that the code below does not take a long time to check. If * this test is taking a very long time to complete, there is a bug. */ class A {} @@ -42,11 +42,11 @@ type B = A & { declare var b: B; (b: B); -" + `; exports[`test2.js 1`] = ` -"/* This test ensures that the code below does not take a long time to check. If +/* This test ensures that the code below does not take a long time to check. If * this test is taking a very long time to complete, there is a bug. */ class A {} @@ -87,5 +87,5 @@ type B = A & { declare var b: B; (b: B); -" + `; diff --git a/tests/flow/typecast/__snapshots__/jsfmt.spec.js.snap b/tests/flow/typecast/__snapshots__/jsfmt.spec.js.snap index 8b091150..cb594a7e 100644 --- a/tests/flow/typecast/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/typecast/__snapshots__/jsfmt.spec.js.snap @@ -1,22 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`typecast.js 1`] = ` -"/** +/** * Copyright 2004-present Facebook. All Rights Reserved. */ var tests = [ () => { // erroneous typcasts raise errors... - var n = (\\"hey\\" : number); + var n = ("hey" : number); // ...but 'any' does dynamic downcasts, if you must - var x: number = (\\"hey\\": any); - var y = ((\\"hey\\": any): number); + 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)); }, () => { @@ -34,16 +34,16 @@ var tests = [ var tests = [ () => { // erroneous typcasts raise errors... - var n = (\\"hey\\": number); + var n = ("hey": number); // ...but 'any' does dynamic downcasts, if you must - var x: number = (\\"hey\\": any); - var y = ((\\"hey\\": any): number); + 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)); }, () => { @@ -54,5 +54,5 @@ var tests = [ // var b = [(0 : ?number), 1, 2, 3, 4, 5, 6, 7, null]; } ]; -" + `; diff --git a/tests/flow/typeof/__snapshots__/jsfmt.spec.js.snap b/tests/flow/typeof/__snapshots__/jsfmt.spec.js.snap index d32615f6..2723aa85 100644 --- a/tests/flow/typeof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/typeof/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`typeof.js 1`] = ` -"/** +/** * @flow */ @@ -78,11 +78,11 @@ 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 @@ -148,7 +148,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 <> == // @@ -165,10 +165,10 @@ 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 + `; diff --git a/tests/flow/unary/__snapshots__/jsfmt.spec.js.snap b/tests/flow/unary/__snapshots__/jsfmt.spec.js.snap index e4511619..4f64e7ce 100644 --- a/tests/flow/unary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/unary/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`unary.js 1`] = ` -"/* @flow */ +/* @flow */ function x0(y: string): number { return +y; // ok, + exists solely for coercion @@ -40,11 +40,11 @@ function x4(y: string): boolean { } (-1: void); // error, number ~> void -" + `; exports[`update.js 1`] = ` -"// @flow +// @flow let tests = [ function(y: number) { @@ -121,5 +121,5 @@ let tests = [ y++; // ok } ]; -" + `; diff --git a/tests/flow/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap index 4e080e5c..c6c0556f 100644 --- a/tests/flow/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`buffer.js 1`] = ` -"/** +/** * @providesModule buffer * * Not in flow. @@ -26,11 +26,11 @@ export var INSPECT_MAX_BYTES = 0; */ export var INSPECT_MAX_BYTES = 0; -" + `; exports[`test.js 1`] = ` -"/** +/** * Copyright 2004-present Facebook. All Rights Reserved. * @flow */ @@ -41,7 +41,7 @@ exports[`test.js 1`] = ` * that follows will cause no errors, but if we resolve to the library * 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @@ -55,7 +55,7 @@ var x: string = buffer.INSPECT_MAX_BYTES; // error, number ~/> string * that follows will cause no errors, but if we resolve to the library * 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 -" + `; diff --git a/tests/flow/unchecked_node_module_vs_lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/unchecked_node_module_vs_lib/__snapshots__/jsfmt.spec.js.snap index b14bdf32..7ab895aa 100644 --- a/tests/flow/unchecked_node_module_vs_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/unchecked_node_module_vs_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/** +/** * Test resolution precedence in node: * checked module > lib def > unchecked module * @@ -11,21 +11,21 @@ exports[`test.js 1`] = ` // node_modules/buffer/index.js is unchecked, // 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 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 // -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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @@ -38,21 +38,21 @@ var x3: string = buffer3.INSPECT_MAX_BYTES; // error, module not found // node_modules/buffer/index.js is unchecked, // 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 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 // -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 -" + `; diff --git a/tests/flow/undefined/__snapshots__/jsfmt.spec.js.snap b/tests/flow/undefined/__snapshots__/jsfmt.spec.js.snap index 0a01d573..177377f0 100644 --- a/tests/flow/undefined/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/undefined/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`issue-518.js 1`] = ` -"function doSomethingAsync(): Promise { +function doSomethingAsync(): Promise { return new Promise((resolve, reject) => { resolve(); // OK to leave out arg, same as resolve(undefined) @@ -26,11 +26,11 @@ function doSomethingAsync(): Promise { // simpler repro to show that too few args are fine when expecting void function foo(x: void) {} foo(); -" + `; exports[`undefined.js 1`] = ` -"function foo() { +function foo() { var x; x.foo(); } @@ -40,7 +40,7 @@ function bar() { if (x) x.bar(); } -function qux(x?: number, y:string = \\"\\", z) { } +function qux(x?: number, y:string = "", z) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo() { var x; @@ -52,12 +52,12 @@ function bar() { if (x) x.bar(); } -function qux(x?: number, y: string = \\"\\", z) {} -" +function qux(x?: number, y: string = "", z) {} + `; exports[`undefined2.js 1`] = ` -"// @flow +// @flow let tests = [ function(x: number) { @@ -94,15 +94,15 @@ let tests = [ let tests = [ function(x: number) { var id; - var name = id ? \\"John\\" : undefined; + var name = id ? "John" : undefined; (name: boolean); // error, string or void - const bar = [undefined, \\"bar\\"]; + const bar = [undefined, "bar"]; (bar[x]: boolean); // error, string or void }, function(x: number) { - var undefined = \\"foo\\"; + var undefined = "foo"; (undefined: string); // ok var x; @@ -110,9 +110,9 @@ let tests = [ x[0]; // should error, could be void } - const bar = [undefined, \\"bar\\"]; + const bar = [undefined, "bar"]; (bar[x]: boolean); // error, string only } ]; -" + `; diff --git a/tests/flow/unicode/__snapshots__/jsfmt.spec.js.snap b/tests/flow/unicode/__snapshots__/jsfmt.spec.js.snap index 4ed4c3db..d54ce7d1 100644 --- a/tests/flow/unicode/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/unicode/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`UnicodeUtils.js 1`] = ` -"/** +/** * @flow */ @@ -22,11 +22,11 @@ function inSurrogateRange(codeUnit) { * representing non-BMP characters ([U+10000..U+10FFFF]). * * Examples: - * - '\\\\u0020' => 1 - * - '\\\\u3020' => 1 - * - '\\\\uD835' => 2 - * - '\\\\uD835\\\\uDDEF' => 2 - * - '\\\\uDDEF' => 2 + * - '\\u0020' => 1 + * - '\\u3020' => 1 + * - '\\uD835' => 2 + * - '\\uD835\\uDDEF' => 2 + * - '\\uDDEF' => 2 * * @param {string} str Non-empty string * @param {number} pos Position in the string to look for one code unit @@ -56,11 +56,11 @@ function inSurrogateRange(codeUnit) { * representing non-BMP characters ([U+10000..U+10FFFF]). * * Examples: - * - '\\\\u0020' => 1 - * - '\\\\u3020' => 1 - * - '\\\\uD835' => 2 - * - '\\\\uD835\\\\uDDEF' => 2 - * - '\\\\uDDEF' => 2 + * - '\\u0020' => 1 + * - '\\u3020' => 1 + * - '\\uD835' => 2 + * - '\\uD835\\uDDEF' => 2 + * - '\\uDDEF' => 2 * * @param {string} str Non-empty string * @param {number} pos Position in the string to look for one code unit @@ -69,5 +69,5 @@ function inSurrogateRange(codeUnit) { function utf16Length(str, pos) { return 1 + inSurrogateRange(str.charCodeAt(pos)); } -" + `; diff --git a/tests/flow/union-intersection/__snapshots__/jsfmt.spec.js.snap b/tests/flow/union-intersection/__snapshots__/jsfmt.spec.js.snap index e7fbe288..2bbc26ba 100644 --- a/tests/flow/union-intersection/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/union-intersection/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`gen_big_disjoint_union.js 1`] = ` -"// perf test for big disjoint union with 1000 cases +// perf test for big disjoint union with 1000 cases type TAction = { type: 'a1', @@ -4008,4013 +4008,4013 @@ function foo(x: TAction): TAction { return x; } // perf test for big disjoint union with 1000 cases type TAction = | { - type: \\"a1\\", + type: "a1", a1: number } | { - type: \\"a2\\", + type: "a2", a1: number } | { - type: \\"a3\\", + type: "a3", a1: number } | { - type: \\"a4\\", + type: "a4", a1: number } | { - type: \\"a5\\", + type: "a5", a1: number } | { - type: \\"a6\\", + type: "a6", a1: number } | { - type: \\"a7\\", + type: "a7", a1: number } | { - type: \\"a8\\", + type: "a8", a1: number } | { - type: \\"a9\\", + type: "a9", a1: number } | { - type: \\"a10\\", + type: "a10", a1: number } | { - type: \\"a11\\", + type: "a11", a2: number } | { - type: \\"a12\\", + type: "a12", a2: number } | { - type: \\"a13\\", + type: "a13", a2: number } | { - type: \\"a14\\", + type: "a14", a2: number } | { - type: \\"a15\\", + type: "a15", a2: number } | { - type: \\"a16\\", + type: "a16", a2: number } | { - type: \\"a17\\", + type: "a17", a2: number } | { - type: \\"a18\\", + type: "a18", a2: number } | { - type: \\"a19\\", + type: "a19", a2: number } | { - type: \\"a20\\", + type: "a20", a2: number } | { - type: \\"a21\\", + type: "a21", a3: number } | { - type: \\"a22\\", + type: "a22", a3: number } | { - type: \\"a23\\", + type: "a23", a3: number } | { - type: \\"a24\\", + type: "a24", a3: number } | { - type: \\"a25\\", + type: "a25", a3: number } | { - type: \\"a26\\", + type: "a26", a3: number } | { - type: \\"a27\\", + type: "a27", a3: number } | { - type: \\"a28\\", + type: "a28", a3: number } | { - type: \\"a29\\", + type: "a29", a3: number } | { - type: \\"a30\\", + type: "a30", a3: number } | { - type: \\"a31\\", + type: "a31", a4: number } | { - type: \\"a32\\", + type: "a32", a4: number } | { - type: \\"a33\\", + type: "a33", a4: number } | { - type: \\"a34\\", + type: "a34", a4: number } | { - type: \\"a35\\", + type: "a35", a4: number } | { - type: \\"a36\\", + type: "a36", a4: number } | { - type: \\"a37\\", + type: "a37", a4: number } | { - type: \\"a38\\", + type: "a38", a4: number } | { - type: \\"a39\\", + type: "a39", a4: number } | { - type: \\"a40\\", + type: "a40", a4: number } | { - type: \\"a41\\", + type: "a41", a5: number } | { - type: \\"a42\\", + type: "a42", a5: number } | { - type: \\"a43\\", + type: "a43", a5: number } | { - type: \\"a44\\", + type: "a44", a5: number } | { - type: \\"a45\\", + type: "a45", a5: number } | { - type: \\"a46\\", + type: "a46", a5: number } | { - type: \\"a47\\", + type: "a47", a5: number } | { - type: \\"a48\\", + type: "a48", a5: number } | { - type: \\"a49\\", + type: "a49", a5: number } | { - type: \\"a50\\", + type: "a50", a5: number } | { - type: \\"a51\\", + type: "a51", a6: number } | { - type: \\"a52\\", + type: "a52", a6: number } | { - type: \\"a53\\", + type: "a53", a6: number } | { - type: \\"a54\\", + type: "a54", a6: number } | { - type: \\"a55\\", + type: "a55", a6: number } | { - type: \\"a56\\", + type: "a56", a6: number } | { - type: \\"a57\\", + type: "a57", a6: number } | { - type: \\"a58\\", + type: "a58", a6: number } | { - type: \\"a59\\", + type: "a59", a6: number } | { - type: \\"a60\\", + type: "a60", a6: number } | { - type: \\"a61\\", + type: "a61", a7: number } | { - type: \\"a62\\", + type: "a62", a7: number } | { - type: \\"a63\\", + type: "a63", a7: number } | { - type: \\"a64\\", + type: "a64", a7: number } | { - type: \\"a65\\", + type: "a65", a7: number } | { - type: \\"a66\\", + type: "a66", a7: number } | { - type: \\"a67\\", + type: "a67", a7: number } | { - type: \\"a68\\", + type: "a68", a7: number } | { - type: \\"a69\\", + type: "a69", a7: number } | { - type: \\"a70\\", + type: "a70", a7: number } | { - type: \\"a71\\", + type: "a71", a8: number } | { - type: \\"a72\\", + type: "a72", a8: number } | { - type: \\"a73\\", + type: "a73", a8: number } | { - type: \\"a74\\", + type: "a74", a8: number } | { - type: \\"a75\\", + type: "a75", a8: number } | { - type: \\"a76\\", + type: "a76", a8: number } | { - type: \\"a77\\", + type: "a77", a8: number } | { - type: \\"a78\\", + type: "a78", a8: number } | { - type: \\"a79\\", + type: "a79", a8: number } | { - type: \\"a80\\", + type: "a80", a8: number } | { - type: \\"a81\\", + type: "a81", a9: number } | { - type: \\"a82\\", + type: "a82", a9: number } | { - type: \\"a83\\", + type: "a83", a9: number } | { - type: \\"a84\\", + type: "a84", a9: number } | { - type: \\"a85\\", + type: "a85", a9: number } | { - type: \\"a86\\", + type: "a86", a9: number } | { - type: \\"a87\\", + type: "a87", a9: number } | { - type: \\"a88\\", + type: "a88", a9: number } | { - type: \\"a89\\", + type: "a89", a9: number } | { - type: \\"a90\\", + type: "a90", a9: number } | { - type: \\"a91\\", + type: "a91", a10: number } | { - type: \\"a92\\", + type: "a92", a10: number } | { - type: \\"a93\\", + type: "a93", a10: number } | { - type: \\"a94\\", + type: "a94", a10: number } | { - type: \\"a95\\", + type: "a95", a10: number } | { - type: \\"a96\\", + type: "a96", a10: number } | { - type: \\"a97\\", + type: "a97", a10: number } | { - type: \\"a98\\", + type: "a98", a10: number } | { - type: \\"a99\\", + type: "a99", a10: number } | { - type: \\"a100\\", + type: "a100", a10: number } | { - type: \\"a101\\", + type: "a101", a11: number } | { - type: \\"a102\\", + type: "a102", a11: number } | { - type: \\"a103\\", + type: "a103", a11: number } | { - type: \\"a104\\", + type: "a104", a11: number } | { - type: \\"a105\\", + type: "a105", a11: number } | { - type: \\"a106\\", + type: "a106", a11: number } | { - type: \\"a107\\", + type: "a107", a11: number } | { - type: \\"a108\\", + type: "a108", a11: number } | { - type: \\"a109\\", + type: "a109", a11: number } | { - type: \\"a110\\", + type: "a110", a11: number } | { - type: \\"a111\\", + type: "a111", a12: number } | { - type: \\"a112\\", + type: "a112", a12: number } | { - type: \\"a113\\", + type: "a113", a12: number } | { - type: \\"a114\\", + type: "a114", a12: number } | { - type: \\"a115\\", + type: "a115", a12: number } | { - type: \\"a116\\", + type: "a116", a12: number } | { - type: \\"a117\\", + type: "a117", a12: number } | { - type: \\"a118\\", + type: "a118", a12: number } | { - type: \\"a119\\", + type: "a119", a12: number } | { - type: \\"a120\\", + type: "a120", a12: number } | { - type: \\"a121\\", + type: "a121", a13: number } | { - type: \\"a122\\", + type: "a122", a13: number } | { - type: \\"a123\\", + type: "a123", a13: number } | { - type: \\"a124\\", + type: "a124", a13: number } | { - type: \\"a125\\", + type: "a125", a13: number } | { - type: \\"a126\\", + type: "a126", a13: number } | { - type: \\"a127\\", + type: "a127", a13: number } | { - type: \\"a128\\", + type: "a128", a13: number } | { - type: \\"a129\\", + type: "a129", a13: number } | { - type: \\"a130\\", + type: "a130", a13: number } | { - type: \\"a131\\", + type: "a131", a14: number } | { - type: \\"a132\\", + type: "a132", a14: number } | { - type: \\"a133\\", + type: "a133", a14: number } | { - type: \\"a134\\", + type: "a134", a14: number } | { - type: \\"a135\\", + type: "a135", a14: number } | { - type: \\"a136\\", + type: "a136", a14: number } | { - type: \\"a137\\", + type: "a137", a14: number } | { - type: \\"a138\\", + type: "a138", a14: number } | { - type: \\"a139\\", + type: "a139", a14: number } | { - type: \\"a140\\", + type: "a140", a14: number } | { - type: \\"a141\\", + type: "a141", a15: number } | { - type: \\"a142\\", + type: "a142", a15: number } | { - type: \\"a143\\", + type: "a143", a15: number } | { - type: \\"a144\\", + type: "a144", a15: number } | { - type: \\"a145\\", + type: "a145", a15: number } | { - type: \\"a146\\", + type: "a146", a15: number } | { - type: \\"a147\\", + type: "a147", a15: number } | { - type: \\"a148\\", + type: "a148", a15: number } | { - type: \\"a149\\", + type: "a149", a15: number } | { - type: \\"a150\\", + type: "a150", a15: number } | { - type: \\"a151\\", + type: "a151", a16: number } | { - type: \\"a152\\", + type: "a152", a16: number } | { - type: \\"a153\\", + type: "a153", a16: number } | { - type: \\"a154\\", + type: "a154", a16: number } | { - type: \\"a155\\", + type: "a155", a16: number } | { - type: \\"a156\\", + type: "a156", a16: number } | { - type: \\"a157\\", + type: "a157", a16: number } | { - type: \\"a158\\", + type: "a158", a16: number } | { - type: \\"a159\\", + type: "a159", a16: number } | { - type: \\"a160\\", + type: "a160", a16: number } | { - type: \\"a161\\", + type: "a161", a17: number } | { - type: \\"a162\\", + type: "a162", a17: number } | { - type: \\"a163\\", + type: "a163", a17: number } | { - type: \\"a164\\", + type: "a164", a17: number } | { - type: \\"a165\\", + type: "a165", a17: number } | { - type: \\"a166\\", + type: "a166", a17: number } | { - type: \\"a167\\", + type: "a167", a17: number } | { - type: \\"a168\\", + type: "a168", a17: number } | { - type: \\"a169\\", + type: "a169", a17: number } | { - type: \\"a170\\", + type: "a170", a17: number } | { - type: \\"a171\\", + type: "a171", a18: number } | { - type: \\"a172\\", + type: "a172", a18: number } | { - type: \\"a173\\", + type: "a173", a18: number } | { - type: \\"a174\\", + type: "a174", a18: number } | { - type: \\"a175\\", + type: "a175", a18: number } | { - type: \\"a176\\", + type: "a176", a18: number } | { - type: \\"a177\\", + type: "a177", a18: number } | { - type: \\"a178\\", + type: "a178", a18: number } | { - type: \\"a179\\", + type: "a179", a18: number } | { - type: \\"a180\\", + type: "a180", a18: number } | { - type: \\"a181\\", + type: "a181", a19: number } | { - type: \\"a182\\", + type: "a182", a19: number } | { - type: \\"a183\\", + type: "a183", a19: number } | { - type: \\"a184\\", + type: "a184", a19: number } | { - type: \\"a185\\", + type: "a185", a19: number } | { - type: \\"a186\\", + type: "a186", a19: number } | { - type: \\"a187\\", + type: "a187", a19: number } | { - type: \\"a188\\", + type: "a188", a19: number } | { - type: \\"a189\\", + type: "a189", a19: number } | { - type: \\"a190\\", + type: "a190", a19: number } | { - type: \\"a191\\", + type: "a191", a20: number } | { - type: \\"a192\\", + type: "a192", a20: number } | { - type: \\"a193\\", + type: "a193", a20: number } | { - type: \\"a194\\", + type: "a194", a20: number } | { - type: \\"a195\\", + type: "a195", a20: number } | { - type: \\"a196\\", + type: "a196", a20: number } | { - type: \\"a197\\", + type: "a197", a20: number } | { - type: \\"a198\\", + type: "a198", a20: number } | { - type: \\"a199\\", + type: "a199", a20: number } | { - type: \\"a200\\", + type: "a200", a20: number } | { - type: \\"a201\\", + type: "a201", a21: number } | { - type: \\"a202\\", + type: "a202", a21: number } | { - type: \\"a203\\", + type: "a203", a21: number } | { - type: \\"a204\\", + type: "a204", a21: number } | { - type: \\"a205\\", + type: "a205", a21: number } | { - type: \\"a206\\", + type: "a206", a21: number } | { - type: \\"a207\\", + type: "a207", a21: number } | { - type: \\"a208\\", + type: "a208", a21: number } | { - type: \\"a209\\", + type: "a209", a21: number } | { - type: \\"a210\\", + type: "a210", a21: number } | { - type: \\"a211\\", + type: "a211", a22: number } | { - type: \\"a212\\", + type: "a212", a22: number } | { - type: \\"a213\\", + type: "a213", a22: number } | { - type: \\"a214\\", + type: "a214", a22: number } | { - type: \\"a215\\", + type: "a215", a22: number } | { - type: \\"a216\\", + type: "a216", a22: number } | { - type: \\"a217\\", + type: "a217", a22: number } | { - type: \\"a218\\", + type: "a218", a22: number } | { - type: \\"a219\\", + type: "a219", a22: number } | { - type: \\"a220\\", + type: "a220", a22: number } | { - type: \\"a221\\", + type: "a221", a23: number } | { - type: \\"a222\\", + type: "a222", a23: number } | { - type: \\"a223\\", + type: "a223", a23: number } | { - type: \\"a224\\", + type: "a224", a23: number } | { - type: \\"a225\\", + type: "a225", a23: number } | { - type: \\"a226\\", + type: "a226", a23: number } | { - type: \\"a227\\", + type: "a227", a23: number } | { - type: \\"a228\\", + type: "a228", a23: number } | { - type: \\"a229\\", + type: "a229", a23: number } | { - type: \\"a230\\", + type: "a230", a23: number } | { - type: \\"a231\\", + type: "a231", a24: number } | { - type: \\"a232\\", + type: "a232", a24: number } | { - type: \\"a233\\", + type: "a233", a24: number } | { - type: \\"a234\\", + type: "a234", a24: number } | { - type: \\"a235\\", + type: "a235", a24: number } | { - type: \\"a236\\", + type: "a236", a24: number } | { - type: \\"a237\\", + type: "a237", a24: number } | { - type: \\"a238\\", + type: "a238", a24: number } | { - type: \\"a239\\", + type: "a239", a24: number } | { - type: \\"a240\\", + type: "a240", a24: number } | { - type: \\"a241\\", + type: "a241", a25: number } | { - type: \\"a242\\", + type: "a242", a25: number } | { - type: \\"a243\\", + type: "a243", a25: number } | { - type: \\"a244\\", + type: "a244", a25: number } | { - type: \\"a245\\", + type: "a245", a25: number } | { - type: \\"a246\\", + type: "a246", a25: number } | { - type: \\"a247\\", + type: "a247", a25: number } | { - type: \\"a248\\", + type: "a248", a25: number } | { - type: \\"a249\\", + type: "a249", a25: number } | { - type: \\"a250\\", + type: "a250", a25: number } | { - type: \\"a251\\", + type: "a251", a26: number } | { - type: \\"a252\\", + type: "a252", a26: number } | { - type: \\"a253\\", + type: "a253", a26: number } | { - type: \\"a254\\", + type: "a254", a26: number } | { - type: \\"a255\\", + type: "a255", a26: number } | { - type: \\"a256\\", + type: "a256", a26: number } | { - type: \\"a257\\", + type: "a257", a26: number } | { - type: \\"a258\\", + type: "a258", a26: number } | { - type: \\"a259\\", + type: "a259", a26: number } | { - type: \\"a260\\", + type: "a260", a26: number } | { - type: \\"a261\\", + type: "a261", a27: number } | { - type: \\"a262\\", + type: "a262", a27: number } | { - type: \\"a263\\", + type: "a263", a27: number } | { - type: \\"a264\\", + type: "a264", a27: number } | { - type: \\"a265\\", + type: "a265", a27: number } | { - type: \\"a266\\", + type: "a266", a27: number } | { - type: \\"a267\\", + type: "a267", a27: number } | { - type: \\"a268\\", + type: "a268", a27: number } | { - type: \\"a269\\", + type: "a269", a27: number } | { - type: \\"a270\\", + type: "a270", a27: number } | { - type: \\"a271\\", + type: "a271", a28: number } | { - type: \\"a272\\", + type: "a272", a28: number } | { - type: \\"a273\\", + type: "a273", a28: number } | { - type: \\"a274\\", + type: "a274", a28: number } | { - type: \\"a275\\", + type: "a275", a28: number } | { - type: \\"a276\\", + type: "a276", a28: number } | { - type: \\"a277\\", + type: "a277", a28: number } | { - type: \\"a278\\", + type: "a278", a28: number } | { - type: \\"a279\\", + type: "a279", a28: number } | { - type: \\"a280\\", + type: "a280", a28: number } | { - type: \\"a281\\", + type: "a281", a29: number } | { - type: \\"a282\\", + type: "a282", a29: number } | { - type: \\"a283\\", + type: "a283", a29: number } | { - type: \\"a284\\", + type: "a284", a29: number } | { - type: \\"a285\\", + type: "a285", a29: number } | { - type: \\"a286\\", + type: "a286", a29: number } | { - type: \\"a287\\", + type: "a287", a29: number } | { - type: \\"a288\\", + type: "a288", a29: number } | { - type: \\"a289\\", + type: "a289", a29: number } | { - type: \\"a290\\", + type: "a290", a29: number } | { - type: \\"a291\\", + type: "a291", a30: number } | { - type: \\"a292\\", + type: "a292", a30: number } | { - type: \\"a293\\", + type: "a293", a30: number } | { - type: \\"a294\\", + type: "a294", a30: number } | { - type: \\"a295\\", + type: "a295", a30: number } | { - type: \\"a296\\", + type: "a296", a30: number } | { - type: \\"a297\\", + type: "a297", a30: number } | { - type: \\"a298\\", + type: "a298", a30: number } | { - type: \\"a299\\", + type: "a299", a30: number } | { - type: \\"a300\\", + type: "a300", a30: number } | { - type: \\"a301\\", + type: "a301", a31: number } | { - type: \\"a302\\", + type: "a302", a31: number } | { - type: \\"a303\\", + type: "a303", a31: number } | { - type: \\"a304\\", + type: "a304", a31: number } | { - type: \\"a305\\", + type: "a305", a31: number } | { - type: \\"a306\\", + type: "a306", a31: number } | { - type: \\"a307\\", + type: "a307", a31: number } | { - type: \\"a308\\", + type: "a308", a31: number } | { - type: \\"a309\\", + type: "a309", a31: number } | { - type: \\"a310\\", + type: "a310", a31: number } | { - type: \\"a311\\", + type: "a311", a32: number } | { - type: \\"a312\\", + type: "a312", a32: number } | { - type: \\"a313\\", + type: "a313", a32: number } | { - type: \\"a314\\", + type: "a314", a32: number } | { - type: \\"a315\\", + type: "a315", a32: number } | { - type: \\"a316\\", + type: "a316", a32: number } | { - type: \\"a317\\", + type: "a317", a32: number } | { - type: \\"a318\\", + type: "a318", a32: number } | { - type: \\"a319\\", + type: "a319", a32: number } | { - type: \\"a320\\", + type: "a320", a32: number } | { - type: \\"a321\\", + type: "a321", a33: number } | { - type: \\"a322\\", + type: "a322", a33: number } | { - type: \\"a323\\", + type: "a323", a33: number } | { - type: \\"a324\\", + type: "a324", a33: number } | { - type: \\"a325\\", + type: "a325", a33: number } | { - type: \\"a326\\", + type: "a326", a33: number } | { - type: \\"a327\\", + type: "a327", a33: number } | { - type: \\"a328\\", + type: "a328", a33: number } | { - type: \\"a329\\", + type: "a329", a33: number } | { - type: \\"a330\\", + type: "a330", a33: number } | { - type: \\"a331\\", + type: "a331", a34: number } | { - type: \\"a332\\", + type: "a332", a34: number } | { - type: \\"a333\\", + type: "a333", a34: number } | { - type: \\"a334\\", + type: "a334", a34: number } | { - type: \\"a335\\", + type: "a335", a34: number } | { - type: \\"a336\\", + type: "a336", a34: number } | { - type: \\"a337\\", + type: "a337", a34: number } | { - type: \\"a338\\", + type: "a338", a34: number } | { - type: \\"a339\\", + type: "a339", a34: number } | { - type: \\"a340\\", + type: "a340", a34: number } | { - type: \\"a341\\", + type: "a341", a35: number } | { - type: \\"a342\\", + type: "a342", a35: number } | { - type: \\"a343\\", + type: "a343", a35: number } | { - type: \\"a344\\", + type: "a344", a35: number } | { - type: \\"a345\\", + type: "a345", a35: number } | { - type: \\"a346\\", + type: "a346", a35: number } | { - type: \\"a347\\", + type: "a347", a35: number } | { - type: \\"a348\\", + type: "a348", a35: number } | { - type: \\"a349\\", + type: "a349", a35: number } | { - type: \\"a350\\", + type: "a350", a35: number } | { - type: \\"a351\\", + type: "a351", a36: number } | { - type: \\"a352\\", + type: "a352", a36: number } | { - type: \\"a353\\", + type: "a353", a36: number } | { - type: \\"a354\\", + type: "a354", a36: number } | { - type: \\"a355\\", + type: "a355", a36: number } | { - type: \\"a356\\", + type: "a356", a36: number } | { - type: \\"a357\\", + type: "a357", a36: number } | { - type: \\"a358\\", + type: "a358", a36: number } | { - type: \\"a359\\", + type: "a359", a36: number } | { - type: \\"a360\\", + type: "a360", a36: number } | { - type: \\"a361\\", + type: "a361", a37: number } | { - type: \\"a362\\", + type: "a362", a37: number } | { - type: \\"a363\\", + type: "a363", a37: number } | { - type: \\"a364\\", + type: "a364", a37: number } | { - type: \\"a365\\", + type: "a365", a37: number } | { - type: \\"a366\\", + type: "a366", a37: number } | { - type: \\"a367\\", + type: "a367", a37: number } | { - type: \\"a368\\", + type: "a368", a37: number } | { - type: \\"a369\\", + type: "a369", a37: number } | { - type: \\"a370\\", + type: "a370", a37: number } | { - type: \\"a371\\", + type: "a371", a38: number } | { - type: \\"a372\\", + type: "a372", a38: number } | { - type: \\"a373\\", + type: "a373", a38: number } | { - type: \\"a374\\", + type: "a374", a38: number } | { - type: \\"a375\\", + type: "a375", a38: number } | { - type: \\"a376\\", + type: "a376", a38: number } | { - type: \\"a377\\", + type: "a377", a38: number } | { - type: \\"a378\\", + type: "a378", a38: number } | { - type: \\"a379\\", + type: "a379", a38: number } | { - type: \\"a380\\", + type: "a380", a38: number } | { - type: \\"a381\\", + type: "a381", a39: number } | { - type: \\"a382\\", + type: "a382", a39: number } | { - type: \\"a383\\", + type: "a383", a39: number } | { - type: \\"a384\\", + type: "a384", a39: number } | { - type: \\"a385\\", + type: "a385", a39: number } | { - type: \\"a386\\", + type: "a386", a39: number } | { - type: \\"a387\\", + type: "a387", a39: number } | { - type: \\"a388\\", + type: "a388", a39: number } | { - type: \\"a389\\", + type: "a389", a39: number } | { - type: \\"a390\\", + type: "a390", a39: number } | { - type: \\"a391\\", + type: "a391", a40: number } | { - type: \\"a392\\", + type: "a392", a40: number } | { - type: \\"a393\\", + type: "a393", a40: number } | { - type: \\"a394\\", + type: "a394", a40: number } | { - type: \\"a395\\", + type: "a395", a40: number } | { - type: \\"a396\\", + type: "a396", a40: number } | { - type: \\"a397\\", + type: "a397", a40: number } | { - type: \\"a398\\", + type: "a398", a40: number } | { - type: \\"a399\\", + type: "a399", a40: number } | { - type: \\"a400\\", + type: "a400", a40: number } | { - type: \\"a401\\", + type: "a401", a41: number } | { - type: \\"a402\\", + type: "a402", a41: number } | { - type: \\"a403\\", + type: "a403", a41: number } | { - type: \\"a404\\", + type: "a404", a41: number } | { - type: \\"a405\\", + type: "a405", a41: number } | { - type: \\"a406\\", + type: "a406", a41: number } | { - type: \\"a407\\", + type: "a407", a41: number } | { - type: \\"a408\\", + type: "a408", a41: number } | { - type: \\"a409\\", + type: "a409", a41: number } | { - type: \\"a410\\", + type: "a410", a41: number } | { - type: \\"a411\\", + type: "a411", a42: number } | { - type: \\"a412\\", + type: "a412", a42: number } | { - type: \\"a413\\", + type: "a413", a42: number } | { - type: \\"a414\\", + type: "a414", a42: number } | { - type: \\"a415\\", + type: "a415", a42: number } | { - type: \\"a416\\", + type: "a416", a42: number } | { - type: \\"a417\\", + type: "a417", a42: number } | { - type: \\"a418\\", + type: "a418", a42: number } | { - type: \\"a419\\", + type: "a419", a42: number } | { - type: \\"a420\\", + type: "a420", a42: number } | { - type: \\"a421\\", + type: "a421", a43: number } | { - type: \\"a422\\", + type: "a422", a43: number } | { - type: \\"a423\\", + type: "a423", a43: number } | { - type: \\"a424\\", + type: "a424", a43: number } | { - type: \\"a425\\", + type: "a425", a43: number } | { - type: \\"a426\\", + type: "a426", a43: number } | { - type: \\"a427\\", + type: "a427", a43: number } | { - type: \\"a428\\", + type: "a428", a43: number } | { - type: \\"a429\\", + type: "a429", a43: number } | { - type: \\"a430\\", + type: "a430", a43: number } | { - type: \\"a431\\", + type: "a431", a44: number } | { - type: \\"a432\\", + type: "a432", a44: number } | { - type: \\"a433\\", + type: "a433", a44: number } | { - type: \\"a434\\", + type: "a434", a44: number } | { - type: \\"a435\\", + type: "a435", a44: number } | { - type: \\"a436\\", + type: "a436", a44: number } | { - type: \\"a437\\", + type: "a437", a44: number } | { - type: \\"a438\\", + type: "a438", a44: number } | { - type: \\"a439\\", + type: "a439", a44: number } | { - type: \\"a440\\", + type: "a440", a44: number } | { - type: \\"a441\\", + type: "a441", a45: number } | { - type: \\"a442\\", + type: "a442", a45: number } | { - type: \\"a443\\", + type: "a443", a45: number } | { - type: \\"a444\\", + type: "a444", a45: number } | { - type: \\"a445\\", + type: "a445", a45: number } | { - type: \\"a446\\", + type: "a446", a45: number } | { - type: \\"a447\\", + type: "a447", a45: number } | { - type: \\"a448\\", + type: "a448", a45: number } | { - type: \\"a449\\", + type: "a449", a45: number } | { - type: \\"a450\\", + type: "a450", a45: number } | { - type: \\"a451\\", + type: "a451", a46: number } | { - type: \\"a452\\", + type: "a452", a46: number } | { - type: \\"a453\\", + type: "a453", a46: number } | { - type: \\"a454\\", + type: "a454", a46: number } | { - type: \\"a455\\", + type: "a455", a46: number } | { - type: \\"a456\\", + type: "a456", a46: number } | { - type: \\"a457\\", + type: "a457", a46: number } | { - type: \\"a458\\", + type: "a458", a46: number } | { - type: \\"a459\\", + type: "a459", a46: number } | { - type: \\"a460\\", + type: "a460", a46: number } | { - type: \\"a461\\", + type: "a461", a47: number } | { - type: \\"a462\\", + type: "a462", a47: number } | { - type: \\"a463\\", + type: "a463", a47: number } | { - type: \\"a464\\", + type: "a464", a47: number } | { - type: \\"a465\\", + type: "a465", a47: number } | { - type: \\"a466\\", + type: "a466", a47: number } | { - type: \\"a467\\", + type: "a467", a47: number } | { - type: \\"a468\\", + type: "a468", a47: number } | { - type: \\"a469\\", + type: "a469", a47: number } | { - type: \\"a470\\", + type: "a470", a47: number } | { - type: \\"a471\\", + type: "a471", a48: number } | { - type: \\"a472\\", + type: "a472", a48: number } | { - type: \\"a473\\", + type: "a473", a48: number } | { - type: \\"a474\\", + type: "a474", a48: number } | { - type: \\"a475\\", + type: "a475", a48: number } | { - type: \\"a476\\", + type: "a476", a48: number } | { - type: \\"a477\\", + type: "a477", a48: number } | { - type: \\"a478\\", + type: "a478", a48: number } | { - type: \\"a479\\", + type: "a479", a48: number } | { - type: \\"a480\\", + type: "a480", a48: number } | { - type: \\"a481\\", + type: "a481", a49: number } | { - type: \\"a482\\", + type: "a482", a49: number } | { - type: \\"a483\\", + type: "a483", a49: number } | { - type: \\"a484\\", + type: "a484", a49: number } | { - type: \\"a485\\", + type: "a485", a49: number } | { - type: \\"a486\\", + type: "a486", a49: number } | { - type: \\"a487\\", + type: "a487", a49: number } | { - type: \\"a488\\", + type: "a488", a49: number } | { - type: \\"a489\\", + type: "a489", a49: number } | { - type: \\"a490\\", + type: "a490", a49: number } | { - type: \\"a491\\", + type: "a491", a50: number } | { - type: \\"a492\\", + type: "a492", a50: number } | { - type: \\"a493\\", + type: "a493", a50: number } | { - type: \\"a494\\", + type: "a494", a50: number } | { - type: \\"a495\\", + type: "a495", a50: number } | { - type: \\"a496\\", + type: "a496", a50: number } | { - type: \\"a497\\", + type: "a497", a50: number } | { - type: \\"a498\\", + type: "a498", a50: number } | { - type: \\"a499\\", + type: "a499", a50: number } | { - type: \\"a500\\", + type: "a500", a50: number } | { - type: \\"a501\\", + type: "a501", a51: number } | { - type: \\"a502\\", + type: "a502", a51: number } | { - type: \\"a503\\", + type: "a503", a51: number } | { - type: \\"a504\\", + type: "a504", a51: number } | { - type: \\"a505\\", + type: "a505", a51: number } | { - type: \\"a506\\", + type: "a506", a51: number } | { - type: \\"a507\\", + type: "a507", a51: number } | { - type: \\"a508\\", + type: "a508", a51: number } | { - type: \\"a509\\", + type: "a509", a51: number } | { - type: \\"a510\\", + type: "a510", a51: number } | { - type: \\"a511\\", + type: "a511", a52: number } | { - type: \\"a512\\", + type: "a512", a52: number } | { - type: \\"a513\\", + type: "a513", a52: number } | { - type: \\"a514\\", + type: "a514", a52: number } | { - type: \\"a515\\", + type: "a515", a52: number } | { - type: \\"a516\\", + type: "a516", a52: number } | { - type: \\"a517\\", + type: "a517", a52: number } | { - type: \\"a518\\", + type: "a518", a52: number } | { - type: \\"a519\\", + type: "a519", a52: number } | { - type: \\"a520\\", + type: "a520", a52: number } | { - type: \\"a521\\", + type: "a521", a53: number } | { - type: \\"a522\\", + type: "a522", a53: number } | { - type: \\"a523\\", + type: "a523", a53: number } | { - type: \\"a524\\", + type: "a524", a53: number } | { - type: \\"a525\\", + type: "a525", a53: number } | { - type: \\"a526\\", + type: "a526", a53: number } | { - type: \\"a527\\", + type: "a527", a53: number } | { - type: \\"a528\\", + type: "a528", a53: number } | { - type: \\"a529\\", + type: "a529", a53: number } | { - type: \\"a530\\", + type: "a530", a53: number } | { - type: \\"a531\\", + type: "a531", a54: number } | { - type: \\"a532\\", + type: "a532", a54: number } | { - type: \\"a533\\", + type: "a533", a54: number } | { - type: \\"a534\\", + type: "a534", a54: number } | { - type: \\"a535\\", + type: "a535", a54: number } | { - type: \\"a536\\", + type: "a536", a54: number } | { - type: \\"a537\\", + type: "a537", a54: number } | { - type: \\"a538\\", + type: "a538", a54: number } | { - type: \\"a539\\", + type: "a539", a54: number } | { - type: \\"a540\\", + type: "a540", a54: number } | { - type: \\"a541\\", + type: "a541", a55: number } | { - type: \\"a542\\", + type: "a542", a55: number } | { - type: \\"a543\\", + type: "a543", a55: number } | { - type: \\"a544\\", + type: "a544", a55: number } | { - type: \\"a545\\", + type: "a545", a55: number } | { - type: \\"a546\\", + type: "a546", a55: number } | { - type: \\"a547\\", + type: "a547", a55: number } | { - type: \\"a548\\", + type: "a548", a55: number } | { - type: \\"a549\\", + type: "a549", a55: number } | { - type: \\"a550\\", + type: "a550", a55: number } | { - type: \\"a551\\", + type: "a551", a56: number } | { - type: \\"a552\\", + type: "a552", a56: number } | { - type: \\"a553\\", + type: "a553", a56: number } | { - type: \\"a554\\", + type: "a554", a56: number } | { - type: \\"a555\\", + type: "a555", a56: number } | { - type: \\"a556\\", + type: "a556", a56: number } | { - type: \\"a557\\", + type: "a557", a56: number } | { - type: \\"a558\\", + type: "a558", a56: number } | { - type: \\"a559\\", + type: "a559", a56: number } | { - type: \\"a560\\", + type: "a560", a56: number } | { - type: \\"a561\\", + type: "a561", a57: number } | { - type: \\"a562\\", + type: "a562", a57: number } | { - type: \\"a563\\", + type: "a563", a57: number } | { - type: \\"a564\\", + type: "a564", a57: number } | { - type: \\"a565\\", + type: "a565", a57: number } | { - type: \\"a566\\", + type: "a566", a57: number } | { - type: \\"a567\\", + type: "a567", a57: number } | { - type: \\"a568\\", + type: "a568", a57: number } | { - type: \\"a569\\", + type: "a569", a57: number } | { - type: \\"a570\\", + type: "a570", a57: number } | { - type: \\"a571\\", + type: "a571", a58: number } | { - type: \\"a572\\", + type: "a572", a58: number } | { - type: \\"a573\\", + type: "a573", a58: number } | { - type: \\"a574\\", + type: "a574", a58: number } | { - type: \\"a575\\", + type: "a575", a58: number } | { - type: \\"a576\\", + type: "a576", a58: number } | { - type: \\"a577\\", + type: "a577", a58: number } | { - type: \\"a578\\", + type: "a578", a58: number } | { - type: \\"a579\\", + type: "a579", a58: number } | { - type: \\"a580\\", + type: "a580", a58: number } | { - type: \\"a581\\", + type: "a581", a59: number } | { - type: \\"a582\\", + type: "a582", a59: number } | { - type: \\"a583\\", + type: "a583", a59: number } | { - type: \\"a584\\", + type: "a584", a59: number } | { - type: \\"a585\\", + type: "a585", a59: number } | { - type: \\"a586\\", + type: "a586", a59: number } | { - type: \\"a587\\", + type: "a587", a59: number } | { - type: \\"a588\\", + type: "a588", a59: number } | { - type: \\"a589\\", + type: "a589", a59: number } | { - type: \\"a590\\", + type: "a590", a59: number } | { - type: \\"a591\\", + type: "a591", a60: number } | { - type: \\"a592\\", + type: "a592", a60: number } | { - type: \\"a593\\", + type: "a593", a60: number } | { - type: \\"a594\\", + type: "a594", a60: number } | { - type: \\"a595\\", + type: "a595", a60: number } | { - type: \\"a596\\", + type: "a596", a60: number } | { - type: \\"a597\\", + type: "a597", a60: number } | { - type: \\"a598\\", + type: "a598", a60: number } | { - type: \\"a599\\", + type: "a599", a60: number } | { - type: \\"a600\\", + type: "a600", a60: number } | { - type: \\"a601\\", + type: "a601", a61: number } | { - type: \\"a602\\", + type: "a602", a61: number } | { - type: \\"a603\\", + type: "a603", a61: number } | { - type: \\"a604\\", + type: "a604", a61: number } | { - type: \\"a605\\", + type: "a605", a61: number } | { - type: \\"a606\\", + type: "a606", a61: number } | { - type: \\"a607\\", + type: "a607", a61: number } | { - type: \\"a608\\", + type: "a608", a61: number } | { - type: \\"a609\\", + type: "a609", a61: number } | { - type: \\"a610\\", + type: "a610", a61: number } | { - type: \\"a611\\", + type: "a611", a62: number } | { - type: \\"a612\\", + type: "a612", a62: number } | { - type: \\"a613\\", + type: "a613", a62: number } | { - type: \\"a614\\", + type: "a614", a62: number } | { - type: \\"a615\\", + type: "a615", a62: number } | { - type: \\"a616\\", + type: "a616", a62: number } | { - type: \\"a617\\", + type: "a617", a62: number } | { - type: \\"a618\\", + type: "a618", a62: number } | { - type: \\"a619\\", + type: "a619", a62: number } | { - type: \\"a620\\", + type: "a620", a62: number } | { - type: \\"a621\\", + type: "a621", a63: number } | { - type: \\"a622\\", + type: "a622", a63: number } | { - type: \\"a623\\", + type: "a623", a63: number } | { - type: \\"a624\\", + type: "a624", a63: number } | { - type: \\"a625\\", + type: "a625", a63: number } | { - type: \\"a626\\", + type: "a626", a63: number } | { - type: \\"a627\\", + type: "a627", a63: number } | { - type: \\"a628\\", + type: "a628", a63: number } | { - type: \\"a629\\", + type: "a629", a63: number } | { - type: \\"a630\\", + type: "a630", a63: number } | { - type: \\"a631\\", + type: "a631", a64: number } | { - type: \\"a632\\", + type: "a632", a64: number } | { - type: \\"a633\\", + type: "a633", a64: number } | { - type: \\"a634\\", + type: "a634", a64: number } | { - type: \\"a635\\", + type: "a635", a64: number } | { - type: \\"a636\\", + type: "a636", a64: number } | { - type: \\"a637\\", + type: "a637", a64: number } | { - type: \\"a638\\", + type: "a638", a64: number } | { - type: \\"a639\\", + type: "a639", a64: number } | { - type: \\"a640\\", + type: "a640", a64: number } | { - type: \\"a641\\", + type: "a641", a65: number } | { - type: \\"a642\\", + type: "a642", a65: number } | { - type: \\"a643\\", + type: "a643", a65: number } | { - type: \\"a644\\", + type: "a644", a65: number } | { - type: \\"a645\\", + type: "a645", a65: number } | { - type: \\"a646\\", + type: "a646", a65: number } | { - type: \\"a647\\", + type: "a647", a65: number } | { - type: \\"a648\\", + type: "a648", a65: number } | { - type: \\"a649\\", + type: "a649", a65: number } | { - type: \\"a650\\", + type: "a650", a65: number } | { - type: \\"a651\\", + type: "a651", a66: number } | { - type: \\"a652\\", + type: "a652", a66: number } | { - type: \\"a653\\", + type: "a653", a66: number } | { - type: \\"a654\\", + type: "a654", a66: number } | { - type: \\"a655\\", + type: "a655", a66: number } | { - type: \\"a656\\", + type: "a656", a66: number } | { - type: \\"a657\\", + type: "a657", a66: number } | { - type: \\"a658\\", + type: "a658", a66: number } | { - type: \\"a659\\", + type: "a659", a66: number } | { - type: \\"a660\\", + type: "a660", a66: number } | { - type: \\"a661\\", + type: "a661", a67: number } | { - type: \\"a662\\", + type: "a662", a67: number } | { - type: \\"a663\\", + type: "a663", a67: number } | { - type: \\"a664\\", + type: "a664", a67: number } | { - type: \\"a665\\", + type: "a665", a67: number } | { - type: \\"a666\\", + type: "a666", a67: number } | { - type: \\"a667\\", + type: "a667", a67: number } | { - type: \\"a668\\", + type: "a668", a67: number } | { - type: \\"a669\\", + type: "a669", a67: number } | { - type: \\"a670\\", + type: "a670", a67: number } | { - type: \\"a671\\", + type: "a671", a68: number } | { - type: \\"a672\\", + type: "a672", a68: number } | { - type: \\"a673\\", + type: "a673", a68: number } | { - type: \\"a674\\", + type: "a674", a68: number } | { - type: \\"a675\\", + type: "a675", a68: number } | { - type: \\"a676\\", + type: "a676", a68: number } | { - type: \\"a677\\", + type: "a677", a68: number } | { - type: \\"a678\\", + type: "a678", a68: number } | { - type: \\"a679\\", + type: "a679", a68: number } | { - type: \\"a680\\", + type: "a680", a68: number } | { - type: \\"a681\\", + type: "a681", a69: number } | { - type: \\"a682\\", + type: "a682", a69: number } | { - type: \\"a683\\", + type: "a683", a69: number } | { - type: \\"a684\\", + type: "a684", a69: number } | { - type: \\"a685\\", + type: "a685", a69: number } | { - type: \\"a686\\", + type: "a686", a69: number } | { - type: \\"a687\\", + type: "a687", a69: number } | { - type: \\"a688\\", + type: "a688", a69: number } | { - type: \\"a689\\", + type: "a689", a69: number } | { - type: \\"a690\\", + type: "a690", a69: number } | { - type: \\"a691\\", + type: "a691", a70: number } | { - type: \\"a692\\", + type: "a692", a70: number } | { - type: \\"a693\\", + type: "a693", a70: number } | { - type: \\"a694\\", + type: "a694", a70: number } | { - type: \\"a695\\", + type: "a695", a70: number } | { - type: \\"a696\\", + type: "a696", a70: number } | { - type: \\"a697\\", + type: "a697", a70: number } | { - type: \\"a698\\", + type: "a698", a70: number } | { - type: \\"a699\\", + type: "a699", a70: number } | { - type: \\"a700\\", + type: "a700", a70: number } | { - type: \\"a701\\", + type: "a701", a71: number } | { - type: \\"a702\\", + type: "a702", a71: number } | { - type: \\"a703\\", + type: "a703", a71: number } | { - type: \\"a704\\", + type: "a704", a71: number } | { - type: \\"a705\\", + type: "a705", a71: number } | { - type: \\"a706\\", + type: "a706", a71: number } | { - type: \\"a707\\", + type: "a707", a71: number } | { - type: \\"a708\\", + type: "a708", a71: number } | { - type: \\"a709\\", + type: "a709", a71: number } | { - type: \\"a710\\", + type: "a710", a71: number } | { - type: \\"a711\\", + type: "a711", a72: number } | { - type: \\"a712\\", + type: "a712", a72: number } | { - type: \\"a713\\", + type: "a713", a72: number } | { - type: \\"a714\\", + type: "a714", a72: number } | { - type: \\"a715\\", + type: "a715", a72: number } | { - type: \\"a716\\", + type: "a716", a72: number } | { - type: \\"a717\\", + type: "a717", a72: number } | { - type: \\"a718\\", + type: "a718", a72: number } | { - type: \\"a719\\", + type: "a719", a72: number } | { - type: \\"a720\\", + type: "a720", a72: number } | { - type: \\"a721\\", + type: "a721", a73: number } | { - type: \\"a722\\", + type: "a722", a73: number } | { - type: \\"a723\\", + type: "a723", a73: number } | { - type: \\"a724\\", + type: "a724", a73: number } | { - type: \\"a725\\", + type: "a725", a73: number } | { - type: \\"a726\\", + type: "a726", a73: number } | { - type: \\"a727\\", + type: "a727", a73: number } | { - type: \\"a728\\", + type: "a728", a73: number } | { - type: \\"a729\\", + type: "a729", a73: number } | { - type: \\"a730\\", + type: "a730", a73: number } | { - type: \\"a731\\", + type: "a731", a74: number } | { - type: \\"a732\\", + type: "a732", a74: number } | { - type: \\"a733\\", + type: "a733", a74: number } | { - type: \\"a734\\", + type: "a734", a74: number } | { - type: \\"a735\\", + type: "a735", a74: number } | { - type: \\"a736\\", + type: "a736", a74: number } | { - type: \\"a737\\", + type: "a737", a74: number } | { - type: \\"a738\\", + type: "a738", a74: number } | { - type: \\"a739\\", + type: "a739", a74: number } | { - type: \\"a740\\", + type: "a740", a74: number } | { - type: \\"a741\\", + type: "a741", a75: number } | { - type: \\"a742\\", + type: "a742", a75: number } | { - type: \\"a743\\", + type: "a743", a75: number } | { - type: \\"a744\\", + type: "a744", a75: number } | { - type: \\"a745\\", + type: "a745", a75: number } | { - type: \\"a746\\", + type: "a746", a75: number } | { - type: \\"a747\\", + type: "a747", a75: number } | { - type: \\"a748\\", + type: "a748", a75: number } | { - type: \\"a749\\", + type: "a749", a75: number } | { - type: \\"a750\\", + type: "a750", a75: number } | { - type: \\"a751\\", + type: "a751", a76: number } | { - type: \\"a752\\", + type: "a752", a76: number } | { - type: \\"a753\\", + type: "a753", a76: number } | { - type: \\"a754\\", + type: "a754", a76: number } | { - type: \\"a755\\", + type: "a755", a76: number } | { - type: \\"a756\\", + type: "a756", a76: number } | { - type: \\"a757\\", + type: "a757", a76: number } | { - type: \\"a758\\", + type: "a758", a76: number } | { - type: \\"a759\\", + type: "a759", a76: number } | { - type: \\"a760\\", + type: "a760", a76: number } | { - type: \\"a761\\", + type: "a761", a77: number } | { - type: \\"a762\\", + type: "a762", a77: number } | { - type: \\"a763\\", + type: "a763", a77: number } | { - type: \\"a764\\", + type: "a764", a77: number } | { - type: \\"a765\\", + type: "a765", a77: number } | { - type: \\"a766\\", + type: "a766", a77: number } | { - type: \\"a767\\", + type: "a767", a77: number } | { - type: \\"a768\\", + type: "a768", a77: number } | { - type: \\"a769\\", + type: "a769", a77: number } | { - type: \\"a770\\", + type: "a770", a77: number } | { - type: \\"a771\\", + type: "a771", a78: number } | { - type: \\"a772\\", + type: "a772", a78: number } | { - type: \\"a773\\", + type: "a773", a78: number } | { - type: \\"a774\\", + type: "a774", a78: number } | { - type: \\"a775\\", + type: "a775", a78: number } | { - type: \\"a776\\", + type: "a776", a78: number } | { - type: \\"a777\\", + type: "a777", a78: number } | { - type: \\"a778\\", + type: "a778", a78: number } | { - type: \\"a779\\", + type: "a779", a78: number } | { - type: \\"a780\\", + type: "a780", a78: number } | { - type: \\"a781\\", + type: "a781", a79: number } | { - type: \\"a782\\", + type: "a782", a79: number } | { - type: \\"a783\\", + type: "a783", a79: number } | { - type: \\"a784\\", + type: "a784", a79: number } | { - type: \\"a785\\", + type: "a785", a79: number } | { - type: \\"a786\\", + type: "a786", a79: number } | { - type: \\"a787\\", + type: "a787", a79: number } | { - type: \\"a788\\", + type: "a788", a79: number } | { - type: \\"a789\\", + type: "a789", a79: number } | { - type: \\"a790\\", + type: "a790", a79: number } | { - type: \\"a791\\", + type: "a791", a80: number } | { - type: \\"a792\\", + type: "a792", a80: number } | { - type: \\"a793\\", + type: "a793", a80: number } | { - type: \\"a794\\", + type: "a794", a80: number } | { - type: \\"a795\\", + type: "a795", a80: number } | { - type: \\"a796\\", + type: "a796", a80: number } | { - type: \\"a797\\", + type: "a797", a80: number } | { - type: \\"a798\\", + type: "a798", a80: number } | { - type: \\"a799\\", + type: "a799", a80: number } | { - type: \\"a800\\", + type: "a800", a80: number } | { - type: \\"a801\\", + type: "a801", a81: number } | { - type: \\"a802\\", + type: "a802", a81: number } | { - type: \\"a803\\", + type: "a803", a81: number } | { - type: \\"a804\\", + type: "a804", a81: number } | { - type: \\"a805\\", + type: "a805", a81: number } | { - type: \\"a806\\", + type: "a806", a81: number } | { - type: \\"a807\\", + type: "a807", a81: number } | { - type: \\"a808\\", + type: "a808", a81: number } | { - type: \\"a809\\", + type: "a809", a81: number } | { - type: \\"a810\\", + type: "a810", a81: number } | { - type: \\"a811\\", + type: "a811", a82: number } | { - type: \\"a812\\", + type: "a812", a82: number } | { - type: \\"a813\\", + type: "a813", a82: number } | { - type: \\"a814\\", + type: "a814", a82: number } | { - type: \\"a815\\", + type: "a815", a82: number } | { - type: \\"a816\\", + type: "a816", a82: number } | { - type: \\"a817\\", + type: "a817", a82: number } | { - type: \\"a818\\", + type: "a818", a82: number } | { - type: \\"a819\\", + type: "a819", a82: number } | { - type: \\"a820\\", + type: "a820", a82: number } | { - type: \\"a821\\", + type: "a821", a83: number } | { - type: \\"a822\\", + type: "a822", a83: number } | { - type: \\"a823\\", + type: "a823", a83: number } | { - type: \\"a824\\", + type: "a824", a83: number } | { - type: \\"a825\\", + type: "a825", a83: number } | { - type: \\"a826\\", + type: "a826", a83: number } | { - type: \\"a827\\", + type: "a827", a83: number } | { - type: \\"a828\\", + type: "a828", a83: number } | { - type: \\"a829\\", + type: "a829", a83: number } | { - type: \\"a830\\", + type: "a830", a83: number } | { - type: \\"a831\\", + type: "a831", a84: number } | { - type: \\"a832\\", + type: "a832", a84: number } | { - type: \\"a833\\", + type: "a833", a84: number } | { - type: \\"a834\\", + type: "a834", a84: number } | { - type: \\"a835\\", + type: "a835", a84: number } | { - type: \\"a836\\", + type: "a836", a84: number } | { - type: \\"a837\\", + type: "a837", a84: number } | { - type: \\"a838\\", + type: "a838", a84: number } | { - type: \\"a839\\", + type: "a839", a84: number } | { - type: \\"a840\\", + type: "a840", a84: number } | { - type: \\"a841\\", + type: "a841", a85: number } | { - type: \\"a842\\", + type: "a842", a85: number } | { - type: \\"a843\\", + type: "a843", a85: number } | { - type: \\"a844\\", + type: "a844", a85: number } | { - type: \\"a845\\", + type: "a845", a85: number } | { - type: \\"a846\\", + type: "a846", a85: number } | { - type: \\"a847\\", + type: "a847", a85: number } | { - type: \\"a848\\", + type: "a848", a85: number } | { - type: \\"a849\\", + type: "a849", a85: number } | { - type: \\"a850\\", + type: "a850", a85: number } | { - type: \\"a851\\", + type: "a851", a86: number } | { - type: \\"a852\\", + type: "a852", a86: number } | { - type: \\"a853\\", + type: "a853", a86: number } | { - type: \\"a854\\", + type: "a854", a86: number } | { - type: \\"a855\\", + type: "a855", a86: number } | { - type: \\"a856\\", + type: "a856", a86: number } | { - type: \\"a857\\", + type: "a857", a86: number } | { - type: \\"a858\\", + type: "a858", a86: number } | { - type: \\"a859\\", + type: "a859", a86: number } | { - type: \\"a860\\", + type: "a860", a86: number } | { - type: \\"a861\\", + type: "a861", a87: number } | { - type: \\"a862\\", + type: "a862", a87: number } | { - type: \\"a863\\", + type: "a863", a87: number } | { - type: \\"a864\\", + type: "a864", a87: number } | { - type: \\"a865\\", + type: "a865", a87: number } | { - type: \\"a866\\", + type: "a866", a87: number } | { - type: \\"a867\\", + type: "a867", a87: number } | { - type: \\"a868\\", + type: "a868", a87: number } | { - type: \\"a869\\", + type: "a869", a87: number } | { - type: \\"a870\\", + type: "a870", a87: number } | { - type: \\"a871\\", + type: "a871", a88: number } | { - type: \\"a872\\", + type: "a872", a88: number } | { - type: \\"a873\\", + type: "a873", a88: number } | { - type: \\"a874\\", + type: "a874", a88: number } | { - type: \\"a875\\", + type: "a875", a88: number } | { - type: \\"a876\\", + type: "a876", a88: number } | { - type: \\"a877\\", + type: "a877", a88: number } | { - type: \\"a878\\", + type: "a878", a88: number } | { - type: \\"a879\\", + type: "a879", a88: number } | { - type: \\"a880\\", + type: "a880", a88: number } | { - type: \\"a881\\", + type: "a881", a89: number } | { - type: \\"a882\\", + type: "a882", a89: number } | { - type: \\"a883\\", + type: "a883", a89: number } | { - type: \\"a884\\", + type: "a884", a89: number } | { - type: \\"a885\\", + type: "a885", a89: number } | { - type: \\"a886\\", + type: "a886", a89: number } | { - type: \\"a887\\", + type: "a887", a89: number } | { - type: \\"a888\\", + type: "a888", a89: number } | { - type: \\"a889\\", + type: "a889", a89: number } | { - type: \\"a890\\", + type: "a890", a89: number } | { - type: \\"a891\\", + type: "a891", a90: number } | { - type: \\"a892\\", + type: "a892", a90: number } | { - type: \\"a893\\", + type: "a893", a90: number } | { - type: \\"a894\\", + type: "a894", a90: number } | { - type: \\"a895\\", + type: "a895", a90: number } | { - type: \\"a896\\", + type: "a896", a90: number } | { - type: \\"a897\\", + type: "a897", a90: number } | { - type: \\"a898\\", + type: "a898", a90: number } | { - type: \\"a899\\", + type: "a899", a90: number } | { - type: \\"a900\\", + type: "a900", a90: number } | { - type: \\"a901\\", + type: "a901", a91: number } | { - type: \\"a902\\", + type: "a902", a91: number } | { - type: \\"a903\\", + type: "a903", a91: number } | { - type: \\"a904\\", + type: "a904", a91: number } | { - type: \\"a905\\", + type: "a905", a91: number } | { - type: \\"a906\\", + type: "a906", a91: number } | { - type: \\"a907\\", + type: "a907", a91: number } | { - type: \\"a908\\", + type: "a908", a91: number } | { - type: \\"a909\\", + type: "a909", a91: number } | { - type: \\"a910\\", + type: "a910", a91: number } | { - type: \\"a911\\", + type: "a911", a92: number } | { - type: \\"a912\\", + type: "a912", a92: number } | { - type: \\"a913\\", + type: "a913", a92: number } | { - type: \\"a914\\", + type: "a914", a92: number } | { - type: \\"a915\\", + type: "a915", a92: number } | { - type: \\"a916\\", + type: "a916", a92: number } | { - type: \\"a917\\", + type: "a917", a92: number } | { - type: \\"a918\\", + type: "a918", a92: number } | { - type: \\"a919\\", + type: "a919", a92: number } | { - type: \\"a920\\", + type: "a920", a92: number } | { - type: \\"a921\\", + type: "a921", a93: number } | { - type: \\"a922\\", + type: "a922", a93: number } | { - type: \\"a923\\", + type: "a923", a93: number } | { - type: \\"a924\\", + type: "a924", a93: number } | { - type: \\"a925\\", + type: "a925", a93: number } | { - type: \\"a926\\", + type: "a926", a93: number } | { - type: \\"a927\\", + type: "a927", a93: number } | { - type: \\"a928\\", + type: "a928", a93: number } | { - type: \\"a929\\", + type: "a929", a93: number } | { - type: \\"a930\\", + type: "a930", a93: number } | { - type: \\"a931\\", + type: "a931", a94: number } | { - type: \\"a932\\", + type: "a932", a94: number } | { - type: \\"a933\\", + type: "a933", a94: number } | { - type: \\"a934\\", + type: "a934", a94: number } | { - type: \\"a935\\", + type: "a935", a94: number } | { - type: \\"a936\\", + type: "a936", a94: number } | { - type: \\"a937\\", + type: "a937", a94: number } | { - type: \\"a938\\", + type: "a938", a94: number } | { - type: \\"a939\\", + type: "a939", a94: number } | { - type: \\"a940\\", + type: "a940", a94: number } | { - type: \\"a941\\", + type: "a941", a95: number } | { - type: \\"a942\\", + type: "a942", a95: number } | { - type: \\"a943\\", + type: "a943", a95: number } | { - type: \\"a944\\", + type: "a944", a95: number } | { - type: \\"a945\\", + type: "a945", a95: number } | { - type: \\"a946\\", + type: "a946", a95: number } | { - type: \\"a947\\", + type: "a947", a95: number } | { - type: \\"a948\\", + type: "a948", a95: number } | { - type: \\"a949\\", + type: "a949", a95: number } | { - type: \\"a950\\", + type: "a950", a95: number } | { - type: \\"a951\\", + type: "a951", a96: number } | { - type: \\"a952\\", + type: "a952", a96: number } | { - type: \\"a953\\", + type: "a953", a96: number } | { - type: \\"a954\\", + type: "a954", a96: number } | { - type: \\"a955\\", + type: "a955", a96: number } | { - type: \\"a956\\", + type: "a956", a96: number } | { - type: \\"a957\\", + type: "a957", a96: number } | { - type: \\"a958\\", + type: "a958", a96: number } | { - type: \\"a959\\", + type: "a959", a96: number } | { - type: \\"a960\\", + type: "a960", a96: number } | { - type: \\"a961\\", + type: "a961", a97: number } | { - type: \\"a962\\", + type: "a962", a97: number } | { - type: \\"a963\\", + type: "a963", a97: number } | { - type: \\"a964\\", + type: "a964", a97: number } | { - type: \\"a965\\", + type: "a965", a97: number } | { - type: \\"a966\\", + type: "a966", a97: number } | { - type: \\"a967\\", + type: "a967", a97: number } | { - type: \\"a968\\", + type: "a968", a97: number } | { - type: \\"a969\\", + type: "a969", a97: number } | { - type: \\"a970\\", + type: "a970", a97: number } | { - type: \\"a971\\", + type: "a971", a98: number } | { - type: \\"a972\\", + type: "a972", a98: number } | { - type: \\"a973\\", + type: "a973", a98: number } | { - type: \\"a974\\", + type: "a974", a98: number } | { - type: \\"a975\\", + type: "a975", a98: number } | { - type: \\"a976\\", + type: "a976", a98: number } | { - type: \\"a977\\", + type: "a977", a98: number } | { - type: \\"a978\\", + type: "a978", a98: number } | { - type: \\"a979\\", + type: "a979", a98: number } | { - type: \\"a980\\", + type: "a980", a98: number } | { - type: \\"a981\\", + type: "a981", a99: number } | { - type: \\"a982\\", + type: "a982", a99: number } | { - type: \\"a983\\", + type: "a983", a99: number } | { - type: \\"a984\\", + type: "a984", a99: number } | { - type: \\"a985\\", + type: "a985", a99: number } | { - type: \\"a986\\", + type: "a986", a99: number } | { - type: \\"a987\\", + type: "a987", a99: number } | { - type: \\"a988\\", + type: "a988", a99: number } | { - type: \\"a989\\", + type: "a989", a99: number } | { - type: \\"a990\\", + type: "a990", a99: number } | { - type: \\"a991\\", + type: "a991", a100: number } | { - type: \\"a992\\", + type: "a992", a100: number } | { - type: \\"a993\\", + type: "a993", a100: number } | { - type: \\"a994\\", + type: "a994", a100: number } | { - type: \\"a995\\", + type: "a995", a100: number } | { - type: \\"a996\\", + type: "a996", a100: number } | { - type: \\"a997\\", + type: "a997", a100: number } | { - type: \\"a998\\", + type: "a998", a100: number } | { - type: \\"a999\\", + type: "a999", a100: number } | { - type: \\"a1000\\", + type: "a1000", a100: number }; function foo(x: TAction): TAction { return x; } -" + `; exports[`test.js 1`] = ` -"type A = {a: number}; +type A = {a: number}; type B = {b: number}; type C = {c: number}; @@ -8053,5 +8053,5 @@ type T4 = (A | C) & (B | C); function f4(x: T4): T4 { return x; } -" + `; diff --git a/tests/flow/union/__snapshots__/jsfmt.spec.js.snap b/tests/flow/union/__snapshots__/jsfmt.spec.js.snap index ddf5b453..db4de98d 100644 --- a/tests/flow/union/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/union/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`blowup.js 1`] = ` -"// @flow +// @flow export type Select = { expression: ArithmeticExpression; @@ -58,7 +58,7 @@ export class Query { select(expr: ArithmeticExpression): this { this._select.push({ expression: expr, - alias: \\"\\" + alias: "" }); return this; } @@ -85,11 +85,11 @@ export class DivOp export class ModOp extends BinaryExpression {} -" + `; exports[`fields.js 1`] = ` -"class C { +class C { x: ?number|string; constructor() { this.x = null; @@ -102,11 +102,11 @@ class C { this.x = null; } } -" + `; exports[`fields2.js 1`] = ` -"class C { } +class C { } class D { content: string|C; @@ -125,46 +125,46 @@ class D { return this.content; } } -" + `; exports[`issue-17.js 1`] = ` -"/* @flow */ +/* @flow */ type T = - {type: \\"a\\"; a: number} | - {type: \\"b\\"; b: string}; + {type: "a"; a: number} | + {type: "b"; b: string}; var l: Array = [ - {type: \\"a\\", a: 1}, - {type: \\"a\\", a: 2}, - {type: \\"a\\", a: 3}, - {type: \\"a\\", a: 4}, - {type: \\"b\\", b: \\"monkey\\"}, - {type: \\"b\\", b: \\"gorilla\\"}, - {type: \\"b\\", b: \\"giraffe\\"}, - {type: \\"b\\", b: \\"penguin\\"}, + {type: "a", a: 1}, + {type: "a", a: 2}, + {type: "a", a: 3}, + {type: "a", a: 4}, + {type: "b", b: "monkey"}, + {type: "b", b: "gorilla"}, + {type: "b", b: "giraffe"}, + {type: "b", b: "penguin"}, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -type T = { type: \\"a\\", a: number } | { type: \\"b\\", b: string }; +type T = { type: "a", a: number } | { type: "b", b: string }; var l: Array = [ - { type: \\"a\\", a: 1 }, - { type: \\"a\\", a: 2 }, - { type: \\"a\\", a: 3 }, - { type: \\"a\\", a: 4 }, - { type: \\"b\\", b: \\"monkey\\" }, - { type: \\"b\\", b: \\"gorilla\\" }, - { type: \\"b\\", b: \\"giraffe\\" }, - { type: \\"b\\", b: \\"penguin\\" } + { type: "a", a: 1 }, + { type: "a", a: 2 }, + { type: "a", a: 3 }, + { type: "a", a: 4 }, + { type: "b", b: "monkey" }, + { type: "b", b: "gorilla" }, + { type: "b", b: "giraffe" }, + { type: "b", b: "penguin" } ]; -" + `; exports[`issue-198.js 1`] = ` -"var p = new Promise(function(resolve, reject) { +var p = new Promise(function(resolve, reject) { resolve(5); }) .then(function(num) { @@ -185,52 +185,52 @@ var p = new Promise(function(resolve, reject) { // This should fail because str is string, not number return str.toFixed(); }); -" + `; exports[`issue-256.js 1`] = ` -"declare class Myclass { +declare class Myclass { myfun(myarray: Array): any; } declare var myclass: Myclass; -myclass.myfun([\\"1\\", \\"2\\", \\"3\\", \\"4\\", \\"5\\", \\"6\\", function (ar) {}]) -myclass.myfun([\\"1\\", \\"2\\", \\"3\\", \\"4\\", \\"5\\", \\"6\\", \\"7\\", function (ar) {}]) +myclass.myfun(["1", "2", "3", "4", "5", "6", function (ar) {}]) +myclass.myfun(["1", "2", "3", "4", "5", "6", "7", function (ar) {}]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare class Myclass { myfun(myarray: Array): any } declare var myclass: Myclass; -myclass.myfun([\\"1\\", \\"2\\", \\"3\\", \\"4\\", \\"5\\", \\"6\\", function(ar) {}]); -myclass.myfun([\\"1\\", \\"2\\", \\"3\\", \\"4\\", \\"5\\", \\"6\\", \\"7\\", function(ar) {}]); -" +myclass.myfun(["1", "2", "3", "4", "5", "6", function(ar) {}]); +myclass.myfun(["1", "2", "3", "4", "5", "6", "7", function(ar) {}]); + `; exports[`issue-323.js 1`] = ` -"var Foo = require(\\"./issue-323-lib\\"); +var Foo = require("./issue-323-lib"); var foo = new Foo(); var foostr: Foo | string = foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var Foo = require(\\"./issue-323-lib\\"); +var Foo = require("./issue-323-lib"); var foo = new Foo(); var foostr: Foo | string = foo; -" + `; exports[`issue-323-lib.js 1`] = ` -"/* @flow */ +/* @flow */ class Foo {} module.exports = Foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ class Foo {} module.exports = Foo; -" + `; exports[`issue-324.js 1`] = ` -"/* @flow */ +/* @flow */ class Foo{}; class Bar{}; @@ -247,11 +247,11 @@ var foostr: Foo | string = new Foo(); var barstr: Bar | string = new Bar(); foostr = barstr; -" + `; exports[`issue-325.js 1`] = ` -"class Tag { +class Tag { constructor() { var a1: Array = []; var a2: Array = a1; @@ -280,24 +280,24 @@ class Tag_ { var a2: Array = a1; } } -" + `; exports[`issue-326.js 1`] = ` -"var numberAndStringArr:Array = [1,2]; +var numberAndStringArr:Array = [1,2]; var stringArr:Array = ['a','b']; var result = numberAndStringArr.concat(stringArr); // no error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var numberAndStringArr: Array = [1, 2]; -var stringArr: Array = [\\"a\\", \\"b\\"]; +var stringArr: Array = ["a", "b"]; var result = numberAndStringArr.concat(stringArr); // no error -" + `; exports[`issue-582.js 1`] = ` -"/*** +/*** * nested unions * @flow */ @@ -318,19 +318,19 @@ var nested2: FooBarBaz = 'baz'; */ // inline -var nested1: (\\"foo\\" | \\"bar\\") | \\"baz\\" = \\"baz\\"; +var nested1: ("foo" | "bar") | "baz" = "baz"; // through tvars -type FooBar = \\"foo\\" | \\"bar\\"; -type Baz = \\"baz\\"; +type FooBar = "foo" | "bar"; +type Baz = "baz"; type FooBarBaz = FooBar | Baz; -var nested2: FooBarBaz = \\"baz\\"; -" +var nested2: FooBarBaz = "baz"; + `; exports[`issue-963.js 1`] = ` -"/*** +/*** * unions with embedded intersections * @flow */ @@ -399,11 +399,11 @@ const u3: union2 = { p1: 1, p2: 2 }; -" + `; exports[`test.js 1`] = ` -"var C = require('test-lib'); +var C = require('test-lib'); // TODO: spurious error! (replacing C with number makes the error go away) // type Foo = Array | Array; @@ -418,11 +418,11 @@ foo(y); // type Bar = (() => C) | (() => string); type Bar = () => (C | string); // workaround -function f() { return \\"\\"; } +function f() { return ""; } function bar(x:Bar) { } bar(f); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var C = require(\\"test-lib\\"); +var C = require("test-lib"); // TODO: spurious error! (replacing C with number makes the error go away) // type Foo = Array | Array; @@ -438,15 +438,15 @@ foo(y); type Bar = () => C | string; // workaround function f() { - return \\"\\"; + return ""; } function bar(x: Bar) {} bar(f); -" + `; exports[`test-lib.js 1`] = ` -"/* @providesModule test-lib */ +/* @providesModule test-lib */ class C { } module.exports = C; @@ -455,11 +455,11 @@ module.exports = C; class C {} module.exports = C; -" + `; exports[`type-app.js 1`] = ` -"/** +/** * @flow */ @@ -488,11 +488,11 @@ var a: LocalClass | number = 123; // introduces this test fixes this such that the speculative algorithm is // correctly delayed upon encountering a non-concrete TypeAppT var b: Iterator | number = 123; -" + `; exports[`union.js 1`] = ` -"function bar(x: Document | string): void { } +function bar(x: Document | string): void { } bar(0); class C { } @@ -510,7 +510,7 @@ declare class F { foo(x: string):void; } function corge(b) { - var x = b ? \\"\\" : 0; + var x = b ? "" : 0; new F().foo(x); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -532,14 +532,14 @@ declare class F { foo(x: string): void } function corge(b) { - var x = b ? \\"\\" : 0; + var x = b ? "" : 0; new F().foo(x); } -" + `; exports[`yuge.js 1`] = ` -"/** +/** * great big union used as type annotation will be flowed into itself. * List.mem check avoids pathology, as long as singletons aren't converted. * This is a band-aid, though: see second case. @@ -561,7 +561,7 @@ class SecurityCheckupTypedLogger { // something quick to get the union size off the Ocaml call stack, // but not sure it's worth doing that before the real solution. ohThatsNotSoGood() { - (\\"\\": ErrorCode); // also, error pos omits this line completely + ("": ErrorCode); // also, error pos omits this line completely } } @@ -5577,13 +5577,13 @@ type Data = { * This is a band-aid, though: see second case. * @flow */ -\\"use strict\\"; +"use strict"; class SecurityCheckupTypedLogger { _data: Data; setError(value: ErrorCode) { - this._data[\\"error\\"] = value; + this._data["error"] = value; } // Bug: right now, any incompatible type coming into a huge @@ -5593,7 +5593,7 @@ class SecurityCheckupTypedLogger { // something quick to get the union size off the Ocaml call stack, // but not sure it's worth doing that before the real solution. ohThatsNotSoGood() { - (\\"\\": ErrorCode); // also, error pos omits this line completely + ("": ErrorCode); // also, error pos omits this line completely } } @@ -10602,5 +10602,5 @@ type ErrorCode = type Data = { error?: ErrorCode }; -" + `; diff --git a/tests/flow/union_new/__snapshots__/jsfmt.spec.js.snap b/tests/flow/union_new/__snapshots__/jsfmt.spec.js.snap index 126bf4af..5904aee4 100644 --- a/tests/flow/union_new/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/union_new/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`issue-815.js 1`] = ` -"/* @flow */ +/* @flow */ type T = A|B; class U {}; declare var children: U; @@ -42,11 +42,11 @@ class VirtualNode { this.children = children.length === 1 ? children[0] : children; } } -" + `; exports[`issue-824.js 1`] = ` -"import { B, C } from \\"./issue-824-helper\\"; +import { B, C } from "./issue-824-helper"; type K = B | C; @@ -63,7 +63,7 @@ export default class A { } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import { B, C } from \\"./issue-824-helper\\"; +import { B, C } from "./issue-824-helper"; type K = B | C; @@ -79,11 +79,11 @@ export default class A { return this.foo(p); } } -" + `; exports[`issue-824-helper.js 1`] = ` -"import A from \\"./issue-824\\"; +import A from "./issue-824"; export class B extends A { which(): number { @@ -96,7 +96,7 @@ export class C extends A { } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import A from \\"./issue-824\\"; +import A from "./issue-824"; export class B extends A { which(): number { @@ -108,11 +108,11 @@ export class C extends A { return 2; } } -" + `; exports[`issue-1349.js 1`] = ` -"/* @flow */ +/* @flow */ var bar: Array<{b: ?boolean, c: number} | {b: boolean}> = [ {b: true, c: 123}, @@ -125,11 +125,11 @@ var bar: Array<{ b: ?boolean, c: number } | { b: boolean }> = [ { b: true, c: 123 }, { b: true } ]; -" + `; exports[`issue-1371.js 1`] = ` -"function create(a: any): { type: 'B', data: number } | { type: 'A', data: string } +function create(a: any): { type: 'B', data: number } | { type: 'A', data: string } { return { type: 'A', @@ -139,18 +139,18 @@ exports[`issue-1371.js 1`] = ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function create( a: any -): { type: \\"B\\", data: number } | { type: \\"A\\", data: string } { +): { type: "B", data: number } | { type: "A", data: string } { return { - type: \\"A\\", + type: "A", data: a }; } -" + `; exports[`issue-1455.js 1`] = ` -"/* @flow */ -import type {Foobar} from \\"./issue-1455-helper\\" +/* @flow */ +import type {Foobar} from "./issue-1455-helper" function create(content: ?Foobar | String | Array) { } @@ -160,29 +160,29 @@ function node(content: ?Foobar | String | Array) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import type { Foobar } from \\"./issue-1455-helper\\"; +import type { Foobar } from "./issue-1455-helper"; function create(content: ?Foobar | String | Array) {} function node(content: ?Foobar | String | Array) { create(content); } -" + `; exports[`issue-1455-helper.js 1`] = ` -"/* @flow */ +/* @flow */ export class Foobar { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ export class Foobar {} -" + `; exports[`issue-1462-i.js 1`] = ` -"type Common = { +type Common = { }; type A = Common & { @@ -208,12 +208,12 @@ function printAll(val: MyType) { type Common = {}; type A = Common & { - type: \\"A\\", + type: "A", foo: number }; type B = Common & { - type: \\"B\\", + type: "B", foo: Array }; @@ -226,11 +226,11 @@ function print(x: number) { function printAll(val: MyType) { print(val.foo); // <--- foo could be an array } -" + `; exports[`issue-1462-ii.js 1`] = ` -"type Common = { +type Common = { }; type A = { @@ -261,12 +261,12 @@ function printAll(val: MyType) { type Common = {}; type A = { - type: \\"A\\", + type: "A", foo: number } & Common; type B = { - type: \\"B\\", + type: "B", foo: Array } & Common; @@ -277,17 +277,17 @@ function print(x: number) { } function printAll(val: MyType) { - if (val.type === \\"A\\") { + if (val.type === "A") { print(val.foo); } else { val.foo.forEach(print); } } -" + `; exports[`issue-1664.js 1`] = ` -"/* @flow */ +/* @flow */ type DataBase = { id: string, @@ -295,22 +295,22 @@ type DataBase = { }; type UserData = DataBase & { - kind: \\"user\\", + kind: "user", }; type SystemData = DataBase & { - kind: \\"system\\", + kind: "system", } 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); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -322,29 +322,29 @@ type DataBase = { }; type UserData = DataBase & { - kind: \\"user\\" + kind: "user" }; type SystemData = DataBase & { - kind: \\"system\\" + kind: "system" }; 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); } -" + `; exports[`issue-1759.js 1`] = ` -"// @flow +// @flow type X = ({a:true} & {b:string}) | ({a:false} & {c:string}); //type X = {a:true, b:string} | {a:false, c:string}; // this works. @@ -362,11 +362,11 @@ function hello(x: X): string { if (x.a === true) return x.b; else return x.c; } -" + `; exports[`issue-2232.js 1`] = ` -"/* @flow */ +/* @flow */ declare type Entity = { id: T, @@ -414,11 +414,11 @@ function test(f: Foo | EmptyFoo) { (f: Foo); } } -" + `; exports[`test1.js 1`] = ` -"// @noflow +// @noflow /** * Test that shows how the implementation of union types is broken @@ -432,7 +432,7 @@ function obj(a: A1 | A2) { return a.x; } -const obj_result = obj({ x: \\"\\" }); // currently an error! (expect it to be OK) +const obj_result = obj({ x: "" }); // currently an error! (expect it to be OK) // Type definitions used above are defined below, but in an order that // deliberately makes their full resolution as lazy as possible. The call above @@ -456,7 +456,7 @@ function fun(a: A3 | A4) { return a(); } -const fun_result = fun(() => \\"\\"); +const fun_result = fun(() => ""); type A3 = () => B3; type A4 = () => B4; @@ -493,7 +493,7 @@ function obj(a: A1 | A2) { return a.x; } -const obj_result = obj({ x: \\"\\" }); // currently an error! (expect it to be OK) +const obj_result = obj({ x: "" }); // currently an error! (expect it to be OK) // Type definitions used above are defined below, but in an order that // deliberately makes their full resolution as lazy as possible. The call above @@ -517,7 +517,7 @@ function fun(a: A3 | A4) { return a(); } -const fun_result = fun(() => \\"\\"); +const fun_result = fun(() => ""); type A3 = () => B3; type A4 = () => B4; @@ -539,11 +539,11 @@ inst([new B6()]); type A5 = B5[]; type A6 = B6[]; -" + `; exports[`test2.js 1`] = ` -"// @noflow +// @noflow /** * Test that shows how the implementation of union types is broken @@ -555,7 +555,7 @@ exports[`test2.js 1`] = ` function obj(a: { x: number } | { x: string }) { } -obj(({ x: \\"\\" }: A1)); +obj(({ x: "" }: A1)); type A1 = { x: B1 }; @@ -567,7 +567,7 @@ type B1 = string; function fun(a: (() => number) | (() => string)) { } -fun(((() => \\"\\"): A2)); +fun(((() => ""): A2)); type A2 = () => B2; @@ -616,7 +616,7 @@ type B5 = string; function tup(a: [number,boolean] | [string,boolean]) { } -tup(([\\"\\",false]: A6)); +tup((["",false]: A6)); type A6 = [B6,boolean]; type B6 = string; @@ -633,7 +633,7 @@ type B6 = string; function obj(a: { x: number } | { x: string }) {} -obj(({ x: \\"\\" }: A1)); +obj(({ x: "" }: A1)); type A1 = { x: B1 }; @@ -645,7 +645,7 @@ type B1 = string; function fun(a: (() => number) | (() => string)) {} -fun((() => \\"\\": A2)); +fun((() => "": A2)); type A2 = () => B2; @@ -694,15 +694,15 @@ type B5 = string; function tup(a: [number, boolean] | [string, boolean]) {} -tup(([\\"\\", false]: A6)); +tup((["", false]: A6)); type A6 = [B6, boolean]; type B6 = string; -" + `; exports[`test3.js 1`] = ` -"// @noflow +// @noflow /** * Test that shows how the implementation of union types is broken @@ -761,11 +761,11 @@ arr(([]: A2)); type A2 = B2[]; type B2 = string; -" + `; exports[`test4.js 1`] = ` -"// @noflow +// @noflow /** * Test that shows how the implementation of union types is broken @@ -844,11 +844,11 @@ function arr_get(i: number): string { type A2 = B2[]; type B2 = string; -" + `; exports[`test5.js 1`] = ` -"// @noflow +// @noflow /** * Test that shows how the implementation of union types is broken @@ -909,11 +909,11 @@ arr(a2); function arr_set(x: string, i: number) { a2[i] = x; } -" + `; exports[`test6.js 1`] = ` -"// @noflow +// @noflow /** * Test that shows how the implementation of union types is broken @@ -966,11 +966,11 @@ const _C = mk_C(); class D extends _C {} class C {} -" + `; exports[`test7.js 1`] = ` -"// @noflow +// @noflow /** * Test that shows how the implementation of union types is broken @@ -1029,11 +1029,11 @@ rec({ x: 0 }); type PF = PG; type PG = { x: X, y?: PG }; -" + `; exports[`test8.js 1`] = ` -"// @noflow +// @noflow /** * Test that shows how the implementation of union types is broken @@ -1080,11 +1080,11 @@ type H1 = boolean; type H1_ = string; type H2 = boolean; type H2_ = number; -" + `; exports[`test9.js 1`] = ` -"// @noflow +// @noflow /** * Test that shows how the implementation of union types is broken @@ -1117,11 +1117,11 @@ function square(x? = 0) { function foo(f: ((_: ?number) => ?number) | (() => void)) {} foo((x): number => square(x)); -" + `; exports[`test10.js 1`] = ` -"// @noflow +// @noflow function id(x: X): X { return x; } @@ -1132,10 +1132,10 @@ function id(x: X): X { return x; } function check_prim(_: number | string) { } // ok -check_prim(\\"\\"); +check_prim(""); -// ...even when they \\"flow\\" in -check_prim(id(\\"\\")); +// ...even when they "flow" in +check_prim(id("")); ////////////////////////////// // class instance annotations @@ -1148,7 +1148,7 @@ function check_inst(_: C | D) { } // ok check_inst(new D); -// ...even when they \\"flow\\" in +// ...even when they "flow" in check_inst(id(new C)); //////////////////////// @@ -1167,10 +1167,10 @@ check_fun((x) => x); function check_obj(_: { x: number } | { x: string }) { } // ok -check_obj({ x: \\"\\" }); +check_obj({ x: "" }); // help! -check_obj({ x: id(\\"\\") }); +check_obj({ x: id("") }); ///////////////////// // array annotations @@ -1179,10 +1179,10 @@ check_obj({ x: id(\\"\\") }); function check_arr(_: number[] | string[]) { } // help! (unlike objects, array literals' element types are always open) -check_arr([\\"\\"]); +check_arr([""]); // help! -check_arr([id(\\"\\")]); +check_arr([id("")]); ////////////////////////////////////// // generic class instance annotations @@ -1207,10 +1207,10 @@ function id(x: X): X { function check_prim(_: number | string) {} // ok -check_prim(\\"\\"); +check_prim(""); -// ...even when they \\"flow\\" in -check_prim(id(\\"\\")); +// ...even when they "flow" in +check_prim(id("")); ////////////////////////////// // class instance annotations @@ -1223,7 +1223,7 @@ function check_inst(_: C | D) {} // ok check_inst(new D()); -// ...even when they \\"flow\\" in +// ...even when they "flow" in check_inst(id(new C())); //////////////////////// @@ -1242,10 +1242,10 @@ check_fun(x => x); function check_obj(_: { x: number } | { x: string }) {} // ok -check_obj({ x: \\"\\" }); +check_obj({ x: "" }); // help! -check_obj({ x: id(\\"\\") }); +check_obj({ x: id("") }); ///////////////////// // array annotations @@ -1254,10 +1254,10 @@ check_obj({ x: id(\\"\\") }); function check_arr(_: number[] | string[]) {} // help! (unlike objects, array literals' element types are always open) -check_arr([\\"\\"]); +check_arr([""]); // help! -check_arr([id(\\"\\")]); +check_arr([id("")]); ////////////////////////////////////// // generic class instance annotations @@ -1268,51 +1268,51 @@ function check_poly_inst(_: P | P) {} // help! check_poly_inst(new P()); -" + `; exports[`test11.js 1`] = ` -"// @noflow +// @noflow // disjoint unions function length(list: List) { - if (list.kind === \\"cons\\") return length(list.next) + 1; + if (list.kind === "cons") return length(list.next) + 1; else return 0; } -length({ kind: \\"nil\\" }); -length({ kind: \\"cons\\" }); // missing \`next\` -length({ kind: \\"cons\\", next: { kind: \\"nil\\" } }); -length({ kind: \\"empty\\" }); // \`kind\` not found +length({ kind: "nil" }); +length({ kind: "cons" }); // missing \`next\` +length({ kind: "cons", next: { kind: "nil" } }); +length({ kind: "empty" }); // \`kind\` not found type List = Nil | Cons; -type Nil = { kind: \\"nil\\" }; -type Cons = { kind: \\"cons\\", next: List }; +type Nil = { kind: "nil" }; +type Cons = { kind: "cons", next: List }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow // disjoint unions function length(list: List) { - if (list.kind === \\"cons\\") return length(list.next) + 1; + if (list.kind === "cons") return length(list.next) + 1; else return 0; } -length({ kind: \\"nil\\" }); -length({ kind: \\"cons\\" }); // missing \`next\` -length({ kind: \\"cons\\", next: { kind: \\"nil\\" } }); -length({ kind: \\"empty\\" }); // \`kind\` not found +length({ kind: "nil" }); +length({ kind: "cons" }); // missing \`next\` +length({ kind: "cons", next: { kind: "nil" } }); +length({ kind: "empty" }); // \`kind\` not found type List = Nil | Cons; -type Nil = { kind: \\"nil\\" }; -type Cons = { kind: \\"cons\\", next: List }; -" +type Nil = { kind: "nil" }; +type Cons = { kind: "cons", next: List }; + `; exports[`test12.js 1`] = ` -"// @noflow +// @noflow // polymorphic recursive types @@ -1333,11 +1333,11 @@ type H = { x: string }; function rec(x: F): G | H { return x; } -" + `; exports[`test13.js 1`] = ` -"// @noflow +// @noflow /* ensure there are no unintended side effects when trying branches */ @@ -1353,20 +1353,20 @@ exports[`test13.js 1`] = ` /* ensure there are no unintended side effects when trying branches */ -({ type: \\"B\\", id: \\"hi\\" }: +({ type: "B", id: "hi" }: | { - type: \\"A\\", + type: "A", id: ?string } | { - type: \\"B\\", + type: "B", id: string }); -" + `; exports[`test14.js 1`] = ` -"// @noflow +// @noflow // annotations @@ -1393,11 +1393,11 @@ function union(o: { x: string } | { x: number }) {} function foo(c: C) { union({ x: c.get() }); } -" + `; exports[`test15.js 1`] = ` -"// @noflow +// @noflow // functions as objects @@ -1427,11 +1427,11 @@ bar(() => { }); // functions as objects function foo(target: EventTarget) { - target.addEventListener(\\"click\\", e => {}); + target.addEventListener("click", e => {}); } declare class EventTarget { - addEventListener(type: \\"foo\\", listener: KeyboardEventHandler): void, + addEventListener(type: "foo", listener: KeyboardEventHandler): void, addEventListener(type: string, listener: EventHandler): void } @@ -1446,11 +1446,11 @@ type KeyboardEventHandler = (event: KeyboardEvent) => mixed; function bar(x: (() => void) | { x: number }) {} bar(() => {}); -" + `; exports[`test16.js 1`] = ` -"// @noflow +// @noflow // annotations @@ -1467,7 +1467,7 @@ bar(() => qux()); var x = false; function qux() { return x; } -x = \\"\\"; +x = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow @@ -1488,12 +1488,12 @@ var x = false; function qux() { return x; } -x = \\"\\"; -" +x = ""; + `; exports[`test17.js 1`] = ` -"// @noflow +// @noflow // Array#concat @@ -1508,11 +1508,11 @@ exports[`test17.js 1`] = ` [].concat([]); ([].concat([0, 1])[1]: string); -" + `; exports[`test18.js 1`] = ` -"// @noflow +// @noflow // method overloads @@ -1539,11 +1539,11 @@ function f() { } new C().m(f()); -" + `; exports[`test19.js 1`] = ` -"// @noflow +// @noflow // constructor overloads @@ -1568,24 +1568,24 @@ declare class D { constructor(_: void): void, constructor(_: null): void } -" + `; exports[`test20.js 1`] = ` -"// @noflow +// @noflow // Array#reduce [0,1].reduce((x,y,i) => y); -[\\"a\\", \\"b\\"].reduce( +["a", "b"].reduce( (regex, representation, index) => { return regex + (index ? '|' : '') + '(' + representation + ')'; }, '', ); -[\\"\\"].reduce((acc,str) => acc * str.length); +[""].reduce((acc,str) => acc * str.length); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow @@ -1593,61 +1593,61 @@ exports[`test20.js 1`] = ` [0, 1].reduce((x, y, i) => y); -[\\"a\\", \\"b\\"].reduce((regex, representation, index) => { - return regex + (index ? \\"|\\" : \\"\\") + \\"(\\" + representation + \\")\\"; -}, \\"\\"); +["a", "b"].reduce((regex, representation, index) => { + return regex + (index ? "|" : "") + "(" + representation + ")"; +}, ""); + +[""].reduce((acc, str) => acc * str.length); -[\\"\\"].reduce((acc, str) => acc * str.length); -" `; exports[`test21.js 1`] = ` -"// @noflow +// @noflow // annotations for disjoint unions type T = - | { type: \\"FOO\\", x: number } - | { type: \\"BAR\\", x: string } + | { type: "FOO", x: number } + | { type: "BAR", x: string } -({ type: (bar(): \\"BAR\\"), x: str() }: T); +({ type: (bar(): "BAR"), x: str() }: T); ({ type: bar(), x: str() }: T); ({ type: bar(), x: (str(): string) }: T); function bar() { - return \\"BAR\\"; + return "BAR"; } function str() { - return \\"hello\\"; + return "hello"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow // annotations for disjoint unions -type T = { type: \\"FOO\\", x: number } | { type: \\"BAR\\", x: string }; +type T = { type: "FOO", x: number } | { type: "BAR", x: string }; -({ type: (bar(): \\"BAR\\"), x: str() }: T); +({ type: (bar(): "BAR"), x: str() }: T); ({ type: bar(), x: str() }: T); ({ type: bar(), x: (str(): string) }: T); function bar() { - return \\"BAR\\"; + return "BAR"; } function str() { - return \\"hello\\"; + return "hello"; } -" + `; exports[`test22.js 1`] = ` -"// @noflow +// @noflow // refinement of disjoint unions @@ -1676,25 +1676,25 @@ function foo(x: T) { type Empty = {}; type Success = { - type: \\"SUCCESS\\", + type: "SUCCESS", result: string }; type Error = { - type: \\"ERROR\\" + type: "ERROR" } & Empty; export type T = Success | Error; function foo(x: T) { - if (x.type === \\"SUCCESS\\") return x.result; + if (x.type === "SUCCESS") return x.result; else return x.result; } -" + `; exports[`test23.js 1`] = ` -"// @noflow +// @noflow // nested intersections (see also lib/test23_lib.js) @@ -1719,11 +1719,11 @@ function foo(obj: Obj) { obj.x; // should be OK obj.x; // should also be OK (the check above shouldn't affect anything) } -" + `; exports[`test24.js 1`] = ` -"// @noflow +// @noflow // scaling test for full type resolution @@ -1789,11 +1789,11 @@ declare class D extends C { } (0: D | number); -" + `; exports[`test25.js 1`] = ` -"// @noflow +// @noflow // termination test (see also lib/test25_lib.js) @@ -1817,11 +1817,11 @@ function foo(rows: Rows, set: Set) { set ); } -" + `; exports[`test26.js 1`] = ` -"// @noflow +// @noflow declare function foo(x: number): number; declare function foo(x: string): string; @@ -1840,7 +1840,7 @@ declare class Record { set(x: 'bar', y: string): void; } -new Record().set('foo', \\"42\\"); +new Record().set('foo', "42"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow @@ -1857,16 +1857,16 @@ declare var y: T; (foo(y): T); declare class Record { - set(x: \\"foo\\", y: number): void, - set(x: \\"bar\\", y: string): void + set(x: "foo", y: number): void, + set(x: "bar", y: string): void } -new Record().set(\\"foo\\", \\"42\\"); -" +new Record().set("foo", "42"); + `; exports[`test27.js 1`] = ` -"// @noflow +// @noflow type X = ({a:true} & {b:string}) | ({a:false} & {c:string}); //type X = {a:true, b:string} | {a:false, c:string}; // this works. @@ -1917,11 +1917,11 @@ function hello4(x: X): string { return x.b; } } -" + `; exports[`test29.js 1`] = ` -"// @noflow +// @noflow // Make sure caching doesn't cause a spurious successful match (e.g., when a // failed match is tried again). This may happen, e.g., when checking @@ -1978,11 +1978,11 @@ class C { return rows.reduce((length, row) => 0, minWidth); } } -" + `; exports[`test30.js 1`] = ` -"// @noflow +// @noflow const Constants = require('./test30-helper'); @@ -1994,16 +1994,16 @@ type ActionType = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow -const Constants = require(\\"./test30-helper\\"); +const Constants = require("./test30-helper"); -type ActionType = { type: \\"foo\\", x: number } | { type: \\"bar\\", x: number }; +type ActionType = { type: "foo", x: number } | { type: "bar", x: number }; ({ type: Constants.BAR, x: 0 }: ActionType); -" + `; exports[`test30-helper.js 1`] = ` -"// @noflow +// @noflow module.exports = { FOO: 'foo', @@ -2013,14 +2013,14 @@ module.exports = { // @noflow module.exports = { - FOO: \\"foo\\", - BAR: \\"bar\\" + FOO: "foo", + BAR: "bar" }; -" + `; exports[`test31.js 1`] = ` -"// @noflow +// @noflow // make sure tuples are type arguments (as used e.g. when viewing maps as // key/value iterables) work @@ -2042,7 +2042,7 @@ declare function convert(iter: SomeIterable<[K,V]>): ImmutableMap; function foo(): ImmutableMap { const countersGlobalMap = new SomeMap(); - countersGlobalMap.set(\\"\\", false); + countersGlobalMap.set("", false); return convert(countersGlobalMap); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2068,14 +2068,14 @@ declare function convert(iter: SomeIterable<[K, V]>): ImmutableMap; function foo(): ImmutableMap { const countersGlobalMap = new SomeMap(); - countersGlobalMap.set(\\"\\", false); + countersGlobalMap.set("", false); return convert(countersGlobalMap); } -" + `; exports[`test32.js 1`] = ` -"// @flow +// @flow // make sure that full resolution jobs don't cache improperly to signal success // when they have failed earlier @@ -2091,8 +2091,8 @@ function foo(value: Indirect | number): Indirect | number { // when they have failed earlier function foo(value: Indirect | number): Indirect | number { - const castedValue: number = typeof value === \\"number\\" ? value : 0; + const castedValue: number = typeof value === "number" ? value : 0; return castedValue; } -" + `; diff --git a/tests/flow/union_new/lib/__snapshots__/jsfmt.spec.js.snap b/tests/flow/union_new/lib/__snapshots__/jsfmt.spec.js.snap index 678c1444..1d1f8604 100644 --- a/tests/flow/union_new/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/union_new/lib/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test23_lib.js 1`] = ` -"declare class SomeLibClass { } +declare class SomeLibClass { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare class SomeLibClass {} -" + `; exports[`test25_lib.js 1`] = ` -"declare class Set { +declare class Set { add(): Set; } @@ -51,12 +51,12 @@ declare class Rows { initialValue: X ): X } -" + `; exports[`test32_lib.js 1`] = ` -"type Indirect = Array; +type Indirect = Array; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Indirect = Array; -" + `; diff --git a/tests/flow/unreachable/__snapshots__/jsfmt.spec.js.snap b/tests/flow/unreachable/__snapshots__/jsfmt.spec.js.snap index 58cac920..7df213ca 100644 --- a/tests/flow/unreachable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/unreachable/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`typecheck.js 1`] = ` -"/* @flow */ +/* @flow */ function test1(): string { return bar(); @@ -48,14 +48,14 @@ function test2() { var y: string = n; // error, n is number (EmptyT would work) } } -" + `; exports[`unreachable.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x, y) { - \\"use strict\\"; + "use strict"; return bar(x) + baz(y); // function declaration is hoisted, should not generate warning @@ -83,7 +83,7 @@ foo(1, 2); /* @flow */ function foo(x, y) { - \\"use strict\\"; + "use strict"; return bar(x) + baz(y); // function declaration is hoisted, should not generate warning @@ -104,5 +104,5 @@ function foo(x, y) { } foo(1, 2); -" + `; diff --git a/tests/flow/value/__snapshots__/jsfmt.spec.js.snap b/tests/flow/value/__snapshots__/jsfmt.spec.js.snap index da9c2fb8..59126f8f 100644 --- a/tests/flow/value/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/value/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`value.js 1`] = ` -"var o = {}; -o[\\"x\\"] = 4; -var y:string = o[\\"x\\"]; +var o = {}; +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/flow/vim_emacs_errors/__snapshots__/jsfmt.spec.js.snap b/tests/flow/vim_emacs_errors/__snapshots__/jsfmt.spec.js.snap index bb5e476d..2eb2d3c0 100644 --- a/tests/flow/vim_emacs_errors/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/vim_emacs_errors/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"// @flow +// @flow (123: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow (123: string); -" + `; diff --git a/tests/flow/weakmode/__snapshots__/jsfmt.spec.js.snap b/tests/flow/weakmode/__snapshots__/jsfmt.spec.js.snap index 3558c5a7..189ec19c 100644 --- a/tests/flow/weakmode/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/weakmode/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should_fail_without_weak.js 1`] = ` -"/* @flow */ +/* @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() { @@ -16,21 +16,21 @@ function expects_an_int() { // 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; } -" + `; exports[`should_pass_with_weak.js 1`] = ` -"/* @flow weak */ +/* @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() { @@ -41,11 +41,11 @@ function expects_an_int() { // 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/flow/while/__snapshots__/jsfmt.spec.js.snap b/tests/flow/while/__snapshots__/jsfmt.spec.js.snap index 0ccb2cd5..d49878de 100644 --- a/tests/flow/while/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/while/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`abnormal.js 1`] = ` -"/* @flow */ +/* @flow */ function foo(x: boolean) { var ii = 10; @@ -42,11 +42,11 @@ function bar(x: boolean) { } //console.log('this is still reachable'); } -" + `; exports[`test.js 1`] = ` -"class C { +class C { m() { return new C; } } function blah() {} @@ -71,5 +71,5 @@ while (node) { blah(); node = parent.m(); } -" + `; diff --git a/tests/flow/window/__snapshots__/jsfmt.spec.js.snap b/tests/flow/window/__snapshots__/jsfmt.spec.js.snap index 50de50c1..85cc431c 100644 --- a/tests/flow/window/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/window/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`window1.js 1`] = ` -"/* +/* @providesModule Window1 */ module.exports = window.history; @@ -10,16 +10,16 @@ module.exports = window.history; @providesModule Window1 */ module.exports = window.history; -" + `; exports[`window2.js 1`] = ` -"/* @providesModule Window2 */ +/* @providesModule Window2 */ module.exports = window.parent; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Window2 */ module.exports = window.parent; -" + `; diff --git a/tests/flow/x/__snapshots__/jsfmt.spec.js.snap b/tests/flow/x/__snapshots__/jsfmt.spec.js.snap index 0ed8994a..e572a26e 100644 --- a/tests/flow/x/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/x/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`XControllerURIBuilder.js 1`] = ` -"/** +/** * @generated SignedSource<<13ca42bbc7fe91f15057861e18a77d88>> * * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -25,7 +25,7 @@ class XControllerURIBuilder { // ... getURI() { // ... - var tokenRegex = new RegExp(/^\\\\{(\\\\?)?(.+?)\\\\}$/); + var tokenRegex = new RegExp(/^\\{(\\?)?(.+?)\\}$/); // ... } } @@ -55,11 +55,11 @@ class XControllerURIBuilder { // ... getURI() { // ... - var tokenRegex = new RegExp(/^\\\\{(\\\\?)?(.+?)\\\\}$/); + var tokenRegex = new RegExp(/^\\{(\\?)?(.+?)\\}$/); // ... } } module.exports = XControllerURIBuilder; -" + `; diff --git a/tests/flow_array_comments/__snapshots__/jsfmt.spec.js.snap b/tests/flow_array_comments/__snapshots__/jsfmt.spec.js.snap index 5e5164e6..44a9adcf 100644 --- a/tests/flow_array_comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_array_comments/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"export type FileMetaData = [ +export type FileMetaData = [ /* id */ string, /* mtime */ number, /* visited */ 0|1, @@ -18,5 +18,5 @@ export type FileMetaData = [ ]; export type ModuleMetaData = [Path, /* type */ number]; -" + `; diff --git a/tests/flow_array_union/__snapshots__/jsfmt.spec.js.snap b/tests/flow_array_union/__snapshots__/jsfmt.spec.js.snap index d1591425..87c989ae 100644 --- a/tests/flow_array_union/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_array_union/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"let arr: (number|string)[] = []; +let arr: (number|string)[] = []; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let arr: (number | string)[] = []; -" + `; diff --git a/tests/flow_comments/__snapshots__/jsfmt.spec.js.snap b/tests/flow_comments/__snapshots__/jsfmt.spec.js.snap index b4225c2b..345d7e3b 100644 --- a/tests/flow_comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_comments/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`arrow.js 1`] = ` -"// Error +// Error const beep = (data/*: Object*/) => {} // OK @@ -12,11 +12,11 @@ const beep = (data: Object) => {}; // OK const beep = (data: Object, secondData: Object) => {}; -" + `; exports[`arrow.js 2`] = ` -"// Error +// Error const beep = (data/*: Object*/) => {} // OK @@ -27,5 +27,5 @@ const beep = (data /*: Object*/) => {}; // OK const beep = (data /*: Object*/, secondData /*: Object*/) => {}; -" + `; diff --git a/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap b/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap index 85f25ffb..b1b6f92a 100644 --- a/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"type Banana = { +type Banana = { eat: string => boolean, }; @@ -64,5 +64,5 @@ type f = /* comment */ arg => void; type f = arg /* comment */ => void; type f = ?arg => void; -" + `; diff --git a/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap b/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap index 65d1bee9..33bfbda8 100644 --- a/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`break.js 1`] = ` -"var X = { +var X = { perform: function< A, B, C, D, E, F, G, T: (a: A, b: B, c: C, d: D, e: E, f: F) => G // eslint-disable-line space-before-function-paren @@ -24,5 +24,5 @@ var X = { T: (a: A, b: B, c: C, d: D, e: E, f: F) => G // eslint-disable-line space-before-function-paren >(method: T, scope: any, a: A, b: B, c: C, d: D, e: E, f: F): G {} }; -" + `; diff --git a/tests/flow_import_type_specifier/__snapshots__/jsfmt.spec.js.snap b/tests/flow_import_type_specifier/__snapshots__/jsfmt.spec.js.snap index 30522918..c99f2018 100644 --- a/tests/flow_import_type_specifier/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_import_type_specifier/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"/** +/** * @flow */ -import { Foo, type Baz } from \\"../module\\"; +import { Foo, type Baz } from "../module"; import type {} from 'foo'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow */ -import { Foo, type Baz } from \\"../module\\"; -import type {} from \\"foo\\"; -" +import { Foo, type Baz } from "../module"; +import type {} from "foo"; + `; diff --git a/tests/flow_method/__snapshots__/jsfmt.spec.js.snap b/tests/flow_method/__snapshots__/jsfmt.spec.js.snap index 56a65ecc..3094aea8 100644 --- a/tests/flow_method/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_method/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`comment.js 1`] = ` -"type Foo = { +type Foo = { method( arg: number, // I belong with baz qux: string @@ -14,11 +14,11 @@ type Foo = { qux: string ): void }; -" + `; exports[`method.js 1`] = ` -"type T = { method: () => void }; +type T = { method: () => void }; type T = { method(): void }; declare class X { method(): void } declare function f(): void; @@ -29,5 +29,5 @@ type T = { method(): void }; declare class X { method(): void } declare function f(): void; var f: () => void; -" + `; diff --git a/tests/flow_object_comment/__snapshots__/jsfmt.spec.js.snap b/tests/flow_object_comment/__snapshots__/jsfmt.spec.js.snap index 870d6ba1..8909b757 100644 --- a/tests/flow_object_comment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_object_comment/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`flow_object_comment.js 1`] = ` -"export default ( +export default ( { foo, bar @@ -22,5 +22,5 @@ export default ({ // comment 2 bar?: Object }) => {}; -" + `; diff --git a/tests/flow_return_arrow/__snapshots__/jsfmt.spec.js.snap b/tests/flow_return_arrow/__snapshots__/jsfmt.spec.js.snap index 17f4406a..23776ac6 100644 --- a/tests/flow_return_arrow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_return_arrow/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`parens.js 1`] = ` -"const f = (): (string => string) => {}; +const f = (): (string => string) => {}; const f = (): (a | string => string) => {}; const f = (): (a & string => string) => {}; function f(): string => string {} @@ -10,5 +10,5 @@ const f = (): (string => string) => {}; const f = (): a | ((string) => string) => {}; const f = (): a & ((string) => string) => {}; function f(): string => string {} -" + `; diff --git a/tests/for/__snapshots__/jsfmt.spec.js.snap b/tests/for/__snapshots__/jsfmt.spec.js.snap index 6de23f3f..b23fd3cf 100644 --- a/tests/for/__snapshots__/jsfmt.spec.js.snap +++ b/tests/for/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`comment.js 1`] = ` -"for (x +for (x /*a*/ in //b y) //c @@ -64,22 +64,22 @@ for (x of y); //a for (x of y); -" + `; exports[`for.js 1`] = ` -"for (;;) {} +for (;;) {} for (var i = 0; i < 10; ++i) {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for (;;) { } for (var i = 0; i < 10; ++i) { } -" + `; exports[`in.js 1`] = ` -"for ((x in a);;) {} +for ((x in a);;) {} for (a=(a in b);;) {} for (let a = (b in c); ; ); for (a && (b in c); ; ); @@ -104,14 +104,14 @@ function* g() { async function f() { for (await (a in b); ; ); } -" + `; exports[`var.js 1`] = ` -"for (a in b) var c = {}; []; +for (a in b) var c = {}; []; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for (a in b) var c = {}; []; -" + `; diff --git a/tests/function/__snapshots__/jsfmt.spec.js.snap b/tests/function/__snapshots__/jsfmt.spec.js.snap index 7c5a63a4..6856bfe0 100644 --- a/tests/function/__snapshots__/jsfmt.spec.js.snap +++ b/tests/function/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`function_expression.js 1`] = ` -"(function() {}).length +(function() {}).length typeof (function() {}); export default (function() {})(); (function() {})()\`\`; @@ -24,5 +24,5 @@ a = function f() {} || b; (function() {} && a); a + function() {}; new function() {}(); -" + `; diff --git a/tests/function_single_destructuring/__snapshots__/jsfmt.spec.js.snap b/tests/function_single_destructuring/__snapshots__/jsfmt.spec.js.snap index 81025372..75fc1e01 100644 --- a/tests/function_single_destructuring/__snapshots__/jsfmt.spec.js.snap +++ b/tests/function_single_destructuring/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"function StatelessFunctionalComponent({ +function StatelessFunctionalComponent({ isActive, onFiltersUpdated, onSelect, @@ -122,5 +122,5 @@ type T = ({ title: number, items: number }) => void; -" + `; diff --git a/tests/if/__snapshots__/jsfmt.spec.js.snap b/tests/if/__snapshots__/jsfmt.spec.js.snap index c68ba8da..1b13bf0b 100644 --- a/tests/if/__snapshots__/jsfmt.spec.js.snap +++ b/tests/if/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`else.js 1`] = ` -"// Both functions below should be formatted exactly the same +// Both functions below should be formatted exactly the same function f() { if (position) @@ -39,11 +39,11 @@ function f() { value: pair.substring(position + 1) }; } -" + `; exports[`if_comments.js 1`] = ` -"async function f() { +async function f() { if (untrackedChoice === 0) /* Cancel */ { return null; } else if (untrackedChoice === 1) /* Add */ { @@ -113,26 +113,26 @@ async function f() { /* Allow Untracked */ allowUntracked = true; } } -" + `; exports[`trailing_comment.js 1`] = ` -"if (code === 92 /* '\\\\' */) {} -if (code === 92 /* '\\\\' */ /* '\\\\' */) {} +if (code === 92 /* '\\' */) {} +if (code === 92 /* '\\' */ /* '\\' */) {} -if (code === 92) /* '\\\\' */ {} -if (code === 92) { /* '\\\\' */ } +if (code === 92) /* '\\' */ {} +if (code === 92) { /* '\\' */ } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -if (code === 92 /* '\\\\' */) { +if (code === 92 /* '\\' */) { } -if (code === 92 /* '\\\\' */ /* '\\\\' */) { +if (code === 92 /* '\\' */ /* '\\' */) { } if (code === 92) { - /* '\\\\' */ + /* '\\' */ } if (code === 92) { - /* '\\\\' */ + /* '\\' */ } -" + `; diff --git a/tests/ignore/__snapshots__/jsfmt.spec.js.snap b/tests/ignore/__snapshots__/jsfmt.spec.js.snap index cfd4c884..b84c893d 100644 --- a/tests/ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/ignore/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ignore.js 1`] = ` -"function a() { +function a() { // prettier-ignore var fnString = - '\\"' + this.USE + ' ' + this.STRICT + '\\";\\\\n' + + '"' + this.USE + ' ' + this.STRICT + '";\\n' + this.filterPrefix() + 'var fn=' + this.generateFunction('fn', 's,l,a,i') + extra + @@ -22,8 +22,8 @@ exports[`ignore.js 1`] = ` // prettier-ignore const commentsWithPrettierIgnore = { - \\"ewww\\": - \\"gross-formatting\\", + "ewww": + "gross-formatting", }; function giveMeSome() { @@ -35,20 +35,20 @@ exports[`ignore.js 1`] = ` console.error( 'In order to use ' + prompt + ', you need to configure a ' + 'few environment variables to be able to commit to the ' + - 'repository. Follow those steps to get you setup:\\\\n' + - '\\\\n' + - 'Go to https://github.com/settings/tokens/new\\\\n' + - ' - Fill \\"Token description\\" with \\"' + prompt + ' for ' + - repoSlug + '\\"\\\\n' + - ' - Check \\"public_repo\\"\\\\n' + - ' - Press \\"Generate Token\\"\\\\n' + - '\\\\n' + + 'repository. Follow those steps to get you setup:\\n' + + '\\n' + + 'Go to https://github.com/settings/tokens/new\\n' + + ' - Fill "Token description" with "' + prompt + ' for ' + + repoSlug + '"\\n' + + ' - Check "public_repo"\\n' + + ' - Press "Generate Token"\\n' + + '\\n' + 'In a different tab, go to https://travis-ci.org/' + - repoSlug + '/settings\\\\n' + - ' - Make sure \\"Build only if .travis.yml is present\\" is ON\\\\n' + - ' - Fill \\"Name\\" with \\"GITHUB_USER\\" and \\"Value\\" with the name of the ' + - 'account you generated the token with. Press \\"Add\\"\\\\n' + - '\\\\n' + + repoSlug + '/settings\\n' + + ' - Make sure "Build only if .travis.yml is present" is ON\\n' + + ' - Fill "Name" with "GITHUB_USER" and "Value" with the name of the ' + + 'account you generated the token with. Press "Add"\\n' + + '\\n' + 'Once this is done, commit anything to the repository to restart ' + 'Travis and it should work :)' ); @@ -68,7 +68,7 @@ exports[`ignore.js 1`] = ` function a() { // prettier-ignore var fnString = - '\\"' + this.USE + ' ' + this.STRICT + '\\";\\\\n' + + '"' + this.USE + ' ' + this.STRICT + '";\\n' + this.filterPrefix() + 'var fn=' + this.generateFunction('fn', 's,l,a,i') + extra + @@ -86,8 +86,8 @@ function a() { // prettier-ignore const commentsWithPrettierIgnore = { - \\"ewww\\": - \\"gross-formatting\\", + "ewww": + "gross-formatting", }; function giveMeSome() { @@ -99,20 +99,20 @@ function a() { console.error( 'In order to use ' + prompt + ', you need to configure a ' + 'few environment variables to be able to commit to the ' + - 'repository. Follow those steps to get you setup:\\\\n' + - '\\\\n' + - 'Go to https://github.com/settings/tokens/new\\\\n' + - ' - Fill \\"Token description\\" with \\"' + prompt + ' for ' + - repoSlug + '\\"\\\\n' + - ' - Check \\"public_repo\\"\\\\n' + - ' - Press \\"Generate Token\\"\\\\n' + - '\\\\n' + + 'repository. Follow those steps to get you setup:\\n' + + '\\n' + + 'Go to https://github.com/settings/tokens/new\\n' + + ' - Fill "Token description" with "' + prompt + ' for ' + + repoSlug + '"\\n' + + ' - Check "public_repo"\\n' + + ' - Press "Generate Token"\\n' + + '\\n' + 'In a different tab, go to https://travis-ci.org/' + - repoSlug + '/settings\\\\n' + - ' - Make sure \\"Build only if .travis.yml is present\\" is ON\\\\n' + - ' - Fill \\"Name\\" with \\"GITHUB_USER\\" and \\"Value\\" with the name of the ' + - 'account you generated the token with. Press \\"Add\\"\\\\n' + - '\\\\n' + + repoSlug + '/settings\\n' + + ' - Make sure "Build only if .travis.yml is present" is ON\\n' + + ' - Fill "Name" with "GITHUB_USER" and "Value" with the name of the ' + + 'account you generated the token with. Press "Add"\\n' + + '\\n' + 'Once this is done, commit anything to the repository to restart ' + 'Travis and it should work :)' ); @@ -127,5 +127,5 @@ function a() { ); } } -" + `; diff --git a/tests/import/__snapshots__/jsfmt.spec.js.snap b/tests/import/__snapshots__/jsfmt.spec.js.snap index b91d0562..2c7c3b7d 100644 --- a/tests/import/__snapshots__/jsfmt.spec.js.snap +++ b/tests/import/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`brackets.js 1`] = ` -"import { +import { runTaskForChanged, description, someOtherLabel, @@ -22,13 +22,13 @@ import { multiLine, andMore, soWeCanGetItTo80Columns -} from \\".\\"; -import { fitsIn, oneLine } from \\".\\"; -" +} from "."; +import { fitsIn, oneLine } from "."; + `; exports[`brackets.js 2`] = ` -"import { +import { runTaskForChanged, description, someOtherLabel, @@ -49,34 +49,34 @@ import { multiLine, andMore, soWeCanGetItTo80Columns -} from \\".\\"; -import {fitsIn, oneLine} from \\".\\"; -" +} from "."; +import {fitsIn, oneLine} from "."; + `; exports[`comments.js 1`] = ` -"import { a //comment1 +import { a //comment1 //comment2 //comment3 -as b} from \\"\\"; +as b} from ""; import { a as //comment1 //comment2 //comment3 b -} from \\"\\"; +} from ""; import { a as //comment2 //comment1 //comment3 b -} from \\"\\"; +} from ""; import { a as //comment3 //comment2 //comment1 b -} from \\"\\"; +} from ""; import { // comment 1 @@ -86,32 +86,32 @@ import { FN4 /* comment 4 */ // FN4, // FN5 -} from \\"./module\\"; +} from "./module"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import { //comment1 //comment2 //comment3 a as b -} from \\"\\"; +} from ""; import { //comment1 //comment2 //comment3 a as b -} from \\"\\"; +} from ""; import { //comment2 //comment1 //comment3 a as b -} from \\"\\"; +} from ""; import { //comment3 //comment2 //comment1 a as b -} from \\"\\"; +} from ""; import { // comment 1 @@ -121,33 +121,33 @@ import { FN4 /* comment 4 */ // FN4, // FN5 -} from \\"./module\\"; -" +} from "./module"; + `; exports[`comments.js 2`] = ` -"import { a //comment1 +import { a //comment1 //comment2 //comment3 -as b} from \\"\\"; +as b} from ""; import { a as //comment1 //comment2 //comment3 b -} from \\"\\"; +} from ""; import { a as //comment2 //comment1 //comment3 b -} from \\"\\"; +} from ""; import { a as //comment3 //comment2 //comment1 b -} from \\"\\"; +} from ""; import { // comment 1 @@ -157,32 +157,32 @@ import { FN4 /* comment 4 */ // FN4, // FN5 -} from \\"./module\\"; +} from "./module"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import { //comment1 //comment2 //comment3 a as b -} from \\"\\"; +} from ""; import { //comment1 //comment2 //comment3 a as b -} from \\"\\"; +} from ""; import { //comment2 //comment1 //comment3 a as b -} from \\"\\"; +} from ""; import { //comment3 //comment2 //comment1 a as b -} from \\"\\"; +} from ""; import { // comment 1 @@ -192,36 +192,36 @@ import { FN4 /* comment 4 */ // FN4, // FN5 -} from \\"./module\\"; -" +} from "./module"; + `; exports[`long-line.js 1`] = ` -"import someCoolUtilWithARatherLongName from '../../../../utils/someCoolUtilWithARatherLongName'; +import someCoolUtilWithARatherLongName from '../../../../utils/someCoolUtilWithARatherLongName'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import someCoolUtilWithARatherLongName - from \\"../../../../utils/someCoolUtilWithARatherLongName\\"; -" + from "../../../../utils/someCoolUtilWithARatherLongName"; + `; exports[`long-line.js 2`] = ` -"import someCoolUtilWithARatherLongName from '../../../../utils/someCoolUtilWithARatherLongName'; +import someCoolUtilWithARatherLongName from '../../../../utils/someCoolUtilWithARatherLongName'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import someCoolUtilWithARatherLongName - from \\"../../../../utils/someCoolUtilWithARatherLongName\\"; -" + from "../../../../utils/someCoolUtilWithARatherLongName"; + `; exports[`multiple_standalones.js 1`] = ` -"import a, * as b from 'a'; +import a, * as b from 'a'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import a, * as b from \\"a\\"; -" +import a, * as b from "a"; + `; exports[`multiple_standalones.js 2`] = ` -"import a, * as b from 'a'; +import a, * as b from 'a'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -import a, * as b from \\"a\\"; -" +import a, * as b from "a"; + `; diff --git a/tests/interface/__snapshots__/jsfmt.spec.js.snap b/tests/interface/__snapshots__/jsfmt.spec.js.snap index fb6e736b..e95644dc 100644 --- a/tests/interface/__snapshots__/jsfmt.spec.js.snap +++ b/tests/interface/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`break.js 1`] = ` -"export interface Environment1 extends GenericEnvironment< +export interface Environment1 extends GenericEnvironment< SomeType, AnotherType, YetAnotherType, @@ -24,16 +24,16 @@ export class Environment2 extends GenericEnvironment { m() {} } -" + `; exports[`module.js 1`] = ` -"declare module X { +declare module X { declare interface Y { x: number; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare module X { declare interface Y { x: number } } -" + `; diff --git a/tests/intersection/__snapshots__/jsfmt.spec.js.snap b/tests/intersection/__snapshots__/jsfmt.spec.js.snap index 6189c753..0971a5cb 100644 --- a/tests/intersection/__snapshots__/jsfmt.spec.js.snap +++ b/tests/intersection/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`intersection.js 1`] = ` -"export type ReallyBigSocketServer = ReallyBigSocketServerInterface & ReallyBigSocketServerStatics; +export type ReallyBigSocketServer = ReallyBigSocketServerInterface & ReallyBigSocketServerStatics; type Props = { focusedChildren?: React.Children, @@ -77,5 +77,5 @@ type DuplexStreamOptions = ReadableStreamOptions & allowHalfOpen?: boolean, readableObjectMode?: boolean }; -" + `; diff --git a/tests/jsx-multiline-assign/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-multiline-assign/__snapshots__/jsfmt.spec.js.snap index 081bf0d1..be5efadc 100644 --- a/tests/jsx-multiline-assign/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx-multiline-assign/__snapshots__/jsfmt.spec.js.snap @@ -1,54 +1,54 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"const comp1 = ( -
+const comp1 = ( +
Keep the wrapping parens.
); -const comp2 =
+const comp2 =
Create wrapping parens.
; -comp2A =
+comp2A =
Create wrapping parens.
; -const comp3 =
Bump to next line without parens
; +const comp3 =
Bump to next line without parens
; -const comp4 =
Create wrapping parens and indent all the things.
; +const comp4 =
Create wrapping parens and indent all the things.
; const comp5 =
Keep it on one line.
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const comp1 = ( -
+
Keep the wrapping parens.
); const comp2 = ( -
+
Create wrapping parens.
); comp2A = ( -
+
Create wrapping parens.
); const comp3 = ( -
Bump to next line without parens
+
Bump to next line without parens
); const comp4 = ( -
+
Create wrapping parens and indent all the things.
); const comp5 =
Keep it on one line.
; -" + `; diff --git a/tests/jsx-newlines/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-newlines/__snapshots__/jsfmt.spec.js.snap index 5d95e552..49d995e1 100644 --- a/tests/jsx-newlines/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx-newlines/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"keep =

+keep =

Welcome to the Universal React Starter-kyt. This starter kyt should serve as the base for an advanced, server-rendered React app. @@ -78,7 +78,7 @@ newlines_elems = regression_extra_newline = (

New Messages
@@ -89,8 +89,8 @@ regression_extra_newline_2 = (
( )
@@ -170,7 +170,7 @@ newlines_elems = ( regression_extra_newline = (
- + New Messages
); @@ -179,22 +179,22 @@ regression_extra_newline_2 = (
( )
); -" + `; exports[`windows.js 1`] = ` -"
+
Text
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Text
; -" + `; diff --git a/tests/jsx-significant-space/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-significant-space/__snapshots__/jsfmt.spec.js.snap index 36c0f42c..e1bb3b16 100644 --- a/tests/jsx-significant-space/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx-significant-space/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"after = +after = foo bar @@ -52,19 +52,19 @@ nest_plz =
regression_not_transformed_1 = - ; + ; regression_not_transformed_2 = - ; + ; similar_1 = - ; + ; similar_2 = - ; + ; similar_3 = - ; + ; not_broken_end =
@@ -91,7 +91,7 @@ before = ( before_break1 = ( - {\\" \\"} + {" "} foo ); @@ -101,7 +101,7 @@ before_break2 = ( - {\\" \\"} + {" "} foo ); @@ -109,7 +109,7 @@ before_break2 = ( after_break = ( foo - {\\" \\"} + {" "} ); @@ -146,42 +146,42 @@ nest_plz = ( regression_not_transformed_1 = ( - {\\" \\"} + {" "} ); regression_not_transformed_2 = ( - {\\" \\"} + {" "} ); similar_1 = ( - {\\" \\"} - + {" "} + ); similar_2 = ( - - {\\" \\"} + + {" "} ); similar_3 = ( - + ); not_broken_end = (
long text long text long text long text long text long text long text long text - {\\" \\"} + {" "} url - {\\" \\"} + {" "} long text long text
); @@ -189,12 +189,12 @@ not_broken_end = ( not_broken_begin = (

- {\\" \\"} + {" "} long text long text long text long text long text long text long text long text url - {\\" \\"} + {" "} long text long text
); -" + `; diff --git a/tests/jsx-split-attrs/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-split-attrs/__snapshots__/jsfmt.spec.js.snap index efb23b71..b672ecc8 100644 --- a/tests/jsx-split-attrs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx-split-attrs/__snapshots__/jsfmt.spec.js.snap @@ -1,72 +1,72 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"long_closed = - +long_closed = + long_open = - + hello long_open_long_children = - - + + Hello world
hey hiya how are ya
-
+
-
+
- d - + d + short_closed = - + short_open = - + hello make_self_closing =
- + - +
leave_opening = - + long_string = -
hello world
+
hello world
long_string_with_extra_param = -
hello world
+
hello world
long_obj =
hello world
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ long_closed = ( ); long_open = ( hello @@ -74,18 +74,18 @@ long_open = ( long_open_long_children = ( Hello world @@ -94,59 +94,59 @@ long_open_long_children = (
-
+
d ); -short_closed = ; +short_closed = ; short_open = ( - + hello ); @@ -154,44 +154,44 @@ short_open = ( make_self_closing = (
); leave_opening = ( - {\\" \\"} + {" "} ); long_string = ( -
+
hello world
); long_string_with_extra_param = (
hello world
@@ -200,15 +200,15 @@ long_string_with_extra_param = ( long_obj = (
hello world
); -" + `; diff --git a/tests/jsx-stateless-arrow-fn/__snapshots__/jsfmt.spec.js.snap b/tests/jsx-stateless-arrow-fn/__snapshots__/jsfmt.spec.js.snap index 21a7ac78..dd9d5787 100644 --- a/tests/jsx-stateless-arrow-fn/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx-stateless-arrow-fn/__snapshots__/jsfmt.spec.js.snap @@ -1,28 +1,28 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"const render1 = ({ styles }) => ( -
+const render1 = ({ styles }) => ( +
Keep the wrapping parens. Put each key on its own line.
); -const render2 = ({ styles }) =>
+const render2 = ({ styles }) =>
Create wrapping parens.
; -const render3 = ({ styles }) =>
Bump to next line without parens
; +const render3 = ({ styles }) =>
Bump to next line without parens
; -const render4 = ({ styles }) =>
Create wrapping parens and indent all the things.
; +const render4 = ({ styles }) =>
Create wrapping parens and indent all the things.
; const render5 = ({ styles }) =>
Keep it on one line.
; const render6 = ({ styles }) => ( -
-
ddd d dd d d dddd dddd hello
-
ddd d dd d d dddd dddd hello
-
-
ddd d dd d d dddd dddd hello
hello
+
+
ddd d dd d d dddd dddd hello
+
ddd d dd d d dddd dddd hello
+
+
ddd d dd d d dddd dddd hello
hello
) @@ -53,46 +53,46 @@ const render10 = (props) =>
{props.even_loooooooooooooooooooooooooooooooooo const notJSX = (aaaaaaaaaaaaaaaaa, bbbbbbbbbbb) => this.someLongCallWithParams(aaaaaa, bbbbbbb).anotherLongCallWithParams(cccccccccccc, dddddddddddddddddddddd) React.render( - + , document.querySelector('#react-root') ) const renderTernary = (props) => - + {props.showTheThing ? - Hello world - : \\"hello \\" + \\"howdy! \\"} + Hello world + : "hello " + "howdy! "} {props.showTheThing ? - Hello world + Hello world : null } {props.showTheThing ? null : - Hello world + Hello world } - {props.showTheOtherThing ?
I am here
:
} + {props.showTheOtherThing ?
I am here
:
} {props.showTheOtherThing ?
I am here!!
: null} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const render1 = ({ styles }) => ( -
+
Keep the wrapping parens. Put each key on its own line.
); const render2 = ({ styles }) => ( -
+
Create wrapping parens.
); const render3 = ({ styles }) => ( -
Bump to next line without parens
+
Bump to next line without parens
); const render4 = ({ styles }) => ( -
+
Create wrapping parens and indent all the things.
); @@ -100,38 +100,38 @@ const render4 = ({ styles }) => ( const render5 = ({ styles }) =>
Keep it on one line.
; const render6 = ({ styles }) => ( -
+
ddd d dd d d dddd dddd hello
ddd d dd d d dddd dddd hello
ddd d dd d d dddd dddd hello
- {\\" \\"} + {" "} hello
@@ -176,41 +176,41 @@ const notJSX = (aaaaaaaaaaaaaaaaa, bbbbbbbbbbb) => React.render( , - document.querySelector(\\"#react-root\\") + document.querySelector("#react-root") ); const renderTernary = props => ( {props.showTheThing ? Hello world - : \\"hello \\" + \\"howdy! \\"} + : "hello " + "howdy! "} {props.showTheThing ? Hello world @@ -218,17 +218,17 @@ const renderTernary = props => ( {props.showTheThing ? null : Hello world } - {props.showTheOtherThing ?
I am here
:
} + {props.showTheOtherThing ?
I am here
:
} {props.showTheOtherThing ?
I am here!!
: null} ); -" + `; diff --git a/tests/jsx/__snapshots__/jsfmt.spec.js.snap b/tests/jsx/__snapshots__/jsfmt.spec.js.snap index defb942d..42b9326b 100644 --- a/tests/jsx/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`expression.js 1`] = ` -"; @@ -16,10 +16,10 @@ exports[`expression.js 1`] = ` style={ [ { - someVeryLongStyle1: \\"true\\", - someVeryLongStyle2: \\"true\\", - someVeryLongStyle3: \\"true\\", - someVeryLongStyle4: \\"true\\" + someVeryLongStyle1: "true", + someVeryLongStyle2: "true", + someVeryLongStyle3: "true", + someVeryLongStyle4: "true" } ] } @@ -70,20 +70,20 @@ exports[`expression.js 1`] = ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; @@ -136,22 +136,22 @@ exports[`expression.js 1`] = ` } />; -" + `; exports[`html_escape.js 1`] = ` -"export default () => ; +export default () => ; -() => ; +() => ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -export default () => ; +export default () => ; + +() => ; -() => ; -" `; exports[`hug.js 1`] = ` -"
+
{__DEV__ ? this.renderDevApp() :
@@ -159,7 +159,7 @@ exports[`hug.js 1`] = ` ))} @@ -172,7 +172,7 @@ exports[`hug.js 1`] = ` ))} @@ -192,7 +192,7 @@ exports[`hug.js 1`] = ` ))} @@ -206,7 +206,7 @@ exports[`hug.js 1`] = ` ))} @@ -215,18 +215,18 @@ exports[`hug.js 1`] = `
{member.memberName.memberSomething + - (member.memberDef.memberSomething.signatures ? \\"()\\" : \\"\\")} + (member.memberDef.memberSomething.signatures ? "()" : "")}
; -" + `; exports[`object-property.js 1`] = ` -"const tabs = [ +const tabs = [ { - title: \\"General Info\\", + title: "General Info", content: ( { a }}>{header}{showSort}; @@ -260,7 +260,7 @@ onClick={() => { { a -}}>{header}; +}}>{header}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { @@ -276,13 +276,13 @@ onClick={() => { }} > {header} - + ; -" + `; exports[`parens.js 1`] = ` -"a = [ +a = [ , ];
; -" + `; exports[`quotes.js 1`] = ` -"
&quot;\\" />; -
; -
&quot;'} />; +
; +
; +
&quot;'} />; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
&quot;\\" />; -
&quot;\\" />; -
&quot;\\"} />; -" +
; +
; +
&quot;"} />; + `; diff --git a/tests/jsx_escape/__snapshots__/jsfmt.spec.js.snap b/tests/jsx_escape/__snapshots__/jsfmt.spec.js.snap index 2f56656c..7764da94 100644 --- a/tests/jsx_escape/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx_escape/__snapshots__/jsfmt.spec.js.snap @@ -1,21 +1,21 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`escape.js 1`] = ` -"
<
+
<
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<
; -" + `; exports[`escape.js 2`] = ` -"
<
+
<
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<
; -" + `; exports[`nbsp.js 1`] = ` -"many_nbsp =
   
+many_nbsp =
   
single_nbsp =
 
many_raw_nbsp =
   
@@ -28,11 +28,11 @@ single_nbsp =
 
; many_raw_nbsp =
   
; amp = foo & bar; raw_amp = foo & bar; -" + `; exports[`nbsp.js 2`] = ` -"many_nbsp =
   
+many_nbsp =
   
single_nbsp =
 
many_raw_nbsp =
   
@@ -46,5 +46,5 @@ many_raw_nbsp =
   
; amp = foo & bar; raw_amp = foo & bar; -" + `; diff --git a/tests/jsx_last_line/__snapshots__/jsfmt.spec.js.snap b/tests/jsx_last_line/__snapshots__/jsfmt.spec.js.snap index 706d39b7..0ac63048 100644 --- a/tests/jsx_last_line/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx_last_line/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`last_line.js 1`] = ` -"and the children go here
and here too
; -" + `; exports[`last_line.js 2`] = ` -"and the children go here
and here too
; -" + `; diff --git a/tests/jsx_template/__snapshots__/jsfmt.spec.js.snap b/tests/jsx_template/__snapshots__/jsfmt.spec.js.snap index f2540360..1eb3222a 100644 --- a/tests/jsx_template/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx_template/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`styled-components.js 1`] = ` -"; -" + `; diff --git a/tests/label/__snapshots__/jsfmt.spec.js.snap b/tests/label/__snapshots__/jsfmt.spec.js.snap index 6677c80e..479ba764 100644 --- a/tests/label/__snapshots__/jsfmt.spec.js.snap +++ b/tests/label/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`comment.js 1`] = ` -"{ +{ inf_leave: // goto emulation for (;;) {} } @@ -11,14 +11,14 @@ exports[`comment.js 1`] = ` inf_leave: for (;;) { } } -" + `; exports[`empty_label.js 1`] = ` -"a:; +a:; b ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a:; b; -" + `; diff --git a/tests/last_argument_expansion/__snapshots__/jsfmt.spec.js.snap b/tests/last_argument_expansion/__snapshots__/jsfmt.spec.js.snap index b93ec243..89561686 100644 --- a/tests/last_argument_expansion/__snapshots__/jsfmt.spec.js.snap +++ b/tests/last_argument_expansion/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`arrow.js 1`] = ` -"export default function searchUsers(action$) { +export default function searchUsers(action$) { return action$.ofType(ActionTypes.SEARCHED_USERS) .map(action => action.payload.query) .filter(q => !!q) @@ -36,18 +36,18 @@ export default function searchUsers(action$) { ) ); } -" + `; exports[`break-parent.js 1`] = ` -"({ +({ processors: [ - require(\\"autoprefixer\\", { - browsers: [\\"> 1%\\", \\"last 2 versions\\", \\"ie >= 11\\", \\"Firefox ESR\\"] + require("autoprefixer", { + browsers: ["> 1%", "last 2 versions", "ie >= 11", "Firefox ESR"] }), - require(\\"postcss-url\\")({ + require("postcss-url")({ url: url => - url.startsWith(\\"/\\") || /^[a-z]+:/.test(url) ? url : \`/static/\${url}\` + url.startsWith("/") || /^[a-z]+:/.test(url) ? url : \`/static/\${url}\` }) ] }); @@ -68,12 +68,12 @@ true ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ({ processors: [ - require(\\"autoprefixer\\", { - browsers: [\\"> 1%\\", \\"last 2 versions\\", \\"ie >= 11\\", \\"Firefox ESR\\"] + require("autoprefixer", { + browsers: ["> 1%", "last 2 versions", "ie >= 11", "Firefox ESR"] }), - require(\\"postcss-url\\")({ + require("postcss-url")({ url: url => - (url.startsWith(\\"/\\") || /^[a-z]+:/.test(url) ? url : \`/static/\${url}\`) + (url.startsWith("/") || /^[a-z]+:/.test(url) ? url : \`/static/\${url}\`) }) ] }); @@ -91,26 +91,26 @@ true f={123412341234} g={123412341234} />; -" + `; exports[`jsx.js 1`] = ` -"const els = items.map(item => ( -
+const els = items.map(item => ( +
{children}
)); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const els = items.map(item => ( -
+
{children}
)); -" + `; exports[`object.js 1`] = ` -"const formatData = pipe( +const formatData = pipe( zip, map(([ ref, data ]) => ({ nodeId: ref.nodeId.toString(), @@ -136,24 +136,24 @@ const formatData = pipe( nodeId: ref.nodeId.toString(), ...attributeFromDataValue(ref.attributeId, data) })), - groupBy(prop(\\"nodeId\\")), + groupBy(prop("nodeId")), map(mergeAll), values ); export const setProp = y => ({ ...y, - a: \\"very, very, very long very, very long text\\" + a: "very, very, very long very, very long text" }); export const log = y => { - console.log(\\"very, very, very long very, very long text\\"); + console.log("very, very, very long very, very long text"); }; -" + `; exports[`overflow.js 1`] = ` -"SuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLongCall((err, result) => { +SuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLongCall((err, result) => { // comment }); @@ -264,5 +264,5 @@ func( // Comments } ); -" + `; diff --git a/tests/line/__snapshots__/jsfmt.spec.js.snap b/tests/line/__snapshots__/jsfmt.spec.js.snap index 2869d3af..f1564de1 100644 --- a/tests/line/__snapshots__/jsfmt.spec.js.snap +++ b/tests/line/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`windows.js 1`] = ` -"const vscode = require(\\"vscode\\"); -const {getDir, getActiveFile, uint8arrayToString} = require(\\"./utils\\"); +const vscode = require("vscode"); +const {getDir, getActiveFile, uint8arrayToString} = require("./utils"); let outChannel; let _commands; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -const vscode = require(\\"vscode\\"); -const { getDir, getActiveFile, uint8arrayToString } = require(\\"./utils\\"); +const vscode = require("vscode"); +const { getDir, getActiveFile, uint8arrayToString } = require("./utils"); let outChannel; let _commands; -" + `; diff --git a/tests/line_suffix_boundary/__snapshots__/jsfmt.spec.js.snap b/tests/line_suffix_boundary/__snapshots__/jsfmt.spec.js.snap index 50b989f5..b118a425 100644 --- a/tests/line_suffix_boundary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/line_suffix_boundary/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`boundary.js 1`] = ` -"\`\${ +\`\${ a + // a a } @@ -41,12 +41,12 @@ a} d} \${/* $FlowFixMe found when converting React.createClass to ES6*/ -ExampleStory.getFragment(\\"story\\")} +ExampleStory.getFragment("story")} \`;
- {ExampleStory.getFragment(\\"story\\") // $FlowFixMe found when converting React.createClass to ES6 + {ExampleStory.getFragment("story") // $FlowFixMe found when converting React.createClass to ES6 }
; -" + `; diff --git a/tests/literal/__snapshots__/jsfmt.spec.js.snap b/tests/literal/__snapshots__/jsfmt.spec.js.snap index 19f45910..5a727503 100644 --- a/tests/literal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/literal/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`number.js 1`] = ` -"// parentheses around numeric literal should be preserved +// parentheses around numeric literal should be preserved function test5(): string { return (100).toString(); } @@ -130,5 +130,5 @@ function test5(): string { 0.5; 0.5; 0.5; -" + `; diff --git a/tests/member/__snapshots__/jsfmt.spec.js.snap b/tests/member/__snapshots__/jsfmt.spec.js.snap index 1191d9b3..a59d573d 100644 --- a/tests/member/__snapshots__/jsfmt.spec.js.snap +++ b/tests/member/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`expand.js 1`] = ` -"const veryVeryVeryVeryVeryVeryVeryLong = doc.expandedStates[doc.expandedStates.length - 1]; +const veryVeryVeryVeryVeryVeryVeryLong = doc.expandedStates[doc.expandedStates.length - 1]; const small = doc.expandedStates[doc.expandedStates.length - 1]; const promises = [ @@ -48,5 +48,5 @@ const promises = [ redis.fetch(), other.fetch() ]; -" + `; diff --git a/tests/method-chain/__snapshots__/jsfmt.spec.js.snap b/tests/method-chain/__snapshots__/jsfmt.spec.js.snap index f471c275..2cfbe30a 100644 --- a/tests/method-chain/__snapshots__/jsfmt.spec.js.snap +++ b/tests/method-chain/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`break-last-call.js 1`] = ` -"export default store => { +export default store => { return callApi(endpoint, schema).then( response => next(actionWith({ response, @@ -50,77 +50,77 @@ export default store => { next( actionWith({ type: failureType, - error: error.message || \\"Something bad happened\\" + error: error.message || "Something bad happened" }) ) ); }; -it(\\"should group messages with same created time\\", () => { +it("should group messages with same created time", () => { expect(groupMessages(messages).toJS()).toEqual({ - \\"11/01/2017 13:36\\": [ + "11/01/2017 13:36": [ { - message: \\"test\\", - messageType: \\"SMS\\", - status: \\"Unknown\\", - created: \\"11/01/2017 13:36\\" + message: "test", + messageType: "SMS", + status: "Unknown", + created: "11/01/2017 13:36" }, { - message: \\"test\\", - messageType: \\"Email\\", - status: \\"Unknown\\", - created: \\"11/01/2017 13:36\\" + message: "test", + messageType: "Email", + status: "Unknown", + created: "11/01/2017 13:36" } ], - \\"09/01/2017 17:25\\": [ + "09/01/2017 17:25": [ { - message: \\"te\\", - messageType: \\"SMS\\", - status: \\"Unknown\\", - created: \\"09/01/2017 17:25\\" + message: "te", + messageType: "SMS", + status: "Unknown", + created: "09/01/2017 17:25" }, { - message: \\"te\\", - messageType: \\"Email\\", - status: \\"Unknown\\", - created: \\"09/01/2017 17:25\\" + message: "te", + messageType: "Email", + status: "Unknown", + created: "09/01/2017 17:25" } ], - \\"11/01/2017 13:33\\": [ + "11/01/2017 13:33": [ { - message: \\"test\\", - messageType: \\"SMS\\", - status: \\"Unknown\\", - created: \\"11/01/2017 13:33\\" + message: "test", + messageType: "SMS", + status: "Unknown", + created: "11/01/2017 13:33" }, { - message: \\"test\\", - messageType: \\"Email\\", - status: \\"Unknown\\", - created: \\"11/01/2017 13:33\\" + message: "test", + messageType: "Email", + status: "Unknown", + created: "11/01/2017 13:33" } ], - \\"11/01/2017 13:37\\": [ + "11/01/2017 13:37": [ { - message: \\"test\\", - messageType: \\"SMS\\", - status: \\"Unknown\\", - created: \\"11/01/2017 13:37\\" + message: "test", + messageType: "SMS", + status: "Unknown", + created: "11/01/2017 13:37" }, { - message: \\"test\\", - messageType: \\"Email\\", - status: \\"Unknown\\", - created: \\"11/01/2017 13:37\\" + message: "test", + messageType: "Email", + status: "Unknown", + created: "11/01/2017 13:37" } ] }); }); -" + `; exports[`break-last-member.js 1`] = ` -"SomeVeryLongUpperCaseConstant.someVeryLongCallExpression().some_very_long_member_expression +SomeVeryLongUpperCaseConstant.someVeryLongCallExpression().some_very_long_member_expression weNeedToReachTheEightyCharacterLimitXXXXXXXXXXXXXXXXX.someNode .childrenInAnArray[0]; superSupersuperSupersuperSupersuperSupersuperSuperLong.exampleOfOrderOfGetterAndSetterReordered; @@ -141,12 +141,12 @@ superSupersuperSupersuperSupersuperSupersuperSuperLong expect( findDOMNode(component.instance()).getElementsByClassName(styles.inner)[0] .style.paddingRight -).toBe(\\"1000px\\"); -" +).toBe("1000px"); + `; exports[`comment.js 1`] = ` -"function f() { +function f() { return observableFromSubscribeFunction() // Debounce manually rather than using editor.onDidStopChanging so that the debounce time is // configurable. @@ -186,11 +186,11 @@ _.a( _.a( a ) /* very very very very very very very long such that it is longer than 80 columns */.a(); -" + `; exports[`first_long.js 1`] = ` -"export default function theFunction(action$, store) { +export default function theFunction(action$, store) { return action$.ofType(THE_ACTION).switchMap(action => Observable .webSocket({ url: THE_URL, @@ -258,11 +258,11 @@ function f() { fileMetadata[H.DEPENDENCIES] = metadata.dependencies || []; }); } -" + `; exports[`inline_merge.js 1`] = ` -"Object.keys( +Object.keys( availableLocales({ test: true }) @@ -278,92 +278,92 @@ Object.keys( ).forEach(locale => { // ... }); -" + `; exports[`logical.js 1`] = ` -"(veryLongVeryLongVeryLong || e).map(tickets => +(veryLongVeryLongVeryLong || e).map(tickets => TicketRecord.createFromSomeLongString()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (veryLongVeryLongVeryLong || e) .map(tickets => TicketRecord.createFromSomeLongString()); -" + `; exports[`multiple-members.js 1`] = ` -"if (testConfig.ENABLE_ONLINE_TESTS === \\"true\\") { - describe(\\"POST /users/me/pet\\", function() { - it(\\"saves pet\\", function() { +if (testConfig.ENABLE_ONLINE_TESTS === "true") { + describe("POST /users/me/pet", function() { + it("saves pet", function() { function assert(pet) { - expect(pet).to.have.property(\\"OwnerAddress\\").that.deep.equals({ - AddressLine1: \\"Alexanderstrasse\\", - AddressLine2: \\"\\", - PostalCode: \\"10999\\", - Region: \\"Berlin\\", - City: \\"Berlin\\", - Country: \\"DE\\" + expect(pet).to.have.property("OwnerAddress").that.deep.equals({ + AddressLine1: "Alexanderstrasse", + AddressLine2: "", + PostalCode: "10999", + Region: "Berlin", + City: "Berlin", + Country: "DE" }); } }); }); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -if (testConfig.ENABLE_ONLINE_TESTS === \\"true\\") { - describe(\\"POST /users/me/pet\\", function() { - it(\\"saves pet\\", function() { +if (testConfig.ENABLE_ONLINE_TESTS === "true") { + describe("POST /users/me/pet", function() { + it("saves pet", function() { function assert(pet) { - expect(pet).to.have.property(\\"OwnerAddress\\").that.deep.equals({ - AddressLine1: \\"Alexanderstrasse\\", - AddressLine2: \\"\\", - PostalCode: \\"10999\\", - Region: \\"Berlin\\", - City: \\"Berlin\\", - Country: \\"DE\\" + expect(pet).to.have.property("OwnerAddress").that.deep.equals({ + AddressLine1: "Alexanderstrasse", + AddressLine2: "", + PostalCode: "10999", + Region: "Berlin", + City: "Berlin", + Country: "DE" }); } }); }); } -" + `; exports[`square_0.js 1`] = ` -"const version = someLongString +const version = someLongString .split('jest version =') .pop() .split(EOL)[0] .trim(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const version = someLongString - .split(\\"jest version =\\") + .split("jest version =") .pop() .split(EOL)[0] .trim(); -" + `; exports[`test.js 1`] = ` -"method().then(x => x) - [\\"abc\\"](x => x) +method().then(x => x) + ["abc"](x => x) [abc](x => x); ({}.a().b()); ({}).a().b(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -method().then(x => x)[\\"abc\\"](x => x)[abc](x => x); +method().then(x => x)["abc"](x => x)[abc](x => x); ({}.a().b()); ({}.a().b()); -" + `; exports[`this.js 1`] = ` -"const sel = this.connections +const sel = this.connections .concat(this.activities.concat(this.operators)) .filter(x => x.selected); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const sel = this.connections .concat(this.activities.concat(this.operators)) .filter(x => x.selected); -" + `; diff --git a/tests/new_expression/__snapshots__/jsfmt.spec.js.snap b/tests/new_expression/__snapshots__/jsfmt.spec.js.snap index c545c407..79f675fc 100644 --- a/tests/new_expression/__snapshots__/jsfmt.spec.js.snap +++ b/tests/new_expression/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`call.js 1`] = ` -"new (factory())() +new (factory())() new factory()() new (factory())(factory()) @@ -10,14 +10,14 @@ new (factory())(); new factory()(); new (factory())(factory()); -" + `; exports[`new_expression.js 1`] = ` -"new (memoize.Cache || MapCache) -new (typeof this == \\"function\\" ? this : Dict()) +new (memoize.Cache || MapCache) +new (typeof this == "function" ? this : Dict()) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ new (memoize.Cache || MapCache)(); -new (typeof this == \\"function\\" ? this : Dict())(); -" +new (typeof this == "function" ? this : Dict())(); + `; diff --git a/tests/newline/__snapshots__/jsfmt.spec.js.snap b/tests/newline/__snapshots__/jsfmt.spec.js.snap index be2ad3d0..50be9785 100644 --- a/tests/newline/__snapshots__/jsfmt.spec.js.snap +++ b/tests/newline/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`backslash_2028.js 1`] = ` -"1;/*a*///b
/*c*/2 +1;/*a*///b
/*c*/2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1; /*a*/ //b
/*c*/2 -" + `; exports[`backslash_2029.js 1`] = ` -"1;/*a*///b
/*c*/2 +1;/*a*///b
/*c*/2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1; /*a*/ //b
/*c*/2 -" + `; diff --git a/tests/no-semi/__snapshots__/jsfmt.spec.js.snap b/tests/no-semi/__snapshots__/jsfmt.spec.js.snap index 11038a7f..431ed42c 100644 --- a/tests/no-semi/__snapshots__/jsfmt.spec.js.snap +++ b/tests/no-semi/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`no-semi.js 1`] = ` -" + // with preexisting semi x; [1, 2, 3].forEach(fn) @@ -161,13 +161,13 @@ x; x; [a, b, ...c] = [1, 2]; x; -/r/i.test(\\"r\\"); +/r/i.test("r"); x; +1; x; -1; x; -(\\"h\\" + \\"i\\").repeat(10); +("h" + "i").repeat(10); x; 1, 2; x; @@ -231,16 +231,16 @@ class A { *i() {} a = 1; - get [\\"y\\"]() {} + get ["y"]() {} a = 1; - static [\\"y\\"]() {} + static ["y"]() {} a = 1; - set [\\"z\\"](z) {} + set ["z"](z) {} a = 1; - async [\\"a\\"]() {} + async ["a"]() {} a = 1; async *g() {} @@ -318,11 +318,11 @@ while (false) aReallyLongLine012345678901234567890123456789012345678901234567890123456789 * (b + c); -" + `; exports[`no-semi.js 2`] = ` -" + // with preexisting semi x; [1, 2, 3].forEach(fn) @@ -482,13 +482,13 @@ x x ;[a, b, ...c] = [1, 2] x -;/r/i.test(\\"r\\") +;/r/i.test("r") x ;+1 x ;-1 x -;(\\"h\\" + \\"i\\").repeat(10) +;("h" + "i").repeat(10) x 1, 2 x @@ -552,16 +552,16 @@ class A { *i() {} a = 1 - get [\\"y\\"]() {} + get ["y"]() {} a = 1 - static [\\"y\\"]() {} + static ["y"]() {} a = 1 - set [\\"z\\"](z) {} + set ["z"](z) {} a = 1 - async [\\"a\\"]() {} + async ["a"]() {} a = 1 async *g() {} @@ -639,11 +639,11 @@ while (false) aReallyLongLine012345678901234567890123456789012345678901234567890123456789 * (b + c) -" + `; exports[`no-semi.js 3`] = ` -" + // with preexisting semi x; [1, 2, 3].forEach(fn) @@ -803,13 +803,13 @@ x x ;[a, b, ...c] = [1, 2] x -;/r/i.test(\\"r\\") +;/r/i.test("r") x ;+1 x ;-1 x -;(\\"h\\" + \\"i\\").repeat(10) +;("h" + "i").repeat(10) x 1, 2 x @@ -874,16 +874,16 @@ class A { *i() {} a = 1 - get [\\"y\\"]() {} + get ["y"]() {} a = 1 - static [\\"y\\"]() {} + static ["y"]() {} a = 1 - set [\\"z\\"](z) {} + set ["z"](z) {} a = 1 - async [\\"a\\"]() {} + async ["a"]() {} a = 1 async *g() {} @@ -961,5 +961,5 @@ while (false) aReallyLongLine012345678901234567890123456789012345678901234567890123456789 * (b + c) -" + `; diff --git a/tests/object-prop-break-in/__snapshots__/jsfmt.spec.js.snap b/tests/object-prop-break-in/__snapshots__/jsfmt.spec.js.snap index 051df4d5..191559b5 100644 --- a/tests/object-prop-break-in/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object-prop-break-in/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`comment.js 1`] = ` -"function foo() { +function foo() { return { // this comment causes the problem bar: baz() + 1 @@ -14,66 +14,66 @@ function foo() { bar: baz() + 1 }; } -" + `; exports[`test.js 1`] = ` -"const a = classnames({ - \\"some-prop\\": this.state.longLongLongLongLongLongLongLongLongTooLongProp +const a = classnames({ + "some-prop": this.state.longLongLongLongLongLongLongLongLongTooLongProp }); const b = classnames({ - \\"some-prop\\": this.state.longLongLongLongLongLongLongLongLongTooLongProp === true + "some-prop": this.state.longLongLongLongLongLongLongLongLongTooLongProp === true }); const c = classnames({ - \\"some-prop\\": [ \\"foo\\", \\"bar\\", \\"foo\\", \\"bar\\", \\"foo\\", \\"bar\\", \\"foo\\", \\"bar\\", \\"foo\\" ] + "some-prop": [ "foo", "bar", "foo", "bar", "foo", "bar", "foo", "bar", "foo" ] }); const d = classnames({ - \\"some-prop\\": () => {} + "some-prop": () => {} }); const e = classnames({ - \\"some-prop\\": function bar() {} + "some-prop": function bar() {} }); const f = classnames({ - \\"some-prop\\": { foo: \\"bar\\", bar: \\"foo\\", foo: \\"bar\\", bar: \\"foo\\", foo: \\"bar\\" } + "some-prop": { foo: "bar", bar: "foo", foo: "bar", bar: "foo", foo: "bar" } }); const g = classnames({ - \\"some-prop\\": longLongLongLongLongLongLongLongLongLongLongLongLongTooLongVar || 1337 + "some-prop": longLongLongLongLongLongLongLongLongLongLongLongLongTooLongVar || 1337 }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const a = classnames({ - \\"some-prop\\": this.state.longLongLongLongLongLongLongLongLongTooLongProp + "some-prop": this.state.longLongLongLongLongLongLongLongLongTooLongProp }); const b = classnames({ - \\"some-prop\\": this.state.longLongLongLongLongLongLongLongLongTooLongProp === + "some-prop": this.state.longLongLongLongLongLongLongLongLongTooLongProp === true }); const c = classnames({ - \\"some-prop\\": [\\"foo\\", \\"bar\\", \\"foo\\", \\"bar\\", \\"foo\\", \\"bar\\", \\"foo\\", \\"bar\\", \\"foo\\"] + "some-prop": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "bar", "foo"] }); const d = classnames({ - \\"some-prop\\": () => {} + "some-prop": () => {} }); const e = classnames({ - \\"some-prop\\": function bar() {} + "some-prop": function bar() {} }); const f = classnames({ - \\"some-prop\\": { foo: \\"bar\\", bar: \\"foo\\", foo: \\"bar\\", bar: \\"foo\\", foo: \\"bar\\" } + "some-prop": { foo: "bar", bar: "foo", foo: "bar", bar: "foo", foo: "bar" } }); const g = classnames({ - \\"some-prop\\": longLongLongLongLongLongLongLongLongLongLongLongLongTooLongVar || + "some-prop": longLongLongLongLongLongLongLongLongLongLongLongLongTooLongVar || 1337 }); -" + `; diff --git a/tests/object_colon_bug/__snapshots__/jsfmt.spec.js.snap b/tests/object_colon_bug/__snapshots__/jsfmt.spec.js.snap index aefdc358..c9bb429f 100644 --- a/tests/object_colon_bug/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object_colon_bug/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`bug.js 1`] = ` -"const foo = { +const foo = { bar: props.bar ? props.bar : noop, baz: props.baz } @@ -12,5 +12,5 @@ const foo = { : noop, baz: props.baz }; -" + `; diff --git a/tests/object_property_comment/__snapshots__/jsfmt.spec.js.snap b/tests/object_property_comment/__snapshots__/jsfmt.spec.js.snap index 96c3e9f2..ab392007 100644 --- a/tests/object_property_comment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object_property_comment/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`after-key.js 1`] = ` -"let a = { +let a = { a /* comment */: () => 1 }; let a = { - \\"a\\" /* comment */: () => 1 + "a" /* comment */: () => 1 }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let a = { @@ -16,11 +16,11 @@ let a = { let a = { a /* comment */: () => 1 }; -" + `; exports[`comment.js 1`] = ` -"o = { +o = { name: // Comment A // Comment B @@ -54,5 +54,5 @@ o = { // Comment B // Comment A name: (({ id: type }: any): CreativeConcept) }; -" + `; diff --git a/tests/objects/__snapshots__/jsfmt.spec.js.snap b/tests/objects/__snapshots__/jsfmt.spec.js.snap index e96e512a..b83ee815 100644 --- a/tests/objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/objects/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`expand.js 1`] = ` -"const Component1 = ({ props }) => ( +const Component1 = ({ props }) => ( Test ); @@ -14,11 +14,11 @@ const Component2 = ({ const Component1 = ({ props }) => Test; const Component2 = ({ props }) => Test; -" + `; exports[`expression.js 1`] = ` -"() => ({}\`\`); +() => ({}\`\`); ({})\`\`; a = () => ({}).x; ({} && a, b); @@ -33,47 +33,47 @@ a = () => ({}).x; a = () => ({}.x); ({} && a, b); ({}::b, 0); -({}::b()\`\`[\\"\\"].c++ && 0 ? 0 : 0, 0); +({}::b()\`\`[""].c++ && 0 ? 0 : 0, 0); ({}(), 0); ({} = 0); ({} = 0), 1; -" + `; exports[`method.js 1`] = ` -"a = { f() {} } +a = { f() {} } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a = { f() {} }; -" + `; exports[`range.js 1`] = ` -"group( +group( concat([ - \\"(\\", + "(", indent( options.tabWidth, - concat([line, join(concat([\\",\\", line]), printed)]) + concat([line, join(concat([",", line]), printed)]) ), - options.trailingComma ? \\",\\" : \\"\\", + options.trailingComma ? "," : "", line, - \\")\\" + ")" ]), {shouldBreak: true} ) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ group( concat([ - \\"(\\", + "(", indent( options.tabWidth, - concat([line, join(concat([\\",\\", line]), printed)]) + concat([line, join(concat([",", line]), printed)]) ), - options.trailingComma ? \\",\\" : \\"\\", + options.trailingComma ? "," : "", line, - \\")\\" + ")" ]), { shouldBreak: true } ); -" + `; diff --git a/tests/optional-type-name/__snapshots__/jsfmt.spec.js.snap b/tests/optional-type-name/__snapshots__/jsfmt.spec.js.snap index e06a66ec..b945cc0e 100644 --- a/tests/optional-type-name/__snapshots__/jsfmt.spec.js.snap +++ b/tests/optional-type-name/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"type Foo = (any) => string +type Foo = (any) => string type Bar = { [string]: number } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Foo = any => string; type Bar = { [string]: number }; -" + `; diff --git a/tests/preserve_line/__snapshots__/jsfmt.spec.js.snap b/tests/preserve_line/__snapshots__/jsfmt.spec.js.snap index acb62f28..971e6de9 100644 --- a/tests/preserve_line/__snapshots__/jsfmt.spec.js.snap +++ b/tests/preserve_line/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`comments.js 1`] = ` -"function a() { +function a() { const a = 5; // comment return a; @@ -58,5 +58,5 @@ function a() { return a; } -" + `; diff --git a/tests/quotes/__snapshots__/jsfmt.spec.js.snap b/tests/quotes/__snapshots__/jsfmt.spec.js.snap index e055dd5e..6b196d9a 100644 --- a/tests/quotes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/quotes/__snapshots__/jsfmt.spec.js.snap @@ -1,22 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`functions.js 1`] = ` -"const a = () => \\"Foo bar\\"; +const a = () => "Foo bar"; function b(object, key) { return object['key']; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -const a = () => \\"Foo bar\\"; +const a = () => "Foo bar"; function b(object, key) { - return object[\\"key\\"]; + return object["key"]; } -" + `; exports[`functions.js 2`] = ` -"const a = () => \\"Foo bar\\"; +const a = () => "Foo bar"; function b(object, key) { return object['key']; @@ -27,12 +27,12 @@ const a = () => 'Foo bar'; function b(object, key) { return object['key']; } -" + `; exports[`strings.js 1`] = ` -"// Every string will be changed to double quotes, unless we end up with fewer -// escaped quotes by using single quotes. (Vice versa if the \\"singleQuote\\" +// Every string will be changed to double quotes, unless we end up with fewer +// escaped quotes by using single quotes. (Vice versa if the "singleQuote" // option is true). // // Note that even if a string already has the correct enclosing quotes, it is @@ -40,69 +40,69 @@ exports[`strings.js 1`] = ` // for consistency. // Simple strings. -\\"abc\\" +"abc" 'abc' // Escape. -'\\\\0' +'\\0' // Emoji. '🐶' // Empty string. -\\"\\" +"" '' // Single double quote. -\\"\\\\\\"\\" -'\\"' +"\\"" +'"' // Single single quote. -\\"'\\" -'\\\\'' +"'" +'\\'' // Unnecessary escapes. -\\"\\\\'\\" -'\\\\\\"' +"\\'" +'\\"' // One of each. -\\"\\\\\\"'\\" -'\\"\\\\'' +"\\"'" +'"\\'' // One of each with unnecessary escapes. -\\"\\\\\\"\\\\'\\" -'\\\\\\"\\\\'' +"\\"\\'" +'\\"\\'' // More double quotes than single quotes. -\\"\\\\\\"'\\\\\\"\\" -'\\"\\\\'\\"' +"\\"'\\"" +'"\\'"' // More single quotes than double quotes. -\\"\\\\\\"''\\" -'\\"\\\\'\\\\'' +"\\"''" +'"\\'\\'' // Two of each. -\\"\\\\\\"\\\\\\"''\\" -'\\"\\"\\\\'\\\\'' +"\\"\\"''" +'""\\'\\'' // Single backslash. -'\\\\\\\\' -\\"\\\\\\\\\\" +'\\\\' +"\\\\" // Backslases. -\\"\\\\\\"\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\" '\\\\'\\\\\\\\'\\\\\\\\\\\\'\\\\\\\\\\\\\\\\'\\" -'\\\\'\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\' \\"\\\\\\"\\\\\\\\\\"\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\"' +"\\"\\\\\\"\\\\\\\\\\" '\\'\\\\'\\\\\\'\\\\\\\\'" +'\\'\\\\\\'\\\\\\\\\\' "\\"\\\\"\\\\\\"\\\\\\\\"' // Somewhat more real-word example. -\\"He's sayin': \\\\\\"How's it goin'?\\\\\\" Don't ask me why.\\" -'He\\\\'s sayin\\\\': \\"How\\\\'s it goin\\\\'?\\" Don\\\\'t ask me why.' +"He's sayin': \\"How's it goin'?\\" Don't ask me why." +'He\\'s sayin\\': "How\\'s it goin\\'?" Don\\'t ask me why.' // Somewhat more real-word example 2. -\\"var backslash = \\\\\\"\\\\\\\\\\\\\\", doubleQuote = '\\\\\\"';\\" -'var backslash = \\"\\\\\\\\\\", doubleQuote = \\\\'\\"\\\\';' +"var backslash = \\"\\\\\\", doubleQuote = '\\"';" +'var backslash = "\\\\", doubleQuote = \\'"\\';' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Every string will be changed to double quotes, unless we end up with fewer -// escaped quotes by using single quotes. (Vice versa if the \\"singleQuote\\" +// escaped quotes by using single quotes. (Vice versa if the "singleQuote" // option is true). // // Note that even if a string already has the correct enclosing quotes, it is @@ -110,46 +110,46 @@ exports[`strings.js 1`] = ` // for consistency. // Simple strings. -\\"abc\\"; -\\"abc\\"; +"abc"; +"abc"; // Escape. -\\"\\\\0\\"; +"\\0"; // Emoji. -\\"🐶\\"; // Empty string. -\\"\\"; -\\"\\"; // Single double quote. -'\\"'; -'\\"'; // Single single quote. -\\"'\\"; -\\"'\\"; // Unnecessary escapes. -\\"'\\"; -'\\"'; // One of each. -\\"\\\\\\"'\\"; -\\"\\\\\\"'\\"; // One of each with unnecessary escapes. -\\"\\\\\\"'\\"; -\\"\\\\\\"'\\"; // More double quotes than single quotes. -'\\"\\\\'\\"'; -'\\"\\\\'\\"'; // More single quotes than double quotes. -\\"\\\\\\"''\\"; -\\"\\\\\\"''\\"; // Two of each. -\\"\\\\\\"\\\\\\"''\\"; -\\"\\\\\\"\\\\\\"''\\"; // Single backslash. -\\"\\\\\\\\\\"; -\\"\\\\\\\\\\"; // Backslases. -\\"\\\\\\"\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\" ''\\\\\\\\'\\\\\\\\'\\\\\\\\\\\\\\\\'\\"; -'\\\\'\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\' \\"\\"\\\\\\\\\\"\\\\\\\\\\"\\\\\\\\\\\\\\\\\\"'; // Somewhat more real-word example. -\\"He's sayin': \\\\\\"How's it goin'?\\\\\\" Don't ask me why.\\"; -\\"He's sayin': \\\\\\"How's it goin'?\\\\\\" Don't ask me why.\\"; // Somewhat more real-word example 2. -'var backslash = \\"\\\\\\\\\\", doubleQuote = \\\\'\\"\\\\';'; -'var backslash = \\"\\\\\\\\\\", doubleQuote = \\\\'\\"\\\\';'; -" +"🐶"; // Empty string. +""; +""; // Single double quote. +'"'; +'"'; // Single single quote. +"'"; +"'"; // Unnecessary escapes. +"'"; +'"'; // One of each. +"\\"'"; +"\\"'"; // One of each with unnecessary escapes. +"\\"'"; +"\\"'"; // More double quotes than single quotes. +'"\\'"'; +'"\\'"'; // More single quotes than double quotes. +"\\"''"; +"\\"''"; // Two of each. +"\\"\\"''"; +"\\"\\"''"; // Single backslash. +"\\\\"; +"\\\\"; // Backslases. +"\\"\\\\\\"\\\\\\\\\\" ''\\\\'\\\\'\\\\\\\\'"; +'\\'\\\\\\'\\\\\\\\\\' ""\\\\"\\\\"\\\\\\\\"'; // Somewhat more real-word example. +"He's sayin': \\"How's it goin'?\\" Don't ask me why."; +"He's sayin': \\"How's it goin'?\\" Don't ask me why."; // Somewhat more real-word example 2. +'var backslash = "\\\\", doubleQuote = \\'"\\';'; +'var backslash = "\\\\", doubleQuote = \\'"\\';'; + `; exports[`strings.js 2`] = ` -"// Every string will be changed to double quotes, unless we end up with fewer -// escaped quotes by using single quotes. (Vice versa if the \\"singleQuote\\" +// Every string will be changed to double quotes, unless we end up with fewer +// escaped quotes by using single quotes. (Vice versa if the "singleQuote" // option is true). // // Note that even if a string already has the correct enclosing quotes, it is @@ -157,69 +157,69 @@ exports[`strings.js 2`] = ` // for consistency. // Simple strings. -\\"abc\\" +"abc" 'abc' // Escape. -'\\\\0' +'\\0' // Emoji. '🐶' // Empty string. -\\"\\" +"" '' // Single double quote. -\\"\\\\\\"\\" -'\\"' +"\\"" +'"' // Single single quote. -\\"'\\" -'\\\\'' +"'" +'\\'' // Unnecessary escapes. -\\"\\\\'\\" -'\\\\\\"' +"\\'" +'\\"' // One of each. -\\"\\\\\\"'\\" -'\\"\\\\'' +"\\"'" +'"\\'' // One of each with unnecessary escapes. -\\"\\\\\\"\\\\'\\" -'\\\\\\"\\\\'' +"\\"\\'" +'\\"\\'' // More double quotes than single quotes. -\\"\\\\\\"'\\\\\\"\\" -'\\"\\\\'\\"' +"\\"'\\"" +'"\\'"' // More single quotes than double quotes. -\\"\\\\\\"''\\" -'\\"\\\\'\\\\'' +"\\"''" +'"\\'\\'' // Two of each. -\\"\\\\\\"\\\\\\"''\\" -'\\"\\"\\\\'\\\\'' +"\\"\\"''" +'""\\'\\'' // Single backslash. -'\\\\\\\\' -\\"\\\\\\\\\\" +'\\\\' +"\\\\" // Backslases. -\\"\\\\\\"\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\" '\\\\'\\\\\\\\'\\\\\\\\\\\\'\\\\\\\\\\\\\\\\'\\" -'\\\\'\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\' \\"\\\\\\"\\\\\\\\\\"\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\"' +"\\"\\\\\\"\\\\\\\\\\" '\\'\\\\'\\\\\\'\\\\\\\\'" +'\\'\\\\\\'\\\\\\\\\\' "\\"\\\\"\\\\\\"\\\\\\\\"' // Somewhat more real-word example. -\\"He's sayin': \\\\\\"How's it goin'?\\\\\\" Don't ask me why.\\" -'He\\\\'s sayin\\\\': \\"How\\\\'s it goin\\\\'?\\" Don\\\\'t ask me why.' +"He's sayin': \\"How's it goin'?\\" Don't ask me why." +'He\\'s sayin\\': "How\\'s it goin\\'?" Don\\'t ask me why.' // Somewhat more real-word example 2. -\\"var backslash = \\\\\\"\\\\\\\\\\\\\\", doubleQuote = '\\\\\\"';\\" -'var backslash = \\"\\\\\\\\\\", doubleQuote = \\\\'\\"\\\\';' +"var backslash = \\"\\\\\\", doubleQuote = '\\"';" +'var backslash = "\\\\", doubleQuote = \\'"\\';' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Every string will be changed to double quotes, unless we end up with fewer -// escaped quotes by using single quotes. (Vice versa if the \\"singleQuote\\" +// escaped quotes by using single quotes. (Vice versa if the "singleQuote" // option is true). // // Note that even if a string already has the correct enclosing quotes, it is @@ -231,35 +231,35 @@ exports[`strings.js 2`] = ` 'abc'; // Escape. -'\\\\0'; +'\\0'; // Emoji. '🐶'; // Empty string. ''; ''; // Single double quote. -'\\"'; -'\\"'; // Single single quote. -\\"'\\"; -\\"'\\"; // Unnecessary escapes. -\\"'\\"; -'\\"'; // One of each. -'\\"\\\\''; -'\\"\\\\''; // One of each with unnecessary escapes. -'\\"\\\\''; -'\\"\\\\''; // More double quotes than single quotes. -'\\"\\\\'\\"'; -'\\"\\\\'\\"'; // More single quotes than double quotes. -\\"\\\\\\"''\\"; -\\"\\\\\\"''\\"; // Two of each. -'\\"\\"\\\\'\\\\''; -'\\"\\"\\\\'\\\\''; // Single backslash. -'\\\\\\\\'; -'\\\\\\\\'; // Backslases. -\\"\\\\\\"\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\" ''\\\\\\\\'\\\\\\\\'\\\\\\\\\\\\\\\\'\\"; -'\\\\'\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\' \\"\\"\\\\\\\\\\"\\\\\\\\\\"\\\\\\\\\\\\\\\\\\"'; // Somewhat more real-word example. -\\"He's sayin': \\\\\\"How's it goin'?\\\\\\" Don't ask me why.\\"; -\\"He's sayin': \\\\\\"How's it goin'?\\\\\\" Don't ask me why.\\"; // Somewhat more real-word example 2. -'var backslash = \\"\\\\\\\\\\", doubleQuote = \\\\'\\"\\\\';'; -'var backslash = \\"\\\\\\\\\\", doubleQuote = \\\\'\\"\\\\';'; -" +'"'; +'"'; // Single single quote. +"'"; +"'"; // Unnecessary escapes. +"'"; +'"'; // One of each. +'"\\''; +'"\\''; // One of each with unnecessary escapes. +'"\\''; +'"\\''; // More double quotes than single quotes. +'"\\'"'; +'"\\'"'; // More single quotes than double quotes. +"\\"''"; +"\\"''"; // Two of each. +'""\\'\\''; +'""\\'\\''; // Single backslash. +'\\\\'; +'\\\\'; // Backslases. +"\\"\\\\\\"\\\\\\\\\\" ''\\\\'\\\\'\\\\\\\\'"; +'\\'\\\\\\'\\\\\\\\\\' ""\\\\"\\\\"\\\\\\\\"'; // Somewhat more real-word example. +"He's sayin': \\"How's it goin'?\\" Don't ask me why."; +"He's sayin': \\"How's it goin'?\\" Don't ask me why."; // Somewhat more real-word example 2. +'var backslash = "\\\\", doubleQuote = \\'"\\';'; +'var backslash = "\\\\", doubleQuote = \\'"\\';'; + `; diff --git a/tests/require/__snapshots__/jsfmt.spec.js.snap b/tests/require/__snapshots__/jsfmt.spec.js.snap index 9c2bd958..113a5587 100644 --- a/tests/require/__snapshots__/jsfmt.spec.js.snap +++ b/tests/require/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`require.js 1`] = ` -"const { one, two, thee, four, five, six, seven, eight, nine, ten } = require('./my-utils'); +const { one, two, thee, four, five, six, seven, eight, nine, ten } = require('./my-utils'); const { one, two, thee, four, five, six, seven, eight, nine, ten, eleven } = require('./my-utils'); const MyReallyExtrememlyLongModuleName = require('MyReallyExtrememlyLongModuleName'); @@ -17,7 +17,7 @@ const { eight, nine, ten -} = require(\\"./my-utils\\"); +} = require("./my-utils"); const { one, two, @@ -30,8 +30,8 @@ const { nine, ten, eleven -} = require(\\"./my-utils\\"); +} = require("./my-utils"); + +const MyReallyExtrememlyLongModuleName = require("MyReallyExtrememlyLongModuleName"); -const MyReallyExtrememlyLongModuleName = require(\\"MyReallyExtrememlyLongModuleName\\"); -" `; diff --git a/tests/rest/__snapshots__/jsfmt.spec.js.snap b/tests/rest/__snapshots__/jsfmt.spec.js.snap index d723daef..89de0451 100644 --- a/tests/rest/__snapshots__/jsfmt.spec.js.snap +++ b/tests/rest/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`trailing-commas.js 1`] = ` -"declare class C { +declare class C { f( superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, ...args @@ -52,5 +52,5 @@ var { veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong, ...a } = {}; -" + `; diff --git a/tests/return/__snapshots__/jsfmt.spec.js.snap b/tests/return/__snapshots__/jsfmt.spec.js.snap index 53f5f14c..44eb387f 100644 --- a/tests/return/__snapshots__/jsfmt.spec.js.snap +++ b/tests/return/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`binaryish.js 1`] = ` -"function f() { +function f() { return ( property.isIdentifier() && FUNCTIONS[property.node.name] && @@ -12,7 +12,7 @@ exports[`binaryish.js 1`] = ` return ( chalk.bold( - 'No tests found related to files changed since last commit.\\\\n', + 'No tests found related to files changed since last commit.\\n', ) + chalk.dim( patternInfo.watch ? @@ -31,15 +31,15 @@ function f() { FUNCTIONS[property.node.name] && (object.isIdentifier(JEST_GLOBAL) || (callee.isMemberExpression() && shouldHoistExpression(object))) && - FUNCTIONS[property.node.name](expr.get(\\"arguments\\")) + FUNCTIONS[property.node.name](expr.get("arguments")) ); return ( - chalk.bold(\\"No tests found related to files changed since last commit.\\\\n\\") + + chalk.bold("No tests found related to files changed since last commit.\\n") + chalk.dim( patternInfo.watch - ? \\"Press \`a\` to run all tests, or run Jest with \`--watchAll\`.\\" - : \\"Run Jest without \`-o\` to run all tests.\\" + ? "Press \`a\` to run all tests, or run Jest with \`--watchAll\`." + : "Run Jest without \`-o\` to run all tests." ) ); @@ -48,16 +48,16 @@ function f() { !filePath.endsWith(\`.\${SNAPSHOT_EXTENSION}\`) ); } -" + `; exports[`comment.js 1`] = ` -"function f() { +function f() { return /* a */; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function f() { return /* a */; } -" + `; diff --git a/tests/shebang/__snapshots__/jsfmt.spec.js.snap b/tests/shebang/__snapshots__/jsfmt.spec.js.snap index e6c317e7..cdd9baaa 100644 --- a/tests/shebang/__snapshots__/jsfmt.spec.js.snap +++ b/tests/shebang/__snapshots__/jsfmt.spec.js.snap @@ -1,21 +1,21 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`shebang.js 1`] = ` -"#!/usr/bin/env node +#!/usr/bin/env node function a() {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #!/usr/bin/env node function a() {} -" + `; exports[`shebang-newline.js 1`] = ` -"#!/usr/bin/env node +#!/usr/bin/env node function a() {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #!/usr/bin/env node function a() {} -" + `; diff --git a/tests/strings/__snapshots__/jsfmt.spec.js.snap b/tests/strings/__snapshots__/jsfmt.spec.js.snap index 44d7a05d..8f7de4f3 100644 --- a/tests/strings/__snapshots__/jsfmt.spec.js.snap +++ b/tests/strings/__snapshots__/jsfmt.spec.js.snap @@ -1,115 +1,115 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`strings.js 1`] = ` -"[ - \\"abc\\", +[ + "abc", 'abc', - '\\\\'', + '\\'', + '"', '\\"', - '\\\\\\"', - '\\\\\\\\\\"', + '\\\\"', - \\"'\\", - \\"\\\\'\\", - \\"\\\\\\\\'\\", + "'", + "\\'", + "\\\\'", - \\"'\\\\\\"\\", - '\\\\'\\"', + "'\\"", + '\\'"', - '\\\\\\\\', - \\"\\\\\\\\\\", + '\\\\', + "\\\\", - '\\\\0', + '\\0', '🐶', - '\\\\uD801\\\\uDC28', + '\\uD801\\uDC28', ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [ - \\"abc\\", - \\"abc\\", + "abc", + "abc", - \\"'\\", + "'", - '\\"', - '\\"', - '\\\\\\\\\\"', + '"', + '"', + '\\\\"', - \\"'\\", - \\"'\\", - \\"\\\\\\\\'\\", + "'", + "'", + "\\\\'", - \\"'\\\\\\"\\", - \\"'\\\\\\"\\", + "'\\"", + "'\\"", - \\"\\\\\\\\\\", - \\"\\\\\\\\\\", + "\\\\", + "\\\\", - \\"\\\\0\\", - \\"🐶\\", - '\\\\uD801\\\\uDC28' + "\\0", + "🐶", + '\\uD801\\uDC28' ]; -" + `; exports[`strings.js 2`] = ` -"[ - \\"abc\\", +[ + "abc", 'abc', - '\\\\'', + '\\'', + '"', '\\"', - '\\\\\\"', - '\\\\\\\\\\"', + '\\\\"', - \\"'\\", - \\"\\\\'\\", - \\"\\\\\\\\'\\", + "'", + "\\'", + "\\\\'", - \\"'\\\\\\"\\", - '\\\\'\\"', + "'\\"", + '\\'"', - '\\\\\\\\', - \\"\\\\\\\\\\", + '\\\\', + "\\\\", - '\\\\0', + '\\0', '🐶', - '\\\\uD801\\\\uDC28', + '\\uD801\\uDC28', ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [ - \\"abc\\", - \\"abc\\", + "abc", + "abc", - \\"'\\", + "'", - '\\"', - '\\"', - '\\\\\\\\\\"', + '"', + '"', + '\\\\"', - \\"'\\", - \\"'\\", - \\"\\\\\\\\'\\", + "'", + "'", + "\\\\'", - \\"'\\\\\\"\\", - \\"'\\\\\\"\\", + "'\\"", + "'\\"", - \\"\\\\\\\\\\", - \\"\\\\\\\\\\", + "\\\\", + "\\\\", - \\"\\\\0\\", - \\"🐶\\", - '\\\\uD801\\\\uDC28', + "\\0", + "🐶", + '\\uD801\\uDC28', ]; -" + `; exports[`template-literals.js 1`] = ` -"foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 } with expr\`); +foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 } with expr\`); const x = \`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( function() {return 3 })() + 3 + 2 + 3 + 2 + 3 } with expr\`; @@ -120,7 +120,7 @@ foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( functi })() + 3 + 2 + 3 + 2 + 3 } with expr\`); pipe.write( - \`\\\\n \${chalk.dim(\`\\\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\`, + \`\\n \${chalk.dim(\`\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\`, ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foo( @@ -140,13 +140,13 @@ foo( ); pipe.write( - \`\\\\n \${chalk.dim(\`\\\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\` + \`\\n \${chalk.dim(\`\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\` ); -" + `; exports[`template-literals.js 2`] = ` -"foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 } with expr\`); +foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 } with expr\`); const x = \`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( function() {return 3 })() + 3 + 2 + 3 + 2 + 3 } with expr\`; @@ -157,7 +157,7 @@ foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( functi })() + 3 + 2 + 3 + 2 + 3 } with expr\`); pipe.write( - \`\\\\n \${chalk.dim(\`\\\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\`, + \`\\n \${chalk.dim(\`\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\`, ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foo( @@ -177,7 +177,7 @@ foo( ); pipe.write( - \`\\\\n \${chalk.dim(\`\\\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\`, + \`\\n \${chalk.dim(\`\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\`, ); -" + `; diff --git a/tests/switch/__snapshots__/jsfmt.spec.js.snap b/tests/switch/__snapshots__/jsfmt.spec.js.snap index 9d65ac16..75830927 100644 --- a/tests/switch/__snapshots__/jsfmt.spec.js.snap +++ b/tests/switch/__snapshots__/jsfmt.spec.js.snap @@ -1,39 +1,39 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`empty_lines.js 1`] = ` -"switch (foo) { - case \\"bar\\": +switch (foo) { + case "bar": doSomething(); - case \\"baz\\": + case "baz": doOtherThing(); } switch (foo) { - case \\"bar\\": + case "bar": doSomething(); - case \\"baz\\": + case "baz": doOtherThing(); } switch (foo) { - case \\"bar\\": + case "bar": doSomething(); - case \\"baz\\": + case "baz": doOtherThing(); } switch (foo) { - case \\"bar\\": + case "bar": doSomething(); - case \\"baz\\": + case "baz": doOtherThing(); } @@ -50,34 +50,34 @@ switch (x) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ switch (foo) { - case \\"bar\\": + case "bar": doSomething(); - case \\"baz\\": + case "baz": doOtherThing(); } switch (foo) { - case \\"bar\\": + case "bar": doSomething(); - case \\"baz\\": + case "baz": doOtherThing(); } switch (foo) { - case \\"bar\\": + case "bar": doSomething(); - case \\"baz\\": + case "baz": doOtherThing(); } switch (foo) { - case \\"bar\\": + case "bar": doSomething(); - case \\"baz\\": + case "baz": doOtherThing(); } @@ -92,11 +92,11 @@ switch (x) { break; } -" + `; exports[`empty_switch.js 1`] = ` -"switch (1) { default:; } +switch (1) { default:; } switch (1) {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ switch (1) { @@ -104,5 +104,5 @@ switch (1) { } switch (1) { } -" + `; diff --git a/tests/tabWith/__snapshots__/jsfmt.spec.js.snap b/tests/tabWith/__snapshots__/jsfmt.spec.js.snap index 2270b72f..0ea7cd38 100644 --- a/tests/tabWith/__snapshots__/jsfmt.spec.js.snap +++ b/tests/tabWith/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`class.js 1`] = ` -"class A { +class A { method() { 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; } @@ -15,23 +15,23 @@ exports[`class.js 1`] = ` class A { method() { 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; } } -" + `; exports[`class.js 2`] = ` -"class A { +class A { method() { 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; } @@ -40,18 +40,18 @@ exports[`class.js 2`] = ` class A { method() { 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; } } -" + `; exports[`nested-functions.spec.js 1`] = ` -"const c = () => {}; +const c = () => {}; function a() { return function b() { @@ -74,11 +74,11 @@ function a() { }; }; } -" + `; exports[`nested-functions.spec.js 2`] = ` -"const c = () => {}; +const c = () => {}; function a() { return function b() { @@ -101,5 +101,5 @@ function a() { }; }; } -" + `; diff --git a/tests/template/__snapshots__/jsfmt.spec.js.snap b/tests/template/__snapshots__/jsfmt.spec.js.snap index 5a493353..d4f89e1f 100644 --- a/tests/template/__snapshots__/jsfmt.spec.js.snap +++ b/tests/template/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`faulty-locations.js 1`] = ` -"var o = { +var o = { [\`key\`]: () => { // Comment } @@ -30,118 +30,118 @@ var x = { } \` }; -" + `; exports[`parenthesis.js 1`] = ` -"// \\"ArrowFunctionExpression\\" +// "ArrowFunctionExpression" (() => {})\`\`; -// \\"AssignmentExpression\\" +// "AssignmentExpression" (b = c)\`\`; -// \\"AwaitExpression\\" +// "AwaitExpression" async function f() { (await b)\`\`; } -// \\"BinaryExpression\\" +// "BinaryExpression" (b + c)\`\`; -// \\"CallExpression\\" +// "CallExpression" b()\`\`; -// \\"ClassExpression\\" +// "ClassExpression" (class {})\`\`; -// \\"ConditionalExpression\\" +// "ConditionalExpression" (b ? c : d)\`\`; -// \\"FunctionExpression\\" +// "FunctionExpression" (function() {})\`\`; -// \\"LogicalExpression\\" +// "LogicalExpression" (b || c)\`\`; -// \\"MemberExpression\\" +// "MemberExpression" b.c\`\`; -// \\"NewExpression\\" +// "NewExpression" (new B())\`\`; -// \\"ObjectExpression\\" +// "ObjectExpression" ({})\`\`; -// \\"SequenceExpression\\" +// "SequenceExpression" (b, c)\`\`; -// \\"TaggedTemplateExpression\\" +// "TaggedTemplateExpression" (\`\`)\`\`; -// \\"UnaryExpression\\" +// "UnaryExpression" (void b)\`\`; -// \\"UpdateExpression\\" +// "UpdateExpression" (++b)\`\`; -// \\"YieldExpression\\" +// "YieldExpression" function* f() { (yield 1)\`\`; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// \\"ArrowFunctionExpression\\" +// "ArrowFunctionExpression" (() => {})\`\`; -// \\"AssignmentExpression\\" +// "AssignmentExpression" (b = c)\`\`; -// \\"AwaitExpression\\" +// "AwaitExpression" async function f() { (await b)\`\`; } -// \\"BinaryExpression\\" +// "BinaryExpression" (b + c)\`\`; -// \\"CallExpression\\" +// "CallExpression" b()\`\`; -// \\"ClassExpression\\" +// "ClassExpression" (class {}\`\`); -// \\"ConditionalExpression\\" +// "ConditionalExpression" (b ? c : d)\`\`; -// \\"FunctionExpression\\" +// "FunctionExpression" (function() {})\`\`; -// \\"LogicalExpression\\" +// "LogicalExpression" (b || c)\`\`; -// \\"MemberExpression\\" +// "MemberExpression" b.c\`\`; -// \\"NewExpression\\" +// "NewExpression" new B()\`\`; -// \\"ObjectExpression\\" +// "ObjectExpression" ({}\`\`); -// \\"SequenceExpression\\" +// "SequenceExpression" (b, c)\`\`; -// \\"TaggedTemplateExpression\\" +// "TaggedTemplateExpression" \`\`\`\`; -// \\"UnaryExpression\\" +// "UnaryExpression" (void b)\`\`; -// \\"UpdateExpression\\" +// "UpdateExpression" (++b)\`\`; -// \\"YieldExpression\\" +// "YieldExpression" function* f() { (yield 1)\`\`; } -" + `; diff --git a/tests/ternaries/__snapshots__/jsfmt.spec.js.snap b/tests/ternaries/__snapshots__/jsfmt.spec.js.snap index 2f2e57dd..dcfa40e2 100644 --- a/tests/ternaries/__snapshots__/jsfmt.spec.js.snap +++ b/tests/ternaries/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"const obj0 = conditionIsTruthy ? shortThing : otherShortThing +const obj0 = conditionIsTruthy ? shortThing : otherShortThing const obj1 = conditionIsTruthy ? { some: 'long', object: 'with', lots: 'of', stuff } : shortThing @@ -16,18 +16,18 @@ const obj5 = conditionIsTruthy ? { some: 'long', object: 'with', lots: 'of', stu const obj0 = conditionIsTruthy ? shortThing : otherShortThing; const obj1 = conditionIsTruthy - ? { some: \\"long\\", object: \\"with\\", lots: \\"of\\", stuff } + ? { some: "long", object: "with", lots: "of", stuff } : shortThing; const obj2 = conditionIsTruthy ? shortThing - : { some: \\"long\\", object: \\"with\\", lots: \\"of\\", stuff }; + : { some: "long", object: "with", lots: "of", stuff }; const obj3 = conditionIsTruthy ? { - some: \\"eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\\", - object: \\"with\\", - lots: \\"of\\", + some: "eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger", + object: "with", + lots: "of", stuff } : shortThing; @@ -35,25 +35,25 @@ const obj3 = conditionIsTruthy const obj4 = conditionIsTruthy ? shortThing : { - some: \\"eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\\", - object: \\"with\\", - lots: \\"of\\", + some: "eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger", + object: "with", + lots: "of", stuff }; const obj5 = conditionIsTruthy - ? { some: \\"long\\", object: \\"with\\", lots: \\"of\\", stuff } + ? { some: "long", object: "with", lots: "of", stuff } : { - some: \\"eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\\", - object: \\"with\\", - lots: \\"of\\", + some: "eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger", + object: "with", + lots: "of", stuff }; -" + `; exports[`test.js 2`] = ` -"const obj0 = conditionIsTruthy ? shortThing : otherShortThing +const obj0 = conditionIsTruthy ? shortThing : otherShortThing const obj1 = conditionIsTruthy ? { some: 'long', object: 'with', lots: 'of', stuff } : shortThing @@ -68,18 +68,18 @@ const obj5 = conditionIsTruthy ? { some: 'long', object: 'with', lots: 'of', stu const obj0 = conditionIsTruthy ? shortThing : otherShortThing; const obj1 = conditionIsTruthy - ? { some: \\"long\\", object: \\"with\\", lots: \\"of\\", stuff } + ? { some: "long", object: "with", lots: "of", stuff } : shortThing; const obj2 = conditionIsTruthy ? shortThing - : { some: \\"long\\", object: \\"with\\", lots: \\"of\\", stuff }; + : { some: "long", object: "with", lots: "of", stuff }; const obj3 = conditionIsTruthy ? { - some: \\"eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\\", - object: \\"with\\", - lots: \\"of\\", + some: "eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger", + object: "with", + lots: "of", stuff } : shortThing; @@ -87,19 +87,19 @@ const obj3 = conditionIsTruthy const obj4 = conditionIsTruthy ? shortThing : { - some: \\"eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\\", - object: \\"with\\", - lots: \\"of\\", + some: "eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger", + object: "with", + lots: "of", stuff }; const obj5 = conditionIsTruthy - ? { some: \\"long\\", object: \\"with\\", lots: \\"of\\", stuff } + ? { some: "long", object: "with", lots: "of", stuff } : { - some: \\"eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\\", - object: \\"with\\", - lots: \\"of\\", + some: "eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger", + object: "with", + lots: "of", stuff }; -" + `; diff --git a/tests/test_declarations/__snapshots__/jsfmt.spec.js.snap b/tests/test_declarations/__snapshots__/jsfmt.spec.js.snap index b838c7ba..ee8d0a12 100644 --- a/tests/test_declarations/__snapshots__/jsfmt.spec.js.snap +++ b/tests/test_declarations/__snapshots__/jsfmt.spec.js.snap @@ -1,154 +1,154 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test_declarations.js 1`] = ` -"// Shouldn't break +// Shouldn't break -it(\\"does something really long and complicated so I have to write a very long name for the test\\", () => { - console.log(\\"hello!\\"); +it("does something really long and complicated so I have to write a very long name for the test", () => { + console.log("hello!"); }); -it(\\"does something really long and complicated so I have to write a very long name for the test\\", function() { - console.log(\\"hello!\\"); +it("does something really long and complicated so I have to write a very long name for the test", function() { + console.log("hello!"); }); it(\`does something really long and complicated so I have to write a very long name for the test\`, function() { - console.log(\\"hello!\\"); + console.log("hello!"); }); it(\`{foo + bar} does something really long and complicated so I have to write a very long name for the test\`, function() { - console.log(\\"hello!\\"); + console.log("hello!"); }); it(\`handles some newlines does something really long and complicated so I have to write a very long name for the test\`, () => { - console.log(\\"hello!\\"); + console.log("hello!"); }) -test(\\"does something really long and complicated so I have to write a very long name for the test\\", (done) => { - console.log(\\"hello!\\"); +test("does something really long and complicated so I have to write a very long name for the test", (done) => { + console.log("hello!"); }); test(\`does something really long and complicated so I have to write a very long name for the test\`, (done) => { - console.log(\\"hello!\\"); + console.log("hello!"); }); -describe(\\"does something really long and complicated so I have to write a very long name for the describe block\\", () => { - it(\\"an example test\\", (done) => { - console.log(\\"hello!\\"); +describe("does something really long and complicated so I have to write a very long name for the describe block", () => { + it("an example test", (done) => { + console.log("hello!"); }); }); describe(\`does something really long and complicated so I have to write a very long name for the describe block\`, () => { it(\`an example test\`, (done) => { - console.log(\\"hello!\\"); + console.log("hello!"); }); }); // Should break -it.only(\\"does something really long and complicated so I have to write a very long name for the test\\", () => { - console.log(\\"hello!\\"); +it.only("does something really long and complicated so I have to write a very long name for the test", () => { + console.log("hello!"); }); it.only(\`does something really long and complicated so I have to write a very long name for the test\`, () => { - console.log(\\"hello!\\"); + console.log("hello!"); }); -it.only(\\"does something really long and complicated so I have to write a very long name for the test\\", 10, () => { - console.log(\\"hello!\\"); +it.only("does something really long and complicated so I have to write a very long name for the test", 10, () => { + console.log("hello!"); }); -it.only.only(\\"does something really long and complicated so I have to write a very long name for the test\\", () => { - console.log(\\"hello!\\"); +it.only.only("does something really long and complicated so I have to write a very long name for the test", () => { + console.log("hello!"); }); -it.only.only(\\"does something really long and complicated so I have to write a very long name for the test\\", (a, b, c) => { - console.log(\\"hello!\\"); +it.only.only("does something really long and complicated so I have to write a very long name for the test", (a, b, c) => { + console.log("hello!"); }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Shouldn't break -it(\\"does something really long and complicated so I have to write a very long name for the test\\", () => { - console.log(\\"hello!\\"); +it("does something really long and complicated so I have to write a very long name for the test", () => { + console.log("hello!"); }); -it(\\"does something really long and complicated so I have to write a very long name for the test\\", function() { - console.log(\\"hello!\\"); +it("does something really long and complicated so I have to write a very long name for the test", function() { + console.log("hello!"); }); it(\`does something really long and complicated so I have to write a very long name for the test\`, function() { - console.log(\\"hello!\\"); + console.log("hello!"); }); it(\`{foo + bar} does something really long and complicated so I have to write a very long name for the test\`, function() { - console.log(\\"hello!\\"); + console.log("hello!"); }); it(\`handles some newlines does something really long and complicated so I have to write a very long name for the test\`, () => { - console.log(\\"hello!\\"); + console.log("hello!"); }); -test(\\"does something really long and complicated so I have to write a very long name for the test\\", done => { - console.log(\\"hello!\\"); +test("does something really long and complicated so I have to write a very long name for the test", done => { + console.log("hello!"); }); test(\`does something really long and complicated so I have to write a very long name for the test\`, done => { - console.log(\\"hello!\\"); + console.log("hello!"); }); -describe(\\"does something really long and complicated so I have to write a very long name for the describe block\\", () => { - it(\\"an example test\\", done => { - console.log(\\"hello!\\"); +describe("does something really long and complicated so I have to write a very long name for the describe block", () => { + it("an example test", done => { + console.log("hello!"); }); }); describe(\`does something really long and complicated so I have to write a very long name for the describe block\`, () => { it(\`an example test\`, done => { - console.log(\\"hello!\\"); + console.log("hello!"); }); }); // Should break it.only( - \\"does something really long and complicated so I have to write a very long name for the test\\", + "does something really long and complicated so I have to write a very long name for the test", () => { - console.log(\\"hello!\\"); + console.log("hello!"); } ); it.only( \`does something really long and complicated so I have to write a very long name for the test\`, () => { - console.log(\\"hello!\\"); + console.log("hello!"); } ); it.only( - \\"does something really long and complicated so I have to write a very long name for the test\\", + "does something really long and complicated so I have to write a very long name for the test", 10, () => { - console.log(\\"hello!\\"); + console.log("hello!"); } ); it.only.only( - \\"does something really long and complicated so I have to write a very long name for the test\\", + "does something really long and complicated so I have to write a very long name for the test", () => { - console.log(\\"hello!\\"); + console.log("hello!"); } ); it.only.only( - \\"does something really long and complicated so I have to write a very long name for the test\\", + "does something really long and complicated so I have to write a very long name for the test", (a, b, c) => { - console.log(\\"hello!\\"); + console.log("hello!"); } ); -" + `; diff --git a/tests/trailing_comma/__snapshots__/jsfmt.spec.js.snap b/tests/trailing_comma/__snapshots__/jsfmt.spec.js.snap index ae5885c3..143bc509 100644 --- a/tests/trailing_comma/__snapshots__/jsfmt.spec.js.snap +++ b/tests/trailing_comma/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`es5.js 1`] = ` -"function send_single_email( +function send_single_email( app, email_id, email_address, @@ -15,7 +15,7 @@ exports[`es5.js 1`] = ` subject, html, reply_to); - return \\"nothing\\"; + return "nothing"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function send_single_email( @@ -34,13 +34,13 @@ function send_single_email( html, reply_to ); - return \\"nothing\\"; + return "nothing"; } -" + `; exports[`es5.js 2`] = ` -"function send_single_email( +function send_single_email( app, email_id, email_address, @@ -54,7 +54,7 @@ exports[`es5.js 2`] = ` subject, html, reply_to); - return \\"nothing\\"; + return "nothing"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function send_single_email( @@ -73,13 +73,13 @@ function send_single_email( html, reply_to, ); - return \\"nothing\\"; + return "nothing"; } -" + `; exports[`es5.js 3`] = ` -"function send_single_email( +function send_single_email( app, email_id, email_address, @@ -93,7 +93,7 @@ exports[`es5.js 3`] = ` subject, html, reply_to); - return \\"nothing\\"; + return "nothing"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function send_single_email( @@ -112,13 +112,13 @@ function send_single_email( html, reply_to ); - return \\"nothing\\"; + return "nothing"; } -" + `; exports[`function-calls.js 1`] = ` -"const a = (param1, param2, param3) => {} +const a = (param1, param2, param3) => {} a('value', 'value2', 'value3'); @@ -132,24 +132,24 @@ a('value', 'value2', a('long-nested-value', 'long-nested-value2', 'long-nested-v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const a = (param1, param2, param3) => {}; -a(\\"value\\", \\"value2\\", \\"value3\\"); +a("value", "value2", "value3"); a( - \\"a-long-value\\", - \\"a-really-really-long-value\\", - \\"a-really-really-really-long-value\\" + "a-long-value", + "a-really-really-long-value", + "a-really-really-really-long-value" ); a( - \\"value\\", - \\"value2\\", - a(\\"long-nested-value\\", \\"long-nested-value2\\", \\"long-nested-value3\\") + "value", + "value2", + a("long-nested-value", "long-nested-value2", "long-nested-value3") ); -" + `; exports[`function-calls.js 2`] = ` -"const a = (param1, param2, param3) => {} +const a = (param1, param2, param3) => {} a('value', 'value2', 'value3'); @@ -163,24 +163,24 @@ a('value', 'value2', a('long-nested-value', 'long-nested-value2', 'long-nested-v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const a = (param1, param2, param3) => {}; -a(\\"value\\", \\"value2\\", \\"value3\\"); +a("value", "value2", "value3"); a( - \\"a-long-value\\", - \\"a-really-really-long-value\\", - \\"a-really-really-really-long-value\\", + "a-long-value", + "a-really-really-long-value", + "a-really-really-really-long-value", ); a( - \\"value\\", - \\"value2\\", - a(\\"long-nested-value\\", \\"long-nested-value2\\", \\"long-nested-value3\\"), + "value", + "value2", + a("long-nested-value", "long-nested-value2", "long-nested-value3"), ); -" + `; exports[`function-calls.js 3`] = ` -"const a = (param1, param2, param3) => {} +const a = (param1, param2, param3) => {} a('value', 'value2', 'value3'); @@ -194,24 +194,24 @@ a('value', 'value2', a('long-nested-value', 'long-nested-value2', 'long-nested-v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const a = (param1, param2, param3) => {}; -a(\\"value\\", \\"value2\\", \\"value3\\"); +a("value", "value2", "value3"); a( - \\"a-long-value\\", - \\"a-really-really-long-value\\", - \\"a-really-really-really-long-value\\" + "a-long-value", + "a-really-really-long-value", + "a-really-really-really-long-value" ); a( - \\"value\\", - \\"value2\\", - a(\\"long-nested-value\\", \\"long-nested-value2\\", \\"long-nested-value3\\") + "value", + "value2", + a("long-nested-value", "long-nested-value2", "long-nested-value3") ); -" + `; exports[`object.js 1`] = ` -"const a = { +const a = { b: true, c: { c1: 'hello' @@ -236,29 +236,29 @@ const aLong = { const a = { b: true, c: { - c1: \\"hello\\" + c1: "hello" }, d: false }; const aLong = { - bHasALongName: \\"a-long-value\\", + bHasALongName: "a-long-value", cHasALongName: { - c1: \\"a-really-long-value\\", - c2: \\"a-really-really-long-value\\" + c1: "a-really-long-value", + c2: "a-really-really-long-value" }, - dHasALongName: \\"a-long-value-too\\" + dHasALongName: "a-long-value-too" }; const aLong = { - dHasALongName: \\"a-long-value-too\\", + dHasALongName: "a-long-value-too", eHasABooleanExpression: a === a }; -" + `; exports[`object.js 2`] = ` -"const a = { +const a = { b: true, c: { c1: 'hello' @@ -283,29 +283,29 @@ const aLong = { const a = { b: true, c: { - c1: \\"hello\\", + c1: "hello", }, d: false, }; const aLong = { - bHasALongName: \\"a-long-value\\", + bHasALongName: "a-long-value", cHasALongName: { - c1: \\"a-really-long-value\\", - c2: \\"a-really-really-long-value\\", + c1: "a-really-long-value", + c2: "a-really-really-long-value", }, - dHasALongName: \\"a-long-value-too\\", + dHasALongName: "a-long-value-too", }; const aLong = { - dHasALongName: \\"a-long-value-too\\", + dHasALongName: "a-long-value-too", eHasABooleanExpression: a === a, }; -" + `; exports[`object.js 3`] = ` -"const a = { +const a = { b: true, c: { c1: 'hello' @@ -330,29 +330,29 @@ const aLong = { const a = { b: true, c: { - c1: \\"hello\\", + c1: "hello", }, d: false, }; const aLong = { - bHasALongName: \\"a-long-value\\", + bHasALongName: "a-long-value", cHasALongName: { - c1: \\"a-really-long-value\\", - c2: \\"a-really-really-long-value\\", + c1: "a-really-long-value", + c2: "a-really-really-long-value", }, - dHasALongName: \\"a-long-value-too\\", + dHasALongName: "a-long-value-too", }; const aLong = { - dHasALongName: \\"a-long-value-too\\", + dHasALongName: "a-long-value-too", eHasABooleanExpression: a === a, }; -" + `; exports[`trailing_whitespace.js 1`] = ` -"let example = [ +let example = [ 'FOO', 'BAR', // Comment @@ -389,8 +389,8 @@ function supersupersupersuperLongF( } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let example = [ - \\"FOO\\", - \\"BAR\\" + "FOO", + "BAR" // Comment ]; @@ -424,11 +424,11 @@ function supersupersupersuperLongF( ) { a; } -" + `; exports[`trailing_whitespace.js 2`] = ` -"let example = [ +let example = [ 'FOO', 'BAR', // Comment @@ -465,8 +465,8 @@ function supersupersupersuperLongF( } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let example = [ - \\"FOO\\", - \\"BAR\\", + "FOO", + "BAR", // Comment ]; @@ -500,11 +500,11 @@ function supersupersupersuperLongF( ) { a; } -" + `; exports[`trailing_whitespace.js 3`] = ` -"let example = [ +let example = [ 'FOO', 'BAR', // Comment @@ -541,8 +541,8 @@ function supersupersupersuperLongF( } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let example = [ - \\"FOO\\", - \\"BAR\\", + "FOO", + "BAR", // Comment ]; @@ -576,5 +576,5 @@ function supersupersupersuperLongF( ) { a; } -" + `; diff --git a/tests/trailing_whitespace/__snapshots__/jsfmt.spec.js.snap b/tests/trailing_whitespace/__snapshots__/jsfmt.spec.js.snap index fdbdef95..31d1cfa3 100644 --- a/tests/trailing_whitespace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/trailing_whitespace/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`trailing.js 1`] = ` -"export type Result = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" }; +export type Result = | { kind: "not-test-editor1" } | { kind: "not-test-editor2" }; // Note: there are trailing whitespace in this file \` @@ -13,8 +13,8 @@ exports[`trailing.js 1`] = ` \`; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export type Result = - | { kind: \\"not-test-editor1\\" } - | { kind: \\"not-test-editor2\\" }; + | { kind: "not-test-editor1" } + | { kind: "not-test-editor2" }; // Note: there are trailing whitespace in this file \` @@ -25,5 +25,5 @@ export type Result = \`; -" + `; diff --git a/tests/try/__snapshots__/jsfmt.spec.js.snap b/tests/try/__snapshots__/jsfmt.spec.js.snap index 54f36555..670951e4 100644 --- a/tests/try/__snapshots__/jsfmt.spec.js.snap +++ b/tests/try/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`empty.js 1`] = ` -"try { +try { } catch (e) { } finally { @@ -18,11 +18,11 @@ try { try { } catch (e) {} -" + `; exports[`try.js 1`] = ` -"try +try /* missing comment */ {;} finally {} @@ -31,5 +31,5 @@ try { /* missing comment */ } finally { } -" + `; diff --git a/tests/typescript/conformance/types/any/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/any/__snapshots__/jsfmt.spec.js.snap index 962556c3..60f010d9 100644 --- a/tests/typescript/conformance/types/any/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/any/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`anyAsConstructor.ts 1`] = ` -"// any is considered an untyped function call +// any is considered an untyped function call // can be called except with type arguments which is an error var x: any; @@ -17,16 +17,16 @@ var d = new x(x); // no error var x: any; var a = new x(); -var b = new x(\\"hello\\"); +var b = new x("hello"); var c = new x(x); // grammar allows this for constructors var d = new x(x); // no error -" + `; exports[`anyAsFunctionCall.ts 1`] = ` -"// any is considered an untyped function call +// any is considered an untyped function call // can be called except with type arguments which is an error var x: any; @@ -39,13 +39,13 @@ var c = x(x); var x: any; var a = x(); -var b = x(\\"hello\\"); +var b = x("hello"); var c = x(x); -" + `; exports[`anyAsGenericFunctionCall.ts 1`] = ` -"// any is considered an untyped function call +// any is considered an untyped function call // can be called except with type arguments which is an error var x: any; @@ -62,19 +62,19 @@ var d = x(x); var x: any; var a = x(); -var b = x(\\"hello\\"); -var c = x(\\"hello\\"); +var b = x("hello"); +var c = x("hello"); class C { foo: string; } var c = x(x); var d = x(x); -" + `; exports[`anyPropertyAccess.ts 1`] = ` -"var x: any; +var x: any; var a = x.foo; var b = x['foo']; var c = x['fn'](); @@ -84,10 +84,10 @@ var f = x['0'].bar; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var x: any; var a = x.foo; -var b = x[\\"foo\\"]; -var c = x[\\"fn\\"](); +var b = x["foo"]; +var c = x["fn"](); var d = x.bar.baz; var e = x[0].foo; -var f = x[\\"0\\"].bar; -" +var f = x["0"].bar; + `; diff --git a/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap index 3285f3a2..699c9549 100644 --- a/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`functionImplementationErrors.ts 1`] = ` -"// @allowUnreachableCode: true +// @allowUnreachableCode: true // FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function () { @@ -80,22 +80,22 @@ var f13 = () => { // FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function() { - return \\"\\"; + return ""; return 3; }; var f2 = function x() { - return \\"\\"; + return ""; return 3; }; var f3 = () => { - return \\"\\"; + return ""; return 3; }; // FunctionExpression with no return type annotation with return branch of number[] and other of string[] var f4 = function() { if (true) { - return [\\"\\"]; + return [""]; } else { return [1]; } @@ -157,11 +157,11 @@ var f13 = () => { return new Base(); return new AnotherClass(); }; -" + `; exports[`functionImplementations.ts 1`] = ` -"// @allowUnreachableCode: true +// @allowUnreachableCode: true // FunctionExpression with no return type annotation and no return statement returns void var v: void = function () { } (); @@ -498,11 +498,11 @@ var f12: (x: number) => any = x => { return; // should be ignored return new AnotherClass(); }; -" + `; exports[`functionOverloadCompatibilityWithVoid01.ts 1`] = ` -"function f(x: string): number; +function f(x: string): number; function f(x: string): void { return; } @@ -511,11 +511,11 @@ function f(x: string): number function f(x: string): void { return; } -" + `; exports[`functionOverloadCompatibilityWithVoid02.ts 1`] = ` -"function f(x: string): void; +function f(x: string): void; function f(x: string): number { return 0; } @@ -524,11 +524,11 @@ function f(x: string): void function f(x: string): number { return 0; } -" + `; exports[`functionOverloadCompatibilityWithVoid03.ts 1`] = ` -"function f(x: string): void; +function f(x: string): void; function f(x: string): void { return; } @@ -537,11 +537,11 @@ function f(x: string): void function f(x: string): void { return; } -" + `; exports[`functionOverloadErrorsSyntax.ts 1`] = ` -"//Function overload signature with optional parameter followed by non-optional parameter +//Function overload signature with optional parameter followed by non-optional parameter function fn4a(x?: number, y: string); function fn4a() { } @@ -562,11 +562,11 @@ function fn4b() {} //Function overload signature with rest param followed by non-optional parameter function fn5(x: string, ...y: any[], z: string) function fn5() {} -" + `; exports[`parameterInitializersForwardReferencing.ts 1`] = ` -"function left(a, b = a, c = b) { +function left(a, b = a, c = b) { a; b; } @@ -662,5 +662,5 @@ function f( }, c = b() ) {} -" + `; diff --git a/tests/typescript/conformance/types/tuple/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/tuple/__snapshots__/jsfmt.spec.js.snap index 2ce504a6..90c57b55 100644 --- a/tests/typescript/conformance/types/tuple/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/tuple/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`contextualTypeWithTuple.ts 1`] = ` -"// no error -var numStrTuple: [number, string] = [5, \\"hello\\"]; -var numStrTuple2: [number, string] = [5, \\"foo\\", true]; -var numStrBoolTuple: [number, string, boolean] = [5, \\"foo\\", true]; -var objNumTuple: [{ a: string }, number] = [{ a: \\"world\\" }, 5]; -var strTupleTuple: [string, [number, {}]] = [\\"bar\\", [5, { x: 1, y: 1 }]]; +// no error +var numStrTuple: [number, string] = [5, "hello"]; +var numStrTuple2: [number, string] = [5, "foo", true]; +var numStrBoolTuple: [number, string, boolean] = [5, "foo", true]; +var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5]; +var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]]; class C { } class D { } -var unionTuple: [C, string | number] = [new C(), \\"foo\\"]; -var unionTuple1: [C, string | number] = [new C(), \\"foo\\"]; -var unionTuple2: [C, string | number, D] = [new C(), \\"foo\\", new D()]; -var unionTuple3: [number, string| number] = [10, \\"foo\\"]; +var unionTuple: [C, string | number] = [new C(), "foo"]; +var unionTuple1: [C, string | number] = [new C(), "foo"]; +var unionTuple2: [C, string | number, D] = [new C(), "foo", new D()]; +var unionTuple3: [number, string| number] = [10, "foo"]; numStrTuple = numStrTuple2; numStrTuple = numStrBoolTuple; @@ -20,7 +20,7 @@ numStrTuple = numStrBoolTuple; // error objNumTuple = [ {}, 5]; numStrBoolTuple = numStrTuple; -var strStrTuple: [string, string] = [\\"foo\\", \\"bar\\", 5]; +var strStrTuple: [string, string] = ["foo", "bar", 5]; unionTuple = unionTuple1; unionTuple = unionTuple2; @@ -28,17 +28,17 @@ unionTuple2 = unionTuple; numStrTuple = unionTuple3; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // no error -var numStrTuple: [number, string] = [5, \\"hello\\"]; -var numStrTuple2: [number, string] = [5, \\"foo\\", true]; -var numStrBoolTuple: [number, string, boolean] = [5, \\"foo\\", true]; -var objNumTuple: [{ a: string }, number] = [{ a: \\"world\\" }, 5]; -var strTupleTuple: [string, [number, {}]] = [\\"bar\\", [5, { x: 1, y: 1 }]]; +var numStrTuple: [number, string] = [5, "hello"]; +var numStrTuple2: [number, string] = [5, "foo", true]; +var numStrBoolTuple: [number, string, boolean] = [5, "foo", true]; +var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5]; +var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]]; class C {} class D {} -var unionTuple: [C, string | number] = [new C(), \\"foo\\"]; -var unionTuple1: [C, string | number] = [new C(), \\"foo\\"]; -var unionTuple2: [C, string | number, D] = [new C(), \\"foo\\", new D()]; -var unionTuple3: [number, string | number] = [10, \\"foo\\"]; +var unionTuple: [C, string | number] = [new C(), "foo"]; +var unionTuple1: [C, string | number] = [new C(), "foo"]; +var unionTuple2: [C, string | number, D] = [new C(), "foo", new D()]; +var unionTuple3: [number, string | number] = [10, "foo"]; numStrTuple = numStrTuple2; numStrTuple = numStrBoolTuple; @@ -46,20 +46,20 @@ numStrTuple = numStrBoolTuple; // error objNumTuple = [{}, 5]; numStrBoolTuple = numStrTuple; -var strStrTuple: [string, string] = [\\"foo\\", \\"bar\\", 5]; +var strStrTuple: [string, string] = ["foo", "bar", 5]; unionTuple = unionTuple1; unionTuple = unionTuple2; unionTuple2 = unionTuple; numStrTuple = unionTuple3; -" + `; exports[`indexerWithTuple.ts 1`] = ` -"var strNumTuple: [string, number] = [\\"foo\\", 10]; -var numTupleTuple: [number, [string, number]] = [10, [\\"bar\\", 20]]; -var unionTuple1: [number, string| number] = [10, \\"foo\\"]; -var unionTuple2: [boolean, string| number] = [true, \\"foo\\"]; +var strNumTuple: [string, number] = ["foo", 10]; +var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]]; +var unionTuple1: [number, string| number] = [10, "foo"]; +var unionTuple2: [boolean, string| number] = [true, "foo"]; // no error var idx0 = 0; @@ -69,8 +69,8 @@ var ele11 = strNumTuple[1]; // number var ele12 = strNumTuple[2]; // string | number var ele13 = strNumTuple[idx0]; // string | number var ele14 = strNumTuple[idx1]; // string | number -var ele15 = strNumTuple[\\"0\\"]; // string -var ele16 = strNumTuple[\\"1\\"]; // number +var ele15 = strNumTuple["0"]; // string +var ele16 = strNumTuple["1"]; // number var strNumTuple1 = numTupleTuple[1]; //[string, number]; var ele17 = numTupleTuple[2]; // number | [string, number] var eleUnion10 = unionTuple1[0]; // number @@ -78,21 +78,21 @@ var eleUnion11 = unionTuple1[1]; // string | number var eleUnion12 = unionTuple1[2]; // string | number var eleUnion13 = unionTuple1[idx0]; // string | number var eleUnion14 = unionTuple1[idx1]; // string | number -var eleUnion15 = unionTuple1[\\"0\\"]; // number -var eleUnion16 = unionTuple1[\\"1\\"]; // string | number +var eleUnion15 = unionTuple1["0"]; // number +var eleUnion16 = unionTuple1["1"]; // string | number var eleUnion20 = unionTuple2[0]; // boolean var eleUnion21 = unionTuple2[1]; // string | number var eleUnion22 = unionTuple2[2]; // string | number | boolean var eleUnion23 = unionTuple2[idx0]; // string | number | boolean var eleUnion24 = unionTuple2[idx1]; // string | number | boolean -var eleUnion25 = unionTuple2[\\"0\\"]; // boolean -var eleUnion26 = unionTuple2[\\"1\\"]; // string | number +var eleUnion25 = unionTuple2["0"]; // boolean +var eleUnion26 = unionTuple2["1"]; // string | number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var strNumTuple: [string, number] = [\\"foo\\", 10]; -var numTupleTuple: [number, [string, number]] = [10, [\\"bar\\", 20]]; -var unionTuple1: [number, string | number] = [10, \\"foo\\"]; -var unionTuple2: [boolean, string | number] = [true, \\"foo\\"]; +var strNumTuple: [string, number] = ["foo", 10]; +var numTupleTuple: [number, [string, number]] = [10, ["bar", 20]]; +var unionTuple1: [number, string | number] = [10, "foo"]; +var unionTuple2: [boolean, string | number] = [true, "foo"]; // no error var idx0 = 0; @@ -102,8 +102,8 @@ var ele11 = strNumTuple[1]; // number var ele12 = strNumTuple[2]; // string | number var ele13 = strNumTuple[idx0]; // string | number var ele14 = strNumTuple[idx1]; // string | number -var ele15 = strNumTuple[\\"0\\"]; // string -var ele16 = strNumTuple[\\"1\\"]; // number +var ele15 = strNumTuple["0"]; // string +var ele16 = strNumTuple["1"]; // number var strNumTuple1 = numTupleTuple[1]; //[string, number]; var ele17 = numTupleTuple[2]; // number | [string, number] var eleUnion10 = unionTuple1[0]; // number @@ -111,53 +111,53 @@ var eleUnion11 = unionTuple1[1]; // string | number var eleUnion12 = unionTuple1[2]; // string | number var eleUnion13 = unionTuple1[idx0]; // string | number var eleUnion14 = unionTuple1[idx1]; // string | number -var eleUnion15 = unionTuple1[\\"0\\"]; // number -var eleUnion16 = unionTuple1[\\"1\\"]; // string | number +var eleUnion15 = unionTuple1["0"]; // number +var eleUnion16 = unionTuple1["1"]; // string | number var eleUnion20 = unionTuple2[0]; // boolean var eleUnion21 = unionTuple2[1]; // string | number var eleUnion22 = unionTuple2[2]; // string | number | boolean var eleUnion23 = unionTuple2[idx0]; // string | number | boolean var eleUnion24 = unionTuple2[idx1]; // string | number | boolean -var eleUnion25 = unionTuple2[\\"0\\"]; // boolean -var eleUnion26 = unionTuple2[\\"1\\"]; // string | number -" +var eleUnion25 = unionTuple2["0"]; // boolean +var eleUnion26 = unionTuple2["1"]; // string | number + `; exports[`tupleElementTypes1.ts 1`] = ` -"var [a, b]: [number, any] = [undefined, undefined]; +var [a, b]: [number, any] = [undefined, undefined]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var [a, b]: [number, any] = [undefined, undefined]; -" + `; exports[`tupleElementTypes2.ts 1`] = ` -"function f([a, b]: [number, any]) { } +function f([a, b]: [number, any]) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function f([a, b]: [number, any]) {} -" + `; exports[`tupleElementTypes3.ts 1`] = ` -"var [a, b] = [0, undefined]; +var [a, b] = [0, undefined]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var [a, b] = [0, undefined]; -" + `; exports[`tupleElementTypes4.ts 1`] = ` -"function f([a, b] = [0, undefined]) { } +function f([a, b] = [0, undefined]) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function f([a, b] = [0, undefined]) {} -" + `; exports[`typeInferenceWithTupleType.ts 1`] = ` -"function combine(x: T, y: U): [T, U] { +function combine(x: T, y: U): [T, U] { return [x, y]; } -var combineResult = combine(\\"string\\", 10); +var combineResult = combine("string", 10); var combineEle1 = combineResult[0]; // string var combineEle2 = combineResult[1]; // number @@ -173,7 +173,7 @@ function zip(array1: T[], array2: U[]): [[T, U]] { return zipResult; } -var zipResult = zip([\\"foo\\", \\"bar\\"], [5, 6]); +var zipResult = zip(["foo", "bar"], [5, 6]); var zipResultEle = zipResult[0]; // [string, number] var zipResultEleEle = zipResult[0][0]; // string @@ -182,7 +182,7 @@ function combine(x: T, y: U): [T, U] { return [x, y]; } -var combineResult = combine(\\"string\\", 10); +var combineResult = combine("string", 10); var combineEle1 = combineResult[0]; // string var combineEle2 = combineResult[1]; // number @@ -198,46 +198,46 @@ function zip(array1: T[], array2: U[]): [[T, U]] { return zipResult; } -var zipResult = zip([\\"foo\\", \\"bar\\"], [5, 6]); +var zipResult = zip(["foo", "bar"], [5, 6]); var zipResultEle = zipResult[0]; // [string, number] var zipResultEleEle = zipResult[0][0]; // string -" + `; exports[`wideningTuples1.ts 1`] = ` -"//@noImplicitAny: true +//@noImplicitAny: true declare function foo(x: T): T; var y = foo([undefined]); -y = [\\"\\"]; +y = [""]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //@noImplicitAny: true declare function foo(x: T): T var y = foo([undefined]); -y = [\\"\\"]; -" +y = [""]; + `; exports[`wideningTuples2.ts 1`] = ` -"//@noImplicitAny: true +//@noImplicitAny: true var foo: () => [any] = function bar() { let intermediate = bar(); - intermediate = [\\"\\"]; + intermediate = [""]; return [undefined]; }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //@noImplicitAny: true var foo: () => [any] = function bar() { let intermediate = bar(); - intermediate = [\\"\\"]; + intermediate = [""]; return [undefined]; }; -" + `; exports[`wideningTuples3.ts 1`] = ` -"//@noImplicitAny: true +//@noImplicitAny: true var a: [any]; var b = a = [undefined, null]; @@ -246,44 +246,44 @@ var b = a = [undefined, null]; var a: [any]; var b = (a = [undefined, null]); -" + `; exports[`wideningTuples4.ts 1`] = ` -"var a: [any]; +var a: [any]; var b = a = [undefined, null]; -b = [\\"\\", \\"\\"]; +b = ["", ""]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var a: [any]; var b = (a = [undefined, null]); -b = [\\"\\", \\"\\"]; -" +b = ["", ""]; + `; exports[`wideningTuples5.ts 1`] = ` -"//@noImplicitAny: true +//@noImplicitAny: true var [a, b] = [undefined, null]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //@noImplicitAny: true var [a, b] = [undefined, null]; -" + `; exports[`wideningTuples6.ts 1`] = ` -"var [a, b] = [undefined, null]; -a = \\"\\"; -b = \\"\\"; +var [a, b] = [undefined, null]; +a = ""; +b = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var [a, b] = [undefined, null]; -a = \\"\\"; -b = \\"\\"; -" +a = ""; +b = ""; + `; exports[`wideningTuples7.ts 1`] = ` -"//@noImplicitAny: true +//@noImplicitAny: true var foo = function bar() { let intermediate: [string]; return intermediate = [undefined]; @@ -294,5 +294,5 @@ var foo = function bar() { let intermediate: [string]; return (intermediate = [undefined]); }; -" + `; diff --git a/tests/typescript/conformance/types/tuple/emptyTuples/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/tuple/emptyTuples/__snapshots__/jsfmt.spec.js.snap index 983dc819..802a5813 100644 --- a/tests/typescript/conformance/types/tuple/emptyTuples/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/tuple/emptyTuples/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`emptyTuplesTypeAssertion02.ts 1`] = ` -"// @declaration: true +// @declaration: true let x = [] as []; let y = x[0]; @@ -10,5 +10,5 @@ let y = x[0]; let x = [] as []; let y = x[0]; -" + `; diff --git a/tests/typescript/conformance/types/typeParameters/typeParameterLists/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/typeParameters/typeParameterLists/__snapshots__/jsfmt.spec.js.snap index 424061b9..8b0ed082 100644 --- a/tests/typescript/conformance/types/typeParameters/typeParameterLists/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/typeParameters/typeParameterLists/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`innerTypeParameterShadowingOuterOne.ts 1`] = ` -"// inner type parameters shadow outer ones of the same name +// inner type parameters shadow outer ones of the same name // no errors expected function f() { @@ -58,11 +58,11 @@ function f2() { // var x: U; // x.getDate(); //} -" + `; exports[`innerTypeParameterShadowingOuterOne2.ts 1`] = ` -"// inner type parameters shadow outer ones of the same name +// inner type parameters shadow outer ones of the same name // no errors expected class C { @@ -137,11 +137,11 @@ class C2 { // x.getDate(); // } //} -" + `; exports[`staticMembersUsingClassTypeParameter.ts 1`] = ` -"// BUG 745747 +// BUG 745747 class C { static x: T; static f(x: T) {} @@ -172,11 +172,11 @@ class C3 { static x: T; static f(x: T) {} } -" + `; exports[`typeParametersAvailableInNestedScope2.ts 1`] = ` -"function foo(x: T, y: U) { +function foo(x: T, y: U) { function bar(z: V) { function baz(a: W) { var c: T; @@ -195,5 +195,5 @@ function foo(x: T, y: U) { } } } -" + `; diff --git a/tests/typescript/conformance/types/union/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/union/__snapshots__/jsfmt.spec.js.snap index 1c81c780..8eb6a3b4 100644 --- a/tests/typescript/conformance/types/union/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/union/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`unionTypeCallSignatures.ts 1`] = ` -"var numOrDate: number | Date; +var numOrDate: number | Date; var strOrBoolean: string | boolean; var strOrNum: string | number; @@ -9,72 +9,72 @@ var strOrNum: string | number; // U has the same set of call signatures, but with return types that are unions of the return types of the respective call signatures from each type in U. var unionOfDifferentReturnType: { (a: number): number; } | { (a: number): Date; }; numOrDate = unionOfDifferentReturnType(10); -strOrBoolean = unionOfDifferentReturnType(\\"hello\\"); // error +strOrBoolean = unionOfDifferentReturnType("hello"); // error unionOfDifferentReturnType1(true); // error in type of parameter var unionOfDifferentReturnType1: { (a: number): number; (a: string): string; } | { (a: number): Date; (a: string): boolean; }; numOrDate = unionOfDifferentReturnType1(10); -strOrBoolean = unionOfDifferentReturnType1(\\"hello\\"); +strOrBoolean = unionOfDifferentReturnType1("hello"); unionOfDifferentReturnType1(true); // error in type of parameter unionOfDifferentReturnType1(); // error missing parameter var unionOfDifferentParameterTypes: { (a: number): number; } | { (a: string): Date; }; unionOfDifferentParameterTypes(10);// error - no call signatures -unionOfDifferentParameterTypes(\\"hello\\");// error - no call signatures +unionOfDifferentParameterTypes("hello");// error - no call signatures unionOfDifferentParameterTypes();// error - no call signatures var unionOfDifferentNumberOfSignatures: { (a: number): number; } | { (a: number): Date; (a: string): boolean; }; unionOfDifferentNumberOfSignatures(); // error - no call signatures unionOfDifferentNumberOfSignatures(10); // error - no call signatures -unionOfDifferentNumberOfSignatures(\\"hello\\"); // error - no call signatures +unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; unionWithDifferentParameterCount();// no call signature -unionWithDifferentParameterCount(\\"hello\\");// no call signature -unionWithDifferentParameterCount(\\"hello\\", 10);// no call signature +unionWithDifferentParameterCount("hello");// no call signature +unionWithDifferentParameterCount("hello", 10);// no call signature var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; strOrNum = unionWithOptionalParameter1('hello'); strOrNum = unionWithOptionalParameter1('hello', 10); -strOrNum = unionWithOptionalParameter1('hello', \\"hello\\"); // error in parameter type +strOrNum = unionWithOptionalParameter1('hello', "hello"); // error in parameter type strOrNum = unionWithOptionalParameter1(); // error var unionWithOptionalParameter2: { (a: string, b?: number): string; } | { (a: string, b: number): number }; strOrNum = unionWithOptionalParameter2('hello'); // error no call signature strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature -strOrNum = unionWithOptionalParameter2('hello', \\"hello\\"); // error no call signature +strOrNum = unionWithOptionalParameter2('hello', "hello"); // error no call signature strOrNum = unionWithOptionalParameter2(); // error no call signature var unionWithOptionalParameter3: { (a: string, b?: number): string; } | { (a: string): number; }; strOrNum = unionWithOptionalParameter3('hello'); strOrNum = unionWithOptionalParameter3('hello', 10); // error no call signature -strOrNum = unionWithOptionalParameter3('hello', \\"hello\\"); // error no call signature +strOrNum = unionWithOptionalParameter3('hello', "hello"); // error no call signature strOrNum = unionWithOptionalParameter3(); // error no call signature var unionWithRestParameter1: { (a: string, ...b: number[]): string; } | { (a: string, ...b: number[]): number }; strOrNum = unionWithRestParameter1('hello'); strOrNum = unionWithRestParameter1('hello', 10); strOrNum = unionWithRestParameter1('hello', 10, 11); -strOrNum = unionWithRestParameter1('hello', \\"hello\\"); // error in parameter type +strOrNum = unionWithRestParameter1('hello', "hello"); // error in parameter type strOrNum = unionWithRestParameter1(); // error var unionWithRestParameter2: { (a: string, ...b: number[]): string; } | { (a: string, b: number): number }; strOrNum = unionWithRestParameter2('hello'); // error no call signature strOrNum = unionWithRestParameter2('hello', 10); // error no call signature strOrNum = unionWithRestParameter2('hello', 10, 11); // error no call signature -strOrNum = unionWithRestParameter2('hello', \\"hello\\"); // error no call signature +strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature strOrNum = unionWithRestParameter2(); // error no call signature var unionWithRestParameter3: { (a: string, ...b: number[]): string; } | { (a: string): number }; strOrNum = unionWithRestParameter3('hello'); strOrNum = unionWithRestParameter3('hello', 10); // error no call signature strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature -strOrNum = unionWithRestParameter3('hello', \\"hello\\"); // error no call signature +strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature strOrNum = unionWithRestParameter3(); // error no call signature var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; }; -strOrNum = unionWithRestParameter4(\\"hello\\"); // error supplied parameters do not match any call signature -strOrNum = unionWithRestParameter4(\\"hello\\", \\"world\\"); +strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature +strOrNum = unionWithRestParameter4("hello", "world"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var numOrDate: number | Date; var strOrBoolean: string | boolean; @@ -84,14 +84,14 @@ var strOrNum: string | number; // U has the same set of call signatures, but with return types that are unions of the return types of the respective call signatures from each type in U. var unionOfDifferentReturnType: { (a: number): number } | { (a: number): Date }; numOrDate = unionOfDifferentReturnType(10); -strOrBoolean = unionOfDifferentReturnType(\\"hello\\"); // error +strOrBoolean = unionOfDifferentReturnType("hello"); // error unionOfDifferentReturnType1(true); // error in type of parameter var unionOfDifferentReturnType1: | { (a: number): number, (a: string): string } | { (a: number): Date, (a: string): boolean }; numOrDate = unionOfDifferentReturnType1(10); -strOrBoolean = unionOfDifferentReturnType1(\\"hello\\"); +strOrBoolean = unionOfDifferentReturnType1("hello"); unionOfDifferentReturnType1(true); // error in type of parameter unionOfDifferentReturnType1(); // error missing parameter @@ -99,7 +99,7 @@ var unionOfDifferentParameterTypes: | { (a: number): number } | { (a: string): Date }; unionOfDifferentParameterTypes(10); // error - no call signatures -unionOfDifferentParameterTypes(\\"hello\\"); // error - no call signatures +unionOfDifferentParameterTypes("hello"); // error - no call signatures unionOfDifferentParameterTypes(); // error - no call signatures var unionOfDifferentNumberOfSignatures: @@ -107,76 +107,76 @@ var unionOfDifferentNumberOfSignatures: | { (a: number): Date, (a: string): boolean }; unionOfDifferentNumberOfSignatures(); // error - no call signatures unionOfDifferentNumberOfSignatures(10); // error - no call signatures -unionOfDifferentNumberOfSignatures(\\"hello\\"); // error - no call signatures +unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures var unionWithDifferentParameterCount: | { (a: string): string } | { (a: string, b: number): number }; unionWithDifferentParameterCount(); // no call signature -unionWithDifferentParameterCount(\\"hello\\"); // no call signature -unionWithDifferentParameterCount(\\"hello\\", 10); // no call signature +unionWithDifferentParameterCount("hello"); // no call signature +unionWithDifferentParameterCount("hello", 10); // no call signature var unionWithOptionalParameter1: | { (a: string, b?: number): string } | { (a: string, b?: number): number }; -strOrNum = unionWithOptionalParameter1(\\"hello\\"); -strOrNum = unionWithOptionalParameter1(\\"hello\\", 10); -strOrNum = unionWithOptionalParameter1(\\"hello\\", \\"hello\\"); // error in parameter type +strOrNum = unionWithOptionalParameter1("hello"); +strOrNum = unionWithOptionalParameter1("hello", 10); +strOrNum = unionWithOptionalParameter1("hello", "hello"); // error in parameter type strOrNum = unionWithOptionalParameter1(); // error var unionWithOptionalParameter2: | { (a: string, b?: number): string } | { (a: string, b: number): number }; -strOrNum = unionWithOptionalParameter2(\\"hello\\"); // error no call signature -strOrNum = unionWithOptionalParameter2(\\"hello\\", 10); // error no call signature -strOrNum = unionWithOptionalParameter2(\\"hello\\", \\"hello\\"); // error no call signature +strOrNum = unionWithOptionalParameter2("hello"); // error no call signature +strOrNum = unionWithOptionalParameter2("hello", 10); // error no call signature +strOrNum = unionWithOptionalParameter2("hello", "hello"); // error no call signature strOrNum = unionWithOptionalParameter2(); // error no call signature var unionWithOptionalParameter3: | { (a: string, b?: number): string } | { (a: string): number }; -strOrNum = unionWithOptionalParameter3(\\"hello\\"); -strOrNum = unionWithOptionalParameter3(\\"hello\\", 10); // error no call signature -strOrNum = unionWithOptionalParameter3(\\"hello\\", \\"hello\\"); // error no call signature +strOrNum = unionWithOptionalParameter3("hello"); +strOrNum = unionWithOptionalParameter3("hello", 10); // error no call signature +strOrNum = unionWithOptionalParameter3("hello", "hello"); // error no call signature strOrNum = unionWithOptionalParameter3(); // error no call signature var unionWithRestParameter1: | { (a: string, ...b: number[]): string } | { (a: string, ...b: number[]): number }; -strOrNum = unionWithRestParameter1(\\"hello\\"); -strOrNum = unionWithRestParameter1(\\"hello\\", 10); -strOrNum = unionWithRestParameter1(\\"hello\\", 10, 11); -strOrNum = unionWithRestParameter1(\\"hello\\", \\"hello\\"); // error in parameter type +strOrNum = unionWithRestParameter1("hello"); +strOrNum = unionWithRestParameter1("hello", 10); +strOrNum = unionWithRestParameter1("hello", 10, 11); +strOrNum = unionWithRestParameter1("hello", "hello"); // error in parameter type strOrNum = unionWithRestParameter1(); // error var unionWithRestParameter2: | { (a: string, ...b: number[]): string } | { (a: string, b: number): number }; -strOrNum = unionWithRestParameter2(\\"hello\\"); // error no call signature -strOrNum = unionWithRestParameter2(\\"hello\\", 10); // error no call signature -strOrNum = unionWithRestParameter2(\\"hello\\", 10, 11); // error no call signature -strOrNum = unionWithRestParameter2(\\"hello\\", \\"hello\\"); // error no call signature +strOrNum = unionWithRestParameter2("hello"); // error no call signature +strOrNum = unionWithRestParameter2("hello", 10); // error no call signature +strOrNum = unionWithRestParameter2("hello", 10, 11); // error no call signature +strOrNum = unionWithRestParameter2("hello", "hello"); // error no call signature strOrNum = unionWithRestParameter2(); // error no call signature var unionWithRestParameter3: | { (a: string, ...b: number[]): string } | { (a: string): number }; -strOrNum = unionWithRestParameter3(\\"hello\\"); -strOrNum = unionWithRestParameter3(\\"hello\\", 10); // error no call signature -strOrNum = unionWithRestParameter3(\\"hello\\", 10, 11); // error no call signature -strOrNum = unionWithRestParameter3(\\"hello\\", \\"hello\\"); // error no call signature +strOrNum = unionWithRestParameter3("hello"); +strOrNum = unionWithRestParameter3("hello", 10); // error no call signature +strOrNum = unionWithRestParameter3("hello", 10, 11); // error no call signature +strOrNum = unionWithRestParameter3("hello", "hello"); // error no call signature strOrNum = unionWithRestParameter3(); // error no call signature var unionWithRestParameter4: | { (...a: string[]): string } | { (a: string, b: string): number }; -strOrNum = unionWithRestParameter4(\\"hello\\"); // error supplied parameters do not match any call signature -strOrNum = unionWithRestParameter4(\\"hello\\", \\"world\\"); -" +strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature +strOrNum = unionWithRestParameter4("hello", "world"); + `; exports[`unionTypeCallSignatures3.ts 1`] = ` -"function f1(s: string) { } +function f1(s: string) { } function f2(s?: string) { } function f3(...s: string[]) { } function f4(s: string, s2?: string) { } @@ -186,7 +186,7 @@ function f7(s: string, ...sRest: string[]) { } var fUnion: typeof f1 | typeof f2 | typeof f3 | typeof f4 | typeof f5 | typeof f6 | typeof f7; -fUnion(\\"\\"); // All constituents can be called by passing a single string. +fUnion(""); // All constituents can be called by passing a single string. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function f1(s: string) {} function f2(s?: string) {} @@ -205,36 +205,36 @@ var fUnion: | typeof f6 | typeof f7; -fUnion(\\"\\"); // All constituents can be called by passing a single string. -" +fUnion(""); // All constituents can be called by passing a single string. + `; exports[`unionTypeCallSignatures4.ts 1`] = ` -"type F1 = (a: string, b?: string) => void; +type F1 = (a: string, b?: string) => void; type F2 = (a: string, b?: string, c?: string) => void; type F3 = (a: string, ...rest: string[]) => void; type F4 = (a: string, b?: string, ...rest: string[]) => void; type F5 = (a: string, b: string) => void; var f12: F1 | F2; -f12(\\"a\\"); -f12(\\"a\\", \\"b\\"); -f12(\\"a\\", \\"b\\", \\"c\\"); // error +f12("a"); +f12("a", "b"); +f12("a", "b", "c"); // error var f34: F3 | F4; -f34(\\"a\\"); -f34(\\"a\\", \\"b\\"); -f34(\\"a\\", \\"b\\", \\"c\\"); +f34("a"); +f34("a", "b"); +f34("a", "b", "c"); var f1234: F1 | F2 | F3 | F4; -f1234(\\"a\\"); -f1234(\\"a\\", \\"b\\"); -f1234(\\"a\\", \\"b\\", \\"c\\"); // error +f1234("a"); +f1234("a", "b"); +f1234("a", "b", "c"); // error var f12345: F1 | F2 | F3 | F4 | F5; -f12345(\\"a\\"); // error -f12345(\\"a\\", \\"b\\"); -f12345(\\"a\\", \\"b\\", \\"c\\"); // error +f12345("a"); // error +f12345("a", "b"); +f12345("a", "b", "c"); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type F1 = (a: string, b?: string) => void; type F2 = (a: string, b?: string, c?: string) => void; @@ -243,29 +243,29 @@ type F4 = (a: string, b?: string, ...rest: string[]) => void; type F5 = (a: string, b: string) => void; var f12: F1 | F2; -f12(\\"a\\"); -f12(\\"a\\", \\"b\\"); -f12(\\"a\\", \\"b\\", \\"c\\"); // error +f12("a"); +f12("a", "b"); +f12("a", "b", "c"); // error var f34: F3 | F4; -f34(\\"a\\"); -f34(\\"a\\", \\"b\\"); -f34(\\"a\\", \\"b\\", \\"c\\"); +f34("a"); +f34("a", "b"); +f34("a", "b", "c"); var f1234: F1 | F2 | F3 | F4; -f1234(\\"a\\"); -f1234(\\"a\\", \\"b\\"); -f1234(\\"a\\", \\"b\\", \\"c\\"); // error +f1234("a"); +f1234("a", "b"); +f1234("a", "b", "c"); // error var f12345: F1 | F2 | F3 | F4 | F5; -f12345(\\"a\\"); // error -f12345(\\"a\\", \\"b\\"); -f12345(\\"a\\", \\"b\\", \\"c\\"); // error -" +f12345("a"); // error +f12345("a", "b"); +f12345("a", "b", "c"); // error + `; exports[`unionTypeConstructSignatures.ts 1`] = ` -"var numOrDate: number | Date; +var numOrDate: number | Date; var strOrBoolean: string | boolean; var strOrNum: string | number; @@ -273,67 +273,67 @@ var strOrNum: string | number; // U has the same set of construct signatures, but with return types that are unions of the return types of the respective construct signatures from each type in U. var unionOfDifferentReturnType: { new (a: number): number; } | { new (a: number): Date; }; numOrDate = new unionOfDifferentReturnType(10); -strOrBoolean = new unionOfDifferentReturnType(\\"hello\\"); // error +strOrBoolean = new unionOfDifferentReturnType("hello"); // error new unionOfDifferentReturnType1(true); // error in type of parameter var unionOfDifferentReturnType1: { new (a: number): number; new (a: string): string; } | { new (a: number): Date; new (a: string): boolean; }; numOrDate = new unionOfDifferentReturnType1(10); -strOrBoolean = new unionOfDifferentReturnType1(\\"hello\\"); +strOrBoolean = new unionOfDifferentReturnType1("hello"); new unionOfDifferentReturnType1(true); // error in type of parameter new unionOfDifferentReturnType1(); // error missing parameter var unionOfDifferentParameterTypes: { new (a: number): number; } | { new (a: string): Date; }; new unionOfDifferentParameterTypes(10);// error - no call signatures -new unionOfDifferentParameterTypes(\\"hello\\");// error - no call signatures +new unionOfDifferentParameterTypes("hello");// error - no call signatures new unionOfDifferentParameterTypes();// error - no call signatures var unionOfDifferentNumberOfSignatures: { new (a: number): number; } | { new (a: number): Date; new (a: string): boolean; }; new unionOfDifferentNumberOfSignatures(); // error - no call signatures new unionOfDifferentNumberOfSignatures(10); // error - no call signatures -new unionOfDifferentNumberOfSignatures(\\"hello\\"); // error - no call signatures +new unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures var unionWithDifferentParameterCount: { new (a: string): string; } | { new (a: string, b: number): number; }; new unionWithDifferentParameterCount();// no call signature -new unionWithDifferentParameterCount(\\"hello\\");// no call signature -new unionWithDifferentParameterCount(\\"hello\\", 10);// no call signature +new unionWithDifferentParameterCount("hello");// no call signature +new unionWithDifferentParameterCount("hello", 10);// no call signature var unionWithOptionalParameter1: { new (a: string, b?: number): string; } | { new (a: string, b?: number): number; }; strOrNum = new unionWithOptionalParameter1('hello'); strOrNum = new unionWithOptionalParameter1('hello', 10); -strOrNum = new unionWithOptionalParameter1('hello', \\"hello\\"); // error in parameter type +strOrNum = new unionWithOptionalParameter1('hello', "hello"); // error in parameter type strOrNum = new unionWithOptionalParameter1(); // error var unionWithOptionalParameter2: { new (a: string, b?: number): string; } | { new (a: string, b: number): number }; strOrNum = new unionWithOptionalParameter2('hello'); // error no call signature strOrNum = new unionWithOptionalParameter2('hello', 10); // error no call signature -strOrNum = new unionWithOptionalParameter2('hello', \\"hello\\"); // error no call signature +strOrNum = new unionWithOptionalParameter2('hello', "hello"); // error no call signature strOrNum = new unionWithOptionalParameter2(); // error no call signature var unionWithOptionalParameter3: { new (a: string, b?: number): string; } | { new (a: string): number; }; strOrNum = new unionWithOptionalParameter3('hello'); // error no call signature strOrNum = new unionWithOptionalParameter3('hello', 10); // error no call signature -strOrNum = new unionWithOptionalParameter3('hello', \\"hello\\"); // error no call signature +strOrNum = new unionWithOptionalParameter3('hello', "hello"); // error no call signature strOrNum = new unionWithOptionalParameter3(); // error no call signature var unionWithRestParameter1: { new (a: string, ...b: number[]): string; } | { new (a: string, ...b: number[]): number }; strOrNum = new unionWithRestParameter1('hello'); strOrNum = new unionWithRestParameter1('hello', 10); strOrNum = new unionWithRestParameter1('hello', 10, 11); -strOrNum = new unionWithRestParameter1('hello', \\"hello\\"); // error in parameter type +strOrNum = new unionWithRestParameter1('hello', "hello"); // error in parameter type strOrNum = new unionWithRestParameter1(); // error var unionWithRestParameter2: { new (a: string, ...b: number[]): string; } | { new (a: string, b: number): number }; strOrNum = new unionWithRestParameter2('hello'); // error no call signature strOrNum = new unionWithRestParameter2('hello', 10); // error no call signature strOrNum = new unionWithRestParameter2('hello', 10, 11); // error no call signature -strOrNum = new unionWithRestParameter2('hello', \\"hello\\"); // error no call signature +strOrNum = new unionWithRestParameter2('hello', "hello"); // error no call signature strOrNum = new unionWithRestParameter2(); // error no call signature var unionWithRestParameter3: { new (a: string, ...b: number[]): string; } | { new (a: string): number }; strOrNum = new unionWithRestParameter3('hello'); // error no call signature strOrNum = new unionWithRestParameter3('hello', 10); // error no call signature strOrNum = new unionWithRestParameter3('hello', 10, 11); // error no call signature -strOrNum = new unionWithRestParameter3('hello', \\"hello\\"); // error no call signature +strOrNum = new unionWithRestParameter3('hello', "hello"); // error no call signature strOrNum = new unionWithRestParameter3(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var numOrDate: number | Date; @@ -346,14 +346,14 @@ var unionOfDifferentReturnType: | { new (a: number): number } | { new (a: number): Date }; numOrDate = new unionOfDifferentReturnType(10); -strOrBoolean = new unionOfDifferentReturnType(\\"hello\\"); // error +strOrBoolean = new unionOfDifferentReturnType("hello"); // error new unionOfDifferentReturnType1(true); // error in type of parameter var unionOfDifferentReturnType1: | { new (a: number): number, new (a: string): string } | { new (a: number): Date, new (a: string): boolean }; numOrDate = new unionOfDifferentReturnType1(10); -strOrBoolean = new unionOfDifferentReturnType1(\\"hello\\"); +strOrBoolean = new unionOfDifferentReturnType1("hello"); new unionOfDifferentReturnType1(true); // error in type of parameter new unionOfDifferentReturnType1(); // error missing parameter @@ -361,7 +361,7 @@ var unionOfDifferentParameterTypes: | { new (a: number): number } | { new (a: string): Date }; new unionOfDifferentParameterTypes(10); // error - no call signatures -new unionOfDifferentParameterTypes(\\"hello\\"); // error - no call signatures +new unionOfDifferentParameterTypes("hello"); // error - no call signatures new unionOfDifferentParameterTypes(); // error - no call signatures var unionOfDifferentNumberOfSignatures: @@ -369,70 +369,70 @@ var unionOfDifferentNumberOfSignatures: | { new (a: number): Date, new (a: string): boolean }; new unionOfDifferentNumberOfSignatures(); // error - no call signatures new unionOfDifferentNumberOfSignatures(10); // error - no call signatures -new unionOfDifferentNumberOfSignatures(\\"hello\\"); // error - no call signatures +new unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures var unionWithDifferentParameterCount: | { new (a: string): string } | { new (a: string, b: number): number }; new unionWithDifferentParameterCount(); // no call signature -new unionWithDifferentParameterCount(\\"hello\\"); // no call signature -new unionWithDifferentParameterCount(\\"hello\\", 10); // no call signature +new unionWithDifferentParameterCount("hello"); // no call signature +new unionWithDifferentParameterCount("hello", 10); // no call signature var unionWithOptionalParameter1: | { new (a: string, b?: number): string } | { new (a: string, b?: number): number }; -strOrNum = new unionWithOptionalParameter1(\\"hello\\"); -strOrNum = new unionWithOptionalParameter1(\\"hello\\", 10); -strOrNum = new unionWithOptionalParameter1(\\"hello\\", \\"hello\\"); // error in parameter type +strOrNum = new unionWithOptionalParameter1("hello"); +strOrNum = new unionWithOptionalParameter1("hello", 10); +strOrNum = new unionWithOptionalParameter1("hello", "hello"); // error in parameter type strOrNum = new unionWithOptionalParameter1(); // error var unionWithOptionalParameter2: | { new (a: string, b?: number): string } | { new (a: string, b: number): number }; -strOrNum = new unionWithOptionalParameter2(\\"hello\\"); // error no call signature -strOrNum = new unionWithOptionalParameter2(\\"hello\\", 10); // error no call signature -strOrNum = new unionWithOptionalParameter2(\\"hello\\", \\"hello\\"); // error no call signature +strOrNum = new unionWithOptionalParameter2("hello"); // error no call signature +strOrNum = new unionWithOptionalParameter2("hello", 10); // error no call signature +strOrNum = new unionWithOptionalParameter2("hello", "hello"); // error no call signature strOrNum = new unionWithOptionalParameter2(); // error no call signature var unionWithOptionalParameter3: | { new (a: string, b?: number): string } | { new (a: string): number }; -strOrNum = new unionWithOptionalParameter3(\\"hello\\"); // error no call signature -strOrNum = new unionWithOptionalParameter3(\\"hello\\", 10); // error no call signature -strOrNum = new unionWithOptionalParameter3(\\"hello\\", \\"hello\\"); // error no call signature +strOrNum = new unionWithOptionalParameter3("hello"); // error no call signature +strOrNum = new unionWithOptionalParameter3("hello", 10); // error no call signature +strOrNum = new unionWithOptionalParameter3("hello", "hello"); // error no call signature strOrNum = new unionWithOptionalParameter3(); // error no call signature var unionWithRestParameter1: | { new (a: string, ...b: number[]): string } | { new (a: string, ...b: number[]): number }; -strOrNum = new unionWithRestParameter1(\\"hello\\"); -strOrNum = new unionWithRestParameter1(\\"hello\\", 10); -strOrNum = new unionWithRestParameter1(\\"hello\\", 10, 11); -strOrNum = new unionWithRestParameter1(\\"hello\\", \\"hello\\"); // error in parameter type +strOrNum = new unionWithRestParameter1("hello"); +strOrNum = new unionWithRestParameter1("hello", 10); +strOrNum = new unionWithRestParameter1("hello", 10, 11); +strOrNum = new unionWithRestParameter1("hello", "hello"); // error in parameter type strOrNum = new unionWithRestParameter1(); // error var unionWithRestParameter2: | { new (a: string, ...b: number[]): string } | { new (a: string, b: number): number }; -strOrNum = new unionWithRestParameter2(\\"hello\\"); // error no call signature -strOrNum = new unionWithRestParameter2(\\"hello\\", 10); // error no call signature -strOrNum = new unionWithRestParameter2(\\"hello\\", 10, 11); // error no call signature -strOrNum = new unionWithRestParameter2(\\"hello\\", \\"hello\\"); // error no call signature +strOrNum = new unionWithRestParameter2("hello"); // error no call signature +strOrNum = new unionWithRestParameter2("hello", 10); // error no call signature +strOrNum = new unionWithRestParameter2("hello", 10, 11); // error no call signature +strOrNum = new unionWithRestParameter2("hello", "hello"); // error no call signature strOrNum = new unionWithRestParameter2(); // error no call signature var unionWithRestParameter3: | { new (a: string, ...b: number[]): string } | { new (a: string): number }; -strOrNum = new unionWithRestParameter3(\\"hello\\"); // error no call signature -strOrNum = new unionWithRestParameter3(\\"hello\\", 10); // error no call signature -strOrNum = new unionWithRestParameter3(\\"hello\\", 10, 11); // error no call signature -strOrNum = new unionWithRestParameter3(\\"hello\\", \\"hello\\"); // error no call signature +strOrNum = new unionWithRestParameter3("hello"); // error no call signature +strOrNum = new unionWithRestParameter3("hello", 10); // error no call signature +strOrNum = new unionWithRestParameter3("hello", 10, 11); // error no call signature +strOrNum = new unionWithRestParameter3("hello", "hello"); // error no call signature strOrNum = new unionWithRestParameter3(); // error no call signature -" + `; exports[`unionTypeEquivalence.ts 1`] = ` -"// A | B is equivalent to A if B is a subtype of A +// A | B is equivalent to A if B is a subtype of A class C { } class D extends C { foo() { } } var x: C; @@ -471,24 +471,24 @@ var AB: string | number; var BC: number | boolean; var z1: typeof AB | boolean; var z1: string | typeof BC; -" + `; exports[`unionTypeFromArrayLiteral.ts 1`] = ` -"// The resulting type an array literal expression is determined as follows: +// The resulting type an array literal expression is determined as follows: // If the array literal is empty, the resulting type is an array type with the element type Undefined. // Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions. // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. var arr1 = [1, 2]; // number[] -var arr2 = [\\"hello\\", true]; // (string | number)[] -var arr3Tuple: [number, string] = [3, \\"three\\"]; // [number, string] -var arr4Tuple: [number, string] = [3, \\"three\\", \\"hello\\"]; // [number, string, string] +var arr2 = ["hello", true]; // (string | number)[] +var arr3Tuple: [number, string] = [3, "three"]; // [number, string] +var arr4Tuple: [number, string] = [3, "three", "hello"]; // [number, string, string] var arrEmpty = []; var arr5Tuple: { 0: string; 5: number; -} = [\\"hello\\", true, false, \\" hello\\", true, 10, \\"any\\"]; // Tuple +} = ["hello", true, false, " hello", true, 10, "any"]; // Tuple class C { foo() { } } class D { foo2() { } } class E extends C { foo3() { } } @@ -505,14 +505,14 @@ var arr9 = [e, f]; // (E|F)[] // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. var arr1 = [1, 2]; // number[] -var arr2 = [\\"hello\\", true]; // (string | number)[] -var arr3Tuple: [number, string] = [3, \\"three\\"]; // [number, string] -var arr4Tuple: [number, string] = [3, \\"three\\", \\"hello\\"]; // [number, string, string] +var arr2 = ["hello", true]; // (string | number)[] +var arr3Tuple: [number, string] = [3, "three"]; // [number, string] +var arr4Tuple: [number, string] = [3, "three", "hello"]; // [number, string, string] var arrEmpty = []; var arr5Tuple: { 0: string, 5: number -} = [\\"hello\\", true, false, \\" hello\\", true, 10, \\"any\\"]; // Tuple +} = ["hello", true, false, " hello", true, 10, "any"]; // Tuple class C { foo() {} } @@ -530,32 +530,32 @@ var arr6 = [c, d]; // (C | D)[] var arr7 = [c, d, e]; // (C | D)[] var arr8 = [c, e]; // C[] var arr9 = [e, f]; // (E|F)[] -" + `; exports[`unionTypeIndexSignature.ts 1`] = ` -"var numOrDate: number | Date; +var numOrDate: number | Date; var anyVar: number; // If each type in U has a string index signature, // U has a string index signature of a union type of the types of the string index signatures from each type in U. var unionOfDifferentReturnType: { [a: string]: number; } | { [a: string]: Date; }; -numOrDate = unionOfDifferentReturnType[\\"hello\\"]; // number | Date +numOrDate = unionOfDifferentReturnType["hello"]; // number | Date numOrDate = unionOfDifferentReturnType[10]; // number | Date var unionOfTypesWithAndWithoutStringSignature: { [a: string]: number; } | boolean; -anyVar = unionOfTypesWithAndWithoutStringSignature[\\"hello\\"]; // any +anyVar = unionOfTypesWithAndWithoutStringSignature["hello"]; // any anyVar = unionOfTypesWithAndWithoutStringSignature[10]; // any // If each type in U has a numeric index signature, // U has a numeric index signature of a union type of the types of the numeric index signatures from each type in U. var unionOfDifferentReturnType1: { [a: number]: number; } | { [a: number]: Date; }; -numOrDate = unionOfDifferentReturnType1[\\"hello\\"]; // any +numOrDate = unionOfDifferentReturnType1["hello"]; // any numOrDate = unionOfDifferentReturnType1[10]; // number | Date var unionOfTypesWithAndWithoutStringSignature1: { [a: number]: number; } | boolean; -anyVar = unionOfTypesWithAndWithoutStringSignature1[\\"hello\\"]; // any +anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"]; // any anyVar = unionOfTypesWithAndWithoutStringSignature1[10]; // any ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var numOrDate: number | Date; @@ -565,13 +565,13 @@ var anyVar: number; // U has a string index signature of a union type of the types of the string index signatures from each type in U. var unionOfDifferentReturnType: { [a: string]: number } | { [a: string]: Date }; -numOrDate = unionOfDifferentReturnType[\\"hello\\"]; // number | Date +numOrDate = unionOfDifferentReturnType["hello"]; // number | Date numOrDate = unionOfDifferentReturnType[10]; // number | Date var unionOfTypesWithAndWithoutStringSignature: | { [a: string]: number } | boolean; -anyVar = unionOfTypesWithAndWithoutStringSignature[\\"hello\\"]; // any +anyVar = unionOfTypesWithAndWithoutStringSignature["hello"]; // any anyVar = unionOfTypesWithAndWithoutStringSignature[10]; // any // If each type in U has a numeric index signature, @@ -579,19 +579,19 @@ anyVar = unionOfTypesWithAndWithoutStringSignature[10]; // any var unionOfDifferentReturnType1: | { [a: number]: number } | { [a: number]: Date }; -numOrDate = unionOfDifferentReturnType1[\\"hello\\"]; // any +numOrDate = unionOfDifferentReturnType1["hello"]; // any numOrDate = unionOfDifferentReturnType1[10]; // number | Date var unionOfTypesWithAndWithoutStringSignature1: | { [a: number]: number } | boolean; -anyVar = unionOfTypesWithAndWithoutStringSignature1[\\"hello\\"]; // any +anyVar = unionOfTypesWithAndWithoutStringSignature1["hello"]; // any anyVar = unionOfTypesWithAndWithoutStringSignature1[10]; // any -" + `; exports[`unionTypePropertyAccessibility.ts 1`] = ` -"class Default { +class Default { member: string; } @@ -686,5 +686,5 @@ v12.member; v13.member; v14.member; v15.member; -" + `; diff --git a/tests/unary/__snapshots__/jsfmt.spec.js.snap b/tests/unary/__snapshots__/jsfmt.spec.js.snap index ff9113c2..6fea263b 100644 --- a/tests/unary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unary/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`object.js 1`] = ` -"state = { +state = { // students hoverColumn: -1 }; @@ -10,11 +10,11 @@ state = { // students hoverColumn: -1 }; -" + `; exports[`series.js 1`] = ` -"1 + ++x; +1 + ++x; 1 + x++; + ++x; @@ -49,5 +49,5 @@ x++ + 1; x-- - 1; --x - 1; -" + `; diff --git a/tests/unary_expression/__snapshots__/jsfmt.spec.js.snap b/tests/unary_expression/__snapshots__/jsfmt.spec.js.snap index 3fceaa16..6b96c2f8 100644 --- a/tests/unary_expression/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unary_expression/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`urnary_expression.js 1`] = ` -"!!x +!!x x++ x--; -+1; @@ -18,5 +18,5 @@ x + +(+(+1)); x + +(+(+1)); x * +y; +x * y; -" + `; diff --git a/tests/unicode/__snapshots__/jsfmt.spec.js.snap b/tests/unicode/__snapshots__/jsfmt.spec.js.snap index 69006e42..02135352 100644 --- a/tests/unicode/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unicode/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`keys.js 1`] = ` -"({'この事はつもり素晴らしいことさ': '35jL9V'}) +({'この事はつもり素晴らしいことさ': '35jL9V'}) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -({ \\"この事はつもり素晴らしいことさ\\": \\"35jL9V\\" }); -" +({ "この事はつもり素晴らしいことさ": "35jL9V" }); + `; diff --git a/tests/union_intersection/__snapshots__/jsfmt.spec.js.snap b/tests/union_intersection/__snapshots__/jsfmt.spec.js.snap index 520c0c14..3466e06f 100644 --- a/tests/union_intersection/__snapshots__/jsfmt.spec.js.snap +++ b/tests/union_intersection/__snapshots__/jsfmt.spec.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`test.js 1`] = ` -"type T5 = \\"1\\" | \\"2\\" | \\"3\\" | \\"4\\" | \\"5\\" | \\"6\\" | \\"7\\" | \\"8\\" | \\"9\\" | \\"10\\" | \\"11\\" | \\"12\\" | \\"13\\"; +type T5 = "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13"; -type T6 = \\"a-long-string\\" | \\"another-long-string\\" | \\"yet-another-long-string\\" | \\"one-more-for-good-measure\\"; +type T6 = "a-long-string" | "another-long-string" | "yet-another-long-string" | "one-more-for-good-measure"; type T7 = - { eventName: \\"these\\", a: number } | - { eventName: \\"will\\", b: number } | - { eventName: \\"not\\", c: number } | - { eventName: \\"fit\\", d: number } | - { eventName: \\"on\\", e: number } | - { eventName: \\"one\\", f: number } | - { eventName: \\"line\\", g: number }; + { eventName: "these", a: number } | + { eventName: "will", b: number } | + { eventName: "not", c: number } | + { eventName: "fit", d: number } | + { eventName: "on", e: number } | + { eventName: "one", f: number } | + { eventName: "line", g: number }; type Comment = { type: 'CommentLine'; @@ -37,38 +37,38 @@ type Comment = { }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type T5 = - | \\"1\\" - | \\"2\\" - | \\"3\\" - | \\"4\\" - | \\"5\\" - | \\"6\\" - | \\"7\\" - | \\"8\\" - | \\"9\\" - | \\"10\\" - | \\"11\\" - | \\"12\\" - | \\"13\\"; + | "1" + | "2" + | "3" + | "4" + | "5" + | "6" + | "7" + | "8" + | "9" + | "10" + | "11" + | "12" + | "13"; type T6 = - | \\"a-long-string\\" - | \\"another-long-string\\" - | \\"yet-another-long-string\\" - | \\"one-more-for-good-measure\\"; + | "a-long-string" + | "another-long-string" + | "yet-another-long-string" + | "one-more-for-good-measure"; type T7 = - | { eventName: \\"these\\", a: number } - | { eventName: \\"will\\", b: number } - | { eventName: \\"not\\", c: number } - | { eventName: \\"fit\\", d: number } - | { eventName: \\"on\\", e: number } - | { eventName: \\"one\\", f: number } - | { eventName: \\"line\\", g: number }; + | { eventName: "these", a: number } + | { eventName: "will", b: number } + | { eventName: "not", c: number } + | { eventName: "fit", d: number } + | { eventName: "on", e: number } + | { eventName: "one", f: number } + | { eventName: "line", g: number }; type Comment = | { - type: \\"CommentLine\\", + type: "CommentLine", _CommentLine: void, value: string, end: number, @@ -79,7 +79,7 @@ type Comment = start: number } | { - type: \\"CommentBlock\\", + type: "CommentBlock", _CommentBlock: void, value: string, end: number, @@ -89,5 +89,5 @@ type Comment = }, start: number }; -" + `; diff --git a/tests/update_expression/__snapshots__/jsfmt.spec.js.snap b/tests/update_expression/__snapshots__/jsfmt.spec.js.snap index ee0cc47f..10011378 100644 --- a/tests/update_expression/__snapshots__/jsfmt.spec.js.snap +++ b/tests/update_expression/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`update_expression.js 1`] = ` -"(this.x++).toString() +(this.x++).toString() new (r++); (x++)(); const uuid = String(this._uuidCounter++); @@ -10,5 +10,5 @@ const uuid = String(this._uuidCounter++); new (r++)(); (x++)(); const uuid = String(this._uuidCounter++); -" + `; diff --git a/tests/variable_declarator/__snapshots__/jsfmt.spec.js.snap b/tests/variable_declarator/__snapshots__/jsfmt.spec.js.snap index 9d35090a..167f0e0f 100644 --- a/tests/variable_declarator/__snapshots__/jsfmt.spec.js.snap +++ b/tests/variable_declarator/__snapshots__/jsfmt.spec.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`string.js 1`] = ` -"elements[0].innerHTML = '
'; +elements[0].innerHTML = '
'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ elements[0].innerHTML = - \\"
\\"; -" + "
"; + `; diff --git a/tests/while/__snapshots__/jsfmt.spec.js.snap b/tests/while/__snapshots__/jsfmt.spec.js.snap index 6c6ff4bb..592c09a9 100644 --- a/tests/while/__snapshots__/jsfmt.spec.js.snap +++ b/tests/while/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`indent.js 1`] = ` -"if (someVeryLongStringA && someVeryLongStringB && someVeryLongStringC && someVeryLongStringD) {} +if (someVeryLongStringA && someVeryLongStringB && someVeryLongStringC && someVeryLongStringD) {} while (someVeryLongStringA && someVeryLongStringB && someVeryLongStringC && someVeryLongStringD) {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ( @@ -18,5 +18,5 @@ while ( someVeryLongStringD ) { } -" + `; diff --git a/tests/windows/__snapshots__/jsfmt.spec.js.snap b/tests/windows/__snapshots__/jsfmt.spec.js.snap index 5892fe8e..2410a68b 100644 --- a/tests/windows/__snapshots__/jsfmt.spec.js.snap +++ b/tests/windows/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`line-ending.js 1`] = ` -"this; +this; has; windows; line; @@ -12,5 +12,5 @@ has; windows; line; endings; -" + `; diff --git a/tests/yield/__snapshots__/jsfmt.spec.js.snap b/tests/yield/__snapshots__/jsfmt.spec.js.snap index b76a92b3..3e663001 100644 --- a/tests/yield/__snapshots__/jsfmt.spec.js.snap +++ b/tests/yield/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`conditional.js 1`] = ` -"function* f() { +function* f() { a = (yield) ? 1 : 1; a = yield 1 ? 1 : 1; a = (yield 1) ? 1 : 1; @@ -40,5 +40,5 @@ async function f() { a = (await 1) ? 1 : 1; a = 1 ? await 1 : await 1; } -" + `; diff --git a/tests_config/raw-serializer.js b/tests_config/raw-serializer.js new file mode 100644 index 00000000..fb10ab9a --- /dev/null +++ b/tests_config/raw-serializer.js @@ -0,0 +1,14 @@ +const RAW = Symbol.for("raw"); + +module.exports = { + print(val) { + return val[RAW]; + }, + test(val) { + return ( + val && + Object.prototype.hasOwnProperty.call(val, RAW) && + typeof val[RAW] === "string" + ); + } +}; diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js index 710829e5..203519b8 100644 --- a/tests_config/run_spec.js +++ b/tests_config/run_spec.js @@ -1,4 +1,5 @@ "use strict"; + const fs = require("fs"); const prettier = require("../"); const types = require("ast-types"); @@ -35,7 +36,7 @@ function run_spec(dirname, options, additionalParsers) { const mergedOptions = mergeDefaultOptions(options || {}); const output = prettyprint(source, path, mergedOptions); test(`${mergedOptions.parser} - ${parser.parser}-verify`, () => { - expect(source + "~".repeat(80) + "\n" + output).toMatchSnapshot( + expect(raw(source + "~".repeat(80) + "\n" + output)).toMatchSnapshot( filename ); }); @@ -118,6 +119,18 @@ function read(filename) { return fs.readFileSync(filename, "utf8"); } +/** + * Wraps a string in a marker object that is used by `./raw-serializer.js` to + * directly print that string in a snapshot without escaping all double quotes. + * Backticks will still be escaped. + */ +function raw(string) { + if (typeof string !== "string") { + throw new Error("Raw snapshots have to be strings."); + } + return { [Symbol.for("raw")]: string }; +} + function mergeDefaultOptions(parserConfig) { return Object.assign( { diff --git a/yarn.lock b/yarn.lock index 1534538c..db8be136 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1871,13 +1871,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@^2.4.3, rimraf@^2.4.4: - version "2.5.4" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" - dependencies: - glob "^7.0.5" - -rimraf@^2.6.1: +rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: