diff --git a/tests/angular_component_examples/__snapshots__/jsfmt.spec.js.snap b/tests/angular_component_examples/__snapshots__/jsfmt.spec.js.snap index 406ef7258..f30ff2d70 100644 --- a/tests/angular_component_examples/__snapshots__/jsfmt.spec.js.snap +++ b/tests/angular_component_examples/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`test.component.ts format 1`] = ` +exports[`test.component.ts - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["typescript"] printWidth: 80 @@ -47,7 +47,7 @@ class TestComponent {} ================================================================================ `; -exports[`test.component.ts format 2`] = ` +exports[`test.component.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] printWidth: 80 diff --git a/tests/angular_interpolation/__snapshots__/jsfmt.spec.js.snap b/tests/angular_interpolation/__snapshots__/jsfmt.spec.js.snap index bd6a7eb1b..da4216f30 100644 --- a/tests/angular_interpolation/__snapshots__/jsfmt.spec.js.snap +++ b/tests/angular_interpolation/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`logical-expression.ng format 1`] = ` +exports[`logical-expression.ng - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["__ng_interpolation"] printWidth: 80 @@ -21,7 +21,7 @@ trailingComma: "none" ================================================================================ `; -exports[`pipe-expression.ng format 1`] = ` +exports[`pipe-expression.ng - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["__ng_interpolation"] printWidth: 80 diff --git a/tests/arrow-call/__snapshots__/jsfmt.spec.js.snap b/tests/arrow-call/__snapshots__/jsfmt.spec.js.snap index 02c7b9af3..da09d5b7f 100644 --- a/tests/arrow-call/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrow-call/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`arrow_call.js format 1`] = ` +exports[`arrow_call.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== +arrowParens: "always" parsers: ["babel", "flow", "typescript"] printWidth: 80 | printWidth @@ -110,7 +111,7 @@ promise.then((result) => ================================================================================ `; -exports[`arrow_call.js format 2`] = ` +exports[`arrow_call.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] printWidth: 80 @@ -221,9 +222,8 @@ promise.then((result) => ================================================================================ `; -exports[`arrow_call.js format 3`] = ` +exports[`arrow_call.js format 1`] = ` ====================================options===================================== -arrowParens: "always" parsers: ["babel", "flow", "typescript"] printWidth: 80 | printWidth diff --git a/tests/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/arrows/__snapshots__/jsfmt.spec.js.snap index 6be562fd0..2a0349ec5 100644 --- a/tests/arrows/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrows/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`arrow_function_expression.js format 1`] = ` +exports[`arrow_function_expression.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -84,7 +84,7 @@ a = (b) => { ================================================================================ `; -exports[`arrow_function_expression.js format 2`] = ` +exports[`arrow_function_expression.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] @@ -168,7 +168,7 @@ a = b => { ================================================================================ `; -exports[`block_like.js format 1`] = ` +exports[`block_like.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -183,7 +183,7 @@ a = () => ({} = this); ================================================================================ `; -exports[`block_like.js format 2`] = ` +exports[`block_like.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] @@ -198,7 +198,7 @@ a = () => ({} = this); ================================================================================ `; -exports[`call.js format 1`] = ` +exports[`call.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -995,7 +995,7 @@ foo( ================================================================================ `; -exports[`call.js format 2`] = ` +exports[`call.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] @@ -1792,7 +1792,7 @@ foo( ================================================================================ `; -exports[`comment.js format 1`] = ` +exports[`comment.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -1865,7 +1865,7 @@ export const bem = (block) => ================================================================================ `; -exports[`comment.js format 2`] = ` +exports[`comment.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] @@ -1938,7 +1938,7 @@ export const bem = block => ================================================================================ `; -exports[`currying.js format 1`] = ` +exports[`currying.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -1985,7 +1985,7 @@ const middleware = (options) => (req, res, next) => { ================================================================================ `; -exports[`currying.js format 2`] = ` +exports[`currying.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] @@ -2032,7 +2032,7 @@ const middleware = options => (req, res, next) => { ================================================================================ `; -exports[`long-call-no-args.js format 1`] = ` +exports[`long-call-no-args.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -2050,7 +2050,7 @@ veryLongCall( ================================================================================ `; -exports[`long-call-no-args.js format 2`] = ` +exports[`long-call-no-args.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] @@ -2068,7 +2068,7 @@ veryLongCall( ================================================================================ `; -exports[`long-contents.js format 1`] = ` +exports[`long-contents.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -2092,7 +2092,7 @@ const foo = () => { ================================================================================ `; -exports[`long-contents.js format 2`] = ` +exports[`long-contents.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] @@ -2116,7 +2116,7 @@ const foo = () => { ================================================================================ `; -exports[`parens.js format 1`] = ` +exports[`parens.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -2167,7 +2167,7 @@ foo((a) => b, d); ================================================================================ `; -exports[`parens.js format 2`] = ` +exports[`parens.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] @@ -2218,7 +2218,7 @@ foo(a => b, d); ================================================================================ `; -exports[`short_body.js format 1`] = ` +exports[`short_body.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -2243,7 +2243,7 @@ const initializeSnapshotState = ( ================================================================================ `; -exports[`short_body.js format 2`] = ` +exports[`short_body.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] @@ -2268,7 +2268,7 @@ const initializeSnapshotState = ( ================================================================================ `; -exports[`type_params.js format 1`] = ` +exports[`type_params.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" parsers: ["babel", "typescript"] @@ -2283,7 +2283,7 @@ printWidth: 80 ================================================================================ `; -exports[`type_params.js format 2`] = ` +exports[`type_params.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["babel", "typescript"] diff --git a/tests/bind_expressions/__snapshots__/jsfmt.spec.js.snap b/tests/bind_expressions/__snapshots__/jsfmt.spec.js.snap index d14836eb4..de930be37 100644 --- a/tests/bind_expressions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/bind_expressions/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,26 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`await.js - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +const doBothThings = async () => { + const request = doAsyncThing(); + return (await request)::doSyncThing(); +}; + +=====================================output===================================== +const doBothThings = async () => { + const request = doAsyncThing() + return (await request)::doSyncThing() +} + +================================================================================ +`; + exports[`await.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -20,23 +41,83 @@ const doBothThings = async () => { ================================================================================ `; -exports[`await.js format 2`] = ` +exports[`bind_parens.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -const doBothThings = async () => { - const request = doAsyncThing(); - return (await request)::doSyncThing(); -}; +(a || b)::c; +a || (b::c); +::obj.prop; +(void 0)::func(); +(+0)::is(-0); +a::(b.c); +a::(b.c()); +a::b.c(); +a::(b.c()()); +a::((b.c())()); +a::(b.c())(); +a::(b.c().d); +a::(c().d.e); +a::(b()); +a::(b::c()); +a::(b()::c); +a::(b().c::d); +a::(b.c::d); +a::(b::c.d); +a::(b.c::d::e); +a::(b::c::d); +a::(b::c::d.e); +a::((b::c::d).e); +a::(void 0); +a::(b.c()::d.e); +a::(b.c::d.e); +a::(b.c::d.e)::f.g; +b.c::d.e; +(b.c::d).e; +(b::c::d).e; +new (a::b)(); +new f(a::b); +f[a::b]; +f[a::b()]; =====================================output===================================== -const doBothThings = async () => { - const request = doAsyncThing() - return (await request)::doSyncThing() -} +;(a || b)::c +a || b::c +;::obj.prop +;(void 0)::func() +;(+0)::is(-0) +a::b.c +a::(b.c()) +a::b.c() +a::(b.c()()) +a::(b.c()()) +a::(b.c())() +a::(b.c().d) +a::(c().d.e) +a::(b()) +a::(b::c()) +a::(b()::c) +a::(b().c::d) +a::(b.c::d) +a::(b::c.d) +a::(b.c::d::e) +a::(b::c::d) +a::(b::c::d.e) +a::(b::c::d).e +a::(void 0) +a::(b.c()::d.e) +a::(b.c::d.e) +a::(b.c::d.e)::f.g +b.c::d.e +;(b.c::d).e +;(b::c::d).e +new (a::b)() +new f(a::b) +f[a::b] +f[a::b()] ================================================================================ `; @@ -121,83 +202,33 @@ f[a::b()]; ================================================================================ `; -exports[`bind_parens.js format 2`] = ` +exports[`long_name_method.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -(a || b)::c; -a || (b::c); -::obj.prop; -(void 0)::func(); -(+0)::is(-0); -a::(b.c); -a::(b.c()); -a::b.c(); -a::(b.c()()); -a::((b.c())()); -a::(b.c())(); -a::(b.c().d); -a::(c().d.e); -a::(b()); -a::(b::c()); -a::(b()::c); -a::(b().c::d); -a::(b.c::d); -a::(b::c.d); -a::(b.c::d::e); -a::(b::c::d); -a::(b::c::d.e); -a::((b::c::d).e); -a::(void 0); -a::(b.c()::d.e); -a::(b.c::d.e); -a::(b.c::d.e)::f.g; -b.c::d.e; -(b.c::d).e; -(b::c::d).e; -new (a::b)(); -new f(a::b); -f[a::b]; -f[a::b()]; - +class X { + constructor() { + this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala; + } + + testLongNameMethodAndSomethingElseLallala() { + return true; + } +} =====================================output===================================== -;(a || b)::c -a || b::c -;::obj.prop -;(void 0)::func() -;(+0)::is(-0) -a::b.c -a::(b.c()) -a::b.c() -a::(b.c()()) -a::(b.c()()) -a::(b.c())() -a::(b.c().d) -a::(c().d.e) -a::(b()) -a::(b::c()) -a::(b()::c) -a::(b().c::d) -a::(b.c::d) -a::(b::c.d) -a::(b.c::d::e) -a::(b::c::d) -a::(b::c::d.e) -a::(b::c::d).e -a::(void 0) -a::(b.c()::d.e) -a::(b.c::d.e) -a::(b.c::d.e)::f.g -b.c::d.e -;(b.c::d).e -;(b::c::d).e -new (a::b)() -new f(a::b) -f[a::b] -f[a::b()] +class X { + constructor() { + this.testLongNameMethodAndSomethingElseLallala = + ::this.testLongNameMethodAndSomethingElseLallala + } + + testLongNameMethodAndSomethingElseLallala() { + return true + } +} ================================================================================ `; @@ -232,32 +263,48 @@ class X { ================================================================================ `; -exports[`long_name_method.js format 2`] = ` +exports[`method_chain.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -class X { - constructor() { - this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala; - } - - testLongNameMethodAndSomethingElseLallala() { - return true; - } -} -=====================================output===================================== -class X { - constructor() { - this.testLongNameMethodAndSomethingElseLallala = - ::this.testLongNameMethodAndSomethingElseLallala - } +import {interval} from 'rxjs/observable/interval'; +import {filter} from 'rxjs/operator/filter'; +import {take} from 'rxjs/operator/take'; +import {map} from 'rxjs/operator/map'; +import {throttle} from 'rxjs/operator/throttle'; +import {takeUntil} from 'rxjs/operator/takeUntil'; - testLongNameMethodAndSomethingElseLallala() { - return true - } +function test(observable) { + return observable + ::filter(data => data.someTest) + ::throttle(() => + interval(10) + ::take(1) + ::takeUntil(observable::filter(data => someOtherTest)) + ) + ::map(someFunction); +} + +=====================================output===================================== +import { interval } from "rxjs/observable/interval" +import { filter } from "rxjs/operator/filter" +import { take } from "rxjs/operator/take" +import { map } from "rxjs/operator/map" +import { throttle } from "rxjs/operator/throttle" +import { takeUntil } from "rxjs/operator/takeUntil" + +function test(observable) { + return observable + ::filter((data) => data.someTest) + ::throttle(() => + interval(10) + ::take(1) + ::takeUntil(observable::filter((data) => someOtherTest)) + ) + ::map(someFunction) } ================================================================================ @@ -309,48 +356,31 @@ function test(observable) { ================================================================================ `; -exports[`method_chain.js format 2`] = ` +exports[`short_name_method.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -import {interval} from 'rxjs/observable/interval'; -import {filter} from 'rxjs/operator/filter'; -import {take} from 'rxjs/operator/take'; -import {map} from 'rxjs/operator/map'; -import {throttle} from 'rxjs/operator/throttle'; -import {takeUntil} from 'rxjs/operator/takeUntil'; - -function test(observable) { - return observable - ::filter(data => data.someTest) - ::throttle(() => - interval(10) - ::take(1) - ::takeUntil(observable::filter(data => someOtherTest)) - ) - ::map(someFunction); +class X { + constructor() { + this.shortMethod = ::this.shortMethod; + } + + shortMethod() { + return true; + } } - =====================================output===================================== -import { interval } from "rxjs/observable/interval" -import { filter } from "rxjs/operator/filter" -import { take } from "rxjs/operator/take" -import { map } from "rxjs/operator/map" -import { throttle } from "rxjs/operator/throttle" -import { takeUntil } from "rxjs/operator/takeUntil" +class X { + constructor() { + this.shortMethod = ::this.shortMethod + } -function test(observable) { - return observable - ::filter((data) => data.someTest) - ::throttle(() => - interval(10) - ::take(1) - ::takeUntil(observable::filter((data) => someOtherTest)) - ) - ::map(someFunction) + shortMethod() { + return true + } } ================================================================================ @@ -385,32 +415,43 @@ class X { ================================================================================ `; -exports[`short_name_method.js format 2`] = ` +exports[`unary.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -class X { - constructor() { - this.shortMethod = ::this.shortMethod; - } - - shortMethod() { - return true; - } -} -=====================================output===================================== -class X { - constructor() { - this.shortMethod = ::this.shortMethod - } +!x::y; +!(x::y /* foo */); +!(/* foo */ x::y); +!( + /* foo */ + x::y +); +!( + x::y + /* foo */ +); +!( + x::y // foo +); - shortMethod() { - return true - } -} +=====================================output===================================== +!x::y +!(x::y /* foo */) +!(/* foo */ x::y) +!( + /* foo */ + x::y +) +!( + x::y + /* foo */ +) +!( + x::y // foo +) ================================================================================ `; @@ -454,44 +495,3 @@ printWidth: 80 ================================================================================ `; - -exports[`unary.js format 2`] = ` -====================================options===================================== -parsers: ["babel"] -printWidth: 80 -semi: false - | printWidth -=====================================input====================================== -!x::y; -!(x::y /* foo */); -!(/* foo */ x::y); -!( - /* foo */ - x::y -); -!( - x::y - /* foo */ -); -!( - x::y // foo -); - -=====================================output===================================== -!x::y -!(x::y /* foo */) -!(/* foo */ x::y) -!( - /* foo */ - x::y -) -!( - x::y - /* foo */ -) -!( - x::y // foo -) - -================================================================================ -`; diff --git a/tests/bracketSpacing/__snapshots__/jsfmt.spec.js.snap b/tests/bracketSpacing/__snapshots__/jsfmt.spec.js.snap index 40260d704..b935d9d8e 100644 --- a/tests/bracketSpacing/__snapshots__/jsfmt.spec.js.snap +++ b/tests/bracketSpacing/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`array.js - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +const arr1 = [1,2,3,4]; +const arr2 = [1, 2, 3, 4]; + +=====================================output===================================== +const arr1 = [1, 2, 3, 4]; +const arr2 = [1, 2, 3, 4]; + +================================================================================ +`; + exports[`array.js format 1`] = ` ====================================options===================================== parsers: ["flow", "typescript"] @@ -16,19 +33,19 @@ const arr2 = [1, 2, 3, 4]; ================================================================================ `; -exports[`array.js format 2`] = ` +exports[`object.js - {"bracketSpacing":false} format 1`] = ` ====================================options===================================== bracketSpacing: false parsers: ["flow", "typescript"] printWidth: 80 | printWidth =====================================input====================================== -const arr1 = [1,2,3,4]; -const arr2 = [1, 2, 3, 4]; +const obj1 = {a:1, b:2, c:3} +const obj2 = { a:1, b:2, c:3 }; =====================================output===================================== -const arr1 = [1, 2, 3, 4]; -const arr2 = [1, 2, 3, 4]; +const obj1 = {a: 1, b: 2, c: 3}; +const obj2 = {a: 1, b: 2, c: 3}; ================================================================================ `; @@ -48,20 +65,3 @@ const obj2 = { a: 1, b: 2, c: 3 }; ================================================================================ `; - -exports[`object.js format 2`] = ` -====================================options===================================== -bracketSpacing: false -parsers: ["flow", "typescript"] -printWidth: 80 - | printWidth -=====================================input====================================== -const obj1 = {a:1, b:2, c:3} -const obj2 = { a:1, b:2, c:3 }; - -=====================================output===================================== -const obj1 = {a: 1, b: 2, c: 3}; -const obj2 = {a: 1, b: 2, c: 3}; - -================================================================================ -`; diff --git a/tests/classes_private_fields/__snapshots__/jsfmt.spec.js.snap b/tests/classes_private_fields/__snapshots__/jsfmt.spec.js.snap index 57bd03f93..2bbcca8d3 100644 --- a/tests/classes_private_fields/__snapshots__/jsfmt.spec.js.snap +++ b/tests/classes_private_fields/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,134 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`private_fields.js - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +class A { #x; #y; } +class B { #x = 0; #y = 1; } + +class C { + static #x; + static #y = 1; +} + +class D { + #x + #y +} + +class Point { + #x = 1; + #y = 2; + + constructor(x = 0, y = 0) { + this.#x = +x; + this.#y = +y; + } + + get x() { return this.#x } + set x(value) { this.#x = +value } + + get y() { return this.#y } + set y(value) { this.#y = +value } + + equals(p) { return this.#x === p.#x && this.#y === p.#y } + + toString() { return \`Point<\${ this.#x },\${ this.#y }>\` } +} + +class E { + async #a() {} + #b() {} + get #c() {} + set #c(bar) {} + *#d() {} + async *#e() {} + get #f() {} + set #f(taz) {} +} + +class F { + #func(id, { blog: { title } }) { + return id + title; + } +} + +=====================================output===================================== +class A { + #x + #y +} +class B { + #x = 0 + #y = 1 +} + +class C { + static #x + static #y = 1 +} + +class D { + #x + #y +} + +class Point { + #x = 1 + #y = 2 + + constructor(x = 0, y = 0) { + this.#x = +x + this.#y = +y + } + + get x() { + return this.#x + } + set x(value) { + this.#x = +value + } + + get y() { + return this.#y + } + set y(value) { + this.#y = +value + } + + equals(p) { + return this.#x === p.#x && this.#y === p.#y + } + + toString() { + return \`Point<\${this.#x},\${this.#y}>\` + } +} + +class E { + async #a() {} + #b() {} + get #c() {} + set #c(bar) {} + *#d() {} + async *#e() {} + get #f() {} + set #f(taz) {} +} + +class F { + #func(id, { blog: { title } }) { + return id + title + } +} + +================================================================================ +`; + exports[`private_fields.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -128,130 +257,28 @@ class F { ================================================================================ `; -exports[`private_fields.js format 2`] = ` +exports[`with_comments.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -class A { #x; #y; } -class B { #x = 0; #y = 1; } - -class C { - static #x; - static #y = 1; -} - -class D { - #x - #y -} - -class Point { - #x = 1; - #y = 2; - - constructor(x = 0, y = 0) { - this.#x = +x; - this.#y = +y; - } - - get x() { return this.#x } - set x(value) { this.#x = +value } - - get y() { return this.#y } - set y(value) { this.#y = +value } - - equals(p) { return this.#x === p.#x && this.#y === p.#y } - - toString() { return \`Point<\${ this.#x },\${ this.#y }>\` } -} - -class E { - async #a() {} - #b() {} - get #c() {} - set #c(bar) {} - *#d() {} - async *#e() {} - get #f() {} - set #f(taz) {} -} - -class F { - #func(id, { blog: { title } }) { - return id + title; - } +class A { + #foobar = + // comment to break + 1 + + // comment to break again + 2; } =====================================output===================================== class A { - #x - #y -} -class B { - #x = 0 - #y = 1 -} - -class C { - static #x - static #y = 1 -} - -class D { - #x - #y -} - -class Point { - #x = 1 - #y = 2 - - constructor(x = 0, y = 0) { - this.#x = +x - this.#y = +y - } - - get x() { - return this.#x - } - set x(value) { - this.#x = +value - } - - get y() { - return this.#y - } - set y(value) { - this.#y = +value - } - - equals(p) { - return this.#x === p.#x && this.#y === p.#y - } - - toString() { - return \`Point<\${this.#x},\${this.#y}>\` - } -} - -class E { - async #a() {} - #b() {} - get #c() {} - set #c(bar) {} - *#d() {} - async *#e() {} - get #f() {} - set #f(taz) {} -} - -class F { - #func(id, { blog: { title } }) { - return id + title - } + #foobar = + // comment to break + 1 + + // comment to break again + 2 } ================================================================================ @@ -282,30 +309,3 @@ class A { ================================================================================ `; - -exports[`with_comments.js format 2`] = ` -====================================options===================================== -parsers: ["babel"] -printWidth: 80 -semi: false - | printWidth -=====================================input====================================== -class A { - #foobar = - // comment to break - 1 + - // comment to break again - 2; -} - -=====================================output===================================== -class A { - #foobar = - // comment to break - 1 + - // comment to break again - 2 -} - -================================================================================ -`; diff --git a/tests/comments/__snapshots__/jsfmt.spec.js.snap b/tests/comments/__snapshots__/jsfmt.spec.js.snap index b05971f71..2963f6a9b 100644 --- a/tests/comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/comments/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`arrow.js - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel", "typescript"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +const fn = (/*event, data*/) => doSomething(); + +const fn2 = (/*event, data*/) => doSomething(anything); + +=====================================output===================================== +const fn = (/*event, data*/) => doSomething() + +const fn2 = (/*event, data*/) => doSomething(anything) + +================================================================================ +`; + exports[`arrow.js format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] @@ -18,21 +37,28 @@ const fn2 = (/*event, data*/) => doSomething(anything); ================================================================================ `; -exports[`arrow.js format 2`] = ` +exports[`assignment-pattern.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -const fn = (/*event, data*/) => doSomething(); +const { a /* comment */ = 1 } = b; -const fn2 = (/*event, data*/) => doSomething(anything); +const { c = 1 /* comment */ } = d; + +let {d //comment += b} = c =====================================output===================================== -const fn = (/*event, data*/) => doSomething() +const { a /* comment */ = 1 } = b -const fn2 = (/*event, data*/) => doSomething(anything) +const { c = 1 /* comment */ } = d + +let { + d = b, //comment +} = c ================================================================================ `; @@ -62,28 +88,27 @@ let { ================================================================================ `; -exports[`assignment-pattern.js format 2`] = ` +exports[`before-comma.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -const { a /* comment */ = 1 } = b; +const foo = { + a: 'a' /* comment for this line */, -const { c = 1 /* comment */ } = d; - -let {d //comment -= b} = c + /* Section B */ + b: 'b', +}; =====================================output===================================== -const { a /* comment */ = 1 } = b +const foo = { + a: "a" /* comment for this line */, -const { c = 1 /* comment */ } = d - -let { - d = b, //comment -} = c + /* Section B */ + b: "b", +} ================================================================================ `; @@ -112,26 +137,156 @@ const foo = { ================================================================================ `; -exports[`before-comma.js format 2`] = ` +exports[`binary-expressions.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -const foo = { - a: 'a' /* comment for this line */, +function addition() { + 0 + // Comment + + x +} - /* Section B */ - b: 'b', -}; +function multiplication() { + 0 + // Comment + * x +} + +function division() { + 0 + // Comment + / x +} + +function substraction() { + 0 + // Comment + - x +} + +function remainder() { + 0 + // Comment + % x +} + +function exponentiation() { + 0 + // Comment + ** x +} + +function leftShift() { + 0 + // Comment + << x +} + +function rightShift() { + 0 + // Comment + >> x +} + +function unsignedRightShift() { + 0 + // Comment + >>> x +} + +function bitwiseAnd() { + 0 + // Comment + & x +} + +function bitwiseOr() { + 0 + // Comment + | x +} + +function bitwiseXor() { + 0 + // Comment + ^ x +} =====================================output===================================== -const foo = { - a: "a" /* comment for this line */, +function addition() { + 0 + + // Comment + x +} - /* Section B */ - b: "b", +function multiplication() { + 0 * + // Comment + x +} + +function division() { + 0 / + // Comment + x +} + +function substraction() { + 0 - + // Comment + x +} + +function remainder() { + 0 % + // Comment + x +} + +function exponentiation() { + 0 ** + // Comment + x +} + +function leftShift() { + 0 << + // Comment + x +} + +function rightShift() { + 0 >> + // Comment + x +} + +function unsignedRightShift() { + 0 >>> + // Comment + x +} + +function bitwiseAnd() { + 0 & + // Comment + x +} + +function bitwiseOr() { + 0 | + // Comment + x +} + +function bitwiseXor() { + 0 ^ + // Comment + x } ================================================================================ @@ -291,157 +446,57 @@ function bitwiseXor() { ================================================================================ `; -exports[`binary-expressions.js format 2`] = ` +exports[`blank.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -function addition() { - 0 - // Comment - + x -} +// This file only +// has comments. This comment +// should still exist +// +// when printed. -function multiplication() { - 0 - // Comment - * x -} +/** + * @typedef {DataDrivenMapping|ConstantMapping} Mapping + */ +/** + * @typedef {Object.} ConfigurationMapping + */ -function division() { - 0 - // Comment - / x -} +/** + * @typedef {Function} D3Scale - a D3 scale + * @property {Function} ticks + * @property {Function} tickFormat + */ +// comment -function substraction() { - 0 - // Comment - - x -} - -function remainder() { - 0 - // Comment - % x -} - -function exponentiation() { - 0 - // Comment - ** x -} - -function leftShift() { - 0 - // Comment - << x -} - -function rightShift() { - 0 - // Comment - >> x -} - -function unsignedRightShift() { - 0 - // Comment - >>> x -} - -function bitwiseAnd() { - 0 - // Comment - & x -} - -function bitwiseOr() { - 0 - // Comment - | x -} - -function bitwiseXor() { - 0 - // Comment - ^ x -} +// comment =====================================output===================================== -function addition() { - 0 + - // Comment - x -} +// This file only +// has comments. This comment +// should still exist +// +// when printed. -function multiplication() { - 0 * - // Comment - x -} +/** + * @typedef {DataDrivenMapping|ConstantMapping} Mapping + */ +/** + * @typedef {Object.} ConfigurationMapping + */ -function division() { - 0 / - // Comment - x -} +/** + * @typedef {Function} D3Scale - a D3 scale + * @property {Function} ticks + * @property {Function} tickFormat + */ +// comment -function substraction() { - 0 - - // Comment - x -} - -function remainder() { - 0 % - // Comment - x -} - -function exponentiation() { - 0 ** - // Comment - x -} - -function leftShift() { - 0 << - // Comment - x -} - -function rightShift() { - 0 >> - // Comment - x -} - -function unsignedRightShift() { - 0 >>> - // Comment - x -} - -function bitwiseAnd() { - 0 & - // Comment - x -} - -function bitwiseOr() { - 0 | - // Comment - x -} - -function bitwiseXor() { - 0 ^ - // Comment - x -} +// comment ================================================================================ `; @@ -500,57 +555,37 @@ printWidth: 80 ================================================================================ `; -exports[`blank.js format 2`] = ` +exports[`break-continue-statements.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -// This file only -// has comments. This comment -// should still exist -// -// when printed. +for (;;) { + break /* comment */; + continue /* comment */; +} -/** - * @typedef {DataDrivenMapping|ConstantMapping} Mapping - */ -/** - * @typedef {Object.} ConfigurationMapping - */ - -/** - * @typedef {Function} D3Scale - a D3 scale - * @property {Function} ticks - * @property {Function} tickFormat - */ -// comment - -// comment +loop: for (;;) { + break /* comment */ loop; + break loop /* comment */; + continue /* comment */ loop; + continue loop /* comment */; +} =====================================output===================================== -// This file only -// has comments. This comment -// should still exist -// -// when printed. +for (;;) { + break /* comment */ + continue /* comment */ +} -/** - * @typedef {DataDrivenMapping|ConstantMapping} Mapping - */ -/** - * @typedef {Object.} ConfigurationMapping - */ - -/** - * @typedef {Function} D3Scale - a D3 scale - * @property {Function} ticks - * @property {Function} tickFormat - */ -// comment - -// comment +loop: for (;;) { + break /* comment */ loop + break loop /* comment */ + continue /* comment */ loop + continue loop /* comment */ +} ================================================================================ `; @@ -589,37 +624,46 @@ loop: for (;;) { ================================================================================ `; -exports[`break-continue-statements.js format 2`] = ` +exports[`call_comment.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -for (;;) { - break /* comment */; - continue /* comment */; -} +render( // Warm any cache + , + container +); -loop: for (;;) { - break /* comment */ loop; - break loop /* comment */; - continue /* comment */ loop; - continue loop /* comment */; -} +React.render( // Warm any cache + , + container +); + +render?.( // Warm any cache + , + container +); =====================================output===================================== -for (;;) { - break /* comment */ - continue /* comment */ -} +render( + // Warm any cache + , + container +) -loop: for (;;) { - break /* comment */ loop - break loop /* comment */ - continue /* comment */ loop - continue loop /* comment */ -} +React.render( + // Warm any cache + , + container +) + +render?.( + // Warm any cache + , + container +) ================================================================================ `; @@ -667,46 +711,47 @@ render?.( ================================================================================ `; -exports[`call_comment.js format 2`] = ` +exports[`dangling.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -render( // Warm any cache - , - container -); - -React.render( // Warm any cache - , - container -); - -render?.( // Warm any cache - , - container -); +var a = {/* dangling */}; +var b = { + // dangling +}; +var b = [/* dangling */]; +function d() { + /* dangling */ +} +new Thing(/* dangling */); +Thing(/* dangling */); +Thing?.(/* dangling */); +declare class Foo extends Qux {/* dangling */} +export /* dangling */{}; =====================================output===================================== -render( - // Warm any cache - , - container -) - -React.render( - // Warm any cache - , - container -) - -render?.( - // Warm any cache - , - container -) +var a = { + /* dangling */ +} +var b = { + // dangling +} +var b = [ + /* dangling */ +] +function d() { + /* dangling */ +} +new Thing(/* dangling */) +Thing(/* dangling */) +Thing?.(/* dangling */) +declare class Foo extends Qux { + /* dangling */ +} +export /* dangling */{} ================================================================================ `; @@ -755,47 +800,25 @@ export /* dangling */{}; ================================================================================ `; -exports[`dangling.js format 2`] = ` +exports[`dangling_array.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -var a = {/* dangling */}; -var b = { - // dangling -}; -var b = [/* dangling */]; -function d() { - /* dangling */ -} -new Thing(/* dangling */); -Thing(/* dangling */); -Thing?.(/* dangling */); -declare class Foo extends Qux {/* dangling */} -export /* dangling */{}; +expect(() => {}).toTriggerReadyStateChanges([ + // Nothing. +]); + +[1 /* first comment */, 2 /* second comment */, 3]; =====================================output===================================== -var a = { - /* dangling */ -} -var b = { - // dangling -} -var b = [ - /* dangling */ -] -function d() { - /* dangling */ -} -new Thing(/* dangling */) -Thing(/* dangling */) -Thing?.(/* dangling */) -declare class Foo extends Qux { - /* dangling */ -} -export /* dangling */{} +expect(() => {}).toTriggerReadyStateChanges([ + // Nothing. +]) + +;[1 /* first comment */, 2 /* second comment */, 3] ================================================================================ `; @@ -822,25 +845,24 @@ expect(() => {}).toTriggerReadyStateChanges([ ================================================================================ `; -exports[`dangling_array.js format 2`] = ` +exports[`dangling_for.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -expect(() => {}).toTriggerReadyStateChanges([ - // Nothing. -]); +for // comment +(;;); -[1 /* first comment */, 2 /* second comment */, 3]; +for /* comment */(;;); =====================================output===================================== -expect(() => {}).toTriggerReadyStateChanges([ - // Nothing. -]) +// comment +for (;;); -;[1 /* first comment */, 2 /* second comment */, 3] +/* comment */ +for (;;); ================================================================================ `; @@ -866,24 +888,49 @@ for (;;); ================================================================================ `; -exports[`dangling_for.js format 2`] = ` +exports[`dynamic_imports.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -for // comment -(;;); +import(/* Hello */ 'something') -for /* comment */(;;); +import('something' /* Hello */) + +import(/* Hello */ 'something' /* Hello */) + +import('something' /* Hello */ + 'else') + +import( + /* Hello */ + 'something' + /* Hello */ +) + +wrap( + import(/* Hello */ + 'something' + ) +) =====================================output===================================== -// comment -for (;;); +import(/* Hello */ "something") -/* comment */ -for (;;); +import("something" /* Hello */) + +import(/* Hello */ "something" /* Hello */) + +import("something" /* Hello */ + "else") + +import( + /* Hello */ + "something" + /* Hello */ +) + +wrap(import(/* Hello */ "something")) ================================================================================ `; @@ -934,49 +981,25 @@ wrap(import(/* Hello */ "something")); ================================================================================ `; -exports[`dynamic_imports.js format 2`] = ` +exports[`emoji.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -import(/* Hello */ 'something') +/* #2091 */ -import('something' /* Hello */) - -import(/* Hello */ 'something' /* Hello */) - -import('something' /* Hello */ + 'else') - -import( - /* Hello */ - 'something' - /* Hello */ -) - -wrap( - import(/* Hello */ - 'something' - ) -) +const test = '💖' +// This comment +// should not get collapsed =====================================output===================================== -import(/* Hello */ "something") +/* #2091 */ -import("something" /* Hello */) - -import(/* Hello */ "something" /* Hello */) - -import("something" /* Hello */ + "else") - -import( - /* Hello */ - "something" - /* Hello */ -) - -wrap(import(/* Hello */ "something")) +const test = "💖" +// This comment +// should not get collapsed ================================================================================ `; @@ -1003,25 +1026,59 @@ const test = "💖"; ================================================================================ `; -exports[`emoji.js format 2`] = ` +exports[`export.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -/* #2091 */ +export //comment +{} -const test = '💖' -// This comment -// should not get collapsed +export /* comment */ {}; + +const foo = '' +export { + foo // comment +} + +const bar = '' +export { + // comment + bar +} + +const fooo = '' +const barr = '' +export { + fooo, // comment + barr, // comment +} =====================================output===================================== -/* #2091 */ +export //comment +{} -const test = "💖" -// This comment -// should not get collapsed +export /* comment */{} + +const foo = "" +export { + foo, // comment +} + +const bar = "" +export { + // comment + bar, +} + +const fooo = "" +const barr = "" +export { + fooo, // comment + barr, // comment +} ================================================================================ `; @@ -1082,59 +1139,19 @@ export { ================================================================================ `; -exports[`export.js format 2`] = ` +exports[`first-line.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -export //comment -{} - -export /* comment */ {}; - -const foo = '' -export { - foo // comment -} - -const bar = '' -export { - // comment - bar -} - -const fooo = '' -const barr = '' -export { - fooo, // comment - barr, // comment -} +a // comment +b =====================================output===================================== -export //comment -{} - -export /* comment */{} - -const foo = "" -export { - foo, // comment -} - -const bar = "" -export { - // comment - bar, -} - -const fooo = "" -const barr = "" -export { - fooo, // comment - barr, // comment -} +a // comment +b ================================================================================ `; @@ -1155,19 +1172,137 @@ b; ================================================================================ `; -exports[`first-line.js format 2`] = ` +exports[`function-declaration.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -a // comment -b +function a(/* comment */) {} // comment +function b() {} // comment +function c(/* comment */ argA, argB, argC) {} // comment +call((/*object*/ row) => {}); +KEYPAD_NUMBERS.map(num => ( // Buttons 0-9 +
+)); + +function f1 /* f */() {} +function f2 (/* args */) {} +function f3 () /* returns */ {} +function f4 /* f */(/* args */) /* returns */ {} + +function f5 /* f */(/* a */ a) {} +function f6 /* f */(a /* a */) {} +function f7 /* f */(/* a */ a) /* returns */ {} + +const obj = { + f1 /* f */() {}, + f2 (/* args */) {}, + f3 () /* returns */ {}, + f4 /* f */(/* args */) /* returns */ {}, +}; + +(function f /* f */() {})(); +(function f (/* args */) {})(); +(function f () /* returns */ {})(); +(function f /* f */(/* args */) /* returns */ {})(); + +class C1 { + f/* f */() {} +} +class C2 { + f(/* args */) {} +} +class C3 { + f() /* returns */ {} +} +class C4 { + f/* f */(/* args */) /* returns */ {} +} + +function foo1() +// this is a function +{ + return 42 +} + +function foo2() // this is a function +{ + return 42 +} + +function foo3() { // this is a function + return 42 +} + +function foo4() { + // this is a function + return 42; +} =====================================output===================================== -a // comment -b +function a(/* comment */) {} // comment +function b() {} // comment +function c(/* comment */ argA, argB, argC) {} // comment +call((/*object*/ row) => {}) +KEYPAD_NUMBERS.map(( + num // Buttons 0-9 +) =>
) + +function f1 /* f */() {} +function f2(/* args */) {} +function f3() /* returns */ {} +function f4 /* f */(/* args */) /* returns */ {} + +function f5 /* f */(/* a */ a) {} +function f6 /* f */(a /* a */) {} +function f7 /* f */(/* a */ a) /* returns */ {} + +const obj = { + f1 /* f */() {}, + f2(/* args */) {}, + f3() /* returns */ {}, + f4 /* f */(/* args */) /* returns */ {}, +} + +;(function f /* f */() {})() +;(function f(/* args */) {})() +;(function f() /* returns */ {})() +;(function f /* f */(/* args */) /* returns */ {})() + +class C1 { + f /* f */() {} +} +class C2 { + f(/* args */) {} +} +class C3 { + f() /* returns */ {} +} +class C4 { + f /* f */(/* args */) /* returns */ {} +} + +function foo1() { + // this is a function + return 42 +} + +function foo2() { + // this is a function + return 42 +} + +function foo3() { + // this is a function + return 42 +} + +function foo4() { + // this is a function + return 42 +} ================================================================================ `; @@ -1306,137 +1441,149 @@ function foo4() { ================================================================================ `; -exports[`function-declaration.js format 2`] = ` +exports[`if.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -function a(/* comment */) {} // comment -function b() {} // comment -function c(/* comment */ argA, argB, argC) {} // comment -call((/*object*/ row) => {}); -KEYPAD_NUMBERS.map(num => ( // Buttons 0-9 -
-)); - -function f1 /* f */() {} -function f2 (/* args */) {} -function f3 () /* returns */ {} -function f4 /* f */(/* args */) /* returns */ {} - -function f5 /* f */(/* a */ a) {} -function f6 /* f */(a /* a */) {} -function f7 /* f */(/* a */ a) /* returns */ {} - -const obj = { - f1 /* f */() {}, - f2 (/* args */) {}, - f3 () /* returns */ {}, - f4 /* f */(/* args */) /* returns */ {}, -}; - -(function f /* f */() {})(); -(function f (/* args */) {})(); -(function f () /* returns */ {})(); -(function f /* f */(/* args */) /* returns */ {})(); - -class C1 { - f/* f */() {} -} -class C2 { - f(/* args */) {} -} -class C3 { - f() /* returns */ {} -} -class C4 { - f/* f */(/* args */) /* returns */ {} -} - -function foo1() -// this is a function +if (1) +// comment { - return 42 + false +} +// comment +else if (2) + true +// multi +// ple +// lines +else if (3) + // existing comment + true +// okay? +else if (4) { + // empty with existing comment +} +// comment +else { } -function foo2() // this is a function -{ - return 42 -} +if (5) // comment +true -function foo3() { // this is a function - return 42 -} +if (6) // comment +{true} +else if (7) // comment +true +else // comment +{true} -function foo4() { - // this is a function - return 42; -} +if (8) // comment +// comment +{true} +else if (9) // comment +// comment +true +else // comment +// comment +{true} + +if (10) /* comment */ // comment +{true} +else if (11) /* comment */ +true +else if (12) // comment /* comment */ // comment +true +else if (13) /* comment */ /* comment */ // comment +true +else /* comment */ +{true} + +if (14) // comment +/* comment */ +// comment +{true} +else if (15) // comment +/* comment */ +/* comment */ // comment +true =====================================output===================================== -function a(/* comment */) {} // comment -function b() {} // comment -function c(/* comment */ argA, argB, argC) {} // comment -call((/*object*/ row) => {}) -KEYPAD_NUMBERS.map(( - num // Buttons 0-9 -) =>
) - -function f1 /* f */() {} -function f2(/* args */) {} -function f3() /* returns */ {} -function f4 /* f */(/* args */) /* returns */ {} - -function f5 /* f */(/* a */ a) {} -function f6 /* f */(a /* a */) {} -function f7 /* f */(/* a */ a) /* returns */ {} - -const obj = { - f1 /* f */() {}, - f2(/* args */) {}, - f3() /* returns */ {}, - f4 /* f */(/* args */) /* returns */ {}, +if (1) { + // comment + false +} +// comment +else if (2) true +// multi +// ple +// lines +else if (3) + // existing comment + true +// okay? +else if (4) { + // empty with existing comment +} +// comment +else { } -;(function f /* f */() {})() -;(function f(/* args */) {})() -;(function f() /* returns */ {})() -;(function f /* f */(/* args */) /* returns */ {})() +if (5) + // comment + true -class C1 { - f /* f */() {} -} -class C2 { - f(/* args */) {} -} -class C3 { - f() /* returns */ {} -} -class C4 { - f /* f */(/* args */) /* returns */ {} +if (6) { + // comment + true +} else if (7) + // comment + true +// comment +else { + true } -function foo1() { - // this is a function - return 42 +if (8) { + // comment + // comment + true +} else if (9) + // comment + // comment + true +// comment +// comment +else { + true } -function foo2() { - // this is a function - return 42 +if (10) { + /* comment */ // comment + true +} else if (11) /* comment */ true +else if (12) + // comment /* comment */ // comment + true +else if (13) + /* comment */ /* comment */ // comment + true +/* comment */ else { + true } -function foo3() { - // this is a function - return 42 -} - -function foo4() { - // this is a function - return 42 -} +if (14) { + // comment + /* comment */ + // comment + true +} else if (15) + // comment + /* comment */ + /* comment */ // comment + true ================================================================================ `; @@ -1587,149 +1734,166 @@ if (14) { ================================================================================ `; -exports[`if.js format 2`] = ` +exports[`issues.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -if (1) -// comment -{ - false +// Does not need to break as it fits in 80 columns +this.call(a, /* comment */ b); + +function f( + someReallyLongArgument: WithSomeLongType, + someReallyLongArgument2: WithSomeLongType, + // Trailing comment should stay after +) {} + +// Comments should either stay at the end of the line or always before, but +// not one before and one after. +throw new ProcessSystemError({ + code: acc.error.code, // Alias of errno + originalError: acc.error, // Just in case. +}); + +// Missing one level of indentation because of the comment +const rootEpic = (actions, store) => ( + combineEpics(...epics)(actions, store) + // Log errors and continue. + .catch((err, stream) => { + getLogger().error(err); + return stream; + }) +); + +// 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 + escapeStringRegExp(target.name) + // target name + '[\\'"]' + // 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 + +// Comments disappear in-between MemberExpressions +Observable.of(process) + // Don't complete until we say so! + .merge(Observable.never()) + // Get the errors. + .takeUntil(throwOnError ? errors.flatMap(Observable.throw) : errors) + .takeUntil(exit); + +// Comments disappear inside of JSX +
+ {/* Some comment */} +
; + +// Comments in JSX tag are placed in a non optimal way +
; + +// Comments disappear in empty blocks +if (1) { + // Comment } -// comment -else if (2) - true -// multi -// ple -// lines -else if (3) - // existing comment - true -// okay? -else if (4) { - // empty with existing comment + +// Comments trigger invalid JavaScript in-between else if +if (1) { } -// comment +// Comment else { + } -if (5) // comment -true +// The comment makes the line break in a weird way +const result = asyncExecute('non_existing_command', /* args */ []); -if (6) // comment -{true} -else if (7) // comment -true -else // comment -{true} - -if (8) // comment -// comment -{true} -else if (9) // comment -// comment -true -else // comment -// comment -{true} - -if (10) /* comment */ // comment -{true} -else if (11) /* comment */ -true -else if (12) // comment /* comment */ // comment -true -else if (13) /* comment */ /* comment */ // comment -true -else /* comment */ -{true} - -if (14) // comment -/* comment */ -// comment -{true} -else if (15) // comment -/* comment */ -/* comment */ // comment -true +// The closing paren is printed on the same line as the comment +foo({} + // Hi +); =====================================output===================================== +// Does not need to break as it fits in 80 columns +this.call(a, /* comment */ b) + +function f( + someReallyLongArgument: WithSomeLongType, + someReallyLongArgument2: WithSomeLongType + // Trailing comment should stay after +) {} + +// Comments should either stay at the end of the line or always before, but +// not one before and one after. +throw new ProcessSystemError({ + code: acc.error.code, // Alias of errno + originalError: acc.error, // Just in case. +}) + +// Missing one level of indentation because of the comment +const rootEpic = (actions, store) => + combineEpics(...epics)(actions, store) + // Log errors and continue. + .catch((err, stream) => { + getLogger().error(err) + return stream + }) + +// 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 + escapeStringRegExp(target.name) + // target name + "['\\"]" + // 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 + +// Comments disappear in-between MemberExpressions +Observable.of(process) + // Don't complete until we say so! + .merge(Observable.never()) + // Get the errors. + .takeUntil(throwOnError ? errors.flatMap(Observable.throw) : errors) + .takeUntil(exit) + +// Comments disappear inside of JSX +;
{/* Some comment */}
+ +// Comments in JSX tag are placed in a non optimal way +;
+ +// Comments disappear in empty blocks if (1) { - // comment - false + // Comment } -// comment -else if (2) true -// multi -// ple -// lines -else if (3) - // existing comment - true -// okay? -else if (4) { - // empty with existing comment + +// Comments trigger invalid JavaScript in-between else if +if (1) { } -// comment +// Comment else { } -if (5) - // comment - true +// The comment makes the line break in a weird way +const result = asyncExecute("non_existing_command", /* args */ []) -if (6) { - // comment - true -} else if (7) - // comment - true -// comment -else { - true -} - -if (8) { - // comment - // comment - true -} else if (9) - // comment - // comment - true -// comment -// comment -else { - true -} - -if (10) { - /* comment */ // comment - true -} else if (11) /* comment */ true -else if (12) - // comment /* comment */ // comment - true -else if (13) - /* comment */ /* comment */ // comment - true -/* comment */ else { - true -} - -if (14) { - // comment - /* comment */ - // comment - true -} else if (15) - // comment - /* comment */ - /* comment */ // comment - true +// The closing paren is printed on the same line as the comment +foo( + {} + // Hi +) ================================================================================ `; @@ -1897,167 +2061,67 @@ foo( ================================================================================ `; -exports[`issues.js format 2`] = ` +exports[`jsdoc.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -// Does not need to break as it fits in 80 columns -this.call(a, /* comment */ b); - -function f( - someReallyLongArgument: WithSomeLongType, - someReallyLongArgument2: WithSomeLongType, - // Trailing comment should stay after -) {} - -// Comments should either stay at the end of the line or always before, but -// not one before and one after. -throw new ProcessSystemError({ - code: acc.error.code, // Alias of errno - originalError: acc.error, // Just in case. -}); - -// Missing one level of indentation because of the comment -const rootEpic = (actions, store) => ( - combineEpics(...epics)(actions, store) - // Log errors and continue. - .catch((err, stream) => { - getLogger().error(err); - return stream; - }) +/** @type {any} */ +const x = ( +
+
+
); -// 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 - escapeStringRegExp(target.name) + // target name - '[\\'"]' + // closing quotation mark - ',?$', // optional trailing comma +/** + * @type {object} + */ +() => ( +
+ sajdfpoiasdjfpoiasdjfpoiasdjfpoiadsjfpaoisdjfapsdiofjapioisadfaskfaspiofjp +
); -// The comment is moved and doesn't trigger the eslint rule anymore -import path from 'path'; // eslint-disable-line nuclide-internal/prefer-nuclide-uri - -// Comments disappear in-between MemberExpressions -Observable.of(process) - // Don't complete until we say so! - .merge(Observable.never()) - // Get the errors. - .takeUntil(throwOnError ? errors.flatMap(Observable.throw) : errors) - .takeUntil(exit); - -// Comments disappear inside of JSX -
- {/* Some comment */} -
; - -// Comments in JSX tag are placed in a non optimal way -
; - -// Comments disappear in empty blocks -if (1) { - // Comment +/** + * @type {object} + */ +function HelloWorld() { + return ( +
+ Test +
+ ); } - -// Comments trigger invalid JavaScript in-between else if -if (1) { -} -// Comment -else { - -} - -// The comment makes the line break in a weird way -const result = asyncExecute('non_existing_command', /* args */ []); - -// The closing paren is printed on the same line as the comment -foo({} - // Hi -); - =====================================output===================================== -// Does not need to break as it fits in 80 columns -this.call(a, /* comment */ b) - -function f( - someReallyLongArgument: WithSomeLongType, - someReallyLongArgument2: WithSomeLongType - // Trailing comment should stay after -) {} - -// Comments should either stay at the end of the line or always before, but -// not one before and one after. -throw new ProcessSystemError({ - code: acc.error.code, // Alias of errno - originalError: acc.error, // Just in case. -}) - -// Missing one level of indentation because of the comment -const rootEpic = (actions, store) => - combineEpics(...epics)(actions, store) - // Log errors and continue. - .catch((err, stream) => { - getLogger().error(err) - return stream - }) - -// 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 - escapeStringRegExp(target.name) + // target name - "['\\"]" + // closing quotation mark - ",?$" // optional trailing comma +/** @type {any} */ +const x = ( +
+
+
) -// The comment is moved and doesn't trigger the eslint rule anymore -import path from "path" // eslint-disable-line nuclide-internal/prefer-nuclide-uri - -// Comments disappear in-between MemberExpressions -Observable.of(process) - // Don't complete until we say so! - .merge(Observable.never()) - // Get the errors. - .takeUntil(throwOnError ? errors.flatMap(Observable.throw) : errors) - .takeUntil(exit) - -// Comments disappear inside of JSX -;
{/* Some comment */}
- -// Comments in JSX tag are placed in a non optimal way -;
- -// Comments disappear in empty blocks -if (1) { - // Comment -} - -// Comments trigger invalid JavaScript in-between else if -if (1) { -} -// Comment -else { -} - -// The comment makes the line break in a weird way -const result = asyncExecute("non_existing_command", /* args */ []) - -// The closing paren is printed on the same line as the comment -foo( - {} - // Hi +/** + * @type {object} + */ +;() => ( +
+ sajdfpoiasdjfpoiasdjfpoiasdjfpoiadsjfpaoisdjfapsdiofjapioisadfaskfaspiofjp +
) +/** + * @type {object} + */ +function HelloWorld() { + return ( +
+ Test +
+ ) +} + ================================================================================ `; @@ -2124,66 +2188,244 @@ function HelloWorld() { ================================================================================ `; -exports[`jsdoc.js format 2`] = ` +exports[`jsx.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -/** @type {any} */ -const x = ( -
-
-
-); +
+ { + /* comment */ + } +
; -/** - * @type {object} - */ -() => ( -
- sajdfpoiasdjfpoiasdjfpoiasdjfpoiadsjfpaoisdjfapsdiofjapioisadfaskfaspiofjp -
-); +
+ {/* comment */ + } +
; + +
+ {/* comment +*/ + } +
; + +
+ {a/* comment +*/ + } +
; + +
+ {/* comment +*/ + a + } +
; + +
+ {/* comment */ + } +
; + +
+ {/* comment */} +
; + +
+ { + // single line comment + } +
; + +
+ { + // multiple line comments 1 + // multiple line comments 2 + } +
; + +
+ { + // multiple mixed comments 1 + /* multiple mixed comments 2 */ + /* multiple mixed comments 3 */ + // multiple mixed comments 4 + } +
; + +
+ { + // Some very v ery very very merry (xmas) very very long line to break line width limit + } +
; + +
{/*
Some very v ery very very long line to break line width limit
*/}
; + +
+ {/** + * JSDoc-y comment in JSX. I wonder what will happen to it? + */} +
; + +
+ { + /** + * Another JSDoc comment in JSX. + */ + } +
; + +
{}}> + +
; + +
+ {foo} +
; + +
+ {foo} +
; + +
+ {foo} +
; + +
+ {children} +
; + + + {} + + -/** - * @type {object} - */ -function HelloWorld() { - return ( -
- Test -
- ); -} =====================================output===================================== -/** @type {any} */ -const x = ( -
-
-
-) +;
{/* comment */}
-/** - * @type {object} - */ -;() => ( -
- sajdfpoiasdjfpoiasdjfpoiasdjfpoiadsjfpaoisdjfapsdiofjapioisadfaskfaspiofjp -
-) +;
{/* comment */}
-/** - * @type {object} - */ -function HelloWorld() { - return ( -
- Test -
- ) -} +;
+ {/* comment + */} +
+ +;
+ { + a + /* comment + */ + } +
+ +;
+ { + /* comment + */ + a + } +
+ +;
{/* comment */}
+ +;
{/* comment */}
+ +;
+ { + // single line comment + } +
+ +;
+ { + // multiple line comments 1 + // multiple line comments 2 + } +
+ +;
+ { + // multiple mixed comments 1 + /* multiple mixed comments 2 */ + /* multiple mixed comments 3 */ + // multiple mixed comments 4 + } +
+ +;
+ { + // Some very v ery very very merry (xmas) very very long line to break line width limit + } +
+ +;
+ {/*
Some very v ery very very long line to break line width limit
*/} +
+ +;
+ {/** + * JSDoc-y comment in JSX. I wonder what will happen to it? + */} +
+ +;
+ {/** + * Another JSDoc comment in JSX. + */} +
+ +;
{}} +>
+ +;
+ {foo} +
+ +;
+ {foo} +
+ +;
+ {foo} +
+ +;
+ {children} +
+ +; + {} + + ================================================================================ `; @@ -2429,244 +2671,195 @@ onClick={() => {}}> ================================================================================ `; -exports[`jsx.js format 2`] = ` +exports[`last-arg.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -
- { - /* comment */ +type f1 = ( + currentRequest: {a: number}, + // TODO this is a very very very very long comment that makes it go > 80 columns +) => number; + +f2 = ( + currentRequest: {a: number}, + // TODO this is a very very very very long comment that makes it go > 80 columns +): number => {}; + +f3 = ( + currentRequest: {a: number}, + // TODO this is a very very very very long comment that makes it go > 80 columns +) => {}; + +f4 = function( + currentRequest: {a: number}, + // TODO this is a very very very very long comment that makes it go > 80 columns +) {}; + +class X { + f( + currentRequest: {a: number}, + // TODO this is a very very very very long comment that makes it go > 80 columns + ) {} +} + +function f5( + a: number +// some comment here +): number { + return a + 1; +} + +var x = { + getSectionMode( + pageMetaData: PageMetaData, + sectionMetaData: SectionMetaData + /* $FlowFixMe This error was exposed while converting keyMirror + * to keyMirrorRecursive */ + ): $Enum { } -
; +} -
- {/* comment */ +class X2 { + getSectionMode( + pageMetaData: PageMetaData, + sectionMetaData: SectionMetaData = ['unknown'] + /* $FlowFixMe This error was exposed while converting keyMirror + * to keyMirrorRecursive */ + ): $Enum { } -
; +} -
- {/* comment -*/ - } -
; +class Foo { + a(lol /*string*/) {} -
- {a/* comment -*/ - } -
; + b(lol /*string*/ + ) {} -
- {/* comment -*/ - a - } -
; + d( + lol /*string*/, + lol2 /*string*/, + lol3 /*string*/, + lol4 /*string*/ + ) {} -
- {/* comment */ - } -
; + d( + lol /*string*/, + lol2 /*string*/, + lol3 /*string*/, + lol4 /*string*/ + ) /*string*/ {} -
- {/* comment */} -
; + // prettier-ignore + c(lol /*string*/ + ) {} -
- { - // single line comment - } -
; + // prettier-ignore + d( + lol /*string*/, + lol2 /*string*/, + lol3 /*string*/, + lol4 /*string*/ + ) {} -
- { - // multiple line comments 1 - // multiple line comments 2 - } -
; - -
- { - // multiple mixed comments 1 - /* multiple mixed comments 2 */ - /* multiple mixed comments 3 */ - // multiple mixed comments 4 - } -
; - -
- { - // Some very v ery very very merry (xmas) very very long line to break line width limit - } -
; - -
{/*
Some very v ery very very long line to break line width limit
*/}
; - -
- {/** - * JSDoc-y comment in JSX. I wonder what will happen to it? - */} -
; - -
- { - /** - * Another JSDoc comment in JSX. - */ - } -
; - -
{}}> - -
; - -
- {foo} -
; - -
- {foo} -
; - -
- {foo} -
; - -
- {children} -
; - - - {} - - + // prettier-ignore + e( + lol /*string*/, + lol2 /*string*/, + lol3 /*string*/, + lol4 /*string*/ + ) {} /* string*/ +} =====================================output===================================== -;
{/* comment */}
+type f1 = ( + currentRequest: { a: number } + // TODO this is a very very very very long comment that makes it go > 80 columns +) => number -;
{/* comment */}
+f2 = ( + currentRequest: { a: number } + // TODO this is a very very very very long comment that makes it go > 80 columns +): number => {} -;
- {/* comment - */} -
+f3 = ( + currentRequest: { a: number } + // TODO this is a very very very very long comment that makes it go > 80 columns +) => {} -;
- { - a - /* comment - */ - } -
+f4 = function ( + currentRequest: { a: number } + // TODO this is a very very very very long comment that makes it go > 80 columns +) {} -;
- { - /* comment - */ - a - } -
+class X { + f( + currentRequest: { a: number } + // TODO this is a very very very very long comment that makes it go > 80 columns + ) {} +} -;
{/* comment */}
+function f5( + a: number + // some comment here +): number { + return a + 1 +} -;
{/* comment */}
+var x = { + getSectionMode( + pageMetaData: PageMetaData, + sectionMetaData: SectionMetaData + /* $FlowFixMe This error was exposed while converting keyMirror + * to keyMirrorRecursive */ + ): $Enum {}, +} -;
- { - // single line comment - } -
+class X2 { + getSectionMode( + pageMetaData: PageMetaData, + sectionMetaData: SectionMetaData = ["unknown"] + /* $FlowFixMe This error was exposed while converting keyMirror + * to keyMirrorRecursive */ + ): $Enum {} +} -;
- { - // multiple line comments 1 - // multiple line comments 2 - } -
+class Foo { + a(lol /*string*/) {} -;
- { - // multiple mixed comments 1 - /* multiple mixed comments 2 */ - /* multiple mixed comments 3 */ - // multiple mixed comments 4 - } -
+ b(lol /*string*/) {} -;
- { - // Some very v ery very very merry (xmas) very very long line to break line width limit - } -
+ d(lol /*string*/, lol2 /*string*/, lol3 /*string*/, lol4 /*string*/) {} -;
- {/*
Some very v ery very very long line to break line width limit
*/} -
+ d( + lol /*string*/, + lol2 /*string*/, + lol3 /*string*/, + lol4 /*string*/ + ) /*string*/ {} -;
- {/** - * JSDoc-y comment in JSX. I wonder what will happen to it? - */} -
+ // prettier-ignore + c(lol /*string*/ + ) {} -;
- {/** - * Another JSDoc comment in JSX. - */} -
+ // prettier-ignore + d( + lol /*string*/, + lol2 /*string*/, + lol3 /*string*/, + lol4 /*string*/ + ) {} -;
{}} ->
- -;
- {foo} -
- -;
- {foo} -
- -;
- {foo} -
- -;
- {children} -
- -; - {} - - + // prettier-ignore + e( + lol /*string*/, + lol2 /*string*/, + lol3 /*string*/, + lol4 /*string*/ + ) {} /* string*/ +} ================================================================================ `; @@ -2863,194 +3056,56 @@ class Foo { ================================================================================ `; -exports[`last-arg.js format 2`] = ` +exports[`preserve-new-line-last.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -type f1 = ( - currentRequest: {a: number}, - // TODO this is a very very very very long comment that makes it go > 80 columns -) => number; - -f2 = ( - currentRequest: {a: number}, - // TODO this is a very very very very long comment that makes it go > 80 columns -): number => {}; - -f3 = ( - currentRequest: {a: number}, - // TODO this is a very very very very long comment that makes it go > 80 columns -) => {}; - -f4 = function( - currentRequest: {a: number}, - // TODO this is a very very very very long comment that makes it go > 80 columns -) {}; - -class X { - f( - currentRequest: {a: number}, - // TODO this is a very very very very long comment that makes it go > 80 columns - ) {} +function f() { + a + /* eslint-disable */ } -function f5( - a: number -// some comment here -): number { - return a + 1; +function f() { + a + + /* eslint-disable */ } -var x = { - getSectionMode( - pageMetaData: PageMetaData, - sectionMetaData: SectionMetaData - /* $FlowFixMe This error was exposed while converting keyMirror - * to keyMirrorRecursive */ - ): $Enum { - } -} +function name() { + // comment1 + func1() -class X2 { - getSectionMode( - pageMetaData: PageMetaData, - sectionMetaData: SectionMetaData = ['unknown'] - /* $FlowFixMe This error was exposed while converting keyMirror - * to keyMirrorRecursive */ - ): $Enum { - } -} + // comment2 + func2() -class Foo { - a(lol /*string*/) {} - - b(lol /*string*/ - ) {} - - d( - lol /*string*/, - lol2 /*string*/, - lol3 /*string*/, - lol4 /*string*/ - ) {} - - d( - lol /*string*/, - lol2 /*string*/, - lol3 /*string*/, - lol4 /*string*/ - ) /*string*/ {} - - // prettier-ignore - c(lol /*string*/ - ) {} - - // prettier-ignore - d( - lol /*string*/, - lol2 /*string*/, - lol3 /*string*/, - lol4 /*string*/ - ) {} - - // prettier-ignore - e( - lol /*string*/, - lol2 /*string*/, - lol3 /*string*/, - lol4 /*string*/ - ) {} /* string*/ + // comment3 why func3 commented + // func3() } =====================================output===================================== -type f1 = ( - currentRequest: { a: number } - // TODO this is a very very very very long comment that makes it go > 80 columns -) => number - -f2 = ( - currentRequest: { a: number } - // TODO this is a very very very very long comment that makes it go > 80 columns -): number => {} - -f3 = ( - currentRequest: { a: number } - // TODO this is a very very very very long comment that makes it go > 80 columns -) => {} - -f4 = function ( - currentRequest: { a: number } - // TODO this is a very very very very long comment that makes it go > 80 columns -) {} - -class X { - f( - currentRequest: { a: number } - // TODO this is a very very very very long comment that makes it go > 80 columns - ) {} +function f() { + a + /* eslint-disable */ } -function f5( - a: number - // some comment here -): number { - return a + 1 +function f() { + a + + /* eslint-disable */ } -var x = { - getSectionMode( - pageMetaData: PageMetaData, - sectionMetaData: SectionMetaData - /* $FlowFixMe This error was exposed while converting keyMirror - * to keyMirrorRecursive */ - ): $Enum {}, -} +function name() { + // comment1 + func1() -class X2 { - getSectionMode( - pageMetaData: PageMetaData, - sectionMetaData: SectionMetaData = ["unknown"] - /* $FlowFixMe This error was exposed while converting keyMirror - * to keyMirrorRecursive */ - ): $Enum {} -} + // comment2 + func2() -class Foo { - a(lol /*string*/) {} - - b(lol /*string*/) {} - - d(lol /*string*/, lol2 /*string*/, lol3 /*string*/, lol4 /*string*/) {} - - d( - lol /*string*/, - lol2 /*string*/, - lol3 /*string*/, - lol4 /*string*/ - ) /*string*/ {} - - // prettier-ignore - c(lol /*string*/ - ) {} - - // prettier-ignore - d( - lol /*string*/, - lol2 /*string*/, - lol3 /*string*/, - lol4 /*string*/ - ) {} - - // prettier-ignore - e( - lol /*string*/, - lol2 /*string*/, - lol3 /*string*/, - lol4 /*string*/ - ) {} /* string*/ + // comment3 why func3 commented + // func3() } ================================================================================ @@ -3110,56 +3165,264 @@ function name() { ================================================================================ `; -exports[`preserve-new-line-last.js format 2`] = ` +exports[`return-statement.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -function f() { - a - /* eslint-disable */ +function jsx() { + return ( + // Comment +
+ ); } -function f() { - a - - /* eslint-disable */ +function unary() { + return ( + // Comment + !!x + ); } -function name() { - // comment1 - func1() +function numericLiteralNoParen() { + return 1337; // Comment +} - // comment2 - func2() +function logical() { + return ( + // Reason for 42 + 42 + ) && 84 +} - // comment3 why func3 commented - // func3() +function binary() { + return ( + // Reason for 42 + 42 + ) * 84 +} + +function binaryInBinaryLeft() { + return ( + // Reason for 42 + 42 + ) * 84 + 2 +} + +function binaryInBinaryRight() { + return ( + // Reason for 42 + 42 + ) + 84 * 2 +} + +function conditional() { + return ( + // Reason for 42 + 42 + ) ? 1 : 2 +} + +function binaryInConditional() { + return ( + // Reason for 42 + 42 + ) * 3 ? 1 : 2 +} + +function call() { + return ( + // Reason for a + a + )() +} + +function memberInside() { + return ( + // Reason for a.b + a.b + ).c +} + +function memberOutside() { + return ( + // Reason for a + a + ).b.c +} + +function memberInAndOutWithCalls() { + return ( + // Reason for a + aFunction.b() + ).c.d() +} + +function excessiveEverything() { + return ( + // Reason for stuff + a.b() * 3 + 4 ? (a\`hi\`, 1) ? 1 : 1 : 1 + ) +} + +// See https://github.com/prettier/prettier/issues/2392 +// function sequenceExpression() { +// return ( +// // Reason for a +// a +// ), b +// } + +function sequenceExpressionInside() { + return ( // Reason for a + a, b + ); +} + +function taggedTemplate() { + return ( + // Reason for a + a + )\`b\` +} + +function inlineComment() { + return ( + /* hi */ 42 + ) || 42 } =====================================output===================================== -function f() { - a - /* eslint-disable */ +function jsx() { + return ( + // Comment +
+ ) } -function f() { - a - - /* eslint-disable */ +function unary() { + return ( + // Comment + !!x + ) } -function name() { - // comment1 - func1() +function numericLiteralNoParen() { + return 1337 // Comment +} - // comment2 - func2() +function logical() { + return ( + // Reason for 42 + 42 && 84 + ) +} - // comment3 why func3 commented - // func3() +function binary() { + return ( + // Reason for 42 + 42 * 84 + ) +} + +function binaryInBinaryLeft() { + return ( + // Reason for 42 + 42 * + 84 + + 2 + ) +} + +function binaryInBinaryRight() { + return ( + // Reason for 42 + 42 + + 84 * 2 + ) +} + +function conditional() { + return ( + // Reason for 42 + 42 + ? 1 + : 2 + ) +} + +function binaryInConditional() { + return ( + // Reason for 42 + 42 * 3 + ? 1 + : 2 + ) +} + +function call() { + return ( + // Reason for a + a() + ) +} + +function memberInside() { + return ( + // Reason for a.b + a.b.c + ) +} + +function memberOutside() { + return ( + // Reason for a + a.b.c + ) +} + +function memberInAndOutWithCalls() { + return ( + aFunction + .b// Reason for a + () + .c.d() + ) +} + +function excessiveEverything() { + return ( + // Reason for stuff + a.b() * 3 + 4 ? ((a\`hi\`, 1) ? 1 : 1) : 1 + ) +} + +// See https://github.com/prettier/prettier/issues/2392 +// function sequenceExpression() { +// return ( +// // Reason for a +// a +// ), b +// } + +function sequenceExpressionInside() { + return ( + // Reason for a + a, b + ) +} + +function taggedTemplate() { + return ( + // Reason for a + a\`b\` + ) +} + +function inlineComment() { + return /* hi */ 42 || 42 } ================================================================================ @@ -3427,265 +3690,75 @@ function inlineComment() { ================================================================================ `; -exports[`return-statement.js format 2`] = ` +exports[`single-star-jsdoc.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -function jsx() { - return ( - // Comment -
- ); +/* + * Looking good! + */ + +if(true) { + /* + * Oh no + */ } -function unary() { - return ( - // Comment - !!x - ); -} + /** first line +* second line + * third line */ -function numericLiteralNoParen() { - return 1337; // Comment -} + /* first line +* second line + * third line */ -function logical() { - return ( - // Reason for 42 - 42 - ) && 84 -} + /*! first line +*second line + * third line */ -function binary() { - return ( - // Reason for 42 - 42 - ) * 84 -} - -function binaryInBinaryLeft() { - return ( - // Reason for 42 - 42 - ) * 84 + 2 -} - -function binaryInBinaryRight() { - return ( - // Reason for 42 - 42 - ) + 84 * 2 -} - -function conditional() { - return ( - // Reason for 42 - 42 - ) ? 1 : 2 -} - -function binaryInConditional() { - return ( - // Reason for 42 - 42 - ) * 3 ? 1 : 2 -} - -function call() { - return ( - // Reason for a - a - )() -} - -function memberInside() { - return ( - // Reason for a.b - a.b - ).c -} - -function memberOutside() { - return ( - // Reason for a - a - ).b.c -} - -function memberInAndOutWithCalls() { - return ( - // Reason for a - aFunction.b() - ).c.d() -} - -function excessiveEverything() { - return ( - // Reason for stuff - a.b() * 3 + 4 ? (a\`hi\`, 1) ? 1 : 1 : 1 - ) -} - -// See https://github.com/prettier/prettier/issues/2392 -// function sequenceExpression() { -// return ( -// // Reason for a -// a -// ), b -// } - -function sequenceExpressionInside() { - return ( // Reason for a - a, b - ); -} - -function taggedTemplate() { - return ( - // Reason for a - a - )\`b\` -} - -function inlineComment() { - return ( - /* hi */ 42 - ) || 42 -} +/*! +* Extracted from vue codebase +* https://github.com/vuejs/vue/blob/cfd73c2386623341fdbb3ac636c4baf84ea89c2c/src/compiler/parser/html-parser.js +* HTML Parser By John Resig (ejohn.org) +* Modified by Juriy "kangax" Zaytsev +* Original code by Erik Arvidsson, Mozilla Public License +* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js +*/ =====================================output===================================== -function jsx() { - return ( - // Comment -
- ) +/* + * Looking good! + */ + +if (true) { + /* + * Oh no + */ } -function unary() { - return ( - // Comment - !!x - ) -} +/** first line + * second line + * third line */ -function numericLiteralNoParen() { - return 1337 // Comment -} +/* first line + * second line + * third line */ -function logical() { - return ( - // Reason for 42 - 42 && 84 - ) -} +/*! first line + *second line + * third line */ -function binary() { - return ( - // Reason for 42 - 42 * 84 - ) -} - -function binaryInBinaryLeft() { - return ( - // Reason for 42 - 42 * - 84 + - 2 - ) -} - -function binaryInBinaryRight() { - return ( - // Reason for 42 - 42 + - 84 * 2 - ) -} - -function conditional() { - return ( - // Reason for 42 - 42 - ? 1 - : 2 - ) -} - -function binaryInConditional() { - return ( - // Reason for 42 - 42 * 3 - ? 1 - : 2 - ) -} - -function call() { - return ( - // Reason for a - a() - ) -} - -function memberInside() { - return ( - // Reason for a.b - a.b.c - ) -} - -function memberOutside() { - return ( - // Reason for a - a.b.c - ) -} - -function memberInAndOutWithCalls() { - return ( - aFunction - .b// Reason for a - () - .c.d() - ) -} - -function excessiveEverything() { - return ( - // Reason for stuff - a.b() * 3 + 4 ? ((a\`hi\`, 1) ? 1 : 1) : 1 - ) -} - -// See https://github.com/prettier/prettier/issues/2392 -// function sequenceExpression() { -// return ( -// // Reason for a -// a -// ), b -// } - -function sequenceExpressionInside() { - return ( - // Reason for a - a, b - ) -} - -function taggedTemplate() { - return ( - // Reason for a - a\`b\` - ) -} - -function inlineComment() { - return /* hi */ 42 || 42 -} +/*! + * Extracted from vue codebase + * https://github.com/vuejs/vue/blob/cfd73c2386623341fdbb3ac636c4baf84ea89c2c/src/compiler/parser/html-parser.js + * HTML Parser By John Resig (ejohn.org) + * Modified by Juriy "kangax" Zaytsev + * Original code by Erik Arvidsson, Mozilla Public License + * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js + */ ================================================================================ `; @@ -3762,75 +3835,90 @@ if (true) { ================================================================================ `; -exports[`single-star-jsdoc.js format 2`] = ` +exports[`switch.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -/* - * Looking good! - */ +switch (node && node.type) { + case "Property": + case "MethodDefinition": + prop = node.key; + break; -if(true) { - /* - * Oh no - */ + case "MemberExpression": + prop = node.property; + break; + + // no default } - /** first line -* second line - * third line */ +switch (foo) { + case "bar": + doThing() - /* first line -* second line - * third line */ + // no default +} - /*! first line -*second line - * third line */ +switch (foo) { + case "bar": //comment + doThing(); //comment -/*! -* Extracted from vue codebase -* https://github.com/vuejs/vue/blob/cfd73c2386623341fdbb3ac636c4baf84ea89c2c/src/compiler/parser/html-parser.js -* HTML Parser By John Resig (ejohn.org) -* Modified by Juriy "kangax" Zaytsev -* Original code by Erik Arvidsson, Mozilla Public License -* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js -*/ + case "baz": + doOtherThing(); //comment + +} + +switch (foo) { + case "bar": { + doThing(); + } //comment + + case "baz": { + doThing(); + } //comment +} =====================================output===================================== -/* - * Looking good! - */ +switch (node && node.type) { + case "Property": + case "MethodDefinition": + prop = node.key + break -if (true) { - /* - * Oh no - */ + case "MemberExpression": + prop = node.property + break + + // no default } -/** first line - * second line - * third line */ +switch (foo) { + case "bar": + doThing() -/* first line - * second line - * third line */ + // no default +} -/*! first line - *second line - * third line */ +switch (foo) { + case "bar": //comment + doThing() //comment -/*! - * Extracted from vue codebase - * https://github.com/vuejs/vue/blob/cfd73c2386623341fdbb3ac636c4baf84ea89c2c/src/compiler/parser/html-parser.js - * HTML Parser By John Resig (ejohn.org) - * Modified by Juriy "kangax" Zaytsev - * Original code by Erik Arvidsson, Mozilla Public License - * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js - */ + case "baz": + doOtherThing() //comment +} + +switch (foo) { + case "bar": { + doThing() + } //comment + + case "baz": { + doThing() + } //comment +} ================================================================================ `; @@ -3922,90 +4010,44 @@ switch (foo) { ================================================================================ `; -exports[`switch.js format 2`] = ` +exports[`tagged-template-literal.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -switch (node && node.type) { - case "Property": - case "MethodDefinition": - prop = node.key; - break; +foo\`\`; // comment - case "MemberExpression": - prop = node.property; - break; +foo // comment +\`\`; - // no default -} +foo // comment +\` +\`; -switch (foo) { - case "bar": - doThing() +foo /* comment */\` +\`; - // no default -} - -switch (foo) { - case "bar": //comment - doThing(); //comment - - case "baz": - doOtherThing(); //comment - -} - -switch (foo) { - case "bar": { - doThing(); - } //comment - - case "baz": { - doThing(); - } //comment -} +foo /* comment */ +\` +\`; =====================================output===================================== -switch (node && node.type) { - case "Property": - case "MethodDefinition": - prop = node.key - break +foo\`\` // comment - case "MemberExpression": - prop = node.property - break +foo // comment +\`\` - // no default -} +foo // comment +\` +\` -switch (foo) { - case "bar": - doThing() +foo/* comment */ \` +\` - // no default -} - -switch (foo) { - case "bar": //comment - doThing() //comment - - case "baz": - doOtherThing() //comment -} - -switch (foo) { - case "bar": { - doThing() - } //comment - - case "baz": { - doThing() - } //comment -} +foo /* comment */\` +\` ================================================================================ `; @@ -4051,43 +4093,40 @@ foo /* comment */\` ================================================================================ `; -exports[`tagged-template-literal.js format 2`] = ` +exports[`template-literal.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -foo\`\`; // comment - -foo // comment -\`\`; - -foo // comment \` -\`; +\${a // comment +} -foo /* comment */\` -\`; +\${b /* comment */} -foo /* comment */ +\${/* comment */ c /* comment */} + +\${// comment +d //comment +}; \` -\`; =====================================output===================================== -foo\`\` // comment +;\` +\${ + a // comment +} -foo // comment -\`\` +\${b /* comment */} -foo // comment -\` -\` +\${/* comment */ c /* comment */} -foo/* comment */ \` -\` - -foo /* comment */\` +\${ + // comment + d //comment +}; \` ================================================================================ @@ -4131,41 +4170,25 @@ d //comment ================================================================================ `; -exports[`template-literal.js format 2`] = ` +exports[`trailing_space.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -\` -\${a // comment -} +#!/there/is-space-here-> -\${b /* comment */} +// Do not trim trailing whitespace from this source file! -\${/* comment */ c /* comment */} - -\${// comment -d //comment -}; -\` +// There is some space here -> =====================================output===================================== -;\` -\${ - a // comment -} +#!/there/is-space-here-> -\${b /* comment */} +// Do not trim trailing whitespace from this source file! -\${/* comment */ c /* comment */} - -\${ - // comment - d //comment -}; -\` +// There is some space here -> ================================================================================ `; @@ -4192,25 +4215,64 @@ printWidth: 80 ================================================================================ `; -exports[`trailing_space.js format 2`] = ` +exports[`trailing-jsdocs.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -#!/there/is-space-here-> +const CONNECTION_STATUS = exports.CONNECTION_STATUS = { + CLOSED: Object.freeze({ kind: 'CLOSED' }), + CONNECTED: Object.freeze({ kind: 'CONNECTED' }), + CONNECTING: Object.freeze({ kind: 'CONNECTING' }), + NOT_CONNECTED: Object.freeze({ kind: 'NOT_CONNECTED' }) }; -// Do not trim trailing whitespace from this source file! - -// There is some space here -> +/* A comment */ /** +* A type that can be written to a buffer. +*/ /** +* Describes the connection status of a ReactiveSocket/DuplexConnection. +* - NOT_CONNECTED: no connection established or pending. +* - CONNECTING: when \`connect()\` has been called but a connection is not yet +* established. +* - CONNECTED: when a connection is established. +* - CLOSED: when the connection has been explicitly closed via \`close()\`. +* - ERROR: when the connection has been closed for any other reason. +*/ /** +* A contract providing different interaction models per the [ReactiveSocket protocol] +* (https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md). +*/ /** +* A single unit of data exchanged between the peers of a \`ReactiveSocket\`. +*/ =====================================output===================================== -#!/there/is-space-here-> +const CONNECTION_STATUS = (exports.CONNECTION_STATUS = { + CLOSED: Object.freeze({ kind: "CLOSED" }), + CONNECTED: Object.freeze({ kind: "CONNECTED" }), + CONNECTING: Object.freeze({ kind: "CONNECTING" }), + NOT_CONNECTED: Object.freeze({ kind: "NOT_CONNECTED" }), +}) -// Do not trim trailing whitespace from this source file! - -// There is some space here -> +/* A comment */ +/** + * A type that can be written to a buffer. + */ +/** + * Describes the connection status of a ReactiveSocket/DuplexConnection. + * - NOT_CONNECTED: no connection established or pending. + * - CONNECTING: when \`connect()\` has been called but a connection is not yet + * established. + * - CONNECTED: when a connection is established. + * - CLOSED: when the connection has been explicitly closed via \`close()\`. + * - ERROR: when the connection has been closed for any other reason. + */ +/** + * A contract providing different interaction models per the [ReactiveSocket protocol] + * (https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md). + */ +/** + * A single unit of data exchanged between the peers of a \`ReactiveSocket\`. + */ ================================================================================ `; @@ -4276,64 +4338,42 @@ const CONNECTION_STATUS = (exports.CONNECTION_STATUS = { ================================================================================ `; -exports[`trailing-jsdocs.js format 2`] = ` +exports[`try.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -const CONNECTION_STATUS = exports.CONNECTION_STATUS = { - CLOSED: Object.freeze({ kind: 'CLOSED' }), - CONNECTED: Object.freeze({ kind: 'CONNECTED' }), - CONNECTING: Object.freeze({ kind: 'CONNECTING' }), - NOT_CONNECTED: Object.freeze({ kind: 'NOT_CONNECTED' }) }; - -/* A comment */ /** -* A type that can be written to a buffer. -*/ /** -* Describes the connection status of a ReactiveSocket/DuplexConnection. -* - NOT_CONNECTED: no connection established or pending. -* - CONNECTING: when \`connect()\` has been called but a connection is not yet -* established. -* - CONNECTED: when a connection is established. -* - CLOSED: when the connection has been explicitly closed via \`close()\`. -* - ERROR: when the connection has been closed for any other reason. -*/ /** -* A contract providing different interaction models per the [ReactiveSocket protocol] -* (https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md). -*/ /** -* A single unit of data exchanged between the peers of a \`ReactiveSocket\`. -*/ +// Comment 1 +try { // Comment 2 + // Comment 3 +} +// Comment 4 +catch(e) { // Comment 5 + // Comment 6 +} +// Comment 7 +finally { // Comment 8 + // Comment 9 +} +// Comment 10 =====================================output===================================== -const CONNECTION_STATUS = (exports.CONNECTION_STATUS = { - CLOSED: Object.freeze({ kind: "CLOSED" }), - CONNECTED: Object.freeze({ kind: "CONNECTED" }), - CONNECTING: Object.freeze({ kind: "CONNECTING" }), - NOT_CONNECTED: Object.freeze({ kind: "NOT_CONNECTED" }), -}) - -/* A comment */ -/** - * A type that can be written to a buffer. - */ -/** - * Describes the connection status of a ReactiveSocket/DuplexConnection. - * - NOT_CONNECTED: no connection established or pending. - * - CONNECTING: when \`connect()\` has been called but a connection is not yet - * established. - * - CONNECTED: when a connection is established. - * - CLOSED: when the connection has been explicitly closed via \`close()\`. - * - ERROR: when the connection has been closed for any other reason. - */ -/** - * A contract providing different interaction models per the [ReactiveSocket protocol] - * (https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md). - */ -/** - * A single unit of data exchanged between the peers of a \`ReactiveSocket\`. - */ +// Comment 1 +try { + // Comment 2 + // Comment 3 +} catch (e) { + // Comment 4 + // Comment 5 + // Comment 6 +} finally { + // Comment 7 + // Comment 8 + // Comment 9 +} +// Comment 10 ================================================================================ `; @@ -4377,42 +4417,153 @@ try { ================================================================================ `; -exports[`try.js format 2`] = ` +exports[`variable_declarator.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -// Comment 1 -try { // Comment 2 - // Comment 3 +let obj1 = // Comment +{ + key: 'val' } -// Comment 4 -catch(e) { // Comment 5 - // Comment 6 + +let obj2 // Comment += { + key: 'val' } -// Comment 7 -finally { // Comment 8 - // Comment 9 + +let obj3 = { // Comment + key: 'val' } -// Comment 10 + +let obj4 = { + // Comment + key: 'val' +} + +let obj5 = // Comment +[ + 'val' +] + +let obj6 // Comment += [ + 'val' +] + +let obj7 = [ // Comment + 'val' +] + +let obj8 = [ + // Comment + 'val' +] + +let obj9 = // Comment +\`val\`; + +let obj10 = // Comment +\` +val +val +\`; + +let obj11 = // Comment +tag\`val\`; + +let obj12 = // Comment +tag\` +val +val +\`; + +let // Comment + foo1 = 'val'; + +let // Comment + foo2 = 'val', + bar = 'val'; + +const foo3 = 123 +// Nothing to see here. +;["2", "3"].forEach(x => console.log(x)) =====================================output===================================== -// Comment 1 -try { - // Comment 2 - // Comment 3 -} catch (e) { - // Comment 4 - // Comment 5 - // Comment 6 -} finally { - // Comment 7 - // Comment 8 - // Comment 9 +let obj1 = + // Comment + { + key: "val", + } + +let obj2 = + // Comment + { + key: "val", + } + +let obj3 = { + // Comment + key: "val", } -// Comment 10 + +let obj4 = { + // Comment + key: "val", +} + +let obj5 = + // Comment + ["val"] + +let obj6 = + // Comment + ["val"] + +let obj7 = [ + // Comment + "val", +] + +let obj8 = [ + // Comment + "val", +] + +let obj9 = + // Comment + \`val\` + +let obj10 = + // Comment + \` +val +val +\` + +let obj11 = + // Comment + tag\`val\` + +let obj12 = + // Comment + tag\` +val +val +\` + +let // Comment + foo1 = "val" + +let // Comment + foo2 = "val", + bar = "val" + +const foo3 = 123 +// Nothing to see here. +;["2", "3"].forEach((x) => console.log(x)) ================================================================================ `; @@ -4567,153 +4718,58 @@ const foo3 = 123; ================================================================================ `; -exports[`variable_declarator.js format 2`] = ` +exports[`while.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] printWidth: 80 semi: false | printWidth =====================================input====================================== -let obj1 = // Comment -{ - key: 'val' -} +while( + true + // Comment + ) {} -let obj2 // Comment -= { - key: 'val' -} +while(true)// Comment +{} -let obj3 = { // Comment - key: 'val' -} +while(true){}// Comment -let obj4 = { - // Comment - key: 'val' -} +while(true)/*Comment*/{} -let obj5 = // Comment -[ - 'val' -] +while( + true // Comment + && true // Comment + ){} -let obj6 // Comment -= [ - 'val' -] +while(true) {} // comment -let obj7 = [ // Comment - 'val' -] - -let obj8 = [ - // Comment - 'val' -] - -let obj9 = // Comment -\`val\`; - -let obj10 = // Comment -\` -val -val -\`; - -let obj11 = // Comment -tag\`val\`; - -let obj12 = // Comment -tag\` -val -val -\`; - -let // Comment - foo1 = 'val'; - -let // Comment - foo2 = 'val', - bar = 'val'; - -const foo3 = 123 -// Nothing to see here. -;["2", "3"].forEach(x => console.log(x)) +while(true) /* comment */ ++x; =====================================output===================================== -let obj1 = +while ( + true // Comment - { - key: "val", - } +) {} -let obj2 = +while (true) { // Comment - { - key: "val", - } - -let obj3 = { - // Comment - key: "val", } -let obj4 = { - // Comment - key: "val", +while (true) {} // Comment + +while (true) { + /*Comment*/ } -let obj5 = - // Comment - ["val"] +while ( + true && // Comment + true // Comment +) {} -let obj6 = - // Comment - ["val"] +while (true) {} // comment -let obj7 = [ - // Comment - "val", -] - -let obj8 = [ - // Comment - "val", -] - -let obj9 = - // Comment - \`val\` - -let obj10 = - // Comment - \` -val -val -\` - -let obj11 = - // Comment - tag\`val\` - -let obj12 = - // Comment - tag\` -val -val -\` - -let // Comment - foo1 = "val" - -let // Comment - foo2 = "val", - bar = "val" - -const foo3 = 123 -// Nothing to see here. -;["2", "3"].forEach((x) => console.log(x)) +while (true) /* comment */ ++x ================================================================================ `; @@ -4772,59 +4828,3 @@ while (true) /* comment */ ++x; ================================================================================ `; - -exports[`while.js format 2`] = ` -====================================options===================================== -parsers: ["flow", "babel", "typescript"] -printWidth: 80 -semi: false - | printWidth -=====================================input====================================== -while( - true - // Comment - ) {} - -while(true)// Comment -{} - -while(true){}// Comment - -while(true)/*Comment*/{} - -while( - true // Comment - && true // Comment - ){} - -while(true) {} // comment - -while(true) /* comment */ ++x; - -=====================================output===================================== -while ( - true - // Comment -) {} - -while (true) { - // Comment -} - -while (true) {} // Comment - -while (true) { - /*Comment*/ -} - -while ( - true && // Comment - true // Comment -) {} - -while (true) {} // comment - -while (true) /* comment */ ++x - -================================================================================ -`; diff --git a/tests/comments_jsx_same_line/__snapshots__/jsfmt.spec.js.snap b/tests/comments_jsx_same_line/__snapshots__/jsfmt.spec.js.snap index 0f42ba764..cd3446339 100644 --- a/tests/comments_jsx_same_line/__snapshots__/jsfmt.spec.js.snap +++ b/tests/comments_jsx_same_line/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`jsx_same_line.js format 1`] = ` +exports[`jsx_same_line.js - {"jsxBracketSameLine":true} format 1`] = ` ====================================options===================================== jsxBracketSameLine: true parsers: ["flow", "babel", "typescript"] diff --git a/tests/css_attribute/__snapshots__/jsfmt.spec.js.snap b/tests/css_attribute/__snapshots__/jsfmt.spec.js.snap index 7ac2a2fbc..c0135b53d 100644 --- a/tests/css_attribute/__snapshots__/jsfmt.spec.js.snap +++ b/tests/css_attribute/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,37 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`custom-selector.css - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["css"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +@custom-selector :--icon i[class^='icon-'], i[class*=' icon-']; +@custom-selector :--icon i[ class ^= 'icon-' ], i[ class *= ' icon-' ]; +@custom-selector +:--icon +i[ +class +^= +'icon-' +] +, +i[ +class +*= +' icon-' +] +; + +=====================================output===================================== +@custom-selector :--icon i[class^='icon-'], i[class*=' icon-']; +@custom-selector :--icon i[class^='icon-'], i[class*=' icon-']; +@custom-selector :--icon i[class^='icon-'], i[class*=' icon-']; + +================================================================================ +`; + exports[`custom-selector.css format 1`] = ` ====================================options===================================== parsers: ["css"] @@ -31,34 +63,24 @@ class ================================================================================ `; -exports[`custom-selector.css format 2`] = ` +exports[`insensitive.css - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -@custom-selector :--icon i[class^='icon-'], i[class*=' icon-']; -@custom-selector :--icon i[ class ^= 'icon-' ], i[ class *= ' icon-' ]; -@custom-selector -:--icon -i[ -class -^= -'icon-' -] -, -i[ -class -*= -' icon-' -] -; +input[type="radio" i] {} +img[alt~="person" i][src*="lorem" i] {} +section:has(:not([type="radio" i], [type="checkbox" i])) {} =====================================output===================================== -@custom-selector :--icon i[class^='icon-'], i[class*=' icon-']; -@custom-selector :--icon i[class^='icon-'], i[class*=' icon-']; -@custom-selector :--icon i[class^='icon-'], i[class*=' icon-']; +input[type='radio' i] { +} +img[alt~='person' i][src*='lorem' i] { +} +section:has(:not([type='radio' i], [type='checkbox' i])) { +} ================================================================================ `; @@ -84,23 +106,28 @@ section:has(:not([type="radio" i], [type="checkbox" i])) { ================================================================================ `; -exports[`insensitive.css format 2`] = ` +exports[`namespaces.css - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -input[type="radio" i] {} -img[alt~="person" i][src*="lorem" i] {} -section:has(:not([type="radio" i], [type="checkbox" i])) {} +@namespace foo "http://www.example.com"; +[foo|att=val] {} +[*|att] {} +[|att] {} +[att] {} =====================================output===================================== -input[type='radio' i] { +@namespace foo 'http://www.example.com'; +[foo|att='val'] { } -img[alt~='person' i][src*='lorem' i] { +[*|att] { } -section:has(:not([type='radio' i], [type='checkbox' i])) { +[|att] { +} +[att] { } ================================================================================ @@ -132,28 +159,38 @@ printWidth: 80 ================================================================================ `; -exports[`namespaces.css format 2`] = ` +exports[`quotes.css - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -@namespace foo "http://www.example.com"; -[foo|att=val] {} -[*|att] {} -[|att] {} -[att] {} +a[id=test] {} +a[id="test"] {} +a[id='test'] {} +a[id=func("foo")] {} +a[class="(╯°□°)╯︵ ┻━┻"]{} +input:not([type="radio"]):not([type="checkbox"]) {} +input:not([type="radio"], [type="checkbox"]) {} +section:has(:not([type="radio"], [type="checkbox"])) {} =====================================output===================================== -@namespace foo 'http://www.example.com'; -[foo|att='val'] { +a[id='test'] { } -[*|att] { +a[id='test'] { } -[|att] { +a[id='test'] { } -[att] { +a[id=func('foo')] { +} +a[class='(╯°□°)╯︵ ┻━┻'] { +} +input:not([type='radio']):not([type='checkbox']) { +} +input:not([type='radio'], [type='checkbox']) { +} +section:has(:not([type='radio'], [type='checkbox'])) { } ================================================================================ @@ -195,39 +232,244 @@ section:has(:not([type="radio"], [type="checkbox"])) { ================================================================================ `; -exports[`quotes.css format 2`] = ` +exports[`spaces.css - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -a[id=test] {} -a[id="test"] {} -a[id='test'] {} -a[id=func("foo")] {} -a[class="(╯°□°)╯︵ ┻━┻"]{} -input:not([type="radio"]):not([type="checkbox"]) {} -input:not([type="radio"], [type="checkbox"]) {} -section:has(:not([type="radio"], [type="checkbox"])) {} +[lang] {} +[ lang] {} +[lang ] {} +[ lang ] {} +[ lang ] {} +[ +lang +] {} +span[lang] {} +span[ lang] {} +span[lang ] {} +span[ lang ] {} +span[ lang ] {} +span[lang='pt'] {} +span[lang ='pt'] {} +span[lang= 'pt'] {} +span[lang = 'pt'] {} +span[lang = 'pt'] {} +span[lang='pt' ] {} +span[lang='pt' ] {} +span[ +lang += +'pt' +] {} +span[ lang ~= 'en-us' ] {} +span[ lang ~= 'en-us' ] {} +span[ lang |='zh' ] {} +span[ +lang +~= +'en-us' +] {} +a[ href ^= '#' ] {} +a[ href $= '.cn' ] {} +a[ href *= 'example' ] {} +a[ +href +*= +'example' +] {} +input[ type = 'radio' i ] {} +input[ type = 'radio' i ] {} +input[ type ~= 'radio' i ] {} +input[ type ~= 'radio' i ] {} +input[ +type +~= +'radio' +i +] {} +img[ alt = 'person' ][ src = 'lorem' ] {} +img[ alt = 'person' ][ src = 'lorem' ] {} +img[ alt ~= 'person' ][ src *= 'lorem' ] {} +img[ alt ~= 'person' ][ src *= 'lorem' ] {} +img[ +alt +~= +'person' +][ +src +*= +'lorem' +] {} +section:has(:not([type='radio'], [type='checkbox'])) {} +section:has(:not([type='radio' i], [type='checkbox' i])) {} +section:has(:not([ type = 'radio' ], [ type = 'checkbox' ])) {} +section:has(:not([ type = 'radio' i ], [ type = 'checkbox' i ])) {} +section:has(:not([ type = 'radio' ], [ type = 'checkbox' ])) {} +section:has(:not([ type = 'radio' i ], [ type = 'checkbox' i ])) {} +section:has(:not([ +type += +'radio' +], [ +type += +'checkbox' +])) {} +section:has(:not([ +type += +'radio' +i +], [ +type += +'checkbox' +i +])) {} +[foo|att=val] {} +[ foo | att = val ] {} +[ foo | att = val ] {} +[ +foo +| +att += +val +] {} +[*|att] {} +[ * | att ] {} +[ * | att ] {} +[ +* +| +att +] {} +[|att] {} +[ | att ] {} +[ | att ] {} +[ +| +att +] {} =====================================output===================================== -a[id='test'] { +[lang] { } -a[id='test'] { +[lang] { } -a[id='test'] { +[lang] { } -a[id=func('foo')] { +[lang] { } -a[class='(╯°□°)╯︵ ┻━┻'] { +[lang] { } -input:not([type='radio']):not([type='checkbox']) { +[lang] { } -input:not([type='radio'], [type='checkbox']) { +span[lang] { +} +span[lang] { +} +span[lang] { +} +span[lang] { +} +span[lang] { +} +span[lang='pt'] { +} +span[lang='pt'] { +} +span[lang='pt'] { +} +span[lang='pt'] { +} +span[lang='pt'] { +} +span[lang='pt'] { +} +span[lang='pt'] { +} +span[lang='pt'] { +} +span[lang~='en-us'] { +} +span[lang~='en-us'] { +} +span[lang|='zh'] { +} +span[lang~='en-us'] { +} +a[href^='#'] { +} +a[href$='.cn'] { +} +a[href*='example'] { +} +a[href*='example'] { +} +input[type='radio' i] { +} +input[type='radio' i] { +} +input[type~='radio' i] { +} +input[type~='radio' i] { +} +input[type~='radio' i] { +} +img[alt='person'][src='lorem'] { +} +img[alt='person'][src='lorem'] { +} +img[alt~='person'][src*='lorem'] { +} +img[alt~='person'][src*='lorem'] { +} +img[alt~='person'][src*='lorem'] { } section:has(:not([type='radio'], [type='checkbox'])) { } +section:has(:not([type='radio' i], [type='checkbox' i])) { +} +section:has(:not([type='radio'], [type='checkbox'])) { +} +section:has(:not([type='radio' i], [type='checkbox' i])) { +} +section:has(:not([type='radio'], [type='checkbox'])) { +} +section:has(:not([type='radio' i], [type='checkbox' i])) { +} +section:has(:not([type='radio'], [type='checkbox'])) { +} +section:has(:not([type='radio' i], [type='checkbox' i])) { +} +[foo|att='val'] { +} +[foo|att='val'] { +} +[foo|att='val'] { +} +[foo|att='val'] { +} +[*|att] { +} +[*|att] { +} +[*|att] { +} +[*|att] { +} +[|att] { +} +[|att] { +} +[|att] { +} +[|att] { +} ================================================================================ `; @@ -472,245 +714,3 @@ section:has(:not([type="radio" i], [type="checkbox" i])) { ================================================================================ `; - -exports[`spaces.css format 2`] = ` -====================================options===================================== -parsers: ["css"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -[lang] {} -[ lang] {} -[lang ] {} -[ lang ] {} -[ lang ] {} -[ -lang -] {} -span[lang] {} -span[ lang] {} -span[lang ] {} -span[ lang ] {} -span[ lang ] {} -span[lang='pt'] {} -span[lang ='pt'] {} -span[lang= 'pt'] {} -span[lang = 'pt'] {} -span[lang = 'pt'] {} -span[lang='pt' ] {} -span[lang='pt' ] {} -span[ -lang -= -'pt' -] {} -span[ lang ~= 'en-us' ] {} -span[ lang ~= 'en-us' ] {} -span[ lang |='zh' ] {} -span[ -lang -~= -'en-us' -] {} -a[ href ^= '#' ] {} -a[ href $= '.cn' ] {} -a[ href *= 'example' ] {} -a[ -href -*= -'example' -] {} -input[ type = 'radio' i ] {} -input[ type = 'radio' i ] {} -input[ type ~= 'radio' i ] {} -input[ type ~= 'radio' i ] {} -input[ -type -~= -'radio' -i -] {} -img[ alt = 'person' ][ src = 'lorem' ] {} -img[ alt = 'person' ][ src = 'lorem' ] {} -img[ alt ~= 'person' ][ src *= 'lorem' ] {} -img[ alt ~= 'person' ][ src *= 'lorem' ] {} -img[ -alt -~= -'person' -][ -src -*= -'lorem' -] {} -section:has(:not([type='radio'], [type='checkbox'])) {} -section:has(:not([type='radio' i], [type='checkbox' i])) {} -section:has(:not([ type = 'radio' ], [ type = 'checkbox' ])) {} -section:has(:not([ type = 'radio' i ], [ type = 'checkbox' i ])) {} -section:has(:not([ type = 'radio' ], [ type = 'checkbox' ])) {} -section:has(:not([ type = 'radio' i ], [ type = 'checkbox' i ])) {} -section:has(:not([ -type -= -'radio' -], [ -type -= -'checkbox' -])) {} -section:has(:not([ -type -= -'radio' -i -], [ -type -= -'checkbox' -i -])) {} -[foo|att=val] {} -[ foo | att = val ] {} -[ foo | att = val ] {} -[ -foo -| -att -= -val -] {} -[*|att] {} -[ * | att ] {} -[ * | att ] {} -[ -* -| -att -] {} -[|att] {} -[ | att ] {} -[ | att ] {} -[ -| -att -] {} - -=====================================output===================================== -[lang] { -} -[lang] { -} -[lang] { -} -[lang] { -} -[lang] { -} -[lang] { -} -span[lang] { -} -span[lang] { -} -span[lang] { -} -span[lang] { -} -span[lang] { -} -span[lang='pt'] { -} -span[lang='pt'] { -} -span[lang='pt'] { -} -span[lang='pt'] { -} -span[lang='pt'] { -} -span[lang='pt'] { -} -span[lang='pt'] { -} -span[lang='pt'] { -} -span[lang~='en-us'] { -} -span[lang~='en-us'] { -} -span[lang|='zh'] { -} -span[lang~='en-us'] { -} -a[href^='#'] { -} -a[href$='.cn'] { -} -a[href*='example'] { -} -a[href*='example'] { -} -input[type='radio' i] { -} -input[type='radio' i] { -} -input[type~='radio' i] { -} -input[type~='radio' i] { -} -input[type~='radio' i] { -} -img[alt='person'][src='lorem'] { -} -img[alt='person'][src='lorem'] { -} -img[alt~='person'][src*='lorem'] { -} -img[alt~='person'][src*='lorem'] { -} -img[alt~='person'][src*='lorem'] { -} -section:has(:not([type='radio'], [type='checkbox'])) { -} -section:has(:not([type='radio' i], [type='checkbox' i])) { -} -section:has(:not([type='radio'], [type='checkbox'])) { -} -section:has(:not([type='radio' i], [type='checkbox' i])) { -} -section:has(:not([type='radio'], [type='checkbox'])) { -} -section:has(:not([type='radio' i], [type='checkbox' i])) { -} -section:has(:not([type='radio'], [type='checkbox'])) { -} -section:has(:not([type='radio' i], [type='checkbox' i])) { -} -[foo|att='val'] { -} -[foo|att='val'] { -} -[foo|att='val'] { -} -[foo|att='val'] { -} -[*|att] { -} -[*|att] { -} -[*|att] { -} -[*|att] { -} -[|att] { -} -[|att] { -} -[|att] { -} -[|att] { -} - -================================================================================ -`; diff --git a/tests/css_quotes/__snapshots__/jsfmt.spec.js.snap b/tests/css_quotes/__snapshots__/jsfmt.spec.js.snap index 183a7ce1e..67eed4b42 100644 --- a/tests/css_quotes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/css_quotes/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,202 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`quotes.css - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["css"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +@charset "UTF-8"; +/* @charset must always have double quotes: https://www.w3.org/TR/css-syntax-3/#determine-the-fallback-encoding */ +/* Also, it has to be the very first thing in the file, but here are some more tests anyway: */ +@charset 'UTF-8'; /* Single quotes are invalid here. Keep them since we don't know what the user is doing. */ + +@supports (content: one "two" three 'four') { + a[href="foo" y], + abbr[title^='It\\'s a trap!'], + img[src=""] { + /* Simple strings. */ + content: "abc"; + content: 'abc'; + + /* Escape. */ + content: '\\A'; + + /* Emoji. */ + content: '🐶'; + + /* Empty string. */ + content: ""; + content: ''; + + /* Single double quote. */ + content: "\\""; + content: '"'; + + /* Single single quote. */ + content: "'"; + content: '\\''; + + /* One of each. */ + content: "\\"'"; + content: '"\\''; + + /* One of each with unnecessary escapes. */ + content: "\\"\\'"; + content: '\\"\\''; + + /* More double quotes than single quotes. */ + content: "\\"'\\""; + content: '"\\'"'; + + /* More single quotes than double quotes. */ + content: "\\"''"; + content: '"\\'\\''; + + /* Two of each. */ + content: "\\"\\"''"; + content: '""\\'\\''; + + /* Single backslash. */ + content: '\\\\'; + content: "\\\\"; + + /* Backslases. */ + content: "\\"\\\\\\"\\\\\\\\\\" '\\'\\\\'\\\\\\'\\\\\\\\'"; + content: '\\'\\\\\\'\\\\\\\\\\' "\\"\\\\"\\\\\\"\\\\\\\\"'; + + /* Somewhat more real-word example. */ + content: "He's sayin': \\"How's it goin'?\\" Don't ask me why."; + content: 'He\\'s sayin\\': "How\\'s it goin\\'?" Don\\'t ask me why.'; + + /* Somewhat more real-word example 2. */ + content: "var backslash = \\"\\\\\\", doubleQuote = '\\"';"; + content: 'var backslash = "\\\\", doubleQuote = \\'"\\';'; + + /* Leave all "escapes" alone. */ + content: "\\Abc4 foo \\n" /* "comment" */ "\\end"; + content: '\\Abc4 foo \\n' /* 'comment' */ '\\end'; + } +} + +@import "file.css"; +@import 'file.css'; + +@import url("foo.css"); +@import url('foo.css'); + +@import "foo.css" screen and (orientation: landscape); +@import 'foo.css' screen and (orientation: landscape); + +@foo "one"; +@foo 'one'; +@foo "one" two 'three'; +@foo ("one"); +@foo ('one'); +@foo ("one" two 'three'); + +one "two" three {} +one 'two' three {} + +=====================================output===================================== +@charset "UTF-8"; +/* @charset must always have double quotes: https://www.w3.org/TR/css-syntax-3/#determine-the-fallback-encoding */ +/* Also, it has to be the very first thing in the file, but here are some more tests anyway: */ +@charset 'UTF-8'; /* Single quotes are invalid here. Keep them since we don't know what the user is doing. */ + +@supports (content: one 'two' three 'four') { + a[href='foo' y], + abbr[title^="It's a trap!"], + img[src=''] { + /* Simple strings. */ + content: 'abc'; + content: 'abc'; + + /* Escape. */ + content: '\\A'; + + /* Emoji. */ + content: '🐶'; + + /* Empty string. */ + content: ''; + content: ''; + + /* Single double quote. */ + content: '"'; + content: '"'; + + /* Single single quote. */ + content: "'"; + content: "'"; + + /* One of each. */ + content: '"\\''; + content: '"\\''; + + /* One of each with unnecessary escapes. */ + content: '"\\''; + content: '"\\''; + + /* More double quotes than single quotes. */ + content: '"\\'"'; + content: '"\\'"'; + + /* More single quotes than double quotes. */ + content: "\\"''"; + content: "\\"''"; + + /* Two of each. */ + content: '""\\'\\''; + content: '""\\'\\''; + + /* Single backslash. */ + content: '\\\\'; + content: '\\\\'; + + /* Backslases. */ + content: "\\"\\\\\\"\\\\\\\\\\" ''\\\\'\\\\'\\\\\\\\'"; + content: '\\'\\\\\\'\\\\\\\\\\' ""\\\\"\\\\"\\\\\\\\"'; + + /* Somewhat more real-word example. */ + content: "He's sayin': \\"How's it goin'?\\" Don't ask me why."; + content: "He's sayin': \\"How's it goin'?\\" Don't ask me why."; + + /* Somewhat more real-word example 2. */ + content: 'var backslash = "\\\\", doubleQuote = \\'"\\';'; + content: 'var backslash = "\\\\", doubleQuote = \\'"\\';'; + + /* Leave all "escapes" alone. */ + content: '\\Abc4 foo \\n' /* "comment" */ '\\end'; + content: '\\Abc4 foo \\n' /* 'comment' */ '\\end'; + } +} + +@import 'file.css'; +@import 'file.css'; + +@import url('foo.css'); +@import url('foo.css'); + +@import 'foo.css' screen and (orientation: landscape); +@import 'foo.css' screen and (orientation: landscape); + +@foo "one"; +@foo 'one'; +@foo "one" two 'three'; +@foo ("one"); +@foo ('one'); +@foo ("one" two 'three'); + +one 'two' three { +} +one 'two' three { +} + +================================================================================ +`; + exports[`quotes.css format 1`] = ` ====================================options===================================== parsers: ["css"] @@ -195,200 +392,3 @@ one "two" three { ================================================================================ `; - -exports[`quotes.css format 2`] = ` -====================================options===================================== -parsers: ["css"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -@charset "UTF-8"; -/* @charset must always have double quotes: https://www.w3.org/TR/css-syntax-3/#determine-the-fallback-encoding */ -/* Also, it has to be the very first thing in the file, but here are some more tests anyway: */ -@charset 'UTF-8'; /* Single quotes are invalid here. Keep them since we don't know what the user is doing. */ - -@supports (content: one "two" three 'four') { - a[href="foo" y], - abbr[title^='It\\'s a trap!'], - img[src=""] { - /* Simple strings. */ - content: "abc"; - content: 'abc'; - - /* Escape. */ - content: '\\A'; - - /* Emoji. */ - content: '🐶'; - - /* Empty string. */ - content: ""; - content: ''; - - /* Single double quote. */ - content: "\\""; - content: '"'; - - /* Single single quote. */ - content: "'"; - content: '\\''; - - /* One of each. */ - content: "\\"'"; - content: '"\\''; - - /* One of each with unnecessary escapes. */ - content: "\\"\\'"; - content: '\\"\\''; - - /* More double quotes than single quotes. */ - content: "\\"'\\""; - content: '"\\'"'; - - /* More single quotes than double quotes. */ - content: "\\"''"; - content: '"\\'\\''; - - /* Two of each. */ - content: "\\"\\"''"; - content: '""\\'\\''; - - /* Single backslash. */ - content: '\\\\'; - content: "\\\\"; - - /* Backslases. */ - content: "\\"\\\\\\"\\\\\\\\\\" '\\'\\\\'\\\\\\'\\\\\\\\'"; - content: '\\'\\\\\\'\\\\\\\\\\' "\\"\\\\"\\\\\\"\\\\\\\\"'; - - /* Somewhat more real-word example. */ - content: "He's sayin': \\"How's it goin'?\\" Don't ask me why."; - content: 'He\\'s sayin\\': "How\\'s it goin\\'?" Don\\'t ask me why.'; - - /* Somewhat more real-word example 2. */ - content: "var backslash = \\"\\\\\\", doubleQuote = '\\"';"; - content: 'var backslash = "\\\\", doubleQuote = \\'"\\';'; - - /* Leave all "escapes" alone. */ - content: "\\Abc4 foo \\n" /* "comment" */ "\\end"; - content: '\\Abc4 foo \\n' /* 'comment' */ '\\end'; - } -} - -@import "file.css"; -@import 'file.css'; - -@import url("foo.css"); -@import url('foo.css'); - -@import "foo.css" screen and (orientation: landscape); -@import 'foo.css' screen and (orientation: landscape); - -@foo "one"; -@foo 'one'; -@foo "one" two 'three'; -@foo ("one"); -@foo ('one'); -@foo ("one" two 'three'); - -one "two" three {} -one 'two' three {} - -=====================================output===================================== -@charset "UTF-8"; -/* @charset must always have double quotes: https://www.w3.org/TR/css-syntax-3/#determine-the-fallback-encoding */ -/* Also, it has to be the very first thing in the file, but here are some more tests anyway: */ -@charset 'UTF-8'; /* Single quotes are invalid here. Keep them since we don't know what the user is doing. */ - -@supports (content: one 'two' three 'four') { - a[href='foo' y], - abbr[title^="It's a trap!"], - img[src=''] { - /* Simple strings. */ - content: 'abc'; - content: 'abc'; - - /* Escape. */ - content: '\\A'; - - /* Emoji. */ - content: '🐶'; - - /* Empty string. */ - content: ''; - content: ''; - - /* Single double quote. */ - content: '"'; - content: '"'; - - /* Single single quote. */ - content: "'"; - content: "'"; - - /* One of each. */ - content: '"\\''; - content: '"\\''; - - /* One of each with unnecessary escapes. */ - content: '"\\''; - content: '"\\''; - - /* More double quotes than single quotes. */ - content: '"\\'"'; - content: '"\\'"'; - - /* More single quotes than double quotes. */ - content: "\\"''"; - content: "\\"''"; - - /* Two of each. */ - content: '""\\'\\''; - content: '""\\'\\''; - - /* Single backslash. */ - content: '\\\\'; - content: '\\\\'; - - /* Backslases. */ - content: "\\"\\\\\\"\\\\\\\\\\" ''\\\\'\\\\'\\\\\\\\'"; - content: '\\'\\\\\\'\\\\\\\\\\' ""\\\\"\\\\"\\\\\\\\"'; - - /* Somewhat more real-word example. */ - content: "He's sayin': \\"How's it goin'?\\" Don't ask me why."; - content: "He's sayin': \\"How's it goin'?\\" Don't ask me why."; - - /* Somewhat more real-word example 2. */ - content: 'var backslash = "\\\\", doubleQuote = \\'"\\';'; - content: 'var backslash = "\\\\", doubleQuote = \\'"\\';'; - - /* Leave all "escapes" alone. */ - content: '\\Abc4 foo \\n' /* "comment" */ '\\end'; - content: '\\Abc4 foo \\n' /* 'comment' */ '\\end'; - } -} - -@import 'file.css'; -@import 'file.css'; - -@import url('foo.css'); -@import url('foo.css'); - -@import 'foo.css' screen and (orientation: landscape); -@import 'foo.css' screen and (orientation: landscape); - -@foo "one"; -@foo 'one'; -@foo "one" two 'three'; -@foo ("one"); -@foo ('one'); -@foo ("one" two 'three'); - -one 'two' three { -} -one 'two' three { -} - -================================================================================ -`; diff --git a/tests/css_scss/__snapshots__/jsfmt.spec.js.snap b/tests/css_scss/__snapshots__/jsfmt.spec.js.snap index b70b2ab51..8373aba41 100644 --- a/tests/css_scss/__snapshots__/jsfmt.spec.js.snap +++ b/tests/css_scss/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`comments.scss format 1`] = ` +exports[`comments.scss - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -37,7 +37,7 @@ trailingComma: "none" ================================================================================ `; -exports[`comments.scss format 2`] = ` +exports[`comments.scss format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -73,11 +73,25 @@ printWidth: 80 ================================================================================ `; +exports[`import_comma.scss - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["scss"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== +@import "rounded-corners", "text-shadow"; + +=====================================output===================================== +@import "rounded-corners", "text-shadow"; + +================================================================================ +`; + exports[`import_comma.scss format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 -trailingComma: "none" | printWidth =====================================input====================================== @import "rounded-corners", "text-shadow"; @@ -88,21 +102,7 @@ trailingComma: "none" ================================================================================ `; -exports[`import_comma.scss format 2`] = ` -====================================options===================================== -parsers: ["scss"] -printWidth: 80 - | printWidth -=====================================input====================================== -@import "rounded-corners", "text-shadow"; - -=====================================output===================================== -@import "rounded-corners", "text-shadow"; - -================================================================================ -`; - -exports[`scss.scss format 1`] = ` +exports[`scss.scss - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -2131,7 +2131,7 @@ label { ================================================================================ `; -exports[`scss.scss format 2`] = ` +exports[`scss.scss format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -4159,7 +4159,7 @@ label { ================================================================================ `; -exports[`string-concatanation.scss format 1`] = ` +exports[`string-concatanation.scss - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -4184,7 +4184,7 @@ a { ================================================================================ `; -exports[`string-concatanation.scss format 2`] = ` +exports[`string-concatanation.scss format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 diff --git a/tests/css_trailing_comma/__snapshots__/jsfmt.spec.js.snap b/tests/css_trailing_comma/__snapshots__/jsfmt.spec.js.snap index 2ecc7d4fb..3223d1613 100644 --- a/tests/css_trailing_comma/__snapshots__/jsfmt.spec.js.snap +++ b/tests/css_trailing_comma/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`at-rules.css format 1`] = ` +exports[`at-rules.css - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 @@ -76,7 +76,7 @@ a { ================================================================================ `; -exports[`at-rules.css format 2`] = ` +exports[`at-rules.css format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -151,7 +151,7 @@ a { ================================================================================ `; -exports[`declaration.css format 1`] = ` +exports[`declaration.css - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 @@ -170,7 +170,7 @@ a { ================================================================================ `; -exports[`declaration.css format 2`] = ` +exports[`declaration.css format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -188,7 +188,7 @@ a { ================================================================================ `; -exports[`list.css format 1`] = ` +exports[`list.css - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 @@ -294,7 +294,7 @@ $breakpoint-map: ( ================================================================================ `; -exports[`list.css format 2`] = ` +exports[`list.css format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -399,7 +399,7 @@ $breakpoint-map: ( ================================================================================ `; -exports[`map.css format 1`] = ` +exports[`map.css - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 @@ -444,7 +444,7 @@ $map: ( ================================================================================ `; -exports[`map.css format 2`] = ` +exports[`map.css format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -488,7 +488,7 @@ $map: ( ================================================================================ `; -exports[`selector_list.css format 1`] = ` +exports[`selector_list.css - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["css"] printWidth: 80 @@ -520,7 +520,7 @@ asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkasdhkajsdhakjsdhkajsdhjkahskjdkjahsj ================================================================================ `; -exports[`selector_list.css format 2`] = ` +exports[`selector_list.css format 1`] = ` ====================================options===================================== parsers: ["scss"] printWidth: 80 @@ -551,26 +551,26 @@ asdasldaskdhjkashdahsdkjahskdjhakjsdkjahsdhkasdhkajsdhakjsdhkajsdhjkahskjdkjahsj ================================================================================ `; +exports[`variable.css - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["css"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== +$test: 1,; +$margin: 0, 2em, 0, 1.5em,; + + +=====================================output===================================== +$test: 1; +$margin: 0, 2em, 0, 1.5em; + +================================================================================ +`; + exports[`variable.css format 1`] = ` ====================================options===================================== -parsers: ["css"] -printWidth: 80 -trailingComma: "none" - | printWidth -=====================================input====================================== -$test: 1,; -$margin: 0, 2em, 0, 1.5em,; - - -=====================================output===================================== -$test: 1; -$margin: 0, 2em, 0, 1.5em; - -================================================================================ -`; - -exports[`variable.css format 2`] = ` -====================================options===================================== parsers: ["scss"] printWidth: 80 | printWidth diff --git a/tests/embedded_language_formatting/in-html/__snapshots__/jsfmt.spec.js.snap b/tests/embedded_language_formatting/in-html/__snapshots__/jsfmt.spec.js.snap index 5a32c8319..b10014a63 100644 --- a/tests/embedded_language_formatting/in-html/__snapshots__/jsfmt.spec.js.snap +++ b/tests/embedded_language_formatting/in-html/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,32 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`test.html - {"embeddedLanguageFormatting":"off"} format 1`] = ` +====================================options===================================== +embeddedLanguageFormatting: "off" +parsers: ["html"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + +=====================================output===================================== + + + + + + +================================================================================ +`; + exports[`test.html format 1`] = ` ====================================options===================================== parsers: ["html"] @@ -26,30 +53,3 @@ printWidth: 80 ================================================================================ `; - -exports[`test.html format 2`] = ` -====================================options===================================== -embeddedLanguageFormatting: "off" -parsers: ["html"] -printWidth: 80 - | printWidth -=====================================input====================================== - - - - - - -=====================================output===================================== - - - - - - -================================================================================ -`; diff --git a/tests/embedded_language_formatting/in-javascript/__snapshots__/jsfmt.spec.js.snap b/tests/embedded_language_formatting/in-javascript/__snapshots__/jsfmt.spec.js.snap index e8f6220db..c86299d39 100644 --- a/tests/embedded_language_formatting/in-javascript/__snapshots__/jsfmt.spec.js.snap +++ b/tests/embedded_language_formatting/in-javascript/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,44 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`test.js - {"embeddedLanguageFormatting":"off"} format 1`] = ` +====================================options===================================== +embeddedLanguageFormatting: "off" +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +css\`a { }\` + +md\`\` + +graphql(\`{id}\`) + +html\`\` + +@Component({ + template: \`\`, + styles: [\`a { }\`] +}) +class TestComponent {} + +=====================================output===================================== +css\`a { }\`; + +md\`\`; + +graphql(\`{id}\`); + +html\`\`; + +@Component({ + template: \`\`, + styles: [\`a { }\`], +}) +class TestComponent {} + +================================================================================ +`; + exports[`test.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -53,42 +92,3 @@ class TestComponent {} ================================================================================ `; - -exports[`test.js format 2`] = ` -====================================options===================================== -embeddedLanguageFormatting: "off" -parsers: ["babel"] -printWidth: 80 - | printWidth -=====================================input====================================== -css\`a { }\` - -md\`\` - -graphql(\`{id}\`) - -html\`\` - -@Component({ - template: \`\`, - styles: [\`a { }\`] -}) -class TestComponent {} - -=====================================output===================================== -css\`a { }\`; - -md\`\`; - -graphql(\`{id}\`); - -html\`\`; - -@Component({ - template: \`\`, - styles: [\`a { }\`], -}) -class TestComponent {} - -================================================================================ -`; diff --git a/tests/embedded_language_formatting/in-markdown/__snapshots__/jsfmt.spec.js.snap b/tests/embedded_language_formatting/in-markdown/__snapshots__/jsfmt.spec.js.snap index 29754a136..be316dc29 100644 --- a/tests/embedded_language_formatting/in-markdown/__snapshots__/jsfmt.spec.js.snap +++ b/tests/embedded_language_formatting/in-markdown/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`test.md - {"embeddedLanguageFormatting":"off"} format 1`] = ` +====================================options===================================== +embeddedLanguageFormatting: "off" +parsers: ["markdown"] +printWidth: 80 + | printWidth +=====================================input====================================== +\`\`\`js +1 + 2 +\`\`\` + +=====================================output===================================== +\`\`\`js +1 + 2 +\`\`\` + +================================================================================ +`; + exports[`test.md format 1`] = ` ====================================options===================================== parsers: ["markdown"] @@ -17,22 +36,3 @@ printWidth: 80 ================================================================================ `; - -exports[`test.md format 2`] = ` -====================================options===================================== -embeddedLanguageFormatting: "off" -parsers: ["markdown"] -printWidth: 80 - | printWidth -=====================================input====================================== -\`\`\`js -1 + 2 -\`\`\` - -=====================================output===================================== -\`\`\`js -1 + 2 -\`\`\` - -================================================================================ -`; diff --git a/tests/embedded_language_formatting/in-vue/__snapshots__/jsfmt.spec.js.snap b/tests/embedded_language_formatting/in-vue/__snapshots__/jsfmt.spec.js.snap index 22e00f772..db4d15ad5 100644 --- a/tests/embedded_language_formatting/in-vue/__snapshots__/jsfmt.spec.js.snap +++ b/tests/embedded_language_formatting/in-vue/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,32 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`in.vue - {"embeddedLanguageFormatting":"off"} format 1`] = ` +====================================options===================================== +embeddedLanguageFormatting: "off" +parsers: ["vue"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + +=====================================output===================================== + + + + +================================================================================ +`; + exports[`in.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] @@ -25,30 +52,3 @@ printWidth: 80 ================================================================================ `; - -exports[`in.vue format 2`] = ` -====================================options===================================== -embeddedLanguageFormatting: "off" -parsers: ["vue"] -printWidth: 80 - | printWidth -=====================================input====================================== - - - - -=====================================output===================================== - - - - -================================================================================ -`; diff --git a/tests/end_of_line/__snapshots__/jsfmt.spec.js.snap b/tests/end_of_line/__snapshots__/jsfmt.spec.js.snap index b4c9c5f68..dc4ee86fd 100644 --- a/tests/end_of_line/__snapshots__/jsfmt.spec.js.snap +++ b/tests/end_of_line/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`example.js format 1`] = ` -====================================options===================================== -endOfLine: "lf" -parsers: ["babel"] -printWidth: 80 - | printWidth -=====================================input====================================== -function f() { - console.log("testing line endings"); -} - -=====================================output===================================== -function f() { - console.log("testing line endings"); -} - -================================================================================ -`; - -exports[`example.js format 2`] = ` +exports[`example.js - {"endOfLine":"cr"} format 1`] = ` ====================================options===================================== endOfLine: "cr" parsers: ["babel"] @@ -38,7 +19,7 @@ function f() { ================================================================================ `; -exports[`example.js format 3`] = ` +exports[`example.js - {"endOfLine":"crlf"} format 1`] = ` ====================================options===================================== endOfLine: "crlf" parsers: ["babel"] @@ -57,66 +38,26 @@ function f() { ================================================================================ `; -exports[`multiline.js format 1`] = ` +exports[`example.js - {"endOfLine":"lf"} format 1`] = ` ====================================options===================================== endOfLine: "lf" parsers: ["babel"] printWidth: 80 | printWidth =====================================input====================================== -type IAmIncredibleLongParameterType = {}; -const IAmAnotherFunctionName = (_0: IAmIncredibleLongParameterType) => {}; -export const IAmIncredibleLongFunctionName = IAmAnotherFunctionName( - (_0: IAmIncredibleLongParameterType) => { - setTimeout(() => { - /* - Multiline comment - Multiline comment - Multiline comment - */ - console.log( - 'Multiline string\\ - Multiline string\\ - Multiline string' - ); - console.log( - \`Multiline \\n string\\ - Multiline string\\ - Multiline string\` - ); - }); - } -); +function f() { + console.log("testing line endings"); +} =====================================output===================================== -type IAmIncredibleLongParameterType = {}; -const IAmAnotherFunctionName = (_0: IAmIncredibleLongParameterType) => {}; -export const IAmIncredibleLongFunctionName = IAmAnotherFunctionName( - (_0: IAmIncredibleLongParameterType) => { - setTimeout(() => { - /* - Multiline comment - Multiline comment - Multiline comment - */ - console.log( - "Multiline string\\ - Multiline string\\ - Multiline string" - ); - console.log( - \`Multiline \\n string\\ - Multiline string\\ - Multiline string\` - ); - }); - } -); +function f() { + console.log("testing line endings"); +} ================================================================================ `; -exports[`multiline.js format 2`] = ` +exports[`multiline.js - {"endOfLine":"cr"} format 1`] = ` ====================================options===================================== endOfLine: "cr" parsers: ["babel"] @@ -175,7 +116,7 @@ export const IAmIncredibleLongFunctionName = IAmAnotherFunctionName( ================================================================================ `; -exports[`multiline.js format 3`] = ` +exports[`multiline.js - {"endOfLine":"crlf"} format 1`] = ` ====================================options===================================== endOfLine: "crlf" parsers: ["babel"] @@ -233,3 +174,62 @@ export const IAmIncredibleLongFunctionName = IAmAnotherFunctionName( ================================================================================ `; + +exports[`multiline.js - {"endOfLine":"lf"} format 1`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +type IAmIncredibleLongParameterType = {}; +const IAmAnotherFunctionName = (_0: IAmIncredibleLongParameterType) => {}; +export const IAmIncredibleLongFunctionName = IAmAnotherFunctionName( + (_0: IAmIncredibleLongParameterType) => { + setTimeout(() => { + /* + Multiline comment + Multiline comment + Multiline comment + */ + console.log( + 'Multiline string\\ + Multiline string\\ + Multiline string' + ); + console.log( + \`Multiline \\n string\\ + Multiline string\\ + Multiline string\` + ); + }); + } +); + +=====================================output===================================== +type IAmIncredibleLongParameterType = {}; +const IAmAnotherFunctionName = (_0: IAmIncredibleLongParameterType) => {}; +export const IAmIncredibleLongFunctionName = IAmAnotherFunctionName( + (_0: IAmIncredibleLongParameterType) => { + setTimeout(() => { + /* + Multiline comment + Multiline comment + Multiline comment + */ + console.log( + "Multiline string\\ + Multiline string\\ + Multiline string" + ); + console.log( + \`Multiline \\n string\\ + Multiline string\\ + Multiline string\` + ); + }); + } +); + +================================================================================ +`; diff --git a/tests/errors/vue/__snapshots__/jsfmt.spec.js.snap b/tests/errors/vue/__snapshots__/jsfmt.spec.js.snap index 4fd7b9c86..67be9de3a 100644 --- a/tests/errors/vue/__snapshots__/jsfmt.spec.js.snap +++ b/tests/errors/vue/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,41 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`custom_block.vue - {"embeddedLanguageFormatting":"off"} error test 1`] = ` +"Unexpected character \\"\\"\\" (2:16) + 1 | +> 2 | const foo = \\" + 4 | " +`; + +exports[`custom_block.vue - {"semi":false} error test 1`] = ` +"Unexpected character \\"\\"\\" (2:16) + 1 | +> 2 | const foo = \\" + 4 | " +`; + +exports[`custom_block.vue - {"trailingComma":"none"} error test 1`] = ` +"Unexpected character \\"\\"\\" (2:16) + 1 | +> 2 | const foo = \\" + 4 | " +`; + +exports[`custom_block.vue - {"vueIndentScriptAndStyle":true} error test 1`] = ` +"Unexpected character \\"\\"\\" (2:16) + 1 | +> 2 | const foo = \\" + 4 | " +`; + exports[`custom_block.vue error test 1`] = ` "Unexpected character \\"\\"\\" (2:16) 1 | @@ -17,39 +53,3 @@ exports[`custom_block.vue error test 2`] = ` 3 | 4 | " `; - -exports[`custom_block.vue error test 3`] = ` -"Unexpected character \\"\\"\\" (2:16) - 1 | -> 2 | const foo = \\" - 4 | " -`; - -exports[`custom_block.vue error test 4`] = ` -"Unexpected character \\"\\"\\" (2:16) - 1 | -> 2 | const foo = \\" - 4 | " -`; - -exports[`custom_block.vue error test 5`] = ` -"Unexpected character \\"\\"\\" (2:16) - 1 | -> 2 | const foo = \\" - 4 | " -`; - -exports[`custom_block.vue error test 6`] = ` -"Unexpected character \\"\\"\\" (2:16) - 1 | -> 2 | const foo = \\" - 4 | " -`; diff --git a/tests/export/__snapshots__/jsfmt.spec.js.snap b/tests/export/__snapshots__/jsfmt.spec.js.snap index 323945fe4..b08674f73 100644 --- a/tests/export/__snapshots__/jsfmt.spec.js.snap +++ b/tests/export/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,40 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`bracket.js - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +export { + runTaskForChanged, + description, + someOtherLabel, + thatMakes, + itGo, + multiLine, + andMore, + soWeCanGetItTo80Columns +}; +export {fitsIn, oneLine}; + +=====================================output===================================== +export { + runTaskForChanged, + description, + someOtherLabel, + thatMakes, + itGo, + multiLine, + andMore, + soWeCanGetItTo80Columns, +}; +export {fitsIn, oneLine}; + +================================================================================ +`; + exports[`bracket.js format 1`] = ` ====================================options===================================== parsers: ["flow", "typescript"] @@ -34,37 +69,19 @@ export { fitsIn, oneLine }; ================================================================================ `; -exports[`bracket.js format 2`] = ` +exports[`empty.js - {"bracketSpacing":false} format 1`] = ` ====================================options===================================== bracketSpacing: false parsers: ["flow", "typescript"] printWidth: 80 | printWidth =====================================input====================================== -export { - runTaskForChanged, - description, - someOtherLabel, - thatMakes, - itGo, - multiLine, - andMore, - soWeCanGetItTo80Columns -}; -export {fitsIn, oneLine}; +export {}; +export {} from "."; =====================================output===================================== -export { - runTaskForChanged, - description, - someOtherLabel, - thatMakes, - itGo, - multiLine, - andMore, - soWeCanGetItTo80Columns, -}; -export {fitsIn, oneLine}; +export {}; +export {} from "."; ================================================================================ `; @@ -84,20 +101,3 @@ export {} from "."; ================================================================================ `; - -exports[`empty.js format 2`] = ` -====================================options===================================== -bracketSpacing: false -parsers: ["flow", "typescript"] -printWidth: 80 - | printWidth -=====================================input====================================== -export {}; -export {} from "."; - -=====================================output===================================== -export {}; -export {} from "."; - -================================================================================ -`; diff --git a/tests/flow_enums/__snapshots__/jsfmt.spec.js.snap b/tests/flow_enums/__snapshots__/jsfmt.spec.js.snap index 258b3289a..a819dc228 100644 --- a/tests/flow_enums/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_enums/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`enum-boolean-explicit.js format 1`] = ` +exports[`enum-boolean-explicit.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -25,7 +25,7 @@ enum E of boolean { ================================================================================ `; -exports[`enum-boolean-implicit.js format 1`] = ` +exports[`enum-boolean-implicit.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -50,7 +50,7 @@ enum E { ================================================================================ `; -exports[`enum-comments.js format 1`] = ` +exports[`enum-comments.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -116,7 +116,7 @@ enum /*Q*/ E6 of string {} ================================================================================ `; -exports[`enum-empty.js format 1`] = ` +exports[`enum-empty.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -135,7 +135,7 @@ enum E {} ================================================================================ `; -exports[`enum-export.js format 1`] = ` +exports[`enum-export.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -158,7 +158,7 @@ export default enum B {}; ================================================================================ `; -exports[`enum-name.js format 1`] = ` +exports[`enum-name.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -178,7 +178,7 @@ enum type {} ================================================================================ `; -exports[`enum-no-trailing-comma.js format 1`] = ` +exports[`enum-no-trailing-comma.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -201,7 +201,7 @@ enum E { ================================================================================ `; -exports[`enum-number-explicit.js format 1`] = ` +exports[`enum-number-explicit.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -226,7 +226,7 @@ enum E of number { ================================================================================ `; -exports[`enum-number-implicit.js format 1`] = ` +exports[`enum-number-implicit.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -251,7 +251,7 @@ enum E { ================================================================================ `; -exports[`enum-string-explicit-defaulted.js format 1`] = ` +exports[`enum-string-explicit-defaulted.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -276,7 +276,7 @@ enum E of string { ================================================================================ `; -exports[`enum-string-explicit-initialized.js format 1`] = ` +exports[`enum-string-explicit-initialized.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -301,7 +301,7 @@ enum E of string { ================================================================================ `; -exports[`enum-string-implicit-defaulted.js format 1`] = ` +exports[`enum-string-implicit-defaulted.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -326,7 +326,7 @@ enum E { ================================================================================ `; -exports[`enum-string-implicit-initialized.js format 1`] = ` +exports[`enum-string-implicit-initialized.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 @@ -351,7 +351,7 @@ enum E { ================================================================================ `; -exports[`enum-symbol.js format 1`] = ` +exports[`enum-symbol.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] printWidth: 80 diff --git a/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap b/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap index 8e5b6c109..61442f62f 100644 --- a/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_function_parentheses/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,55 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`single.js - {"arrowParens":"avoid"} format 1`] = ` +====================================options===================================== +arrowParens: "avoid" +parsers: ["flow", "babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +const selectorByPath: + Path + => SomethingSelector< + SomethingUEditorContextType, + SomethingUEditorContextType, + SomethingBulkValue +> = memoizeWithArgs(/* ... */) + +=====================================output===================================== +const selectorByPath: Path => SomethingSelector< + SomethingUEditorContextType, + SomethingUEditorContextType, + SomethingBulkValue +> = memoizeWithArgs(/* ... */); + +================================================================================ +`; + +exports[`single.js - {"trailingComma":"all"} format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 +trailingComma: "all" + | printWidth +=====================================input====================================== +const selectorByPath: + Path + => SomethingSelector< + SomethingUEditorContextType, + SomethingUEditorContextType, + SomethingBulkValue +> = memoizeWithArgs(/* ... */) + +=====================================output===================================== +const selectorByPath: (Path) => SomethingSelector< + SomethingUEditorContextType, + SomethingUEditorContextType, + SomethingBulkValue, +> = memoizeWithArgs(/* ... */); + +================================================================================ +`; + exports[`single.js format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] @@ -24,52 +74,276 @@ const selectorByPath: (Path) => SomethingSelector< ================================================================================ `; -exports[`single.js format 2`] = ` -====================================options===================================== -parsers: ["flow", "babel"] -printWidth: 80 -trailingComma: "all" - | printWidth -=====================================input====================================== -const selectorByPath: - Path - => SomethingSelector< - SomethingUEditorContextType, - SomethingUEditorContextType, - SomethingBulkValue -> = memoizeWithArgs(/* ... */) - -=====================================output===================================== -const selectorByPath: (Path) => SomethingSelector< - SomethingUEditorContextType, - SomethingUEditorContextType, - SomethingBulkValue, -> = memoizeWithArgs(/* ... */); - -================================================================================ -`; - -exports[`single.js format 3`] = ` +exports[`test.js - {"arrowParens":"avoid"} format 1`] = ` ====================================options===================================== arrowParens: "avoid" parsers: ["flow", "babel"] printWidth: 80 | printWidth =====================================input====================================== -const selectorByPath: - Path - => SomethingSelector< - SomethingUEditorContextType, - SomethingUEditorContextType, - SomethingBulkValue -> = memoizeWithArgs(/* ... */) +type Banana = { + eat: string => boolean, +}; + +type Hex = {n: 0x01}; + +type T1 = { method: (a) => void }; + +type T2 = { method(a): void }; + +declare class X { method(a): void } + +declare function f(a): void; + +var f: (a) => void; + +interface F1 { m(string): number } + +interface F2 { m: (string) => number } + +function f1(o: { f: (string) => void }) {} + +function f2(o: { f(string): void }) {} + +type f3 = (...arg) => void; + +type f4 = (/* comment */ arg) => void; + +type f5 = (arg /* comment */) => void; + +type f6 = (?arg) => void; + +class Y { + constructor( + ideConnectionFactory: child_process$ChildProcess => FlowIDEConnection = + defaultIDEConnectionFactory, + ) { + } +} + +interface F { + ideConnectionFactoryLongLongLong: (child_process$ChildProcess) => FlowIDEConnection +} + +type ExtractType = (B) => D + +type T3 = ?(() => A); + +type T4 = ?(() => A) | B; + +type T5 = ?() => A | B; + +type T6 = (?() => A) | B; + +// https://github.com/babel/babel/issues/7924 +//type T = ??() => A; + +type T7 = ?(?(() => A)); + +type T8 = ?(?() => A) | B; =====================================output===================================== -const selectorByPath: Path => SomethingSelector< - SomethingUEditorContextType, - SomethingUEditorContextType, - SomethingBulkValue -> = memoizeWithArgs(/* ... */); +type Banana = { + eat: string => boolean, +}; + +type Hex = { n: 0x01 }; + +type T1 = { method: a => void }; + +type T2 = { method(a): void }; + +declare class X { + method(a): void; +} + +declare function f(a): void; + +var f: a => void; + +interface F1 { + m(string): number; +} + +interface F2 { + m: string => number; +} + +function f1(o: { f: string => void }) {} + +function f2(o: { f(string): void }) {} + +type f3 = (...arg) => void; + +type f4 = /* comment */ arg => void; + +type f5 = arg /* comment */ => void; + +type f6 = (?arg) => void; + +class Y { + constructor( + ideConnectionFactory: child_process$ChildProcess => FlowIDEConnection = defaultIDEConnectionFactory + ) {} +} + +interface F { + ideConnectionFactoryLongLongLong: child_process$ChildProcess => FlowIDEConnection; +} + +type ExtractType = (B) => D; + +type T3 = ?() => A; + +type T4 = ?(() => A) | B; + +type T5 = ?() => A | B; + +type T6 = ?(() => A) | B; + +// https://github.com/babel/babel/issues/7924 +//type T = ??() => A; + +type T7 = ??(() => A); + +type T8 = ??(() => A) | B; + +================================================================================ +`; + +exports[`test.js - {"trailingComma":"all"} format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 +trailingComma: "all" + | printWidth +=====================================input====================================== +type Banana = { + eat: string => boolean, +}; + +type Hex = {n: 0x01}; + +type T1 = { method: (a) => void }; + +type T2 = { method(a): void }; + +declare class X { method(a): void } + +declare function f(a): void; + +var f: (a) => void; + +interface F1 { m(string): number } + +interface F2 { m: (string) => number } + +function f1(o: { f: (string) => void }) {} + +function f2(o: { f(string): void }) {} + +type f3 = (...arg) => void; + +type f4 = (/* comment */ arg) => void; + +type f5 = (arg /* comment */) => void; + +type f6 = (?arg) => void; + +class Y { + constructor( + ideConnectionFactory: child_process$ChildProcess => FlowIDEConnection = + defaultIDEConnectionFactory, + ) { + } +} + +interface F { + ideConnectionFactoryLongLongLong: (child_process$ChildProcess) => FlowIDEConnection +} + +type ExtractType = (B) => D + +type T3 = ?(() => A); + +type T4 = ?(() => A) | B; + +type T5 = ?() => A | B; + +type T6 = (?() => A) | B; + +// https://github.com/babel/babel/issues/7924 +//type T = ??() => A; + +type T7 = ?(?(() => A)); + +type T8 = ?(?() => A) | B; + +=====================================output===================================== +type Banana = { + eat: (string) => boolean, +}; + +type Hex = { n: 0x01 }; + +type T1 = { method: (a) => void }; + +type T2 = { method(a): void }; + +declare class X { + method(a): void; +} + +declare function f(a): void; + +var f: (a) => void; + +interface F1 { + m(string): number; +} + +interface F2 { + m: (string) => number; +} + +function f1(o: { f: (string) => void }) {} + +function f2(o: { f(string): void }) {} + +type f3 = (...arg) => void; + +type f4 = (/* comment */ arg) => void; + +type f5 = (arg /* comment */) => void; + +type f6 = (?arg) => void; + +class Y { + constructor( + ideConnectionFactory: (child_process$ChildProcess) => FlowIDEConnection = defaultIDEConnectionFactory, + ) {} +} + +interface F { + ideConnectionFactoryLongLongLong: (child_process$ChildProcess) => FlowIDEConnection; +} + +type ExtractType = (B) => D; + +type T3 = ?() => A; + +type T4 = ?(() => A) | B; + +type T5 = ?() => A | B; + +type T6 = ?(() => A) | B; + +// https://github.com/babel/babel/issues/7924 +//type T = ??() => A; + +type T7 = ??(() => A); + +type T8 = ??(() => A) | B; ================================================================================ `; @@ -209,277 +483,3 @@ type T8 = ??(() => A) | B; ================================================================================ `; - -exports[`test.js format 2`] = ` -====================================options===================================== -parsers: ["flow", "babel"] -printWidth: 80 -trailingComma: "all" - | printWidth -=====================================input====================================== -type Banana = { - eat: string => boolean, -}; - -type Hex = {n: 0x01}; - -type T1 = { method: (a) => void }; - -type T2 = { method(a): void }; - -declare class X { method(a): void } - -declare function f(a): void; - -var f: (a) => void; - -interface F1 { m(string): number } - -interface F2 { m: (string) => number } - -function f1(o: { f: (string) => void }) {} - -function f2(o: { f(string): void }) {} - -type f3 = (...arg) => void; - -type f4 = (/* comment */ arg) => void; - -type f5 = (arg /* comment */) => void; - -type f6 = (?arg) => void; - -class Y { - constructor( - ideConnectionFactory: child_process$ChildProcess => FlowIDEConnection = - defaultIDEConnectionFactory, - ) { - } -} - -interface F { - ideConnectionFactoryLongLongLong: (child_process$ChildProcess) => FlowIDEConnection -} - -type ExtractType = (B) => D - -type T3 = ?(() => A); - -type T4 = ?(() => A) | B; - -type T5 = ?() => A | B; - -type T6 = (?() => A) | B; - -// https://github.com/babel/babel/issues/7924 -//type T = ??() => A; - -type T7 = ?(?(() => A)); - -type T8 = ?(?() => A) | B; - -=====================================output===================================== -type Banana = { - eat: (string) => boolean, -}; - -type Hex = { n: 0x01 }; - -type T1 = { method: (a) => void }; - -type T2 = { method(a): void }; - -declare class X { - method(a): void; -} - -declare function f(a): void; - -var f: (a) => void; - -interface F1 { - m(string): number; -} - -interface F2 { - m: (string) => number; -} - -function f1(o: { f: (string) => void }) {} - -function f2(o: { f(string): void }) {} - -type f3 = (...arg) => void; - -type f4 = (/* comment */ arg) => void; - -type f5 = (arg /* comment */) => void; - -type f6 = (?arg) => void; - -class Y { - constructor( - ideConnectionFactory: (child_process$ChildProcess) => FlowIDEConnection = defaultIDEConnectionFactory, - ) {} -} - -interface F { - ideConnectionFactoryLongLongLong: (child_process$ChildProcess) => FlowIDEConnection; -} - -type ExtractType = (B) => D; - -type T3 = ?() => A; - -type T4 = ?(() => A) | B; - -type T5 = ?() => A | B; - -type T6 = ?(() => A) | B; - -// https://github.com/babel/babel/issues/7924 -//type T = ??() => A; - -type T7 = ??(() => A); - -type T8 = ??(() => A) | B; - -================================================================================ -`; - -exports[`test.js format 3`] = ` -====================================options===================================== -arrowParens: "avoid" -parsers: ["flow", "babel"] -printWidth: 80 - | printWidth -=====================================input====================================== -type Banana = { - eat: string => boolean, -}; - -type Hex = {n: 0x01}; - -type T1 = { method: (a) => void }; - -type T2 = { method(a): void }; - -declare class X { method(a): void } - -declare function f(a): void; - -var f: (a) => void; - -interface F1 { m(string): number } - -interface F2 { m: (string) => number } - -function f1(o: { f: (string) => void }) {} - -function f2(o: { f(string): void }) {} - -type f3 = (...arg) => void; - -type f4 = (/* comment */ arg) => void; - -type f5 = (arg /* comment */) => void; - -type f6 = (?arg) => void; - -class Y { - constructor( - ideConnectionFactory: child_process$ChildProcess => FlowIDEConnection = - defaultIDEConnectionFactory, - ) { - } -} - -interface F { - ideConnectionFactoryLongLongLong: (child_process$ChildProcess) => FlowIDEConnection -} - -type ExtractType = (B) => D - -type T3 = ?(() => A); - -type T4 = ?(() => A) | B; - -type T5 = ?() => A | B; - -type T6 = (?() => A) | B; - -// https://github.com/babel/babel/issues/7924 -//type T = ??() => A; - -type T7 = ?(?(() => A)); - -type T8 = ?(?() => A) | B; - -=====================================output===================================== -type Banana = { - eat: string => boolean, -}; - -type Hex = { n: 0x01 }; - -type T1 = { method: a => void }; - -type T2 = { method(a): void }; - -declare class X { - method(a): void; -} - -declare function f(a): void; - -var f: a => void; - -interface F1 { - m(string): number; -} - -interface F2 { - m: string => number; -} - -function f1(o: { f: string => void }) {} - -function f2(o: { f(string): void }) {} - -type f3 = (...arg) => void; - -type f4 = /* comment */ arg => void; - -type f5 = arg /* comment */ => void; - -type f6 = (?arg) => void; - -class Y { - constructor( - ideConnectionFactory: child_process$ChildProcess => FlowIDEConnection = defaultIDEConnectionFactory - ) {} -} - -interface F { - ideConnectionFactoryLongLongLong: child_process$ChildProcess => FlowIDEConnection; -} - -type ExtractType = (B) => D; - -type T3 = ?() => A; - -type T4 = ?(() => A) | B; - -type T5 = ?() => A | B; - -type T6 = ?(() => A) | B; - -// https://github.com/babel/babel/issues/7924 -//type T = ??() => A; - -type T7 = ??(() => A); - -type T8 = ??(() => A) | B; - -================================================================================ -`; diff --git a/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap b/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap index 8948669a8..02240702a 100644 --- a/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_generic/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,40 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`break.js - {"trailingComma":"all"} format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 +trailingComma: "all" + | printWidth +=====================================input====================================== +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 + >( + method: T, scope: any, + a: A, b: B, c: C, d: D, e: E, f: F, + ): G { + } +} + +=====================================output===================================== +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 + >(method: T, scope: any, a: A, b: B, c: C, d: D, e: E, f: F): G {}, +}; + +================================================================================ +`; + exports[`break.js format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] @@ -34,37 +69,19 @@ var X = { ================================================================================ `; -exports[`break.js format 2`] = ` +exports[`generic.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 trailingComma: "all" | printWidth =====================================input====================================== -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 - >( - method: T, scope: any, - a: A, b: B, c: C, d: D, e: E, f: F, - ): G { - } -} +const identity = (t: T): T => t; +const a = 1; =====================================output===================================== -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 - >(method: T, scope: any, a: A, b: B, c: C, d: D, e: E, f: F): G {}, -}; +const identity = (t: T): T => t; +const a = 1; ================================================================================ `; @@ -85,19 +102,23 @@ const a = 1; ================================================================================ `; -exports[`generic.js format 2`] = ` +exports[`interface.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 trailingComma: "all" | printWidth =====================================input====================================== -const identity = (t: T): T => t; -const a = 1; +interface A { 'C': string; } +interface B { "D": boolean; } =====================================output===================================== -const identity = (t: T): T => t; -const a = 1; +interface A { + C: string; +} +interface B { + D: boolean; +} ================================================================================ `; @@ -122,23 +143,33 @@ interface B { ================================================================================ `; -exports[`interface.js format 2`] = ` +exports[`nullable.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 trailingComma: "all" | printWidth =====================================input====================================== -interface A { 'C': string; } -interface B { "D": boolean; } +function formatEntireFile( + fileVersion: FileVersion, + range: atom$Range, +): Promise {} + +function foo(): Promise {} =====================================output===================================== -interface A { - C: string; -} -interface B { - D: boolean; -} +function formatEntireFile( + fileVersion: FileVersion, + range: atom$Range, +): Promise {} + +function foo(): Promise {} ================================================================================ `; @@ -173,33 +204,17 @@ function foo(): Promise {} ================================================================================ `; -exports[`nullable.js format 2`] = ` +exports[`single-identifier.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 trailingComma: "all" | printWidth =====================================input====================================== -function formatEntireFile( - fileVersion: FileVersion, - range: atom$Range, -): Promise {} - -function foo(): Promise {} +const longVariableName: Array = this.foo.bar.baz.collider.body.vertices.reduce(); =====================================output===================================== -function formatEntireFile( - fileVersion: FileVersion, - range: atom$Range, -): Promise {} - -function foo(): Promise {} +const longVariableName: Array = this.foo.bar.baz.collider.body.vertices.reduce(); ================================================================================ `; @@ -218,17 +233,29 @@ const longVariableName: Array = this.foo.bar.baz.collider.body.vertices. ================================================================================ `; -exports[`single-identifier.js format 2`] = ` +exports[`trailing.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 trailingComma: "all" | printWidth =====================================input====================================== -const longVariableName: Array = this.foo.bar.baz.collider.body.vertices.reduce(); +type State = { + errors: Immutable.Map< + Ahohohhohohohohohohohohohohooh, + Fbt | Immutable.Map + >, + shouldValidate: boolean, +}; =====================================output===================================== -const longVariableName: Array = this.foo.bar.baz.collider.body.vertices.reduce(); +type State = { + errors: Immutable.Map< + Ahohohhohohohohohohohohohohooh, + Fbt | Immutable.Map, + >, + shouldValidate: boolean, +}; ================================================================================ `; @@ -259,29 +286,21 @@ type State = { ================================================================================ `; -exports[`trailing.js format 2`] = ` +exports[`type.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 trailingComma: "all" | printWidth =====================================input====================================== -type State = { - errors: Immutable.Map< - Ahohohhohohohohohohohohohohooh, - Fbt | Immutable.Map - >, - shouldValidate: boolean, -}; +type F = (T) => T; +type G = ((A) => B); +type H = { 'A': string, "B": number }; =====================================output===================================== -type State = { - errors: Immutable.Map< - Ahohohhohohohohohohohohohohooh, - Fbt | Immutable.Map, - >, - shouldValidate: boolean, -}; +type F = (T) => T; +type G = (A) => B; +type H = { A: string, B: number }; ================================================================================ `; @@ -304,21 +323,23 @@ type H = { A: string, B: number }; ================================================================================ `; -exports[`type.js format 2`] = ` +exports[`union.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 trailingComma: "all" | printWidth =====================================input====================================== -type F = (T) => T; -type G = ((A) => B); -type H = { 'A': string, "B": number }; +type Foo = Promise< + { ok: true, bar: string, baz: SomeOtherLongType } | + { ok: false, bar: SomeOtherLongType } +>; =====================================output===================================== -type F = (T) => T; -type G = (A) => B; -type H = { A: string, B: number }; +type Foo = Promise< + | { ok: true, bar: string, baz: SomeOtherLongType } + | { ok: false, bar: SomeOtherLongType }, +>; ================================================================================ `; @@ -342,24 +363,3 @@ type Foo = Promise< ================================================================================ `; - -exports[`union.js format 2`] = ` -====================================options===================================== -parsers: ["flow", "babel"] -printWidth: 80 -trailingComma: "all" - | printWidth -=====================================input====================================== -type Foo = Promise< - { ok: true, bar: string, baz: SomeOtherLongType } | - { ok: false, bar: SomeOtherLongType } ->; - -=====================================output===================================== -type Foo = Promise< - | { ok: true, bar: string, baz: SomeOtherLongType } - | { ok: false, bar: SomeOtherLongType }, ->; - -================================================================================ -`; diff --git a/tests/flow_object_inexact/__snapshots__/jsfmt.spec.js.snap b/tests/flow_object_inexact/__snapshots__/jsfmt.spec.js.snap index 5ae3dcb2f..7b792ce63 100644 --- a/tests/flow_object_inexact/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_object_inexact/__snapshots__/jsfmt.spec.js.snap @@ -1,276 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`comments.js format 1`] = ` -====================================options===================================== -parsers: ["flow", "babel"] -printWidth: 80 -trailingComma: "es5" - | printWidth -=====================================input====================================== -// @flow - -type Foo = { - // comment - ..., -}; - -type Foo = { - /* comment */ - ..., -}; - -type Foo = { /* comment */ ... }; - -type Foo = { /* comment */ - ...}; - -type Foo = { - // comment0 - // comment1 - ..., -}; - -type Foo = { - /* comment0 */ - /* comment1 */ - ..., -}; - -type Foo = { - // comment - foo: string, - ... -}; - -type Foo = { - // comment0 - // comment1 - foo: string, - ... -}; - -type Foo = { - /* comment */ - foo: string, - ... -}; - -type Foo = { - /* comment */ - [string]: string, - ... -}; - -type Foo = { - /* comment0 */ - /* comment1 */ - foo: string, - ... -}; - -=====================================output===================================== -// @flow - -type Foo = { - // comment - ... -}; - -type Foo = { - /* comment */ - ... -}; - -type Foo = { /* comment */ ... }; - -type Foo = { - /* comment */ - ... -}; - -type Foo = { - // comment0 - // comment1 - ... -}; - -type Foo = { - /* comment0 */ - /* comment1 */ - ... -}; - -type Foo = { - // comment - foo: string, - ... -}; - -type Foo = { - // comment0 - // comment1 - foo: string, - ... -}; - -type Foo = { - /* comment */ - foo: string, - ... -}; - -type Foo = { - /* comment */ - [string]: string, - ... -}; - -type Foo = { - /* comment0 */ - /* comment1 */ - foo: string, - ... -}; - -================================================================================ -`; - -exports[`comments.js format 2`] = ` -====================================options===================================== -parsers: ["flow", "babel"] -printWidth: 80 -trailingComma: "none" - | printWidth -=====================================input====================================== -// @flow - -type Foo = { - // comment - ..., -}; - -type Foo = { - /* comment */ - ..., -}; - -type Foo = { /* comment */ ... }; - -type Foo = { /* comment */ - ...}; - -type Foo = { - // comment0 - // comment1 - ..., -}; - -type Foo = { - /* comment0 */ - /* comment1 */ - ..., -}; - -type Foo = { - // comment - foo: string, - ... -}; - -type Foo = { - // comment0 - // comment1 - foo: string, - ... -}; - -type Foo = { - /* comment */ - foo: string, - ... -}; - -type Foo = { - /* comment */ - [string]: string, - ... -}; - -type Foo = { - /* comment0 */ - /* comment1 */ - foo: string, - ... -}; - -=====================================output===================================== -// @flow - -type Foo = { - // comment - ... -}; - -type Foo = { - /* comment */ - ... -}; - -type Foo = { /* comment */ ... }; - -type Foo = { - /* comment */ - ... -}; - -type Foo = { - // comment0 - // comment1 - ... -}; - -type Foo = { - /* comment0 */ - /* comment1 */ - ... -}; - -type Foo = { - // comment - foo: string, - ... -}; - -type Foo = { - // comment0 - // comment1 - foo: string, - ... -}; - -type Foo = { - /* comment */ - foo: string, - ... -}; - -type Foo = { - /* comment */ - [string]: string, - ... -}; - -type Foo = { - /* comment0 */ - /* comment1 */ - foo: string, - ... -}; - -================================================================================ -`; - -exports[`comments.js format 3`] = ` +exports[`comments.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 @@ -405,7 +135,390 @@ type Foo = { ================================================================================ `; -exports[`test.js format 1`] = ` +exports[`comments.js - {"trailingComma":"es5"} format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 +trailingComma: "es5" + | printWidth +=====================================input====================================== +// @flow + +type Foo = { + // comment + ..., +}; + +type Foo = { + /* comment */ + ..., +}; + +type Foo = { /* comment */ ... }; + +type Foo = { /* comment */ + ...}; + +type Foo = { + // comment0 + // comment1 + ..., +}; + +type Foo = { + /* comment0 */ + /* comment1 */ + ..., +}; + +type Foo = { + // comment + foo: string, + ... +}; + +type Foo = { + // comment0 + // comment1 + foo: string, + ... +}; + +type Foo = { + /* comment */ + foo: string, + ... +}; + +type Foo = { + /* comment */ + [string]: string, + ... +}; + +type Foo = { + /* comment0 */ + /* comment1 */ + foo: string, + ... +}; + +=====================================output===================================== +// @flow + +type Foo = { + // comment + ... +}; + +type Foo = { + /* comment */ + ... +}; + +type Foo = { /* comment */ ... }; + +type Foo = { + /* comment */ + ... +}; + +type Foo = { + // comment0 + // comment1 + ... +}; + +type Foo = { + /* comment0 */ + /* comment1 */ + ... +}; + +type Foo = { + // comment + foo: string, + ... +}; + +type Foo = { + // comment0 + // comment1 + foo: string, + ... +}; + +type Foo = { + /* comment */ + foo: string, + ... +}; + +type Foo = { + /* comment */ + [string]: string, + ... +}; + +type Foo = { + /* comment0 */ + /* comment1 */ + foo: string, + ... +}; + +================================================================================ +`; + +exports[`comments.js - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== +// @flow + +type Foo = { + // comment + ..., +}; + +type Foo = { + /* comment */ + ..., +}; + +type Foo = { /* comment */ ... }; + +type Foo = { /* comment */ + ...}; + +type Foo = { + // comment0 + // comment1 + ..., +}; + +type Foo = { + /* comment0 */ + /* comment1 */ + ..., +}; + +type Foo = { + // comment + foo: string, + ... +}; + +type Foo = { + // comment0 + // comment1 + foo: string, + ... +}; + +type Foo = { + /* comment */ + foo: string, + ... +}; + +type Foo = { + /* comment */ + [string]: string, + ... +}; + +type Foo = { + /* comment0 */ + /* comment1 */ + foo: string, + ... +}; + +=====================================output===================================== +// @flow + +type Foo = { + // comment + ... +}; + +type Foo = { + /* comment */ + ... +}; + +type Foo = { /* comment */ ... }; + +type Foo = { + /* comment */ + ... +}; + +type Foo = { + // comment0 + // comment1 + ... +}; + +type Foo = { + /* comment0 */ + /* comment1 */ + ... +}; + +type Foo = { + // comment + foo: string, + ... +}; + +type Foo = { + // comment0 + // comment1 + foo: string, + ... +}; + +type Foo = { + /* comment */ + foo: string, + ... +}; + +type Foo = { + /* comment */ + [string]: string, + ... +}; + +type Foo = { + /* comment0 */ + /* comment1 */ + foo: string, + ... +}; + +================================================================================ +`; + +exports[`test.js - {"trailingComma":"all"} format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 +trailingComma: "all" + | printWidth +=====================================input====================================== +//@flow +type T = { + a: number, + ..., +} + +type I = { + [string]: number, + ..., +} + +type U = { a: number, b: number, c: number, d: number, e: number, f: number, g: number, ...}; + +type V = {x: {...}, y: {x: {...}, a: number, b: number, c: number, d: number, e: number, f: number, ...}, z: {...}, foo: number, bar: {foo: number, ...}, ...}; + +function test(x: {foo: number, bar: number, baz: number, qux: nunber, a: number, b: number, c: {a: number, ...}, ...}) { return x; } +function test(x: {foo: number, bar: number, baz: number, qux: nunber, a: number, b: number, c: {a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, ...}, ...}) { return x; } + +type W = {...}; +type X = { + ..., +}; + +=====================================output===================================== +//@flow +type T = { + a: number, + ... +}; + +type I = { + [string]: number, + ... +}; + +type U = { + a: number, + b: number, + c: number, + d: number, + e: number, + f: number, + g: number, + ... +}; + +type V = { + x: { ... }, + y: { + x: { ... }, + a: number, + b: number, + c: number, + d: number, + e: number, + f: number, + ... + }, + z: { ... }, + foo: number, + bar: { foo: number, ... }, + ... +}; + +function test(x: { + foo: number, + bar: number, + baz: number, + qux: nunber, + a: number, + b: number, + c: { a: number, ... }, + ... +}) { + return x; +} +function test(x: { + foo: number, + bar: number, + baz: number, + qux: nunber, + a: number, + b: number, + c: { + a: number, + b: number, + c: number, + d: number, + e: number, + f: number, + g: number, + h: number, + i: number, + ... + }, + ... +}) { + return x; +} + +type W = { ... }; +type X = { ... }; + +================================================================================ +`; + +exports[`test.js - {"trailingComma":"es5"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 @@ -518,7 +631,7 @@ type X = { ... }; ================================================================================ `; -exports[`test.js format 2`] = ` +exports[`test.js - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 @@ -630,116 +743,3 @@ type X = { ... }; ================================================================================ `; - -exports[`test.js format 3`] = ` -====================================options===================================== -parsers: ["flow", "babel"] -printWidth: 80 -trailingComma: "all" - | printWidth -=====================================input====================================== -//@flow -type T = { - a: number, - ..., -} - -type I = { - [string]: number, - ..., -} - -type U = { a: number, b: number, c: number, d: number, e: number, f: number, g: number, ...}; - -type V = {x: {...}, y: {x: {...}, a: number, b: number, c: number, d: number, e: number, f: number, ...}, z: {...}, foo: number, bar: {foo: number, ...}, ...}; - -function test(x: {foo: number, bar: number, baz: number, qux: nunber, a: number, b: number, c: {a: number, ...}, ...}) { return x; } -function test(x: {foo: number, bar: number, baz: number, qux: nunber, a: number, b: number, c: {a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, ...}, ...}) { return x; } - -type W = {...}; -type X = { - ..., -}; - -=====================================output===================================== -//@flow -type T = { - a: number, - ... -}; - -type I = { - [string]: number, - ... -}; - -type U = { - a: number, - b: number, - c: number, - d: number, - e: number, - f: number, - g: number, - ... -}; - -type V = { - x: { ... }, - y: { - x: { ... }, - a: number, - b: number, - c: number, - d: number, - e: number, - f: number, - ... - }, - z: { ... }, - foo: number, - bar: { foo: number, ... }, - ... -}; - -function test(x: { - foo: number, - bar: number, - baz: number, - qux: nunber, - a: number, - b: number, - c: { a: number, ... }, - ... -}) { - return x; -} -function test(x: { - foo: number, - bar: number, - baz: number, - qux: nunber, - a: number, - b: number, - c: { - a: number, - b: number, - c: number, - d: number, - e: number, - f: number, - g: number, - h: number, - i: number, - ... - }, - ... -}) { - return x; -} - -type W = { ... }; -type X = { ... }; - -================================================================================ -`; diff --git a/tests/flow_object_order/__snapshots__/jsfmt.spec.js.snap b/tests/flow_object_order/__snapshots__/jsfmt.spec.js.snap index aec074abd..3ceedfc68 100644 --- a/tests/flow_object_order/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_object_order/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,42 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`order.js - {"trailingComma":"all"} format 1`] = ` +====================================options===================================== +parsers: ["flow"] +printWidth: 80 +trailingComma: "all" + | printWidth +=====================================input====================================== +type Foo = { + // a + alpha: 'hello', + + // b + [key: string]: void, + // c + + beta: 10, + + // d +} + +=====================================output===================================== +type Foo = { + // a + alpha: "hello", + + // b + [key: string]: void, + // c + + beta: 10, + + // d +}; + +================================================================================ +`; + exports[`order.js format 1`] = ` ====================================options===================================== parsers: ["flow"] @@ -35,40 +72,3 @@ type Foo = { ================================================================================ `; - -exports[`order.js format 2`] = ` -====================================options===================================== -parsers: ["flow"] -printWidth: 80 -trailingComma: "all" - | printWidth -=====================================input====================================== -type Foo = { - // a - alpha: 'hello', - - // b - [key: string]: void, - // c - - beta: 10, - - // d -} - -=====================================output===================================== -type Foo = { - // a - alpha: "hello", - - // b - [key: string]: void, - // c - - beta: 10, - - // d -}; - -================================================================================ -`; diff --git a/tests/flow_parameter_with_type/__snapshots__/jsfmt.spec.js.snap b/tests/flow_parameter_with_type/__snapshots__/jsfmt.spec.js.snap index 04419c87f..17c451403 100644 --- a/tests/flow_parameter_with_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_parameter_with_type/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`param.js - {"trailingComma":"all"} format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 +trailingComma: "all" + | printWidth +=====================================input====================================== +const f = ({}: MyVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongType) => {}; +function g({}: Foo) {} + +=====================================output===================================== +const f = ({}: MyVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongType) => {}; +function g({}: Foo) {} + +================================================================================ +`; + exports[`param.js format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] @@ -15,20 +32,3 @@ function g({}: Foo) {} ================================================================================ `; - -exports[`param.js format 2`] = ` -====================================options===================================== -parsers: ["flow", "babel"] -printWidth: 80 -trailingComma: "all" - | printWidth -=====================================input====================================== -const f = ({}: MyVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongType) => {}; -function g({}: Foo) {} - -=====================================output===================================== -const f = ({}: MyVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongType) => {}; -function g({}: Foo) {} - -================================================================================ -`; diff --git a/tests/flow_private_class_fields/__snapshots__/jsfmt.spec.js.snap b/tests/flow_private_class_fields/__snapshots__/jsfmt.spec.js.snap index d29714474..c9802e0a9 100644 --- a/tests/flow_private_class_fields/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_private_class_fields/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`quotes.js format 1`] = ` +exports[`quotes.js - {"quoteProps":"consistent"} format 1`] = ` ====================================options===================================== parsers: ["flow"] printWidth: 80 diff --git a/tests/flow_type_declarations/__snapshots__/jsfmt.spec.js.snap b/tests/flow_type_declarations/__snapshots__/jsfmt.spec.js.snap index 8b737991e..04af9fe80 100644 --- a/tests/flow_type_declarations/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow_type_declarations/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`declare_export.js - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +declare export default 5; + +=====================================output===================================== +declare export default 5 + +================================================================================ +`; + exports[`declare_export.js format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] @@ -14,17 +29,17 @@ declare export default 5; ================================================================================ `; -exports[`declare_export.js format 2`] = ` +exports[`declare_type.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -declare export default 5; +declare type A = string; =====================================output===================================== -declare export default 5 +declare type A = string ================================================================================ `; @@ -43,17 +58,17 @@ declare type A = string; ================================================================================ `; -exports[`declare_type.js format 2`] = ` +exports[`declare_var.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -declare type A = string; +declare var bool: React$PropType$Primitive; =====================================output===================================== -declare type A = string +declare var bool: React$PropType$Primitive ================================================================================ `; @@ -72,17 +87,31 @@ declare var bool: React$PropType$Primitive; ================================================================================ `; -exports[`declare_var.js format 2`] = ` +exports[`long.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -declare var bool: React$PropType$Primitive; +export type AdamPlacementValidationSingleErrorKey = + 'SOME_FANCY_TARGETS.GLOBAL_TARGET'; + +export type SomeReallyLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey = true; + +export type SomeOtherLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey = null; + +type SomeOtherLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey2 = SomeReallyLongLongLongLongLongLongIdentifier; =====================================output===================================== -declare var bool: React$PropType$Primitive +export type AdamPlacementValidationSingleErrorKey = + "SOME_FANCY_TARGETS.GLOBAL_TARGET" + +export type SomeReallyLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey = true + +export type SomeOtherLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey = null + +type SomeOtherLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey2 = SomeReallyLongLongLongLongLongLongIdentifier ================================================================================ `; @@ -115,31 +144,43 @@ type SomeOtherLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey2 = Som ================================================================================ `; -exports[`long.js format 2`] = ` +exports[`opaque.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] printWidth: 80 semi: false | printWidth =====================================input====================================== -export type AdamPlacementValidationSingleErrorKey = - 'SOME_FANCY_TARGETS.GLOBAL_TARGET'; - -export type SomeReallyLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey = true; - -export type SomeOtherLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey = null; - -type SomeOtherLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey2 = SomeReallyLongLongLongLongLongLongIdentifier; +declare export opaque type Foo; +declare export opaque type Bar; +declare export opaque type Baz: Foo; +declare export opaque type Foo1: Bar; +declare export opaque type Foo2: Bar; +declare export opaque type Foo3: Bar; +opaque type ID = string; +opaque type Foo4 = Bar; +opaque type Maybe = _Maybe; +export opaque type Foo5 = number; +opaque type union = + | {type: "A"} + | {type: "B"}; +opaque type overloads = + & ((x: string) => number) + & ((x: number) => string); =====================================output===================================== -export type AdamPlacementValidationSingleErrorKey = - "SOME_FANCY_TARGETS.GLOBAL_TARGET" - -export type SomeReallyLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey = true - -export type SomeOtherLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey = null - -type SomeOtherLongLongLongLongLongLongLongLongLongLongLongLongLongLongKey2 = SomeReallyLongLongLongLongLongLongIdentifier +declare export opaque type Foo +declare export opaque type Bar +declare export opaque type Baz: Foo +declare export opaque type Foo1: Bar +declare export opaque type Foo2: Bar +declare export opaque type Foo3: Bar +opaque type ID = string +opaque type Foo4 = Bar +opaque type Maybe = _Maybe +export opaque type Foo5 = number +opaque type union = { type: "A" } | { type: "B" } +opaque type overloads = ((x: string) => number) & ((x: number) => string) ================================================================================ `; @@ -183,44 +224,3 @@ opaque type overloads = ((x: string) => number) & ((x: number) => string); ================================================================================ `; - -exports[`opaque.js format 2`] = ` -====================================options===================================== -parsers: ["flow", "babel"] -printWidth: 80 -semi: false - | printWidth -=====================================input====================================== -declare export opaque type Foo; -declare export opaque type Bar; -declare export opaque type Baz: Foo; -declare export opaque type Foo1: Bar; -declare export opaque type Foo2: Bar; -declare export opaque type Foo3: Bar; -opaque type ID = string; -opaque type Foo4 = Bar; -opaque type Maybe = _Maybe; -export opaque type Foo5 = number; -opaque type union = - | {type: "A"} - | {type: "B"}; -opaque type overloads = - & ((x: string) => number) - & ((x: number) => string); - -=====================================output===================================== -declare export opaque type Foo -declare export opaque type Bar -declare export opaque type Baz: Foo -declare export opaque type Foo1: Bar -declare export opaque type Foo2: Bar -declare export opaque type Foo3: Bar -opaque type ID = string -opaque type Foo4 = Bar -opaque type Maybe = _Maybe -export opaque type Foo5 = number -opaque type union = { type: "A" } | { type: "B" } -opaque type overloads = ((x: string) => number) & ((x: number) => string) - -================================================================================ -`; diff --git a/tests/graphql_bracket_spacing/__snapshots__/jsfmt.spec.js.snap b/tests/graphql_bracket_spacing/__snapshots__/jsfmt.spec.js.snap index 2fda795e2..e4d91a93d 100644 --- a/tests/graphql_bracket_spacing/__snapshots__/jsfmt.spec.js.snap +++ b/tests/graphql_bracket_spacing/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,28 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`bracket_spacing.graphql - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["graphql"] +printWidth: 80 + | printWidth +=====================================input====================================== +fragment Visit on HighlightedVisit + @argumentDefinitions( + count: {type: "Int", defaultValue: 20} + ) { + name +} + +=====================================output===================================== +fragment Visit on HighlightedVisit + @argumentDefinitions(count: {type: "Int", defaultValue: 20}) { + name +} + +================================================================================ +`; + exports[`bracket_spacing.graphql format 1`] = ` ====================================options===================================== parsers: ["graphql"] @@ -21,26 +44,3 @@ fragment Visit on HighlightedVisit ================================================================================ `; - -exports[`bracket_spacing.graphql format 2`] = ` -====================================options===================================== -bracketSpacing: false -parsers: ["graphql"] -printWidth: 80 - | printWidth -=====================================input====================================== -fragment Visit on HighlightedVisit - @argumentDefinitions( - count: {type: "Int", defaultValue: 20} - ) { - name -} - -=====================================output===================================== -fragment Visit on HighlightedVisit - @argumentDefinitions(count: {type: "Int", defaultValue: 20}) { - name -} - -================================================================================ -`; diff --git a/tests/graphql_trailing_comma/__snapshots__/jsfmt.spec.js.snap b/tests/graphql_trailing_comma/__snapshots__/jsfmt.spec.js.snap index 353171de4..213a2e2c2 100644 --- a/tests/graphql_trailing_comma/__snapshots__/jsfmt.spec.js.snap +++ b/tests/graphql_trailing_comma/__snapshots__/jsfmt.spec.js.snap @@ -1,66 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`trailing.graphql format 1`] = ` -====================================options===================================== -parsers: ["graphql"] -printWidth: 80 -trailingComma: "none" - | printWidth -=====================================input====================================== -query Query( - $pageID: ID! - $scale: Float - $PROJECT_UNIT_PROFILE_PICTURE_SIZE: Int - $PROJECT_UNIT_CARD_SIZE: Int -) @argumentDefinitions( - count: {type: "Int", defaultValue: 20, someSuperSuperSuperSuperLongType: 301} - test: [{type: "Int", defaultValue: 20, someSuperSuperSuperSuperLongType: 301}] - ) { - cover_photo { - image( - width: $PROJECT_UNIT_CARD_SIZE, - height: $PROJECT_UNIT_CARD_SIZE, - sizing: "cover-fill", - scale: $scale, - ) { - uri - } - } -} - -=====================================output===================================== -query Query( - $pageID: ID! - $scale: Float - $PROJECT_UNIT_PROFILE_PICTURE_SIZE: Int - $PROJECT_UNIT_CARD_SIZE: Int -) - @argumentDefinitions( - count: { - type: "Int" - defaultValue: 20 - someSuperSuperSuperSuperLongType: 301 - } - test: [ - { type: "Int", defaultValue: 20, someSuperSuperSuperSuperLongType: 301 } - ] - ) { - cover_photo { - image( - width: $PROJECT_UNIT_CARD_SIZE - height: $PROJECT_UNIT_CARD_SIZE - sizing: "cover-fill" - scale: $scale - ) { - uri - } - } -} - -================================================================================ -`; - -exports[`trailing.graphql format 2`] = ` +exports[`trailing.graphql - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["graphql"] printWidth: 80 @@ -120,7 +60,67 @@ query Query( ================================================================================ `; -exports[`trailing.graphql format 3`] = ` +exports[`trailing.graphql - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["graphql"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== +query Query( + $pageID: ID! + $scale: Float + $PROJECT_UNIT_PROFILE_PICTURE_SIZE: Int + $PROJECT_UNIT_CARD_SIZE: Int +) @argumentDefinitions( + count: {type: "Int", defaultValue: 20, someSuperSuperSuperSuperLongType: 301} + test: [{type: "Int", defaultValue: 20, someSuperSuperSuperSuperLongType: 301}] + ) { + cover_photo { + image( + width: $PROJECT_UNIT_CARD_SIZE, + height: $PROJECT_UNIT_CARD_SIZE, + sizing: "cover-fill", + scale: $scale, + ) { + uri + } + } +} + +=====================================output===================================== +query Query( + $pageID: ID! + $scale: Float + $PROJECT_UNIT_PROFILE_PICTURE_SIZE: Int + $PROJECT_UNIT_CARD_SIZE: Int +) + @argumentDefinitions( + count: { + type: "Int" + defaultValue: 20 + someSuperSuperSuperSuperLongType: 301 + } + test: [ + { type: "Int", defaultValue: 20, someSuperSuperSuperSuperLongType: 301 } + ] + ) { + cover_photo { + image( + width: $PROJECT_UNIT_CARD_SIZE + height: $PROJECT_UNIT_CARD_SIZE + sizing: "cover-fill" + scale: $scale + ) { + uri + } + } +} + +================================================================================ +`; + +exports[`trailing.graphql format 1`] = ` ====================================options===================================== parsers: ["graphql"] printWidth: 80 diff --git a/tests/handlebars-attr-node/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-attr-node/__snapshots__/jsfmt.spec.js.snap index 28d08f5d9..785413ece 100644 --- a/tests/handlebars-attr-node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-attr-node/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`brackets.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+
+
+
+ +=====================================output===================================== +
+
+
+
+================================================================================ +`; + exports[`brackets.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -18,23 +38,3 @@ printWidth: 80
================================================================================ `; - -exports[`brackets.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
-
-
-
- -=====================================output===================================== -
-
-
-
-================================================================================ -`; diff --git a/tests/handlebars-basics/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-basics/__snapshots__/jsfmt.spec.js.snap index 94032943d..6be961146 100644 --- a/tests/handlebars-basics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-basics/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,80 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`component.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== + +{{@greeting}}, {{@name}}! + +
+ +
+ +
+ + hello + + + + + + + + + + + + +
Hello
+ +
    +
+=====================================output===================================== + +{{@greeting}}, {{@name}}! + +
+ +
+ +
+ + + hello + + + + + + + + + + + + + +
+ Hello +
+ +
    +
+================================================================================ +`; + exports[`component.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -74,78 +149,29 @@ printWidth: 80 ================================================================================ `; -exports[`component.hbs format 2`] = ` +exports[`literals.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== - -{{@greeting}}, {{@name}}! +{{mustache true}} +{{mustache 5}} +{{mustache undefined}} +{{mustache null}} + +{{! Mustache Comment}} +{{!-- Mustache Comment }} --}} -
- -
- -
- - hello - - - - - - - - - - - - -
Hello
- -
    -
=====================================output===================================== - -{{@greeting}}, {{@name}}! - -
- -
- -
- - - hello - - - - - - - - - - - - - -
- Hello -
- -
    -
+{{mustache true}} +{{mustache 5}} +{{mustache undefined}} +{{mustache null}} + +{{! Mustache Comment}} +{{!-- Mustache Comment }} --}} ================================================================================ `; @@ -174,29 +200,35 @@ printWidth: 80 ================================================================================ `; -exports[`literals.hbs format 2`] = ` +exports[`nested-path.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -{{mustache true}} -{{mustache 5}} -{{mustache undefined}} -{{mustache null}} - -{{! Mustache Comment}} -{{!-- Mustache Comment }} --}} +
+

{{title}}

+

By {{author.name}}

+ +
+ {{body}} +
+
=====================================output===================================== -{{mustache true}} -{{mustache 5}} -{{mustache undefined}} -{{mustache null}} - -{{! Mustache Comment}} -{{!-- Mustache Comment }} --}} +
+

+ {{title}} +

+

+ By {{author.name}} +

+ +
+ {{body}} +
+
================================================================================ `; @@ -231,35 +263,19 @@ printWidth: 80 ================================================================================ `; -exports[`nested-path.hbs format 2`] = ` +exports[`raw.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -
-

{{title}}

-

By {{author.name}}

- -
- {{body}} -
-
+

{{{raw}}}

=====================================output===================================== -
-

- {{title}} -

-

- By {{author.name}} -

- -
- {{body}} -
-
+

+ {{{raw}}} +

================================================================================ `; @@ -278,19 +294,27 @@ printWidth: 80 ================================================================================ `; -exports[`raw.hbs format 2`] = ` +exports[`string-literals.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -

{{{raw}}}

+{{"abc"}} +{{'abc'}} +{{" \\" \\" ' more double quote than single quote "}} +{{' \\' \\' " more single quote than double quote '}} +{{' " \\' \\" \\\\ '}} +{{" \\" \\' ' \\\\ "}} =====================================output===================================== -

- {{{raw}}} -

+{{'abc'}} +{{'abc'}} +{{' " " \\' more double quote than single quote '}} +{{" ' ' \\" more single quote than double quote "}} +{{' " \\' \\" \\\\ '}} +{{" \\" \\' ' \\\\ "}} ================================================================================ `; @@ -316,27 +340,3 @@ printWidth: 80 {{" \\" \\' ' \\\\ "}} ================================================================================ `; - -exports[`string-literals.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -{{"abc"}} -{{'abc'}} -{{" \\" \\" ' more double quote than single quote "}} -{{' \\' \\' " more single quote than double quote '}} -{{' " \\' \\" \\\\ '}} -{{" \\" \\' ' \\\\ "}} - -=====================================output===================================== -{{'abc'}} -{{'abc'}} -{{' " " \\' more double quote than single quote '}} -{{" ' ' \\" more single quote than double quote "}} -{{' " \\' \\" \\\\ '}} -{{" \\" \\' ' \\\\ "}} -================================================================================ -`; diff --git a/tests/handlebars-block-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-block-statement/__snapshots__/jsfmt.spec.js.snap index 49d2da475..b72e58183 100644 --- a/tests/handlebars-block-statement/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-block-statement/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,163 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`block-statement.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +{{#block param hashKey=hashValue as |blockParam|}} + Hello +{{/block}} + +{{#block almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars helloWorldParam key=here}} +{{/block}} + +{{#block param param param param param param param hashKey=hashValue as |blockParam|}} + Hello +{{/block}} + +{{#block param param param param param param param hashKey=HashValue hashKey=hashValue}} + Hello +{{/block}} + +{{#block param param param param param param param param param param param param param}} + Hello +{{/block}} + +{{#block hashKey=HashValue hashKey=hashValue hashKey=HashValue hashKey=hashValue hashKey=HashValue}} + Hello +{{/block}} + +{{#block}} + {{#block}} + hello + {{/block}} +{{/block}} + +{{#block}} + {{#block param}} + hello + {{/block}} +{{/block}} + +{{#block param}} + {{#block param}} + hello + {{/block}} +{{/block}} + +{{#block}} + hello +{{/block}} + + + {{firstName}} + + + + {{firstName}} {{lastName}} + + +=====================================output===================================== +{{#block param hashKey=hashValue as |blockParam|}} + Hello +{{/block}} + +{{#block + almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars + helloWorldParam + key=here +}}{{/block}} + +{{#block + param + param + param + param + param + param + param + hashKey=hashValue as |blockParam| +}} + Hello +{{/block}} + +{{#block + param + param + param + param + param + param + param + hashKey=HashValue + hashKey=hashValue +}} + Hello +{{/block}} + +{{#block + param + param + param + param + param + param + param + param + param + param + param + param + param +}} + Hello +{{/block}} + +{{#block + hashKey=HashValue + hashKey=hashValue + hashKey=HashValue + hashKey=hashValue + hashKey=HashValue +}} + Hello +{{/block}} + +{{#block}} + {{#block}} + hello + {{/block}} +{{/block}} + +{{#block}} + {{#block param}} + hello + {{/block}} +{{/block}} + +{{#block param}} + {{#block param}} + hello + {{/block}} +{{/block}} + +{{#block}} + hello +{{/block}} + + + {{firstName}} + + + + {{firstName}} {{lastName}} + +================================================================================ +`; + exports[`block-statement.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -157,161 +315,33 @@ printWidth: 80 ================================================================================ `; -exports[`block-statement.hbs format 2`] = ` +exports[`each.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -{{#block param hashKey=hashValue as |blockParam|}} - Hello -{{/block}} - -{{#block almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars helloWorldParam key=here}} -{{/block}} - -{{#block param param param param param param param hashKey=hashValue as |blockParam|}} - Hello -{{/block}} - -{{#block param param param param param param param hashKey=HashValue hashKey=hashValue}} - Hello -{{/block}} - -{{#block param param param param param param param param param param param param param}} - Hello -{{/block}} - -{{#block hashKey=HashValue hashKey=hashValue hashKey=HashValue hashKey=hashValue hashKey=HashValue}} - Hello -{{/block}} - -{{#block}} - {{#block}} - hello - {{/block}} -{{/block}} - -{{#block}} - {{#block param}} - hello - {{/block}} -{{/block}} - -{{#block param}} - {{#block param}} - hello - {{/block}} -{{/block}} - -{{#block}} - hello -{{/block}} - - - {{firstName}} - - - - {{firstName}} {{lastName}} - +
+ {{#each comments}} +

{{title}}

+
{{body}}
+ {{/each}} +
=====================================output===================================== -{{#block param hashKey=hashValue as |blockParam|}} - Hello -{{/block}} - -{{#block - almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars - helloWorldParam - key=here -}}{{/block}} - -{{#block - param - param - param - param - param - param - param - hashKey=hashValue as |blockParam| -}} - Hello -{{/block}} - -{{#block - param - param - param - param - param - param - param - hashKey=HashValue - hashKey=hashValue -}} - Hello -{{/block}} - -{{#block - param - param - param - param - param - param - param - param - param - param - param - param - param -}} - Hello -{{/block}} - -{{#block - hashKey=HashValue - hashKey=hashValue - hashKey=HashValue - hashKey=hashValue - hashKey=HashValue -}} - Hello -{{/block}} - -{{#block}} - {{#block}} - hello - {{/block}} -{{/block}} - -{{#block}} - {{#block param}} - hello - {{/block}} -{{/block}} - -{{#block param}} - {{#block param}} - hello - {{/block}} -{{/block}} - -{{#block}} - hello -{{/block}} - - - {{firstName}} - - - - {{firstName}} {{lastName}} - +
+ {{#each comments}} +

+ + {{title}} + +

+
+ {{body}} +
+ {{/each}} +
================================================================================ `; @@ -344,33 +374,225 @@ printWidth: 80 ================================================================================ `; -exports[`each.hbs format 2`] = ` +exports[`if-else.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -
- {{#each comments}} -

{{title}}

-
{{body}}
- {{/each}} +

+{{#if isAtWork}} + Ship that code! +{{else if isReading}} + You can finish War and Peace eventually... +{{else}} + Go to bed! +{{/if}} +

+ +

+{{#if a}} + A +{{else}} + B +{{/if}} +

+ +{{#if a}} + b +{{else if c}} + d +{{else}} + e +{{/if}} + +{{#if a}} + b +{{else if c}} + d +{{else}} + hello + {{#if f}} + g + {{/if}} + e +{{/if}} + +{{#if a}} + b +{{else if c}} + d +{{else if e}} + f +{{else if g}} + h +{{else}} + j +{{/if}} + +
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}}
-=====================================output===================================== -
- {{#each comments}} -

- - {{title}} - -

-
- {{body}} -
- {{/each}} +
+
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+ +{{#if a}} + b +{{else}} + {{#each c as |d|}} + e + {{/each}} +{{/if}} + +{{#if a}} + {{#if b}} + ab + {{else if c}} + ac + {{/if}} +{{/if}} + +{{#if a}} + a +
b
+ c +{{else}} + {{#if c}} + a + b +
c
+ {{/if}} +
a
+ b + c +{{/if}} + +=====================================output===================================== +

+ {{#if isAtWork}} + Ship that code! + {{else if isReading}} + You can finish War and Peace eventually... + {{else}} + Go to bed! + {{/if}} +

+ +

+ {{#if a}} + A + {{else}} + B + {{/if}} +

+ +{{#if a}} + b +{{else if c}} + d +{{else}} + e +{{/if}} + +{{#if a}} + b +{{else if c}} + d +{{else}} + hello + {{#if f}} + g + {{/if}} + e +{{/if}} + +{{#if a}} + b +{{else if c}} + d +{{else if e}} + f +{{else if g}} + h +{{else}} + j +{{/if}} + +
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+ +
+
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+
+ +{{#if a}} + b +{{else}} + {{#each c as |d|}} + e + {{/each}} +{{/if}} + +{{#if a}} + {{#if b}} + ab + {{else if c}} + ac + {{/if}} +{{/if}} + +{{#if a}} + a +
+ b +
+ c +{{else}} + {{#if c}} + a + b +
+ c +
+ {{/if}} +
+ a +
+ b + c +{{/if}} ================================================================================ `; @@ -595,225 +817,27 @@ printWidth: 80 ================================================================================ `; -exports[`if-else.hbs format 2`] = ` +exports[`loop.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -

-{{#if isAtWork}} - Ship that code! -{{else if isReading}} - You can finish War and Peace eventually... -{{else}} - Go to bed! -{{/if}} -

- -

-{{#if a}} - A -{{else}} - B -{{/if}} -

- -{{#if a}} - b -{{else if c}} - d -{{else}} - e -{{/if}} - -{{#if a}} - b -{{else if c}} - d -{{else}} - hello - {{#if f}} - g - {{/if}} - e -{{/if}} - -{{#if a}} - b -{{else if c}} - d -{{else if e}} - f -{{else if g}} - h -{{else}} - j -{{/if}} - -
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
- -
-
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
-
- -{{#if a}} - b -{{else}} - {{#each c as |d|}} - e +
    + {{#each speakers key="@index" as |speaker|}} +
  • {{speaker}}
  • {{/each}} -{{/if}} - -{{#if a}} - {{#if b}} - ab - {{else if c}} - ac - {{/if}} -{{/if}} - -{{#if a}} - a -
    b
    - c -{{else}} - {{#if c}} - a - b -
    c
    - {{/if}} -
    a
    - b - c -{{/if}} +
=====================================output===================================== -

- {{#if isAtWork}} - Ship that code! - {{else if isReading}} - You can finish War and Peace eventually... - {{else}} - Go to bed! - {{/if}} -

- -

- {{#if a}} - A - {{else}} - B - {{/if}} -

- -{{#if a}} - b -{{else if c}} - d -{{else}} - e -{{/if}} - -{{#if a}} - b -{{else if c}} - d -{{else}} - hello - {{#if f}} - g - {{/if}} - e -{{/if}} - -{{#if a}} - b -{{else if c}} - d -{{else if e}} - f -{{else if g}} - h -{{else}} - j -{{/if}} - -
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
- -
-
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
-
- -{{#if a}} - b -{{else}} - {{#each c as |d|}} - e +
    + {{#each speakers key='@index' as |speaker|}} +
  • + {{speaker}} +
  • {{/each}} -{{/if}} - -{{#if a}} - {{#if b}} - ab - {{else if c}} - ac - {{/if}} -{{/if}} - -{{#if a}} - a -
    - b -
    - c -{{else}} - {{#if c}} - a - b -
    - c -
    - {{/if}} -
    - a -
    - b - c -{{/if}} +
================================================================================ `; @@ -839,27 +863,3 @@ printWidth: 80 ================================================================================ `; - -exports[`loop.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
    - {{#each speakers key="@index" as |speaker|}} -
  • {{speaker}}
  • - {{/each}} -
- -=====================================output===================================== -
    - {{#each speakers key='@index' as |speaker|}} -
  • - {{speaker}} -
  • - {{/each}} -
-================================================================================ -`; diff --git a/tests/handlebars-concat-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-concat-statement/__snapshots__/jsfmt.spec.js.snap index 63dee28e0..dd6090b15 100644 --- a/tests/handlebars-concat-statement/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-concat-statement/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,60 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`concat-statement.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+ Hello +
+ +
+ Hello +
+ + + +
+
+
+
+
+
+
+
+
+
+=====================================output===================================== +
+ Hello +
+ +
+ Hello +
+ + + +
+
+
+
+
+
+
+
+
+
+================================================================================ +`; + exports[`concat-statement.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -54,58 +109,43 @@ printWidth: 80 ================================================================================ `; -exports[`concat-statement.hbs format 2`] = ` +exports[`in-attr-node.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== -
- Hello -
- -
- Hello -
- - - -
-
-
-
-
-
-
-
-
-
-=====================================output===================================== -
- Hello -
- -
hey
+Link + + +=====================================output===================================== +
+ hey
- - - -
-
-
-
-
-
-
-
-
-
+ + Link + + ================================================================================ `; @@ -147,43 +187,3 @@ printWidth: 80 ================================================================================ `; - -exports[`in-attr-node.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
hey
-Link - - -=====================================output===================================== -
- hey -
- - Link - - -================================================================================ -`; diff --git a/tests/handlebars-element-node/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-element-node/__snapshots__/jsfmt.spec.js.snap index 81c1a6916..42e4a868b 100644 --- a/tests/handlebars-element-node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-element-node/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,89 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`element-node.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+ Hello +
+ +
+ Hello +
+ +
+ hi +
+ +
+ A long enough string to trigger a line break that would prevent wrapping. +
+ +
+ A long enough string to trigger a line break that would prevent wrapping more. +
+ +
+ A long enough string to trigger a line break that would prevent wrapping more and more. +
+ +
+ {{#block}} + {{hello}} + {{/block}} +
+ +
+ {{hello}} +
+ +
+ + +=====================================output===================================== +
+ Hello +
+ +
+ Hello +
+ +
+ hi +
+ +
+ A long enough string to trigger a line break that would prevent wrapping. +
+ +
+ A long enough string to trigger a line break that would prevent wrapping more. +
+ +
+ A long enough string to trigger a line break that would prevent wrapping more and more. +
+ +
+ {{#block}} + {{hello}} + {{/block}} +
+ +
+ {{hello}} +
+ +
+ +================================================================================ +`; + exports[`element-node.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -82,87 +166,3 @@ printWidth: 80 ================================================================================ `; - -exports[`element-node.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
- Hello -
- -
- Hello -
- -
- hi -
- -
- A long enough string to trigger a line break that would prevent wrapping. -
- -
- A long enough string to trigger a line break that would prevent wrapping more. -
- -
- A long enough string to trigger a line break that would prevent wrapping more and more. -
- -
- {{#block}} - {{hello}} - {{/block}} -
- -
- {{hello}} -
- -
- - -=====================================output===================================== -
- Hello -
- -
- Hello -
- -
- hi -
- -
- A long enough string to trigger a line break that would prevent wrapping. -
- -
- A long enough string to trigger a line break that would prevent wrapping more. -
- -
- A long enough string to trigger a line break that would prevent wrapping more and more. -
- -
- {{#block}} - {{hello}} - {{/block}} -
- -
- {{hello}} -
- -
- -================================================================================ -`; diff --git a/tests/handlebars-escape/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-escape/__snapshots__/jsfmt.spec.js.snap index 970869656..bcf687f3e 100644 --- a/tests/handlebars-escape/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-escape/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`html-entities.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +

Some escaped characters: < > &

+=====================================output===================================== +

+ Some escaped characters: < > & +

+================================================================================ +`; + exports[`html-entities.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -13,18 +28,3 @@ printWidth: 80

================================================================================ `; - -exports[`html-entities.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -

Some escaped characters: < > &

-=====================================output===================================== -

- Some escaped characters: < > & -

-================================================================================ -`; diff --git a/tests/handlebars-last-line/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-last-line/__snapshots__/jsfmt.spec.js.snap index 917aa0fb3..c1add0784 100644 --- a/tests/handlebars-last-line/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-last-line/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`empty-with-no-trailing-newline.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== + +=====================================output===================================== + +================================================================================ +`; + exports[`empty-with-no-trailing-newline.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -12,7 +25,7 @@ printWidth: 80 ================================================================================ `; -exports[`empty-with-no-trailing-newline.hbs format 2`] = ` +exports[`empty-with-trailing-newline.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 @@ -20,6 +33,7 @@ singleQuote: true | printWidth =====================================input====================================== + =====================================output===================================== ================================================================================ @@ -38,17 +52,17 @@ printWidth: 80 ================================================================================ `; -exports[`empty-with-trailing-newline.hbs format 2`] = ` +exports[`end-of-line-last.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== - +a bare string to hightlight eol last handling =====================================output===================================== - +a bare string to hightlight eol last handling ================================================================================ `; @@ -64,17 +78,3 @@ a bare string to hightlight eol last handling a bare string to hightlight eol last handling ================================================================================ `; - -exports[`end-of-line-last.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -a bare string to hightlight eol last handling - -=====================================output===================================== -a bare string to hightlight eol last handling -================================================================================ -`; diff --git a/tests/handlebars-mustache-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-mustache-statement/__snapshots__/jsfmt.spec.js.snap index 42609ffaa..3ca269c88 100644 --- a/tests/handlebars-mustache-statement/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-mustache-statement/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,124 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`basics.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== + + + + + + +
+
+ +
+
+ +
+
+ +
+
+ +=====================================output===================================== + + + + + + +
+
+ +
+
+ +
+
+ +
+
+================================================================================ +`; + exports[`basics.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -118,121 +237,79 @@ printWidth: 80 ================================================================================ `; -exports[`basics.hbs format 2`] = ` +exports[`element-modifier-statement.hbs - {"singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 80 singleQuote: true | printWidth =====================================input====================================== - - - - - - -
+
+ Hello
-
+
+ Hello
-
+
+ Hello
-
+
+ Hello
=====================================output===================================== - - - - - - -
+
+ Hello
+ Hello
+ Hello
+ Hello
================================================================================ `; @@ -312,80 +389,3 @@ printWidth: 80
================================================================================ `; - -exports[`element-modifier-statement.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
- Hello -
- -
- Hello -
- -
- Hello -
- -
- Hello -
- -=====================================output===================================== -
- Hello -
- -
- Hello -
- -
- Hello -
- -
- Hello -
-================================================================================ -`; diff --git a/tests/handlebars-prettier-ignore/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-prettier-ignore/__snapshots__/jsfmt.spec.js.snap index dff93ea4d..2d3b544c0 100644 --- a/tests/handlebars-prettier-ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-prettier-ignore/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,82 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`prettier-ignore.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +{{! prettier-ignore }} +
+ "hello! my parent was ignored" + {{#my-crazy-component "shall" be="preserved"}} + + {{/my-crazy-component}} +
+ +{{#a-normal-component isRestoredTo = "order" }} + +{{/a-normal-component}} + +
+ + {{! prettier-ignore }} +
+ + + + +
+ {{#another-sibling as |isFixed|}} + +
{{ isFixed }} + + All of this should be fixed + +
+ + {{/another-sibling}} +
+=====================================output===================================== +{{! prettier-ignore }} +
+ "hello! my parent was ignored" + {{#my-crazy-component "shall" be="preserved"}} + + {{/my-crazy-component}} +
+ +{{#a-normal-component isRestoredTo='order'}} + +{{/a-normal-component}} + +
+ + {{! prettier-ignore }} +
+ + + + +
+ {{#another-sibling as |isFixed|}} +
+ {{isFixed}} + + All of this should be fixed +
+ {{/another-sibling}} +
+================================================================================ +`; + exports[`prettier-ignore.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -75,80 +152,3 @@ printWidth: 80
================================================================================ `; - -exports[`prettier-ignore.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -{{! prettier-ignore }} -
- "hello! my parent was ignored" - {{#my-crazy-component "shall" be="preserved"}} - - {{/my-crazy-component}} -
- -{{#a-normal-component isRestoredTo = "order" }} - -{{/a-normal-component}} - -
- - {{! prettier-ignore }} -
- - - - -
- {{#another-sibling as |isFixed|}} - -
{{ isFixed }} - - All of this should be fixed - -
- - {{/another-sibling}} -
-=====================================output===================================== -{{! prettier-ignore }} -
- "hello! my parent was ignored" - {{#my-crazy-component "shall" be="preserved"}} - - {{/my-crazy-component}} -
- -{{#a-normal-component isRestoredTo='order'}} - -{{/a-normal-component}} - -
- - {{! prettier-ignore }} -
- - - - -
- {{#another-sibling as |isFixed|}} -
- {{isFixed}} - - All of this should be fixed -
- {{/another-sibling}} -
-================================================================================ -`; diff --git a/tests/handlebars-sub-expression/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-sub-expression/__snapshots__/jsfmt.spec.js.snap index 6721680e2..1b1206781 100644 --- a/tests/handlebars-sub-expression/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-sub-expression/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,104 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`sub-expressions.hbs - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+ +{{#block + (concat + (service) + (helper param hashPair=Value) + (largeNameHelper param param param param hashPair=value hashPair=value hashPair=Value) + hashPair=(helper param param param param param param hashPair=value hashPair=value hashPair=value) + hashPair=(does not need a line break due to being under 80 chars long) + ) +}} + +{{/block}} + +{{foobar-sub-component/foobar-foo + hook="stringLiteral" + foo= + (t + (concat "stringLiteral" (get blockParam "stringLiteral") hash=hash hash=hash) + foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) + ) +}} + +=====================================output===================================== +
+ +{{#block + (concat + (service) + (helper param hashPair=Value) + (largeNameHelper + param param param param hashPair=value hashPair=value hashPair=Value + ) + hashPair=(helper + param + param + param + param + param + param + hashPair=value + hashPair=value + hashPair=value + ) + hashPair=(does not need a line break due to being under 80 chars long) + ) +}}{{/block}} + +{{foobar-sub-component/foobar-foo + hook='stringLiteral' + foo=(t + (concat + 'stringLiteral' (get blockParam 'stringLiteral') hash=hash hash=hash + ) + foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) + ) +}} +================================================================================ +`; + exports[`sub-expressions.hbs format 1`] = ` ====================================options===================================== parsers: ["glimmer"] @@ -97,102 +196,3 @@ printWidth: 80 }} ================================================================================ `; - -exports[`sub-expressions.hbs format 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
- -{{#block - (concat - (service) - (helper param hashPair=Value) - (largeNameHelper param param param param hashPair=value hashPair=value hashPair=Value) - hashPair=(helper param param param param param param hashPair=value hashPair=value hashPair=value) - hashPair=(does not need a line break due to being under 80 chars long) - ) -}} - -{{/block}} - -{{foobar-sub-component/foobar-foo - hook="stringLiteral" - foo= - (t - (concat "stringLiteral" (get blockParam "stringLiteral") hash=hash hash=hash) - foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) - ) -}} - -=====================================output===================================== -
- -{{#block - (concat - (service) - (helper param hashPair=Value) - (largeNameHelper - param param param param hashPair=value hashPair=value hashPair=Value - ) - hashPair=(helper - param - param - param - param - param - param - hashPair=value - hashPair=value - hashPair=value - ) - hashPair=(does not need a line break due to being under 80 chars long) - ) -}}{{/block}} - -{{foobar-sub-component/foobar-foo - hook='stringLiteral' - foo=(t - (concat - 'stringLiteral' (get blockParam 'stringLiteral') hash=hash hash=hash - ) - foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) - ) -}} -================================================================================ -`; diff --git a/tests/handlebars-venerable/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-venerable/__snapshots__/jsfmt.spec.js.snap index 100559aaf..6d9eadf0a 100644 --- a/tests/handlebars-venerable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-venerable/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,46 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`template.html - {"singleQuote":true} format 1`] = ` +====================================options===================================== +parsers: ["html"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== + + + + +=====================================output===================================== + + + + +================================================================================ +`; + exports[`template.html format 1`] = ` ====================================options===================================== parsers: ["html"] @@ -39,44 +80,3 @@ printWidth: 80 ================================================================================ `; - -exports[`template.html format 2`] = ` -====================================options===================================== -parsers: ["html"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== - - - - -=====================================output===================================== - - - - -================================================================================ -`; diff --git a/tests/handlebars-whitespace/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-whitespace/__snapshots__/jsfmt.spec.js.snap index 4209dcfed..4ea808062 100644 --- a/tests/handlebars-whitespace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/handlebars-whitespace/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`basics.hbs format 1`] = ` +exports[`basics.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -94,7 +94,7 @@ printWidth: 40 ================================================================================ `; -exports[`boss.hbs format 1`] = ` +exports[`boss.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -145,7 +145,7 @@ hey ================================================================================ `; -exports[`curly.hbs format 1`] = ` +exports[`curly.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -163,7 +163,7 @@ printWidth: 40 ================================================================================ `; -exports[`display-inline-block.hbs format 1`] = ` +exports[`display-inline-block.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -209,7 +209,7 @@ Click here! Click here! Click here! Click here! Click here! Click here! ================================================================================ `; -exports[`display-none.hbs format 1`] = ` +exports[`display-none.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -233,7 +233,7 @@ printWidth: 40 ================================================================================ `; -exports[`fill.hbs format 1`] = ` +exports[`fill.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -270,7 +270,7 @@ printWidth: 40 ================================================================================ `; -exports[`inline-element.hbs format 1`] = ` +exports[`inline-element.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -327,7 +327,7 @@ conubia nostra, per inceptos himenaeos. Donec in ornare velit. ================================================================================ `; -exports[`non-breaking-whitespace.hbs format 1`] = ` +exports[`non-breaking-whitespace.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -356,7 +356,7 @@ printWidth: 40 ================================================================================ `; -exports[`preserved-spaces-and-breaks.hbs format 1`] = ` +exports[`preserved-spaces-and-breaks.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -448,7 +448,7 @@ sometimes{{nogaps ================================================================================ `; -exports[`punctuation.hbs format 1`] = ` +exports[`punctuation.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -471,7 +471,7 @@ printWidth: 40 ================================================================================ `; -exports[`surrounding-linebreak.hbs format 1`] = ` +exports[`surrounding-linebreak.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -524,7 +524,7 @@ printWidth: 40 ================================================================================ `; -exports[`table.hbs format 1`] = ` +exports[`table.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 @@ -611,7 +611,7 @@ printWidth: 40 ================================================================================ `; -exports[`whitespace-control.hbs format 1`] = ` +exports[`whitespace-control.hbs - {"printWidth":40} format 1`] = ` ====================================options===================================== parsers: ["glimmer"] printWidth: 40 diff --git a/tests/html_angular/__snapshots__/jsfmt.spec.js.snap b/tests/html_angular/__snapshots__/jsfmt.spec.js.snap index 9d0a7a196..d50e8fb6f 100644 --- a/tests/html_angular/__snapshots__/jsfmt.spec.js.snap +++ b/tests/html_angular/__snapshots__/jsfmt.spec.js.snap @@ -1,48 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`angularjs.html format 1`] = ` -====================================options===================================== -parsers: ["angular"] -printWidth: 80 -trailingComma: "none" - | printWidth -=====================================input====================================== -
Warning!
- -
-
-
-
- -=====================================output===================================== -
Warning!
- -
-
-
-
- -================================================================================ -`; - -exports[`angularjs.html format 2`] = ` +exports[`angularjs.html - {"bracketSpacing":false} format 1`] = ` ====================================options===================================== +bracketSpacing: false parsers: ["angular"] printWidth: 80 | printWidth @@ -81,7 +41,48 @@ printWidth: 80 ================================================================================ `; -exports[`angularjs.html format 3`] = ` +exports[`angularjs.html - {"htmlWhitespaceSensitivity":"ignore"} format 1`] = ` +====================================options===================================== +htmlWhitespaceSensitivity: "ignore" +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input====================================== +
Warning!
+ +
+
+
+
+ +=====================================output===================================== +
Warning!
+ +
+
+
+
+ +================================================================================ +`; + +exports[`angularjs.html - {"printWidth":1} format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 1 @@ -152,109 +153,94 @@ printWidth: 1 ================================================================================ `; -exports[`angularjs.html format 4`] = ` -====================================options===================================== -htmlWhitespaceSensitivity: "ignore" -parsers: ["angular"] -printWidth: 80 - | printWidth -=====================================input====================================== -
Warning!
- -
-
-
-
- -=====================================output===================================== -
Warning!
- -
-
-
-
- -================================================================================ -`; - -exports[`angularjs.html format 5`] = ` -====================================options===================================== -bracketSpacing: false -parsers: ["angular"] -printWidth: 80 - | printWidth -=====================================input====================================== -
Warning!
- -
-
-
-
- -=====================================output===================================== -
Warning!
- -
-
-
-
- -================================================================================ -`; - -exports[`attr-name.component.html format 1`] = ` +exports[`angularjs.html - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 80 trailingComma: "none" | printWidth =====================================input====================================== -
+
Warning!
+ +
+
+
+
=====================================output===================================== -
+
Warning!
+ +
+
+
+
================================================================================ `; -exports[`attr-name.component.html format 2`] = ` +exports[`angularjs.html format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 80 | printWidth =====================================input====================================== +
Warning!
+ +
+
+
+
+ +=====================================output===================================== +
Warning!
+ +
+
+
+
+ +================================================================================ +`; + +exports[`attr-name.component.html - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input======================================
=====================================output===================================== @@ -263,7 +249,22 @@ printWidth: 80 ================================================================================ `; -exports[`attr-name.component.html format 3`] = ` +exports[`attr-name.component.html - {"htmlWhitespaceSensitivity":"ignore"} format 1`] = ` +====================================options===================================== +htmlWhitespaceSensitivity: "ignore" +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +=====================================output===================================== +
+ +================================================================================ +`; + +exports[`attr-name.component.html - {"printWidth":1} format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 1 @@ -280,43 +281,42 @@ printWidth: 1 ================================================================================ `; -exports[`attr-name.component.html format 4`] = ` -====================================options===================================== -htmlWhitespaceSensitivity: "ignore" -parsers: ["angular"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- -=====================================output===================================== -
- -================================================================================ -`; - -exports[`attr-name.component.html format 5`] = ` -====================================options===================================== -bracketSpacing: false -parsers: ["angular"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- -=====================================output===================================== -
- -================================================================================ -`; - -exports[`attributes.component.html format 1`] = ` +exports[`attr-name.component.html - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 80 trailingComma: "none" | printWidth =====================================input====================================== +
+ +=====================================output===================================== +
+ +================================================================================ +`; + +exports[`attr-name.component.html format 1`] = ` +====================================options===================================== +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +=====================================output===================================== +
+ +================================================================================ +`; + +exports[`attributes.component.html - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input======================================
- -=====================================output===================================== -
- -================================================================================ -`; - -exports[`attributes.component.html format 5`] = ` -====================================options===================================== -bracketSpacing: false -parsers: ["angular"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- -=====================================output===================================== -
- -================================================================================ -`; - -exports[`first-lf.component.html format 1`] = ` +exports[`attributes.component.html - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 80 trailingComma: "none" | printWidth =====================================input====================================== - - - - - - - - - - - - - - - - - - - - +
=====================================output===================================== - - - - - - - - - - - - - - - - - - - - +
================================================================================ `; -exports[`first-lf.component.html format 2`] = ` +exports[`attributes.component.html format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 80 | printWidth =====================================input====================================== +
+ +=====================================output===================================== +
+ +================================================================================ +`; + +exports[`first-lf.component.html - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input====================================== @@ -2177,7 +2085,100 @@ printWidth: 80 ================================================================================ `; -exports[`first-lf.component.html format 3`] = ` +exports[`first-lf.component.html - {"htmlWhitespaceSensitivity":"ignore"} format 1`] = ` +====================================options===================================== +htmlWhitespaceSensitivity: "ignore" +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + + + + + + + + + + + + + + + + +=====================================output===================================== + + + + + + + + + + + + + + + + + + + + + +================================================================================ +`; + +exports[`first-lf.component.html - {"printWidth":1} format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 1 @@ -2349,257 +2350,198 @@ printWidth: 1 ================================================================================ `; -exports[`first-lf.component.html format 4`] = ` -====================================options===================================== -htmlWhitespaceSensitivity: "ignore" -parsers: ["angular"] -printWidth: 80 - | printWidth -=====================================input====================================== - - - - - - - - - - - - - - - - - - - - - -=====================================output===================================== - - - - - - - - - - - - - - - - - - - - - -================================================================================ -`; - -exports[`first-lf.component.html format 5`] = ` -====================================options===================================== -bracketSpacing: false -parsers: ["angular"] -printWidth: 80 - | printWidth -=====================================input====================================== - - - - - - - - - - - - - - - - - - - - - -=====================================output===================================== - - - - - - - - - - - - - - - - - - - - - -================================================================================ -`; - -exports[`ignore-attribute.component.html format 1`] = ` +exports[`first-lf.component.html - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 80 trailingComma: "none" | printWidth =====================================input====================================== -
- -
- -
- -
+ + + + + + + + + + + + + + + + + + + + =====================================output===================================== -
- -
- -
- -
+ + + + + + + + + + + + + + + + + + + + ================================================================================ `; -exports[`ignore-attribute.component.html format 2`] = ` +exports[`first-lf.component.html format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 80 | printWidth =====================================input====================================== + + + + + + + + + + + + + + + + + + + + + +=====================================output===================================== + + + + + + + + + + + + + + + + + + + + + +================================================================================ +`; + +exports[`ignore-attribute.component.html - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input======================================
+ +
+ +
+ +
+ +=====================================output===================================== +
+ +
+ +
+ +
+ +================================================================================ +`; + +exports[`ignore-attribute.component.html - {"printWidth":1} format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 1 @@ -2734,131 +2735,130 @@ printWidth: 1 ================================================================================ `; -exports[`ignore-attribute.component.html format 4`] = ` -====================================options===================================== -htmlWhitespaceSensitivity: "ignore" -parsers: ["angular"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- -
- -
- -
- -=====================================output===================================== -
- -
- -
- -
- -================================================================================ -`; - -exports[`ignore-attribute.component.html format 5`] = ` -====================================options===================================== -bracketSpacing: false -parsers: ["angular"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- -
- -
- -
- -=====================================output===================================== -
- -
- -
- -
- -================================================================================ -`; - -exports[`interpolation.component.html format 1`] = ` +exports[`ignore-attribute.component.html - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["angular"] printWidth: 80 trailingComma: "none" | printWidth =====================================input====================================== +
+ +
+ +
+ +
+ +=====================================output===================================== +
+ +
+ +
+ +
+ +================================================================================ +`; + +exports[`ignore-attribute.component.html format 1`] = ` +====================================options===================================== +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +
+ +
+ +
+ +=====================================output===================================== +
+ +
+ +
+ +
+ +================================================================================ +`; + +exports[`interpolation.component.html - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input======================================
{{ a | b : c }}
{{ a | pipe }}
{{ 0 - 1 }}
@@ -2936,8 +2936,8 @@ trailingComma: "none"
{{ a(1)(2) }}
{{ a[b] }}
{{ [1] }}
-
{{ { a: 1 } }}
-
{{ { a: 1 } }}
+
{{ {a: 1} }}
+
{{ {a: 1} }}
{{ true }}
{{ undefined }}
{{ null }}
@@ -3008,19 +3008,20 @@ trailingComma: "none"

{{ "delete" - | translate: { what: "entities" | translate: { count: array.length } } + | translate: {what: "entities" | translate: ({count: array.length})} }}

-

{{ { a: 1 + {} } }}

-

{{ { a: a === {} } }}

-

{{ { a: !{} } }}

-

{{ { a: a ? b : {} } }}

+

{{ {a: 1 + ({})} }}

+

{{ {a: a === ({})} }}

+

{{ {a: !({})} }}

+

{{ {a: a ? b : ({})} }}

================================================================================ `; -exports[`interpolation.component.html format 2`] = ` +exports[`interpolation.component.html - {"htmlWhitespaceSensitivity":"ignore"} format 1`] = ` ====================================options===================================== +htmlWhitespaceSensitivity: "ignore" parsers: ["angular"] printWidth: 80 | printWidth @@ -3121,19 +3122,16 @@ printWidth: 80
{{ a?.b() }}
{{ a?.b }}
{{ a // hello }}
- -
- - -
- -=====================================output===================================== -
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- - -
- -================================================================================ -`; - -exports[`textarea.html format 4`] = ` -====================================options===================================== -htmlWhitespaceSensitivity: "strict" -parsers: ["html"] printWidth: 80 | printWidth =====================================input====================================== @@ -3910,75 +3983,59 @@ printWidth: 80 ================================================================================ `; -exports[`textarea.html format 5`] = ` +exports[`unsupported.html - {"htmlWhitespaceSensitivity":"ignore"} format 1`] = ` ====================================options===================================== htmlWhitespaceSensitivity: "ignore" parsers: ["html"] printWidth: 80 | printWidth =====================================input====================================== -
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- - -
+
=====================================output===================================== -
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- +
-
+================================================================================ +`; + +exports[`unsupported.html - {"htmlWhitespaceSensitivity":"strict"} format 1`] = ` +====================================options===================================== +htmlWhitespaceSensitivity: "strict" +parsers: ["html"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +=====================================output===================================== +
+ +================================================================================ +`; + +exports[`unsupported.html - {"printWidth":"Infinity"} format 1`] = ` +====================================options===================================== +parsers: ["html"] +printWidth: Infinity +=====================================input====================================== +
+ +=====================================output===================================== +
+ +================================================================================ +`; + +exports[`unsupported.html - {"printWidth":1} format 1`] = ` +====================================options===================================== +parsers: ["html"] +printWidth: 1 + | printWidth +=====================================input====================================== +
+ +=====================================output===================================== +
================================================================================ `; @@ -3996,60 +4053,3 @@ printWidth: 80 ================================================================================ `; - -exports[`unsupported.html format 2`] = ` -====================================options===================================== -parsers: ["html"] -printWidth: 1 - | printWidth -=====================================input====================================== -
- -=====================================output===================================== -
- -================================================================================ -`; - -exports[`unsupported.html format 3`] = ` -====================================options===================================== -parsers: ["html"] -printWidth: Infinity -=====================================input====================================== -
- -=====================================output===================================== -
- -================================================================================ -`; - -exports[`unsupported.html format 4`] = ` -====================================options===================================== -htmlWhitespaceSensitivity: "strict" -parsers: ["html"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- -=====================================output===================================== -
- -================================================================================ -`; - -exports[`unsupported.html format 5`] = ` -====================================options===================================== -htmlWhitespaceSensitivity: "ignore" -parsers: ["html"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- -=====================================output===================================== -
- -================================================================================ -`; diff --git a/tests/html_vue/__snapshots__/jsfmt.spec.js.snap b/tests/html_vue/__snapshots__/jsfmt.spec.js.snap index 001ba3ffe..9243149f8 100644 --- a/tests/html_vue/__snapshots__/jsfmt.spec.js.snap +++ b/tests/html_vue/__snapshots__/jsfmt.spec.js.snap @@ -1,223 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`attributes.vue format 1`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 -trailingComma: "none" - | printWidth -=====================================input====================================== - - -=====================================output===================================== - - -================================================================================ -`; - -exports[`attributes.vue format 2`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 - | printWidth -=====================================input====================================== - - -=====================================output===================================== - - -================================================================================ -`; - -exports[`attributes.vue format 3`] = ` +exports[`attributes.vue - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 @@ -326,338 +109,224 @@ semi: false ================================================================================ `; -exports[`board_card.vue format 1`] = ` +exports[`attributes.vue - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 trailingComma: "none" | printWidth =====================================input====================================== - - =====================================output===================================== - - ================================================================================ `; -exports[`board_card.vue format 2`] = ` +exports[`attributes.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 | printWidth =====================================input====================================== - - =====================================output===================================== - - ================================================================================ `; -exports[`board_card.vue format 3`] = ` +exports[`board_card.vue - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 @@ -823,7 +492,357 @@ export default { ================================================================================ `; -exports[`case-sensitive-tags.vue format 1`] = ` +exports[`board_card.vue - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== + + + + +=====================================output===================================== + + + + +================================================================================ +`; + +exports[`board_card.vue format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + +=====================================output===================================== + + + + +================================================================================ +`; + +exports[`case-sensitive-tags.vue - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`case-sensitive-tags.vue - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 @@ -842,7 +861,7 @@ trailingComma: "none" ================================================================================ `; -exports[`case-sensitive-tags.vue format 2`] = ` +exports[`case-sensitive-tags.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 @@ -860,21 +879,62 @@ printWidth: 80 ================================================================================ `; -exports[`case-sensitive-tags.vue format 3`] = ` +exports[`custom-block.vue - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 semi: false | printWidth =====================================input====================================== - + + en: + one: One + two: Two + + + =====================================output===================================== - + + en: + one: One + two: Two + + + + + + + +================================================================================ +`; + +exports[`custom-block.vue - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== + + en: + one: One + two: Two + + + + +=====================================output===================================== + + en: + one: One + two: Two + + + + + + ================================================================================ `; @@ -883,7 +943,6 @@ exports[`custom-block.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 -trailingComma: "none" | printWidth =====================================input====================================== @@ -909,61 +968,150 @@ trailingComma: "none" ================================================================================ `; -exports[`custom-block.vue format 2`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 - | printWidth -=====================================input====================================== - - en: - one: One - two: Two - - - - -=====================================output===================================== - - en: - one: One - two: Two - - - - - - - -================================================================================ -`; - -exports[`custom-block.vue format 3`] = ` +exports[`expression-binding.vue - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 semi: false | printWidth =====================================input====================================== - - en: - one: One - two: Two - - - + + + + + + + =====================================output===================================== - - en: - one: One - two: Two - + + + + + + + - - - - +================================================================================ +`; + +exports[`expression-binding.vue - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== + + + + + + + + +=====================================output===================================== + + + + + + + ================================================================================ `; @@ -972,7 +1120,6 @@ exports[`expression-binding.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 -trailingComma: "none" | printWidth =====================================input====================================== @@ -1042,148 +1189,117 @@ trailingComma: "none" ================================================================================ `; -exports[`expression-binding.vue format 2`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 - | printWidth -=====================================input====================================== - - - - - - - - -=====================================output===================================== - - - - - - - - -================================================================================ -`; - -exports[`expression-binding.vue format 3`] = ` +exports[`filter.vue - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 semi: false | printWidth =====================================input====================================== - + - - - - - =====================================output===================================== - + - - - - - + +================================================================================ +`; + +exports[`filter.vue - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== + + + +=====================================output===================================== + + ================================================================================ @@ -1193,7 +1309,6 @@ exports[`filter.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 -trailingComma: "none" | printWidth =====================================input====================================== @@ -1247,383 +1362,7 @@ trailingComma: "none" ================================================================================ `; -exports[`filter.vue format 2`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 - | printWidth -=====================================input====================================== - - - -=====================================output===================================== - - - -================================================================================ -`; - -exports[`filter.vue format 3`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 -semi: false - | printWidth -=====================================input====================================== - - - -=====================================output===================================== - - - -================================================================================ -`; - -exports[`interpolations.vue format 1`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 -trailingComma: "none" - | printWidth -=====================================input====================================== - - -=====================================output===================================== - - -================================================================================ -`; - -exports[`interpolations.vue format 2`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 - | printWidth -=====================================input====================================== - - -=====================================output===================================== - - -================================================================================ -`; - -exports[`interpolations.vue format 3`] = ` +exports[`interpolations.vue - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 @@ -1754,7 +1493,374 @@ x => { ================================================================================ `; -exports[`pre-child.vue format 1`] = ` +exports[`interpolations.vue - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`interpolations.vue format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`pre-child.vue - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== + + + + + + + + + +=====================================output===================================== + + + + + + + + + +================================================================================ +`; + +exports[`pre-child.vue - {"trailingComma":"none"} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 @@ -1860,7 +1966,7 @@ trailingComma: "none" ================================================================================ `; -exports[`pre-child.vue format 2`] = ` +exports[`pre-child.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 @@ -1965,108 +2071,36 @@ printWidth: 80 ================================================================================ `; -exports[`pre-child.vue format 3`] = ` +exports[`script_src.vue - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 semi: false | printWidth =====================================input====================================== - - - - - - - - + + =====================================output===================================== - + + - - +================================================================================ +`; - +exports[`script_src.vue - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== + + - +=====================================output===================================== + + ================================================================================ `; @@ -2075,7 +2109,6 @@ exports[`script_src.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 -trailingComma: "none" | printWidth =====================================input====================================== @@ -2088,149 +2121,7 @@ trailingComma: "none" ================================================================================ `; -exports[`script_src.vue format 2`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 - | printWidth -=====================================input====================================== - - - -=====================================output===================================== - - - -================================================================================ -`; - -exports[`script_src.vue format 3`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 -semi: false - | printWidth -=====================================input====================================== - - - -=====================================output===================================== - - - -================================================================================ -`; - -exports[`self_closing.vue format 1`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 -trailingComma: "none" - | printWidth -=====================================input====================================== - - - - - - - - -=====================================output===================================== - - - - - - - - -================================================================================ -`; - -exports[`self_closing.vue format 2`] = ` -====================================options===================================== -parsers: ["vue"] -printWidth: 80 - | printWidth -=====================================input====================================== - - - - - - - - -=====================================output===================================== - - - - - - - - -================================================================================ -`; - -exports[`self_closing.vue format 3`] = ` +exports[`self_closing.vue - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 @@ -2285,7 +2176,139 @@ foo() ================================================================================ `; -exports[`self_closing_style.vue format 1`] = ` +exports[`self_closing.vue - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== + + + + + + + + +=====================================output===================================== + + + + + + + + +================================================================================ +`; + +exports[`self_closing.vue format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + + + +=====================================output===================================== + + + + + + + + +================================================================================ +`; + +exports[`self_closing_style.vue - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== + + + + + + + + + + + + + + - + + + + + + + + + + + +================================================================================ +`; + +exports[`style.vue - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== + + + + + + + + + + + + + + + + +=====================================output===================================== + + + + + + + + + + + + + ================================================================================ `; @@ -2357,7 +2571,6 @@ exports[`style.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 -trailingComma: "none" | printWidth =====================================input====================================== - - - - - - - - - - - - - - - -=====================================output===================================== - - - - - - - - - - - - - - -================================================================================ -`; - -exports[`style.vue format 3`] = ` +exports[`tag-name.vue - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 semi: false | printWidth =====================================input====================================== - - - - - - - - - - - - - - - + =====================================output===================================== - + - - +================================================================================ +`; - - +exports[`tag-name.vue - {"trailingComma":"none"} format 1`] = ` +====================================options===================================== +parsers: ["vue"] +printWidth: 80 +trailingComma: "none" + | printWidth +=====================================input====================================== + - - - - - +=====================================output===================================== + ================================================================================ `; @@ -2677,7 +2715,6 @@ exports[`tag-name.vue format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 -trailingComma: "none" | printWidth =====================================input======================================