diff --git a/tests/flow/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap b/tests/flow/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..ef137757e
--- /dev/null
+++ b/tests/flow/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,135 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`array.js format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+function excludeFirstFiveResults4([first, second, third, fourth, fifth, ...rest]: Result[]) {
+ return rest;
+}
+
+=====================================output=====================================
+function excludeFirstFiveResults4([
+ first,
+ second,
+ third,
+ fourth,
+ fifth,
+ ...rest
+]: Result[]) {
+ return rest;
+}
+
+================================================================================
+`;
+
+exports[`object.js format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+function StatelessFunctionalComponent4({
+ isActive,
+ onFiltersUpdated,
+ onSelect,
+ onSubmitAndDeselect,
+ onCancel,
+ searchFilters,
+ title,
+ items,
+}: MyType | null | void) {
+ return
+}
+
+const StatelessFunctionalComponent5 = ({
+ isActive,
+ onFiltersUpdated,
+ onSelect,
+ onSubmitAndDeselect,
+ onCancel,
+ searchFilters,
+ title,
+ items,
+}: {
+ isActive: number,
+ onFiltersUpdated: number,
+ onSelect: number,
+ onSubmitAndDeselect: number,
+ onCancel: number,
+ searchFilters: number,
+ title: number,
+ items: number,
+}) => {
+ return
+};
+
+type T = ({
+ isActive: number,
+ onFiltersUpdated: number,
+ onSelect: number,
+ onSubmitAndDeselect: number,
+ onCancel: number,
+ searchFilters: number,
+ title: number,
+ items: number,
+}) => void;
+
+const X = (props: {
+ a: boolean,
+}) =>
+ ;
+
+=====================================output=====================================
+function StatelessFunctionalComponent4({
+ isActive,
+ onFiltersUpdated,
+ onSelect,
+ onSubmitAndDeselect,
+ onCancel,
+ searchFilters,
+ title,
+ items,
+}: MyType | null | void) {
+ return ;
+}
+
+const StatelessFunctionalComponent5 = ({
+ isActive,
+ onFiltersUpdated,
+ onSelect,
+ onSubmitAndDeselect,
+ onCancel,
+ searchFilters,
+ title,
+ items,
+}: {
+ isActive: number,
+ onFiltersUpdated: number,
+ onSelect: number,
+ onSubmitAndDeselect: number,
+ onCancel: number,
+ searchFilters: number,
+ title: number,
+ items: number,
+}) => {
+ return ;
+};
+
+type T = ({
+ isActive: number,
+ onFiltersUpdated: number,
+ onSelect: number,
+ onSubmitAndDeselect: number,
+ onCancel: number,
+ searchFilters: number,
+ title: number,
+ items: number,
+}) => void;
+
+const X = (props: { a: boolean }) => ;
+
+================================================================================
+`;
diff --git a/tests/flow/function-single-destructuring/array.js b/tests/flow/function-single-destructuring/array.js
new file mode 100644
index 000000000..536efe075
--- /dev/null
+++ b/tests/flow/function-single-destructuring/array.js
@@ -0,0 +1,3 @@
+function excludeFirstFiveResults4([first, second, third, fourth, fifth, ...rest]: Result[]) {
+ return rest;
+}
diff --git a/tests/flow/function-single-destructuring/jsfmt.spec.js b/tests/flow/function-single-destructuring/jsfmt.spec.js
new file mode 100644
index 000000000..fbfa6501a
--- /dev/null
+++ b/tests/flow/function-single-destructuring/jsfmt.spec.js
@@ -0,0 +1 @@
+run_spec(__dirname, ["flow", "babel"]);
diff --git a/tests/flow/function-single-destructuring/object.js b/tests/flow/function-single-destructuring/object.js
new file mode 100644
index 000000000..241627eaa
--- /dev/null
+++ b/tests/flow/function-single-destructuring/object.js
@@ -0,0 +1,50 @@
+function StatelessFunctionalComponent4({
+ isActive,
+ onFiltersUpdated,
+ onSelect,
+ onSubmitAndDeselect,
+ onCancel,
+ searchFilters,
+ title,
+ items,
+}: MyType | null | void) {
+ return
+}
+
+const StatelessFunctionalComponent5 = ({
+ isActive,
+ onFiltersUpdated,
+ onSelect,
+ onSubmitAndDeselect,
+ onCancel,
+ searchFilters,
+ title,
+ items,
+}: {
+ isActive: number,
+ onFiltersUpdated: number,
+ onSelect: number,
+ onSubmitAndDeselect: number,
+ onCancel: number,
+ searchFilters: number,
+ title: number,
+ items: number,
+}) => {
+ return
+};
+
+type T = ({
+ isActive: number,
+ onFiltersUpdated: number,
+ onSelect: number,
+ onSubmitAndDeselect: number,
+ onCancel: number,
+ searchFilters: number,
+ title: number,
+ items: number,
+}) => void;
+
+const X = (props: {
+ a: boolean,
+}) =>
+ ;
diff --git a/tests/flow/ignore/__snapshots__/jsfmt.spec.js.snap b/tests/flow/ignore/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..de5212b5d
--- /dev/null
+++ b/tests/flow/ignore/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,36 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`ignore.js format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+function a() {
+ // Incorrectly indented on purpose
+ function f* prettier-ignore */ T : B>(
+ a : Array < number > // prettier-ignore
+ ) {
+
+ call(
+ f( 1 )
+ // prettier-ignore
+ )
+ }
+}
+
+=====================================output=====================================
+function a() {
+ // Incorrectly indented on purpose
+ function f* prettier-ignore */ T : B>(
+ a : Array < number > // prettier-ignore
+ ) {
+ call(
+ f( 1 )
+ // prettier-ignore
+ );
+ }
+}
+
+================================================================================
+`;
diff --git a/tests/flow/ignore/ignore.js b/tests/flow/ignore/ignore.js
new file mode 100644
index 000000000..bcfdb517e
--- /dev/null
+++ b/tests/flow/ignore/ignore.js
@@ -0,0 +1,12 @@
+function a() {
+ // Incorrectly indented on purpose
+ function f* prettier-ignore */ T : B>(
+ a : Array < number > // prettier-ignore
+ ) {
+
+ call(
+ f( 1 )
+ // prettier-ignore
+ )
+ }
+}
diff --git a/tests/flow/ignore/jsfmt.spec.js b/tests/flow/ignore/jsfmt.spec.js
new file mode 100644
index 000000000..fbfa6501a
--- /dev/null
+++ b/tests/flow/ignore/jsfmt.spec.js
@@ -0,0 +1 @@
+run_spec(__dirname, ["flow", "babel"]);
diff --git a/tests/flow/no-semi/__snapshots__/jsfmt.spec.js.snap b/tests/flow/no-semi/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..2a25e9c70
--- /dev/null
+++ b/tests/flow/no-semi/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,282 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`comments.js - {"semi":false} format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+semi: false
+ | printWidth
+=====================================input======================================
+let error = new Error(response.statusText);
+// comment
+(error: any).response = response
+
+x;
+
+/* comment */ (error: any).response = response
+
+x;
+
+(error: any).response = response; /* comment */
+
+=====================================output=====================================
+let error = new Error(response.statusText)
+// comment
+;(error: any).response = response
+
+x
+
+/* comment */ ;(error: any).response = response
+
+x
+
+;(error: any).response = response /* comment */
+
+================================================================================
+`;
+
+exports[`comments.js format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+let error = new Error(response.statusText);
+// comment
+(error: any).response = response
+
+x;
+
+/* comment */ (error: any).response = response
+
+x;
+
+(error: any).response = response; /* comment */
+
+=====================================output=====================================
+let error = new Error(response.statusText);
+// comment
+(error: any).response = response;
+
+x;
+
+/* comment */ (error: any).response = response;
+
+x;
+
+(error: any).response = response; /* comment */
+
+================================================================================
+`;
+
+exports[`flow-interfaces.js - {"semi":false} format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+semi: false
+ | printWidth
+=====================================input======================================
+declare class A {
+ one: boolean;
+ two: { three: string }
+ | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// declare class B {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+declare interface C {
+ one: boolean;
+ two: { three: string }
+ | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// declare interface D {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+interface E {
+ one: boolean;
+ two: { three: string }
+ | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// interface F {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+=====================================output=====================================
+declare class A {
+ one: boolean;
+ two: { three: string } | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// declare class B {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+declare interface C {
+ one: boolean;
+ two: { three: string } | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// declare interface D {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+interface E {
+ one: boolean;
+ two: { three: string } | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// interface F {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+================================================================================
+`;
+
+exports[`flow-interfaces.js format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+declare class A {
+ one: boolean;
+ two: { three: string }
+ | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// declare class B {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+declare interface C {
+ one: boolean;
+ two: { three: string }
+ | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// declare interface D {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+interface E {
+ one: boolean;
+ two: { three: string }
+ | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// interface F {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+=====================================output=====================================
+declare class A {
+ one: boolean;
+ two: { three: string } | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// declare class B {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+declare interface C {
+ one: boolean;
+ two: { three: string } | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// declare interface D {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+interface E {
+ one: boolean;
+ two: { three: string } | number;
+}
+
+// NOTE: Flow and Babel both fail to apply ASI here
+// interface F {
+// one: boolean
+// two: { three: string }
+// | number
+// }
+
+================================================================================
+`;
+
+exports[`no-semi.js - {"semi":false} format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+semi: false
+ | printWidth
+=====================================input======================================
+// flow
+
+(x: void);
+(y: void)
+
+=====================================output=====================================
+// flow
+
+;(x: void)
+;(y: void)
+
+================================================================================
+`;
+
+exports[`no-semi.js format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+// flow
+
+(x: void);
+(y: void)
+
+=====================================output=====================================
+// flow
+
+(x: void);
+(y: void);
+
+================================================================================
+`;
diff --git a/tests/flow/no-semi/comments.js b/tests/flow/no-semi/comments.js
new file mode 100644
index 000000000..34f27c796
--- /dev/null
+++ b/tests/flow/no-semi/comments.js
@@ -0,0 +1,11 @@
+let error = new Error(response.statusText);
+// comment
+(error: any).response = response
+
+x;
+
+/* comment */ (error: any).response = response
+
+x;
+
+(error: any).response = response; /* comment */
diff --git a/tests/js/no-semi/flow-interfaces.js b/tests/flow/no-semi/flow-interfaces.js
similarity index 100%
rename from tests/js/no-semi/flow-interfaces.js
rename to tests/flow/no-semi/flow-interfaces.js
diff --git a/tests/flow/no-semi/jsfmt.spec.js b/tests/flow/no-semi/jsfmt.spec.js
new file mode 100644
index 000000000..2f93d9870
--- /dev/null
+++ b/tests/flow/no-semi/jsfmt.spec.js
@@ -0,0 +1,2 @@
+run_spec(__dirname, ["flow", "babel"]);
+run_spec(__dirname, ["flow", "babel"], { semi: false });
diff --git a/tests/flow/no-semi/no-semi.js b/tests/flow/no-semi/no-semi.js
new file mode 100644
index 000000000..f24ab7eaa
--- /dev/null
+++ b/tests/flow/no-semi/no-semi.js
@@ -0,0 +1,4 @@
+// flow
+
+(x: void);
+(y: void)
diff --git a/tests/flow/object-property-comment/__snapshots__/jsfmt.spec.js.snap b/tests/flow/object-property-comment/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..38c611665
--- /dev/null
+++ b/tests/flow/object-property-comment/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,48 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`comment.js format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+o = {
+ name:
+ // Comment A
+ // Comment B
+ (({id: type}: any): CreativeConcept),
+};
+
+o = {
+ name: // Comment A
+ // Comment B
+ (({ id: type }: any): CreativeConcept)
+};
+
+o = {
+ name: // Comment B // Comment A
+ (({ id: type }: any): CreativeConcept)
+};
+
+=====================================output=====================================
+o = {
+ name:
+ // Comment A
+ // Comment B
+ (({ id: type }: any): CreativeConcept),
+};
+
+o = {
+ // Comment A
+ name:
+ // Comment B
+ (({ id: type }: any): CreativeConcept),
+};
+
+o = {
+ // Comment B // Comment A
+ name: (({ id: type }: any): CreativeConcept),
+};
+
+================================================================================
+`;
diff --git a/tests/js/object-property-comment/comment.js b/tests/flow/object-property-comment/comment.js
similarity index 100%
rename from tests/js/object-property-comment/comment.js
rename to tests/flow/object-property-comment/comment.js
diff --git a/tests/flow/object-property-comment/jsfmt.spec.js b/tests/flow/object-property-comment/jsfmt.spec.js
new file mode 100644
index 000000000..fbfa6501a
--- /dev/null
+++ b/tests/flow/object-property-comment/jsfmt.spec.js
@@ -0,0 +1 @@
+run_spec(__dirname, ["flow", "babel"]);
diff --git a/tests/flow/template/__snapshots__/jsfmt.spec.js.snap b/tests/flow/template/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..1c55a27f1
--- /dev/null
+++ b/tests/flow/template/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,65 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`inline.js format 1`] = `
+====================================options=====================================
+parsers: ["flow", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+(): {
+ someLong: boolean,
+ t: boolean
+} => \`
+ a
+\`;
+
+(): {
+ someLong: boolean,
+ t: boolean
+} =>
+ \`
+ a
+ \`;
+
+(
+ someLong: boolean,
+ t: boolean
+) => \`
+ a
+ \`;
+
+(
+ someLong: boolean,
+ t: boolean
+) =>
+ \`
+ a
+ \`;
+
+=====================================output=====================================
+(): {
+ someLong: boolean,
+ t: boolean,
+} => \`
+ a
+\`;
+
+(): {
+ someLong: boolean,
+ t: boolean,
+} =>
+ \`
+ a
+ \`;
+
+(someLong: boolean, t: boolean) => \`
+ a
+ \`;
+
+(someLong: boolean, t: boolean) =>
+ \`
+ a
+ \`;
+
+================================================================================
+`;
diff --git a/tests/flow/template/inline.js b/tests/flow/template/inline.js
new file mode 100644
index 000000000..2e602c0f3
--- /dev/null
+++ b/tests/flow/template/inline.js
@@ -0,0 +1,29 @@
+(): {
+ someLong: boolean,
+ t: boolean
+} => `
+ a
+`;
+
+(): {
+ someLong: boolean,
+ t: boolean
+} =>
+ `
+ a
+ `;
+
+(
+ someLong: boolean,
+ t: boolean
+) => `
+ a
+ `;
+
+(
+ someLong: boolean,
+ t: boolean
+) =>
+ `
+ a
+ `;
diff --git a/tests/flow/template/jsfmt.spec.js b/tests/flow/template/jsfmt.spec.js
new file mode 100644
index 000000000..fbfa6501a
--- /dev/null
+++ b/tests/flow/template/jsfmt.spec.js
@@ -0,0 +1 @@
+run_spec(__dirname, ["flow", "babel"]);
diff --git a/tests/js/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrows/__snapshots__/jsfmt.spec.js.snap
index 2a0349ec5..f7d478fcc 100644
--- a/tests/js/arrows/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/arrows/__snapshots__/jsfmt.spec.js.snap
@@ -33,7 +33,6 @@ x => ({}()())
x => ({}()\`\`)
x => ({}().b);
a = b => c;
-a = (b?) => c;
x => (y = z);
x => (y += z);
f(a => ({})) + 1;
@@ -71,7 +70,6 @@ a = () => ({}, a);
(x) => ({}()\`\`);
(x) => ({}().b);
a = (b) => c;
-a = (b?) => c;
(x) => (y = z);
(x) => (y += z);
f((a) => ({})) + 1;
@@ -117,7 +115,6 @@ x => ({}()())
x => ({}()\`\`)
x => ({}().b);
a = b => c;
-a = (b?) => c;
x => (y = z);
x => (y += z);
f(a => ({})) + 1;
@@ -155,7 +152,6 @@ x => ({}()());
x => ({}()\`\`);
x => ({}().b);
a = b => c;
-a = (b?) => c;
x => (y = z);
x => (y += z);
f(a => ({})) + 1;
@@ -2217,83 +2213,3 @@ foo(a => b, d);
================================================================================
`;
-
-exports[`short_body.js - {"arrowParens":"always"} format 1`] = `
-====================================options=====================================
-arrowParens: "always"
-parsers: ["babel", "typescript"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-const initializeSnapshotState = (
- testFile: Path,
- update: boolean,
- testPath: string,
- expand: boolean,
-) => new SnapshotState(testFile, update, testPath, expand);
-
-=====================================output=====================================
-const initializeSnapshotState = (
- testFile: Path,
- update: boolean,
- testPath: string,
- expand: boolean
-) => new SnapshotState(testFile, update, testPath, expand);
-
-================================================================================
-`;
-
-exports[`short_body.js - {"arrowParens":"avoid"} format 1`] = `
-====================================options=====================================
-arrowParens: "avoid"
-parsers: ["babel", "typescript"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-const initializeSnapshotState = (
- testFile: Path,
- update: boolean,
- testPath: string,
- expand: boolean,
-) => new SnapshotState(testFile, update, testPath, expand);
-
-=====================================output=====================================
-const initializeSnapshotState = (
- testFile: Path,
- update: boolean,
- testPath: string,
- expand: boolean
-) => new SnapshotState(testFile, update, testPath, expand);
-
-================================================================================
-`;
-
-exports[`type_params.js - {"arrowParens":"always"} format 1`] = `
-====================================options=====================================
-arrowParens: "always"
-parsers: ["babel", "typescript"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-(a) => { }
-
-=====================================output=====================================
-(a) => {};
-
-================================================================================
-`;
-
-exports[`type_params.js - {"arrowParens":"avoid"} format 1`] = `
-====================================options=====================================
-arrowParens: "avoid"
-parsers: ["babel", "typescript"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-(a) => { }
-
-=====================================output=====================================
-(a) => {};
-
-================================================================================
-`;
diff --git a/tests/js/arrows/arrow_function_expression.js b/tests/js/arrows/arrow_function_expression.js
index ceae6d7ae..d2215a73b 100644
--- a/tests/js/arrows/arrow_function_expression.js
+++ b/tests/js/arrows/arrow_function_expression.js
@@ -24,7 +24,6 @@ x => ({}()())
x => ({}()``)
x => ({}().b);
a = b => c;
-a = (b?) => c;
x => (y = z);
x => (y += z);
f(a => ({})) + 1;
diff --git a/tests/js/class-comment/__snapshots__/jsfmt.spec.js.snap b/tests/js/class-comment/__snapshots__/jsfmt.spec.js.snap
index 728892bc9..7c34cc5da 100644
--- a/tests/js/class-comment/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/class-comment/__snapshots__/jsfmt.spec.js.snap
@@ -1,254 +1,26 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`class-implements.js format 1`] = `
+exports[`class-property.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
-class a1 extends b // comment
-implements z
-{
- constructor() {}
-}
-
-class a2 extends b implements z { // comment
- constructor() {}
-}
-
-class a3 extends b
-implements
-// comment
-z,
-y {
- constructor() {}
-}
-
-class a4 extends b
-implements z, // comment
-y {
- constructor() {}
-}
-
-class a5 extends b implements
- z, // comment-z
- y // comment-y
- {
- constructor() {}
-}
-
-class a6 extends b implements
-// comment-z1
- z, // comment-z2
- // comment-y1
- y // comment-y2
- {
- constructor() {}
-}
-
-class a7 extends b implements
-// comment-z1
- z, // comment-z2
- // comment-y1
- y // comment-y2
- // comment-y3
- {
- //comment-body
- constructor() {}
-}
-
-class a8 extends b // comment-b
- implements
-// comment-z1
- z, // comment-z2
- // comment-y1
- y // comment-y2
- {
- constructor() {}
-}
-
-class a9 extends
-// comment-b1
-b // comment-b2
-// comment-b3
- implements
-// comment-z1
- z, // comment-z2
- // comment-y1
- y // comment-y2
- {
- constructor() {}
+class X {
+ TEMPLATE =
+ // tab index is needed so we can focus, which is needed for keyboard events
+ '';
}
=====================================output=====================================
-class a1
- extends b // comment
- implements z {
- constructor() {}
-}
-
-class a2 extends b implements z {
- // comment
- constructor() {}
-}
-
-class a3
- extends b
- // comment
- implements z, y {
- constructor() {}
-}
-
-class a4
- extends b
- implements
- z, // comment
- y {
- constructor() {}
-}
-
-class a5
- extends b
- implements
- z, // comment-z
- y {
- // comment-y
- constructor() {}
-}
-
-class a6
- extends b
- // comment-z1
- implements
- z, // comment-z2
- // comment-y1
- y {
- // comment-y2
- constructor() {}
-}
-
-class a7
- extends b
- // comment-z1
- implements
- z, // comment-z2
- // comment-y1
- y {
- // comment-y2
- // comment-y3
- //comment-body
- constructor() {}
-}
-
-class a8
- extends b // comment-b
- // comment-z1
- implements
- z, // comment-z2
- // comment-y1
- y {
- // comment-y2
- constructor() {}
-}
-
-class a9
- // comment-b1
- extends b // comment-b2
- // comment-b3
- // comment-z1
- implements
- z, // comment-z2
- // comment-y1
- y {
- // comment-y2
- constructor() {}
-}
-
-================================================================================
-`;
-
-exports[`declare.js format 1`] = `
-====================================options=====================================
-parsers: ["babel", "flow", "typescript"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-declare class a // 1
- // extends b // 2
- implements z,x // 3
-{
- doo:boolean
-}
-
-declare class A1 // 1
-// 2
-extends B // 3
-{}
-
-=====================================output=====================================
-declare class a // 1
- // extends b // 2
- implements z, x {
- // 3
- doo: boolean;
-}
-
-declare class A1 // 1
- // 2
- extends B {
- // 3
-}
-
-================================================================================
-`;
-
-exports[`generic.js format 1`] = `
-====================================options=====================================
-parsers: ["babel", "flow", "typescript"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-class G1 implements IPoly {
- x: T;
-}
-
-class G2 // g2
- implements IPoly {
- x: T;
-}
-
-class G3 // g3
- extends U implements IPoly {
- x: T;
-}
-
-class G4 extends U implements IPoly {
- x: T;
-}
-
-=====================================output=====================================
-class G1 implements IPoly {
- x: T;
-}
-
-class G2 // g2
- implements IPoly {
- x: T;
-}
-
-class G3 // g3
- extends U
- implements IPoly {
- x: T;
-}
-
-class G4<
- T // g4
- >
- extends U
- implements IPoly {
- x: T;
+class X {
+ TEMPLATE =
+ // tab index is needed so we can focus, which is needed for keyboard events
+ '";
}
================================================================================
@@ -267,22 +39,6 @@ class x {
}
}
-class X {
- TEMPLATE =
- // tab index is needed so we can focus, which is needed for keyboard events
- '';
-}
-
-export class SnapshotLogger {
- constructor(
- retentionPeriod: number = 5 * 60 * 1000, // retain past five minutes
- snapshotInterval: number = 30 * 1000, // snapshot no more than every 30s
- ) {
- }
-}
-
=====================================output=====================================
class x {
focus() { // comment 1
@@ -290,21 +46,6 @@ class x {
}
}
-class X {
- TEMPLATE =
- // tab index is needed so we can focus, which is needed for keyboard events
- '";
-}
-
-export class SnapshotLogger {
- constructor(
- retentionPeriod: number = 5 * 60 * 1000, // retain past five minutes
- snapshotInterval: number = 30 * 1000 // snapshot no more than every 30s
- ) {}
-}
-
================================================================================
`;
diff --git a/tests/js/class-comment/class-property.js b/tests/js/class-comment/class-property.js
new file mode 100644
index 000000000..9ceb7dce9
--- /dev/null
+++ b/tests/js/class-comment/class-property.js
@@ -0,0 +1,7 @@
+class X {
+ TEMPLATE =
+ // tab index is needed so we can focus, which is needed for keyboard events
+ '';
+}
diff --git a/tests/js/class-comment/misc.js b/tests/js/class-comment/misc.js
index 3e6f521a0..628db6655 100644
--- a/tests/js/class-comment/misc.js
+++ b/tests/js/class-comment/misc.js
@@ -4,19 +4,3 @@ class x {
// comment 2
}
}
-
-class X {
- TEMPLATE =
- // tab index is needed so we can focus, which is needed for keyboard events
- '';
-}
-
-export class SnapshotLogger {
- constructor(
- retentionPeriod: number = 5 * 60 * 1000, // retain past five minutes
- snapshotInterval: number = 30 * 1000, // snapshot no more than every 30s
- ) {
- }
-}
diff --git a/tests/js/classes/__snapshots__/jsfmt.spec.js.snap b/tests/js/classes/__snapshots__/jsfmt.spec.js.snap
index 15c6e89f9..d073c79fa 100644
--- a/tests/js/classes/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/classes/__snapshots__/jsfmt.spec.js.snap
@@ -20,96 +20,6 @@ printWidth: 80
================================================================================
`;
-exports[`break.js format 1`] = `
-====================================options=====================================
-parsers: ["babel", "flow", "typescript"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-class MyContractSelectionWidget extends React.Component implements SomethingLarge {
- method() {}
-}
-
-class DisplayObject1
- extends utils.EventEmitter
- implements interaction_InteractiveTarget {
-}
-
-class DisplayObject2 extends utils.EventEmitter
- implements interaction_InteractiveTarget {
-}
-
-class DisplayObject3 extends utils.EventEmitter
- implements interaction_InteractiveTarget,
- somethingElse_SomeOtherThing,
- somethingElseAgain_RunningOutOfNames {
-}
-
-class DisplayObject4 extends utils.EventEmitter implements interaction_InteractiveTarget {}
-class Readable extends events.EventEmitter implements NodeJS_ReadableStream {}
-class InMemoryAppender extends log4javascript.Appender implements ICachedLogMessageProvider {}
-
-class Foo extends Immutable.Record({
- ipaddress: '',
-}) {
- ipaddress: string;
-}
-
-export class VisTimelineComponent
- implements AfterViewInit, OnChanges, OnDestroy {
-}
-export class VisTimelineComponent2
- implements AfterViewInit, OnChanges, OnDestroy, AndSomethingReallyReallyLong {
-}
-
-=====================================output=====================================
-class MyContractSelectionWidget
- extends React.Component
- implements SomethingLarge {
- method() {}
-}
-
-class DisplayObject1
- extends utils.EventEmitter
- implements interaction_InteractiveTarget {}
-
-class DisplayObject2
- extends utils.EventEmitter
- implements interaction_InteractiveTarget {}
-
-class DisplayObject3
- extends utils.EventEmitter
- implements
- interaction_InteractiveTarget,
- somethingElse_SomeOtherThing,
- somethingElseAgain_RunningOutOfNames {}
-
-class DisplayObject4
- extends utils.EventEmitter
- implements interaction_InteractiveTarget {}
-class Readable extends events.EventEmitter implements NodeJS_ReadableStream {}
-class InMemoryAppender
- extends log4javascript.Appender
- implements ICachedLogMessageProvider {}
-
-class Foo extends Immutable.Record({
- ipaddress: "",
-}) {
- ipaddress: string;
-}
-
-export class VisTimelineComponent
- implements AfterViewInit, OnChanges, OnDestroy {}
-export class VisTimelineComponent2
- implements
- AfterViewInit,
- OnChanges,
- OnDestroy,
- AndSomethingReallyReallyLong {}
-
-================================================================================
-`;
-
exports[`call.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
diff --git a/tests/js/comments/__snapshots__/jsfmt.spec.js.snap b/tests/js/comments/__snapshots__/jsfmt.spec.js.snap
index ad6411e20..748be7411 100644
--- a/tests/js/comments/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/comments/__snapshots__/jsfmt.spec.js.snap
@@ -1158,8 +1158,6 @@ function d() {
}
new Thing(/* dangling */);
Thing(/* dangling */);
-Thing?.(/* dangling */);
-declare class Foo extends Qux {/* dangling */}
export /* dangling */{};
=====================================output=====================================
@@ -1177,10 +1175,6 @@ function d() {
}
new Thing(/* dangling */)
Thing(/* dangling */)
-Thing?.(/* dangling */)
-declare class Foo extends Qux {
- /* dangling */
-}
export /* dangling */{}
================================================================================
@@ -1202,8 +1196,6 @@ function d() {
}
new Thing(/* dangling */);
Thing(/* dangling */);
-Thing?.(/* dangling */);
-declare class Foo extends Qux {/* dangling */}
export /* dangling */{};
=====================================output=====================================
@@ -1221,10 +1213,6 @@ function d() {
}
new Thing(/* dangling */);
Thing(/* dangling */);
-Thing?.(/* dangling */);
-declare class Foo extends Qux {
- /* dangling */
-}
export /* dangling */{};
================================================================================
@@ -2174,12 +2162,6 @@ semi: 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({
@@ -2253,12 +2235,6 @@ foo({}
// 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({
@@ -2337,12 +2313,6 @@ printWidth: 80
// 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({
@@ -2416,12 +2386,6 @@ foo({}
// 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({
@@ -3108,59 +3072,6 @@ 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 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 {
- }
-}
-
-class X2 {
- getSectionMode(
- pageMetaData: PageMetaData,
- sectionMetaData: SectionMetaData = ['unknown']
- /* $FlowFixMe This error was exposed while converting keyMirror
- * to keyMirrorRecursive */
- ): $Enum {
- }
-}
class Foo {
a(lol /*string*/) {}
@@ -3204,58 +3115,6 @@ class Foo {
}
=====================================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 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 {},
-}
-
-class X2 {
- getSectionMode(
- pageMetaData: PageMetaData,
- sectionMetaData: SectionMetaData = ["unknown"]
- /* $FlowFixMe This error was exposed while converting keyMirror
- * to keyMirrorRecursive */
- ): $Enum {}
-}
-
class Foo {
a(lol /*string*/) {}
@@ -3300,59 +3159,6 @@ parsers: ["babel", "flow", "typescript"]
printWidth: 80
| 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 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 {
- }
-}
-
-class X2 {
- getSectionMode(
- pageMetaData: PageMetaData,
- sectionMetaData: SectionMetaData = ['unknown']
- /* $FlowFixMe This error was exposed while converting keyMirror
- * to keyMirrorRecursive */
- ): $Enum {
- }
-}
class Foo {
a(lol /*string*/) {}
@@ -3396,58 +3202,6 @@ class Foo {
}
=====================================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 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 {},
-};
-
-class X2 {
- getSectionMode(
- pageMetaData: PageMetaData,
- sectionMetaData: SectionMetaData = ["unknown"]
- /* $FlowFixMe This error was exposed while converting keyMirror
- * to keyMirrorRecursive */
- ): $Enum {}
-}
-
class Foo {
a(lol /*string*/) {}
diff --git a/tests/js/comments/dangling.js b/tests/js/comments/dangling.js
index 30ae92724..1dd97d1c3 100644
--- a/tests/js/comments/dangling.js
+++ b/tests/js/comments/dangling.js
@@ -8,6 +8,4 @@ function d() {
}
new Thing(/* dangling */);
Thing(/* dangling */);
-Thing?.(/* dangling */);
-declare class Foo extends Qux {/* dangling */}
export /* dangling */{};
diff --git a/tests/js/comments/issues.js b/tests/js/comments/issues.js
index 8fd1ea659..8ed30fb6e 100644
--- a/tests/js/comments/issues.js
+++ b/tests/js/comments/issues.js
@@ -1,12 +1,6 @@
// 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({
diff --git a/tests/js/comments/last-arg.js b/tests/js/comments/last-arg.js
index c6bdbd706..443d41ba3 100644
--- a/tests/js/comments/last-arg.js
+++ b/tests/js/comments/last-arg.js
@@ -1,56 +1,3 @@
-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 {
- }
-}
-
-class X2 {
- getSectionMode(
- pageMetaData: PageMetaData,
- sectionMetaData: SectionMetaData = ['unknown']
- /* $FlowFixMe This error was exposed while converting keyMirror
- * to keyMirrorRecursive */
- ): $Enum {
- }
-}
class Foo {
a(lol /*string*/) {}
diff --git a/tests/js/empty-paren-comment/__snapshots__/jsfmt.spec.js.snap b/tests/js/empty-paren-comment/__snapshots__/jsfmt.spec.js.snap
index ecd34d007..0151ae287 100644
--- a/tests/js/empty-paren-comment/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/empty-paren-comment/__snapshots__/jsfmt.spec.js.snap
@@ -25,6 +25,36 @@ class x {
================================================================================
`;
+exports[`class-property.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+class Foo {
+ f(/* ... */) {}
+ f() /* ... */ {}
+ f = (/* ... */) => {};
+ static f(/* ... */) {};
+ static f = (/* ... */) => {};
+ static f = function(/* ... */) {};
+ static f = function f(/* ... */) {};
+}
+
+=====================================output=====================================
+class Foo {
+ f(/* ... */) {}
+ f() /* ... */ {}
+ f = (/* ... */) => {};
+ static f(/* ... */) {}
+ static f = (/* ... */) => {};
+ static f = function (/* ... */) {};
+ static f = function f(/* ... */) {};
+}
+
+================================================================================
+`;
+
exports[`empty_paren_comment.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
@@ -42,16 +72,6 @@ const obj = {
f: function f(/* ... */) {}
}
-class Foo {
- f(/* ... */) {}
- f() /* ... */ {}
- f = (/* ... */) => {};
- static f(/* ... */) {};
- static f = (/* ... */) => {};
- static f = function(/* ... */) {};
- static f = function f(/* ... */) {};
-}
-
f(/* ... */);
f(a, /* ... */);
f(a, /* ... */ b);
@@ -72,16 +92,6 @@ const obj = {
f: function f(/* ... */) {},
};
-class Foo {
- f(/* ... */) {}
- f() /* ... */ {}
- f = (/* ... */) => {};
- static f(/* ... */) {}
- static f = (/* ... */) => {};
- static f = function (/* ... */) {};
- static f = function f(/* ... */) {};
-}
-
f(/* ... */);
f(a /* ... */);
f(a, /* ... */ b);
diff --git a/tests/js/empty-paren-comment/class-property.js b/tests/js/empty-paren-comment/class-property.js
new file mode 100644
index 000000000..498213c66
--- /dev/null
+++ b/tests/js/empty-paren-comment/class-property.js
@@ -0,0 +1,9 @@
+class Foo {
+ f(/* ... */) {}
+ f() /* ... */ {}
+ f = (/* ... */) => {};
+ static f(/* ... */) {};
+ static f = (/* ... */) => {};
+ static f = function(/* ... */) {};
+ static f = function f(/* ... */) {};
+}
diff --git a/tests/js/empty-paren-comment/empty_paren_comment.js b/tests/js/empty-paren-comment/empty_paren_comment.js
index efd379970..0af922fbd 100644
--- a/tests/js/empty-paren-comment/empty_paren_comment.js
+++ b/tests/js/empty-paren-comment/empty_paren_comment.js
@@ -9,16 +9,6 @@ const obj = {
f: function f(/* ... */) {}
}
-class Foo {
- f(/* ... */) {}
- f() /* ... */ {}
- f = (/* ... */) => {};
- static f(/* ... */) {};
- static f = (/* ... */) => {};
- static f = function(/* ... */) {};
- static f = function f(/* ... */) {};
-}
-
f(/* ... */);
f(a, /* ... */);
f(a, /* ... */ b);
diff --git a/tests/js/end-of-line/__snapshots__/jsfmt.spec.js.snap b/tests/js/end-of-line/__snapshots__/jsfmt.spec.js.snap
index dc4ee86fd..991edbedf 100644
--- a/tests/js/end-of-line/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/end-of-line/__snapshots__/jsfmt.spec.js.snap
@@ -56,180 +56,3 @@ function f() {
================================================================================
`;
-
-exports[`multiline.js - {"endOfLine":"cr"} format 1`] = `
-====================================options=====================================
-endOfLine: "cr"
-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\`
- );
- });
- }
-);
-
-================================================================================
-`;
-
-exports[`multiline.js - {"endOfLine":"crlf"} format 1`] = `
-====================================options=====================================
-endOfLine: "crlf"
-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\`
- );
- });
- }
-);
-
-================================================================================
-`;
-
-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/js/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap b/tests/js/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap
index f66df8808..878103c30 100644
--- a/tests/js/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/function-single-destructuring/__snapshots__/jsfmt.spec.js.snap
@@ -18,10 +18,6 @@ function excludeFirstFiveResults3([firstResult, secondResult, thirdResult, fourt
return rest;
}
-function excludeFirstFiveResults4([first, second, third, fourth, fifth, ...rest]: Result[]) {
- return rest;
-}
-
const excludeFirstFiveResults5 = ([first, second, third, fourth, fifth, ...rest]) => {
return rest;
}
@@ -72,17 +68,6 @@ function excludeFirstFiveResults3(
return rest;
}
-function excludeFirstFiveResults4([
- first,
- second,
- third,
- fourth,
- fifth,
- ...rest
-]: Result[]) {
- return rest;
-}
-
const excludeFirstFiveResults5 = ([
first,
second,
@@ -172,40 +157,6 @@ function StatelessFunctionalComponent3(
return
}
-function StatelessFunctionalComponent4({
- isActive,
- onFiltersUpdated,
- onSelect,
- onSubmitAndDeselect,
- onCancel,
- searchFilters,
- title,
- items,
-}: MyType | null | void) {
- return
-}
-
-const StatelessFunctionalComponent5 = ({
- isActive,
- onFiltersUpdated,
- onSelect,
- onSubmitAndDeselect,
- onCancel,
- searchFilters,
- title,
- items,
-}: {
- isActive: number,
- onFiltersUpdated: number,
- onSelect: number,
- onSubmitAndDeselect: number,
- onCancel: number,
- searchFilters: number,
- title: number,
- items: number,
-}) => {
- return
-};
class C {
StatelessFunctionalComponent({
@@ -222,22 +173,6 @@ class C {
}
}
-type T = ({
- isActive: number,
- onFiltersUpdated: number,
- onSelect: number,
- onSubmitAndDeselect: number,
- onCancel: number,
- searchFilters: number,
- title: number,
- items: number,
-}) => void;
-
-const X = (props: {
- a: boolean,
-}) =>
- ;
-
=====================================output=====================================
function StatelessFunctionalComponent({
isActive,
@@ -282,41 +217,6 @@ function StatelessFunctionalComponent3(
return ;
}
-function StatelessFunctionalComponent4({
- isActive,
- onFiltersUpdated,
- onSelect,
- onSubmitAndDeselect,
- onCancel,
- searchFilters,
- title,
- items,
-}: MyType | null | void) {
- return ;
-}
-
-const StatelessFunctionalComponent5 = ({
- isActive,
- onFiltersUpdated,
- onSelect,
- onSubmitAndDeselect,
- onCancel,
- searchFilters,
- title,
- items,
-}: {
- isActive: number,
- onFiltersUpdated: number,
- onSelect: number,
- onSubmitAndDeselect: number,
- onCancel: number,
- searchFilters: number,
- title: number,
- items: number,
-}) => {
- return ;
-};
-
class C {
StatelessFunctionalComponent({
isActive,
@@ -332,18 +232,5 @@ class C {
}
}
-type T = ({
- isActive: number,
- onFiltersUpdated: number,
- onSelect: number,
- onSubmitAndDeselect: number,
- onCancel: number,
- searchFilters: number,
- title: number,
- items: number,
-}) => void;
-
-const X = (props: { a: boolean }) => ;
-
================================================================================
`;
diff --git a/tests/js/function-single-destructuring/array.js b/tests/js/function-single-destructuring/array.js
index 833deeb7d..6e5f35197 100644
--- a/tests/js/function-single-destructuring/array.js
+++ b/tests/js/function-single-destructuring/array.js
@@ -10,10 +10,6 @@ function excludeFirstFiveResults3([firstResult, secondResult, thirdResult, fourt
return rest;
}
-function excludeFirstFiveResults4([first, second, third, fourth, fifth, ...rest]: Result[]) {
- return rest;
-}
-
const excludeFirstFiveResults5 = ([first, second, third, fourth, fifth, ...rest]) => {
return rest;
}
diff --git a/tests/js/function-single-destructuring/object.js b/tests/js/function-single-destructuring/object.js
index fb473faaa..822677e03 100644
--- a/tests/js/function-single-destructuring/object.js
+++ b/tests/js/function-single-destructuring/object.js
@@ -41,40 +41,6 @@ function StatelessFunctionalComponent3(
return
}
-function StatelessFunctionalComponent4({
- isActive,
- onFiltersUpdated,
- onSelect,
- onSubmitAndDeselect,
- onCancel,
- searchFilters,
- title,
- items,
-}: MyType | null | void) {
- return
-}
-
-const StatelessFunctionalComponent5 = ({
- isActive,
- onFiltersUpdated,
- onSelect,
- onSubmitAndDeselect,
- onCancel,
- searchFilters,
- title,
- items,
-}: {
- isActive: number,
- onFiltersUpdated: number,
- onSelect: number,
- onSubmitAndDeselect: number,
- onCancel: number,
- searchFilters: number,
- title: number,
- items: number,
-}) => {
- return
-};
class C {
StatelessFunctionalComponent({
@@ -90,19 +56,3 @@ class C {
return
}
}
-
-type T = ({
- isActive: number,
- onFiltersUpdated: number,
- onSelect: number,
- onSubmitAndDeselect: number,
- onCancel: number,
- searchFilters: number,
- title: number,
- items: number,
-}) => void;
-
-const X = (props: {
- a: boolean,
-}) =>
- ;
diff --git a/tests/js/function/__snapshots__/jsfmt.spec.js.snap b/tests/js/function/__snapshots__/jsfmt.spec.js.snap
index 05a2af2e2..5cb573c3a 100644
--- a/tests/js/function/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/function/__snapshots__/jsfmt.spec.js.snap
@@ -33,41 +33,3 @@ new (function () {})();
================================================================================
`;
-
-exports[`single_expand.js format 1`] = `
-====================================options=====================================
-parsers: ["babel", "flow", "typescript"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-function onDidInsertSuggestion({
- editor,
- triggerPosition,
- re
-}): Promise {
-}
-
-class X {
- async onDidInsertSuggestion({editor, triggerPosition, suggestion}): Promise<
- void
- > {
- }
-}
-
-=====================================output=====================================
-function onDidInsertSuggestion({
- editor,
- triggerPosition,
- re,
-}): Promise {}
-
-class X {
- async onDidInsertSuggestion({
- editor,
- triggerPosition,
- suggestion,
- }): Promise {}
-}
-
-================================================================================
-`;
diff --git a/tests/js/functional-composition/__snapshots__/jsfmt.spec.js.snap b/tests/js/functional-composition/__snapshots__/jsfmt.spec.js.snap
index 5ba85dfe1..25fee5bb5 100644
--- a/tests/js/functional-composition/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/functional-composition/__snapshots__/jsfmt.spec.js.snap
@@ -282,7 +282,7 @@ printWidth: 80
)
)()
.then(messageResponse(logger, msg))
- .catch((err: Error) => {
+ .catch((err) => {
logger.error(
pipe(
O.fromNullable(err.stack),
@@ -315,7 +315,7 @@ printWidth: 80
TE.chain(flow(publishServiceEvent(analytics), TE.mapLeft(nackFromError)))
)()
.then(messageResponse(logger, msg))
- .catch((err: Error) => {
+ .catch((err) => {
logger.error(
pipe(O.fromNullable(err.stack), O.getOrElse(constant(err.message)))
);
@@ -359,7 +359,7 @@ printWidth: 80
)
)()
.then(messageResponse(logger, msg))
- .catch((err: Error) => {
+ .catch((err) => {
logger.error(
pipe(
// add a descriptive comment here
@@ -410,7 +410,7 @@ printWidth: 80
)
)()
.then(messageResponse(logger, msg))
- .catch((err: Error) => {
+ .catch((err) => {
logger.error(
pipe(
// add a descriptive comment here
diff --git a/tests/js/functional-composition/pipe-function-calls-with-comments.js b/tests/js/functional-composition/pipe-function-calls-with-comments.js
index 8d7066e2f..7e6a13544 100644
--- a/tests/js/functional-composition/pipe-function-calls-with-comments.js
+++ b/tests/js/functional-composition/pipe-function-calls-with-comments.js
@@ -21,7 +21,7 @@
)
)()
.then(messageResponse(logger, msg))
- .catch((err: Error) => {
+ .catch((err) => {
logger.error(
pipe(
// add a descriptive comment here
diff --git a/tests/js/functional-composition/pipe-function-calls.js b/tests/js/functional-composition/pipe-function-calls.js
index 7cc62e012..d7e7ac409 100644
--- a/tests/js/functional-composition/pipe-function-calls.js
+++ b/tests/js/functional-composition/pipe-function-calls.js
@@ -16,7 +16,7 @@
)
)()
.then(messageResponse(logger, msg))
- .catch((err: Error) => {
+ .catch((err) => {
logger.error(
pipe(
O.fromNullable(err.stack),
diff --git a/tests/js/ignore/__snapshots__/jsfmt.spec.js.snap b/tests/js/ignore/__snapshots__/jsfmt.spec.js.snap
index f1fddfeaa..97a5134c5 100644
--- a/tests/js/ignore/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/ignore/__snapshots__/jsfmt.spec.js.snap
@@ -57,17 +57,6 @@ function a() {
'Once this is done, commit anything to the repository to restart ' +
'Travis and it should work :)'
);
-
- // Incorrectly indented on purpose
- function f* prettier-ignore */ T : B>(
- a : Array < number > // prettier-ignore
- ) {
-
- call(
- f( 1 )
- // prettier-ignore
- )
- }
}
const response = {
@@ -128,16 +117,6 @@ function a() {
'Once this is done, commit anything to the repository to restart ' +
'Travis and it should work :)'
);
-
- // Incorrectly indented on purpose
- function f* prettier-ignore */ T : B>(
- a : Array < number > // prettier-ignore
- ) {
- call(
- f( 1 )
- // prettier-ignore
- );
- }
}
const response = {
diff --git a/tests/js/ignore/ignore.js b/tests/js/ignore/ignore.js
index 8ac7d275f..71a787035 100644
--- a/tests/js/ignore/ignore.js
+++ b/tests/js/ignore/ignore.js
@@ -49,17 +49,6 @@ function a() {
'Once this is done, commit anything to the repository to restart ' +
'Travis and it should work :)'
);
-
- // Incorrectly indented on purpose
- function f* prettier-ignore */ T : B>(
- a : Array < number > // prettier-ignore
- ) {
-
- call(
- f( 1 )
- // prettier-ignore
- )
- }
}
const response = {
diff --git a/tests/js/interface/jsfmt.spec.js b/tests/js/interface/jsfmt.spec.js
deleted file mode 100644
index eb85eda6b..000000000
--- a/tests/js/interface/jsfmt.spec.js
+++ /dev/null
@@ -1 +0,0 @@
-run_spec(__dirname, ["babel", "flow", "typescript"]);
diff --git a/tests/js/last-argument-expansion/__snapshots__/jsfmt.spec.js.snap b/tests/js/last-argument-expansion/__snapshots__/jsfmt.spec.js.snap
index 6f6c26242..c52a30092 100644
--- a/tests/js/last-argument-expansion/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/last-argument-expansion/__snapshots__/jsfmt.spec.js.snap
@@ -46,44 +46,6 @@ export default function searchUsers(action$) {
================================================================================
`;
-exports[`break.js format 1`] = `
-====================================options=====================================
-parsers: ["babel", "flow"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-export default class AddAssetHtmlPlugin {
- apply(compiler: WebpackCompilerType) {
- compiler.plugin('compilation', (compilation: WebpackCompilationType) => {
- compilation.plugin('html-webpack-plugin-before-html', (callback: Callback) => {
- addAllAssetsToCompilation(this.assets, compilation, htmlPluginData, callback);
- });
- });
- }
-}
-
-=====================================output=====================================
-export default class AddAssetHtmlPlugin {
- apply(compiler: WebpackCompilerType) {
- compiler.plugin("compilation", (compilation: WebpackCompilationType) => {
- compilation.plugin(
- "html-webpack-plugin-before-html",
- (callback: Callback) => {
- addAllAssetsToCompilation(
- this.assets,
- compilation,
- htmlPluginData,
- callback
- );
- }
- );
- });
- }
-}
-
-================================================================================
-`;
-
exports[`break-parent.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow"]
@@ -154,16 +116,7 @@ parsers: ["babel", "flow"]
printWidth: 80
| printWidth
=====================================input======================================
-var listener = DOM.listen(
- introCard,
- 'click',
- sigil,
- (event: JavelinEvent): void =>
- BanzaiLogger.log(
- config,
- {...logData, ...DataStore.get(event.getNode(sigil))},
- ),
-);
+
a(
SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong,
@@ -222,17 +175,6 @@ return /******/ (function(modules) { // webpackBootstrap
});
=====================================output=====================================
-var listener = DOM.listen(
- introCard,
- "click",
- sigil,
- (event: JavelinEvent): void =>
- BanzaiLogger.log(config, {
- ...logData,
- ...DataStore.get(event.getNode(sigil)),
- })
-);
-
a(
SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong,
[
diff --git a/tests/js/last-argument-expansion/edge_case.js b/tests/js/last-argument-expansion/edge_case.js
index 43373d5de..3072023cb 100644
--- a/tests/js/last-argument-expansion/edge_case.js
+++ b/tests/js/last-argument-expansion/edge_case.js
@@ -1,13 +1,4 @@
-var listener = DOM.listen(
- introCard,
- 'click',
- sigil,
- (event: JavelinEvent): void =>
- BanzaiLogger.log(
- config,
- {...logData, ...DataStore.get(event.getNode(sigil))},
- ),
-);
+
a(
SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong,
diff --git a/tests/js/method-chain/__snapshots__/jsfmt.spec.js.snap b/tests/js/method-chain/__snapshots__/jsfmt.spec.js.snap
index ef0f42622..c43f77bda 100644
--- a/tests/js/method-chain/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/method-chain/__snapshots__/jsfmt.spec.js.snap
@@ -304,15 +304,6 @@ ret = __DEV__ ?
vm.runInContext(source, ctx)
: a
-this.firebase.object(\`/shops/\${shopLocation.shop}\`)
- // keep distance info
- .first((shop: ShopQueryResult, index: number, source: Observable): any => {
- // add distance to result
- const s = shop;
- s.distance = shopLocation.distance;
- return s;
- });
-
angular.module('AngularAppModule')
// Hello, I am comment.
.constant('API_URL', 'http://localhost:8080/api');
@@ -376,22 +367,6 @@ ret = __DEV__
vm.runInContext(source, ctx)
: a;
-this.firebase
- .object(\`/shops/\${shopLocation.shop}\`)
- // keep distance info
- .first(
- (
- shop: ShopQueryResult,
- index: number,
- source: Observable
- ): any => {
- // add distance to result
- const s = shop;
- s.distance = shopLocation.distance;
- return s;
- }
- );
-
angular
.module("AngularAppModule")
// Hello, I am comment.
diff --git a/tests/js/method-chain/comment.js b/tests/js/method-chain/comment.js
index bd9b52b37..a8dd95f51 100644
--- a/tests/js/method-chain/comment.js
+++ b/tests/js/method-chain/comment.js
@@ -48,15 +48,6 @@ ret = __DEV__ ?
vm.runInContext(source, ctx)
: a
-this.firebase.object(`/shops/${shopLocation.shop}`)
- // keep distance info
- .first((shop: ShopQueryResult, index: number, source: Observable): any => {
- // add distance to result
- const s = shop;
- s.distance = shopLocation.distance;
- return s;
- });
-
angular.module('AngularAppModule')
// Hello, I am comment.
.constant('API_URL', 'http://localhost:8080/api');
diff --git a/tests/js/multiparser-css/__snapshots__/jsfmt.spec.js.snap b/tests/js/multiparser-css/__snapshots__/jsfmt.spec.js.snap
index 4e5032471..ec8e35c05 100644
--- a/tests/js/multiparser-css/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/multiparser-css/__snapshots__/jsfmt.spec.js.snap
@@ -260,14 +260,6 @@ export const Group = styled.div\`
}
\`
-const yesFrame = (
- ...args: Interpolation>[]
-) => css\`
- \${ChatRoot}[data-frame="yes"] & {
- \${css({}, ...args)}
- }
-\`
-
=====================================output=====================================
export const Group = styled.div\`
margin: 0;
@@ -285,14 +277,6 @@ export const Group = styled.div\`
}
\`;
-const yesFrame = (
- ...args: Interpolation>[]
-) => css\`
- \${ChatRoot}[data-frame="yes"] & {
- \${css({}, ...args)}
- }
-\`;
-
================================================================================
`;
diff --git a/tests/js/multiparser-css/issue-6259.js b/tests/js/multiparser-css/issue-6259.js
index ffe328b93..3eb8b59ac 100644
--- a/tests/js/multiparser-css/issue-6259.js
+++ b/tests/js/multiparser-css/issue-6259.js
@@ -13,11 +13,3 @@ export const Group = styled.div`
display: flex;
}
`
-
-const yesFrame = (
- ...args: Interpolation>[]
-) => css`
- ${ChatRoot}[data-frame="yes"] & {
- ${css({}, ...args)}
- }
-`
diff --git a/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap b/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap
index cd4a7c3a0..d50c33308 100644
--- a/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap
@@ -1,5 +1,498 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`class.js - {"semi":false} format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow"]
+printWidth: 80
+semi: false
+ | printWidth
+=====================================input======================================
+// TODO: upgrade parser
+// class A {
+// async; // The semicolon is *not* necessary
+// x(){}
+// }
+// class B {
+// static; // The semicolon *is* necessary
+// x(){}
+// }
+
+class C1 {
+ get; // The semicolon *is* necessary
+ x(){}
+}
+class C2 {
+ get = () => {}; // The semicolon is *not* necessary
+ x(){}
+}
+class C3 {
+ set; // The semicolon *is* necessary
+ x(){}
+}
+class C4 {
+ set = () => {}; // The semicolon is *not* necessary
+ x(){}
+}
+
+
+
+class A {
+ a = 0;
+ [b](){}
+
+ c = 0;
+ *d(){}
+
+ e = 0;
+ [f] = 0
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {};
+ [h](){}
+
+ p() {};
+ *i(){}
+
+ a = 1;
+ get ['y']() {}
+
+ a = 1;
+ static ['y']() {}
+
+ a = 1;
+ set ['z'](z) {}
+
+ a = 1;
+ async ['a']() {}
+
+ a = 1;
+ async *g() {}
+
+ a = 0;
+ b = 1;
+}
+
+class A {
+ a = 0;
+ [b](){}
+
+ c = 0;
+ *d(){}
+
+ e = 0;
+ [f] = 0
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {};
+ [h](){}
+
+ p() {};
+ *i(){}
+
+ a = 1;
+ get ['y']() {}
+
+ a = 1;
+ static ['y']() {}
+
+ a = 1;
+ set ['z'](z) {}
+
+ a = 1;
+ async ['a']() {}
+
+ a = 1;
+ async *g() {}
+
+ a = 0;
+ b = 1;
+}
+
+// being first/last shouldn't break things
+class G1 {
+ x = 1
+}
+class G2 {
+ x() {}
+}
+class G3 {
+ *x() {}
+}
+class G4 {
+ [x] = 1
+}
+
+=====================================output=====================================
+// TODO: upgrade parser
+// class A {
+// async; // The semicolon is *not* necessary
+// x(){}
+// }
+// class B {
+// static; // The semicolon *is* necessary
+// x(){}
+// }
+
+class C1 {
+ get; // The semicolon *is* necessary
+ x() {}
+}
+class C2 {
+ get = () => {} // The semicolon is *not* necessary
+ x() {}
+}
+class C3 {
+ set; // The semicolon *is* necessary
+ x() {}
+}
+class C4 {
+ set = () => {} // The semicolon is *not* necessary
+ x() {}
+}
+
+class A {
+ a = 0;
+ [b]() {}
+
+ c = 0;
+ *d() {}
+
+ e = 0;
+ [f] = 0
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {}
+ [h]() {}
+
+ p() {}
+ *i() {}
+
+ a = 1
+ get ["y"]() {}
+
+ a = 1
+ static ["y"]() {}
+
+ a = 1
+ set ["z"](z) {}
+
+ a = 1
+ async ["a"]() {}
+
+ a = 1
+ async *g() {}
+
+ a = 0
+ b = 1
+}
+
+class A {
+ a = 0;
+ [b]() {}
+
+ c = 0;
+ *d() {}
+
+ e = 0;
+ [f] = 0
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {}
+ [h]() {}
+
+ p() {}
+ *i() {}
+
+ a = 1
+ get ["y"]() {}
+
+ a = 1
+ static ["y"]() {}
+
+ a = 1
+ set ["z"](z) {}
+
+ a = 1
+ async ["a"]() {}
+
+ a = 1
+ async *g() {}
+
+ a = 0
+ b = 1
+}
+
+// being first/last shouldn't break things
+class G1 {
+ x = 1
+}
+class G2 {
+ x() {}
+}
+class G3 {
+ *x() {}
+}
+class G4 {
+ [x] = 1
+}
+
+================================================================================
+`;
+
+exports[`class.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+// TODO: upgrade parser
+// class A {
+// async; // The semicolon is *not* necessary
+// x(){}
+// }
+// class B {
+// static; // The semicolon *is* necessary
+// x(){}
+// }
+
+class C1 {
+ get; // The semicolon *is* necessary
+ x(){}
+}
+class C2 {
+ get = () => {}; // The semicolon is *not* necessary
+ x(){}
+}
+class C3 {
+ set; // The semicolon *is* necessary
+ x(){}
+}
+class C4 {
+ set = () => {}; // The semicolon is *not* necessary
+ x(){}
+}
+
+
+
+class A {
+ a = 0;
+ [b](){}
+
+ c = 0;
+ *d(){}
+
+ e = 0;
+ [f] = 0
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {};
+ [h](){}
+
+ p() {};
+ *i(){}
+
+ a = 1;
+ get ['y']() {}
+
+ a = 1;
+ static ['y']() {}
+
+ a = 1;
+ set ['z'](z) {}
+
+ a = 1;
+ async ['a']() {}
+
+ a = 1;
+ async *g() {}
+
+ a = 0;
+ b = 1;
+}
+
+class A {
+ a = 0;
+ [b](){}
+
+ c = 0;
+ *d(){}
+
+ e = 0;
+ [f] = 0
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {};
+ [h](){}
+
+ p() {};
+ *i(){}
+
+ a = 1;
+ get ['y']() {}
+
+ a = 1;
+ static ['y']() {}
+
+ a = 1;
+ set ['z'](z) {}
+
+ a = 1;
+ async ['a']() {}
+
+ a = 1;
+ async *g() {}
+
+ a = 0;
+ b = 1;
+}
+
+// being first/last shouldn't break things
+class G1 {
+ x = 1
+}
+class G2 {
+ x() {}
+}
+class G3 {
+ *x() {}
+}
+class G4 {
+ [x] = 1
+}
+
+=====================================output=====================================
+// TODO: upgrade parser
+// class A {
+// async; // The semicolon is *not* necessary
+// x(){}
+// }
+// class B {
+// static; // The semicolon *is* necessary
+// x(){}
+// }
+
+class C1 {
+ get; // The semicolon *is* necessary
+ x() {}
+}
+class C2 {
+ get = () => {}; // The semicolon is *not* necessary
+ x() {}
+}
+class C3 {
+ set; // The semicolon *is* necessary
+ x() {}
+}
+class C4 {
+ set = () => {}; // The semicolon is *not* necessary
+ x() {}
+}
+
+class A {
+ a = 0;
+ [b]() {}
+
+ c = 0;
+ *d() {}
+
+ e = 0;
+ [f] = 0;
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {}
+ [h]() {}
+
+ p() {}
+ *i() {}
+
+ a = 1;
+ get ["y"]() {}
+
+ a = 1;
+ static ["y"]() {}
+
+ a = 1;
+ set ["z"](z) {}
+
+ a = 1;
+ async ["a"]() {}
+
+ a = 1;
+ async *g() {}
+
+ a = 0;
+ b = 1;
+}
+
+class A {
+ a = 0;
+ [b]() {}
+
+ c = 0;
+ *d() {}
+
+ e = 0;
+ [f] = 0;
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {}
+ [h]() {}
+
+ p() {}
+ *i() {}
+
+ a = 1;
+ get ["y"]() {}
+
+ a = 1;
+ static ["y"]() {}
+
+ a = 1;
+ set ["z"](z) {}
+
+ a = 1;
+ async ["a"]() {}
+
+ a = 1;
+ async *g() {}
+
+ a = 0;
+ b = 1;
+}
+
+// being first/last shouldn't break things
+class G1 {
+ x = 1;
+}
+class G2 {
+ x() {}
+}
+class G3 {
+ *x() {}
+}
+class G4 {
+ [x] = 1;
+}
+
+================================================================================
+`;
+
exports[`comments.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel", "flow"]
@@ -9,28 +502,28 @@ semi: false
=====================================input======================================
let error = new Error(response.statusText);
// comment
-(error: any).response = response
+[].response = response
x;
-/* comment */ (error: any).response = response
+/* comment */ [].response = response
x;
-(error: any).response = response; /* comment */
+[].response = response; /* comment */
=====================================output=====================================
let error = new Error(response.statusText)
// comment
-;(error: any).response = response
+;[].response = response
x
-/* comment */ ;(error: any).response = response
+/* comment */ ;[].response = response
x
-;(error: any).response = response /* comment */
+;[].response = response /* comment */
================================================================================
`;
@@ -43,199 +536,28 @@ printWidth: 80
=====================================input======================================
let error = new Error(response.statusText);
// comment
-(error: any).response = response
+[].response = response
x;
-/* comment */ (error: any).response = response
+/* comment */ [].response = response
x;
-(error: any).response = response; /* comment */
+[].response = response; /* comment */
=====================================output=====================================
let error = new Error(response.statusText);
// comment
-(error: any).response = response;
+[].response = response;
x;
-/* comment */ (error: any).response = response;
+/* comment */ [].response = response;
x;
-(error: any).response = response; /* comment */
-
-================================================================================
-`;
-
-exports[`flow-interfaces.js - {"semi":false} format 1`] = `
-====================================options=====================================
-parsers: ["babel", "flow"]
-printWidth: 80
-semi: false
- | printWidth
-=====================================input======================================
-declare class A {
- one: boolean;
- two: { three: string }
- | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// declare class B {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-declare interface C {
- one: boolean;
- two: { three: string }
- | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// declare interface D {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-interface E {
- one: boolean;
- two: { three: string }
- | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// interface F {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-=====================================output=====================================
-declare class A {
- one: boolean;
- two: { three: string } | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// declare class B {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-declare interface C {
- one: boolean;
- two: { three: string } | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// declare interface D {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-interface E {
- one: boolean;
- two: { three: string } | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// interface F {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-================================================================================
-`;
-
-exports[`flow-interfaces.js format 1`] = `
-====================================options=====================================
-parsers: ["babel", "flow"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-declare class A {
- one: boolean;
- two: { three: string }
- | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// declare class B {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-declare interface C {
- one: boolean;
- two: { three: string }
- | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// declare interface D {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-interface E {
- one: boolean;
- two: { three: string }
- | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// interface F {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-=====================================output=====================================
-declare class A {
- one: boolean;
- two: { three: string } | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// declare class B {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-declare interface C {
- one: boolean;
- two: { three: string } | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// declare interface D {
-// one: boolean
-// two: { three: string }
-// | number
-// }
-
-interface E {
- one: boolean;
- two: { three: string } | number;
-}
-
-// NOTE: Flow and Babel both fail to apply ASI here
-// interface F {
-// one: boolean
-// two: { three: string }
-// | number
-// }
+[].response = response; /* comment */
================================================================================
`;
@@ -325,89 +647,11 @@ x; (x, y) => x
class X {} [1, 2, 3].forEach(fn)
-// TODO: upgrade parser
-// class A {
-// async; // The semicolon is *not* necessary
-// x(){}
-// }
-// class B {
-// static; // The semicolon *is* necessary
-// x(){}
-// }
-
-class C1 {
- get; // The semicolon *is* necessary
- x(){}
-}
-class C2 {
- get = () => {}; // The semicolon is *not* necessary
- x(){}
-}
-class C3 {
- set; // The semicolon *is* necessary
- x(){}
-}
-class C4 {
- set = () => {}; // The semicolon is *not* necessary
- x(){}
-}
-
// don't semicolon if it doesn't start statement
if (true) (() => {})()
-class A {
- a = 0;
- [b](){}
-
- c = 0;
- *d(){}
-
- e = 0;
- [f] = 0
-
- // none of the semicolons above this comment can be omitted.
- // none of the semicolons below this comment are necessary.
-
- q() {};
- [h](){}
-
- p() {};
- *i(){}
-
- a = 1;
- get ['y']() {}
-
- a = 1;
- static ['y']() {}
-
- a = 1;
- set ['z'](z) {}
-
- a = 1;
- async ['a']() {}
-
- a = 1;
- async *g() {}
-
- a = 0;
- b = 1;
-}
-
-// being first/last shouldn't break things
-class G1 {
- x = 1
-}
-class G2 {
- x() {}
-}
-class G3 {
- *x() {}
-}
-class G4 {
- [x] = 1
-}
// check indentation
@@ -415,11 +659,6 @@ if (true) {
x; (() => {})()
}
-// flow
-
-(x: void);
-(y: void)
-
// check statement clauses
do break; while (false)
@@ -503,89 +742,10 @@ x
class X {}
;[1, 2, 3].forEach(fn)
-// TODO: upgrade parser
-// class A {
-// async; // The semicolon is *not* necessary
-// x(){}
-// }
-// class B {
-// static; // The semicolon *is* necessary
-// x(){}
-// }
-
-class C1 {
- get; // The semicolon *is* necessary
- x() {}
-}
-class C2 {
- get = () => {} // The semicolon is *not* necessary
- x() {}
-}
-class C3 {
- set; // The semicolon *is* necessary
- x() {}
-}
-class C4 {
- set = () => {} // The semicolon is *not* necessary
- x() {}
-}
-
// don't semicolon if it doesn't start statement
if (true) (() => {})()
-class A {
- a = 0;
- [b]() {}
-
- c = 0;
- *d() {}
-
- e = 0;
- [f] = 0
-
- // none of the semicolons above this comment can be omitted.
- // none of the semicolons below this comment are necessary.
-
- q() {}
- [h]() {}
-
- p() {}
- *i() {}
-
- a = 1
- get ["y"]() {}
-
- a = 1
- static ["y"]() {}
-
- a = 1
- set ["z"](z) {}
-
- a = 1
- async ["a"]() {}
-
- a = 1
- async *g() {}
-
- a = 0
- b = 1
-}
-
-// being first/last shouldn't break things
-class G1 {
- x = 1
-}
-class G2 {
- x() {}
-}
-class G3 {
- *x() {}
-}
-class G4 {
- [x] = 1
-}
-
// check indentation
if (true) {
@@ -593,11 +753,6 @@ if (true) {
;(() => {})()
}
-// flow
-
-;(x: void)
-;(y: void)
-
// check statement clauses
do break
@@ -675,89 +830,11 @@ x; (x, y) => x
class X {} [1, 2, 3].forEach(fn)
-// TODO: upgrade parser
-// class A {
-// async; // The semicolon is *not* necessary
-// x(){}
-// }
-// class B {
-// static; // The semicolon *is* necessary
-// x(){}
-// }
-
-class C1 {
- get; // The semicolon *is* necessary
- x(){}
-}
-class C2 {
- get = () => {}; // The semicolon is *not* necessary
- x(){}
-}
-class C3 {
- set; // The semicolon *is* necessary
- x(){}
-}
-class C4 {
- set = () => {}; // The semicolon is *not* necessary
- x(){}
-}
-
// don't semicolon if it doesn't start statement
if (true) (() => {})()
-class A {
- a = 0;
- [b](){}
-
- c = 0;
- *d(){}
-
- e = 0;
- [f] = 0
-
- // none of the semicolons above this comment can be omitted.
- // none of the semicolons below this comment are necessary.
-
- q() {};
- [h](){}
-
- p() {};
- *i(){}
-
- a = 1;
- get ['y']() {}
-
- a = 1;
- static ['y']() {}
-
- a = 1;
- set ['z'](z) {}
-
- a = 1;
- async ['a']() {}
-
- a = 1;
- async *g() {}
-
- a = 0;
- b = 1;
-}
-
-// being first/last shouldn't break things
-class G1 {
- x = 1
-}
-class G2 {
- x() {}
-}
-class G3 {
- *x() {}
-}
-class G4 {
- [x] = 1
-}
// check indentation
@@ -765,11 +842,6 @@ if (true) {
x; (() => {})()
}
-// flow
-
-(x: void);
-(y: void)
-
// check statement clauses
do break; while (false)
@@ -853,89 +925,10 @@ x;
class X {}
[1, 2, 3].forEach(fn);
-// TODO: upgrade parser
-// class A {
-// async; // The semicolon is *not* necessary
-// x(){}
-// }
-// class B {
-// static; // The semicolon *is* necessary
-// x(){}
-// }
-
-class C1 {
- get; // The semicolon *is* necessary
- x() {}
-}
-class C2 {
- get = () => {}; // The semicolon is *not* necessary
- x() {}
-}
-class C3 {
- set; // The semicolon *is* necessary
- x() {}
-}
-class C4 {
- set = () => {}; // The semicolon is *not* necessary
- x() {}
-}
-
// don't semicolon if it doesn't start statement
if (true) (() => {})();
-class A {
- a = 0;
- [b]() {}
-
- c = 0;
- *d() {}
-
- e = 0;
- [f] = 0;
-
- // none of the semicolons above this comment can be omitted.
- // none of the semicolons below this comment are necessary.
-
- q() {}
- [h]() {}
-
- p() {}
- *i() {}
-
- a = 1;
- get ["y"]() {}
-
- a = 1;
- static ["y"]() {}
-
- a = 1;
- set ["z"](z) {}
-
- a = 1;
- async ["a"]() {}
-
- a = 1;
- async *g() {}
-
- a = 0;
- b = 1;
-}
-
-// being first/last shouldn't break things
-class G1 {
- x = 1;
-}
-class G2 {
- x() {}
-}
-class G3 {
- *x() {}
-}
-class G4 {
- [x] = 1;
-}
-
// check indentation
if (true) {
@@ -943,11 +936,6 @@ if (true) {
(() => {})();
}
-// flow
-
-(x: void);
-(y: void);
-
// check statement clauses
do break;
diff --git a/tests/js/no-semi/class.js b/tests/js/no-semi/class.js
new file mode 100644
index 000000000..1747fe083
--- /dev/null
+++ b/tests/js/no-semi/class.js
@@ -0,0 +1,118 @@
+// TODO: upgrade parser
+// class A {
+// async; // The semicolon is *not* necessary
+// x(){}
+// }
+// class B {
+// static; // The semicolon *is* necessary
+// x(){}
+// }
+
+class C1 {
+ get; // The semicolon *is* necessary
+ x(){}
+}
+class C2 {
+ get = () => {}; // The semicolon is *not* necessary
+ x(){}
+}
+class C3 {
+ set; // The semicolon *is* necessary
+ x(){}
+}
+class C4 {
+ set = () => {}; // The semicolon is *not* necessary
+ x(){}
+}
+
+
+
+class A {
+ a = 0;
+ [b](){}
+
+ c = 0;
+ *d(){}
+
+ e = 0;
+ [f] = 0
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {};
+ [h](){}
+
+ p() {};
+ *i(){}
+
+ a = 1;
+ get ['y']() {}
+
+ a = 1;
+ static ['y']() {}
+
+ a = 1;
+ set ['z'](z) {}
+
+ a = 1;
+ async ['a']() {}
+
+ a = 1;
+ async *g() {}
+
+ a = 0;
+ b = 1;
+}
+
+class A {
+ a = 0;
+ [b](){}
+
+ c = 0;
+ *d(){}
+
+ e = 0;
+ [f] = 0
+
+ // none of the semicolons above this comment can be omitted.
+ // none of the semicolons below this comment are necessary.
+
+ q() {};
+ [h](){}
+
+ p() {};
+ *i(){}
+
+ a = 1;
+ get ['y']() {}
+
+ a = 1;
+ static ['y']() {}
+
+ a = 1;
+ set ['z'](z) {}
+
+ a = 1;
+ async ['a']() {}
+
+ a = 1;
+ async *g() {}
+
+ a = 0;
+ b = 1;
+}
+
+// being first/last shouldn't break things
+class G1 {
+ x = 1
+}
+class G2 {
+ x() {}
+}
+class G3 {
+ *x() {}
+}
+class G4 {
+ [x] = 1
+}
diff --git a/tests/js/no-semi/comments.js b/tests/js/no-semi/comments.js
index 34f27c796..9ada40721 100644
--- a/tests/js/no-semi/comments.js
+++ b/tests/js/no-semi/comments.js
@@ -1,11 +1,11 @@
let error = new Error(response.statusText);
// comment
-(error: any).response = response
+[].response = response
x;
-/* comment */ (error: any).response = response
+/* comment */ [].response = response
x;
-(error: any).response = response; /* comment */
+[].response = response; /* comment */
diff --git a/tests/js/no-semi/no-semi.js b/tests/js/no-semi/no-semi.js
index 351c104b4..2169fb985 100644
--- a/tests/js/no-semi/no-semi.js
+++ b/tests/js/no-semi/no-semi.js
@@ -19,89 +19,11 @@ x; (x, y) => x
class X {} [1, 2, 3].forEach(fn)
-// TODO: upgrade parser
-// class A {
-// async; // The semicolon is *not* necessary
-// x(){}
-// }
-// class B {
-// static; // The semicolon *is* necessary
-// x(){}
-// }
-
-class C1 {
- get; // The semicolon *is* necessary
- x(){}
-}
-class C2 {
- get = () => {}; // The semicolon is *not* necessary
- x(){}
-}
-class C3 {
- set; // The semicolon *is* necessary
- x(){}
-}
-class C4 {
- set = () => {}; // The semicolon is *not* necessary
- x(){}
-}
-
// don't semicolon if it doesn't start statement
if (true) (() => {})()
-class A {
- a = 0;
- [b](){}
-
- c = 0;
- *d(){}
-
- e = 0;
- [f] = 0
-
- // none of the semicolons above this comment can be omitted.
- // none of the semicolons below this comment are necessary.
-
- q() {};
- [h](){}
-
- p() {};
- *i(){}
-
- a = 1;
- get ['y']() {}
-
- a = 1;
- static ['y']() {}
-
- a = 1;
- set ['z'](z) {}
-
- a = 1;
- async ['a']() {}
-
- a = 1;
- async *g() {}
-
- a = 0;
- b = 1;
-}
-
-// being first/last shouldn't break things
-class G1 {
- x = 1
-}
-class G2 {
- x() {}
-}
-class G3 {
- *x() {}
-}
-class G4 {
- [x] = 1
-}
// check indentation
@@ -109,11 +31,6 @@ if (true) {
x; (() => {})()
}
-// flow
-
-(x: void);
-(y: void)
-
// check statement clauses
do break; while (false)
diff --git a/tests/js/object-property-comment/__snapshots__/jsfmt.spec.js.snap b/tests/js/object-property-comment/__snapshots__/jsfmt.spec.js.snap
index a996cf694..17a5b0cae 100644
--- a/tests/js/object-property-comment/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/object-property-comment/__snapshots__/jsfmt.spec.js.snap
@@ -25,50 +25,3 @@ let b = {
================================================================================
`;
-
-exports[`comment.js format 1`] = `
-====================================options=====================================
-parsers: ["babel", "flow"]
-printWidth: 80
- | printWidth
-=====================================input======================================
-o = {
- name:
- // Comment A
- // Comment B
- (({id: type}: any): CreativeConcept),
-};
-
-o = {
- name: // Comment A
- // Comment B
- (({ id: type }: any): CreativeConcept)
-};
-
-o = {
- name: // Comment B // Comment A
- (({ id: type }: any): CreativeConcept)
-};
-
-=====================================output=====================================
-o = {
- name:
- // Comment A
- // Comment B
- (({ id: type }: any): CreativeConcept),
-};
-
-o = {
- // Comment A
- name:
- // Comment B
- (({ id: type }: any): CreativeConcept),
-};
-
-o = {
- // Comment B // Comment A
- name: (({ id: type }: any): CreativeConcept),
-};
-
-================================================================================
-`;
diff --git a/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap b/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap
index 7368ed457..607faf8b4 100644
--- a/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap
@@ -189,6 +189,103 @@ class D {
================================================================================
`;
+exports[`numeric-separator.js - {"quoteProps":"as-needed"} format 1`] = `
+====================================options=====================================
+parsers: ["babel"]
+printWidth: 80
+quoteProps: "as-needed"
+ | printWidth
+=====================================input======================================
+a = {
+
+ 0xb_b: '0xb_b', // 187
+ 0xb_b_bn: '0xb_b_bn', // 3003
+ 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
+}
+
+=====================================output=====================================
+a = {
+ 0xb_b: "0xb_b", // 187
+ 0xb_b_bn: "0xb_b_bn", // 3003
+ 0b100000000000_000000000000000011n: "0b100000000000_000000000000000011n", // 536870915
+};
+
+================================================================================
+`;
+
+exports[`numeric-separator.js - {"quoteProps":"consistent","singleQuote":true} format 1`] = `
+====================================options=====================================
+parsers: ["babel"]
+printWidth: 80
+quoteProps: "consistent"
+singleQuote: true
+ | printWidth
+=====================================input======================================
+a = {
+
+ 0xb_b: '0xb_b', // 187
+ 0xb_b_bn: '0xb_b_bn', // 3003
+ 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
+}
+
+=====================================output=====================================
+a = {
+ 0xb_b: '0xb_b', // 187
+ 0xb_b_bn: '0xb_b_bn', // 3003
+ 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n', // 536870915
+};
+
+================================================================================
+`;
+
+exports[`numeric-separator.js - {"quoteProps":"consistent"} format 1`] = `
+====================================options=====================================
+parsers: ["babel"]
+printWidth: 80
+quoteProps: "consistent"
+ | printWidth
+=====================================input======================================
+a = {
+
+ 0xb_b: '0xb_b', // 187
+ 0xb_b_bn: '0xb_b_bn', // 3003
+ 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
+}
+
+=====================================output=====================================
+a = {
+ 0xb_b: "0xb_b", // 187
+ 0xb_b_bn: "0xb_b_bn", // 3003
+ 0b100000000000_000000000000000011n: "0b100000000000_000000000000000011n", // 536870915
+};
+
+================================================================================
+`;
+
+exports[`numeric-separator.js - {"quoteProps":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["babel"]
+printWidth: 80
+quoteProps: "preserve"
+ | printWidth
+=====================================input======================================
+a = {
+
+ 0xb_b: '0xb_b', // 187
+ 0xb_b_bn: '0xb_b_bn', // 3003
+ 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
+}
+
+=====================================output=====================================
+a = {
+ 0xb_b: "0xb_b", // 187
+ 0xb_b_bn: "0xb_b_bn", // 3003
+ 0b100000000000_000000000000000011n: "0b100000000000_000000000000000011n", // 536870915
+};
+
+================================================================================
+`;
+
exports[`objects.js - {"quoteProps":"as-needed"} format 1`] = `
====================================options=====================================
parsers: ["babel"]
@@ -285,10 +382,7 @@ Object.entries({
0o10: '0o10', // 8
0xf: '0xf', // 15
2n: '2n', // 2
- 0xb_b: '0xb_b', // 187
- 0xb_b_bn: '0xb_b_bn', // 3003
0xan: '0xan', // 10
- 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
})
// Negative numbers cannot be unquoted.
@@ -387,10 +481,7 @@ Object.entries({
0o10: "0o10", // 8
0xf: "0xf", // 15
2n: "2n", // 2
- 0xb_b: "0xb_b", // 187
- 0xb_b_bn: "0xb_b_bn", // 3003
0xan: "0xan", // 10
- 0b100000000000_000000000000000011n: "0b100000000000_000000000000000011n", // 536870915
});
// Negative numbers cannot be unquoted.
@@ -499,10 +590,7 @@ Object.entries({
0o10: '0o10', // 8
0xf: '0xf', // 15
2n: '2n', // 2
- 0xb_b: '0xb_b', // 187
- 0xb_b_bn: '0xb_b_bn', // 3003
0xan: '0xan', // 10
- 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
})
// Negative numbers cannot be unquoted.
@@ -601,10 +689,7 @@ Object.entries({
0o10: '0o10', // 8
0xf: '0xf', // 15
2n: '2n', // 2
- 0xb_b: '0xb_b', // 187
- 0xb_b_bn: '0xb_b_bn', // 3003
0xan: '0xan', // 10
- 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n', // 536870915
});
// Negative numbers cannot be unquoted.
@@ -712,10 +797,7 @@ Object.entries({
0o10: '0o10', // 8
0xf: '0xf', // 15
2n: '2n', // 2
- 0xb_b: '0xb_b', // 187
- 0xb_b_bn: '0xb_b_bn', // 3003
0xan: '0xan', // 10
- 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
})
// Negative numbers cannot be unquoted.
@@ -814,10 +896,7 @@ Object.entries({
0o10: "0o10", // 8
0xf: "0xf", // 15
2n: "2n", // 2
- 0xb_b: "0xb_b", // 187
- 0xb_b_bn: "0xb_b_bn", // 3003
0xan: "0xan", // 10
- 0b100000000000_000000000000000011n: "0b100000000000_000000000000000011n", // 536870915
});
// Negative numbers cannot be unquoted.
@@ -925,10 +1004,7 @@ Object.entries({
0o10: '0o10', // 8
0xf: '0xf', // 15
2n: '2n', // 2
- 0xb_b: '0xb_b', // 187
- 0xb_b_bn: '0xb_b_bn', // 3003
0xan: '0xan', // 10
- 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
})
// Negative numbers cannot be unquoted.
@@ -1027,10 +1103,7 @@ Object.entries({
0o10: "0o10", // 8
0xf: "0xf", // 15
2n: "2n", // 2
- 0xb_b: "0xb_b", // 187
- 0xb_b_bn: "0xb_b_bn", // 3003
0xan: "0xan", // 10
- 0b100000000000_000000000000000011n: "0b100000000000_000000000000000011n", // 536870915
});
// Negative numbers cannot be unquoted.
diff --git a/tests/js/quote-props/numeric-separator.js b/tests/js/quote-props/numeric-separator.js
new file mode 100644
index 000000000..e382f3f0f
--- /dev/null
+++ b/tests/js/quote-props/numeric-separator.js
@@ -0,0 +1,6 @@
+a = {
+
+ 0xb_b: '0xb_b', // 187
+ 0xb_b_bn: '0xb_b_bn', // 3003
+ 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
+}
diff --git a/tests/js/quote-props/objects.js b/tests/js/quote-props/objects.js
index 1c23be6fe..1320543c4 100644
--- a/tests/js/quote-props/objects.js
+++ b/tests/js/quote-props/objects.js
@@ -87,10 +87,7 @@ Object.entries({
0o10: '0o10', // 8
0xf: '0xf', // 15
2n: '2n', // 2
- 0xb_b: '0xb_b', // 187
- 0xb_b_bn: '0xb_b_bn', // 3003
0xan: '0xan', // 10
- 0b100000000000_000000000000000011n: '0b100000000000_000000000000000011n' // 536870915
})
// Negative numbers cannot be unquoted.
diff --git a/tests/js/tab-width/__snapshots__/jsfmt.spec.js.snap b/tests/js/tab-width/__snapshots__/jsfmt.spec.js.snap
index 823cc71cf..732457489 100644
--- a/tests/js/tab-width/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/tab-width/__snapshots__/jsfmt.spec.js.snap
@@ -14,7 +14,7 @@ class A {
x = x + 1;
if (true) x = "";
}
- var z:number = x;
+ var z = x;
}
}
@@ -26,7 +26,7 @@ class A {
x = x + 1;
if (true) x = "";
}
- var z: number = x;
+ var z = x;
}
}
@@ -46,7 +46,7 @@ class A {
x = x + 1;
if (true) x = "";
}
- var z:number = x;
+ var z = x;
}
}
@@ -58,7 +58,7 @@ class A {
x = x + 1;
if (true) x = "";
}
- var z: number = x;
+ var z = x;
}
}
diff --git a/tests/js/tab-width/class.js b/tests/js/tab-width/class.js
index 3e07e843a..d08556d1b 100644
--- a/tests/js/tab-width/class.js
+++ b/tests/js/tab-width/class.js
@@ -5,6 +5,6 @@ class A {
x = x + 1;
if (true) x = "";
}
- var z:number = x;
+ var z = x;
}
}
diff --git a/tests/js/template/__snapshots__/jsfmt.spec.js.snap b/tests/js/template/__snapshots__/jsfmt.spec.js.snap
index 1bcb51c12..00b56b604 100644
--- a/tests/js/template/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/template/__snapshots__/jsfmt.spec.js.snap
@@ -275,35 +275,6 @@ this._pipe.write(\`
a
\`;
-(): {
- someLong: boolean,
- t: boolean
-} => \`
- a
-\`;
-
-(): {
- someLong: boolean,
- t: boolean
-} =>
- \`
- a
- \`;
-
-(
- someLong: boolean,
- t: boolean
-) => \`
- a
- \`;
-
-(
- someLong: boolean,
- t: boolean
-) =>
- \`
- a
- \`;
// https://github.com/prettier/prettier/issues/5529
editTitle += \`\${iconHTML({ class: "reply-to-glyph" })}\`;
@@ -334,30 +305,6 @@ this._pipe.write(\`
a
\`;
-(): {
- someLong: boolean,
- t: boolean,
-} => \`
- a
-\`;
-
-(): {
- someLong: boolean,
- t: boolean,
-} =>
- \`
- a
- \`;
-
-(someLong: boolean, t: boolean) => \`
- a
- \`;
-
-(someLong: boolean, t: boolean) =>
- \`
- a
- \`;
-
// https://github.com/prettier/prettier/issues/5529
editTitle += \`\${iconHTML({ class: "reply-to-glyph" })}\`;
diff --git a/tests/js/template/inline.js b/tests/js/template/inline.js
index 937a910a8..e3d9ad22d 100644
--- a/tests/js/template/inline.js
+++ b/tests/js/template/inline.js
@@ -27,35 +27,6 @@ this._pipe.write(`
a
`;
-(): {
- someLong: boolean,
- t: boolean
-} => `
- a
-`;
-
-(): {
- someLong: boolean,
- t: boolean
-} =>
- `
- a
- `;
-
-(
- someLong: boolean,
- t: boolean
-) => `
- a
- `;
-
-(
- someLong: boolean,
- t: boolean
-) =>
- `
- a
- `;
// https://github.com/prettier/prettier/issues/5529
editTitle += `${iconHTML({ class: "reply-to-glyph" })}`;
diff --git a/tests/js/test-declarations/__snapshots__/jsfmt.spec.js.snap b/tests/js/test-declarations/__snapshots__/jsfmt.spec.js.snap
index 50f8111f7..eef73e20b 100644
--- a/tests/js/test-declarations/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/test-declarations/__snapshots__/jsfmt.spec.js.snap
@@ -831,10 +831,6 @@ test(\`does something really long and complicated so I have to write a very long
console.log("hello!");
});
-test("does something really long and complicated so I have to write a very long name for the test", (done) => {
- console.log("hello!");
-});
-
describe("does something really long and complicated so I have to write a very long name for the describe block", () => {
it("an example test", (done) => {
console.log("hello!");
@@ -963,10 +959,6 @@ test(\`does something really long and complicated so I have to write a very long
console.log("hello!");
});
-test("does something really long and complicated so I have to write a very long name for the test", (done) => {
- console.log("hello!");
-});
-
describe("does something really long and complicated so I have to write a very long name for the describe block", () => {
it("an example test", done => {
console.log("hello!");
@@ -1114,10 +1106,6 @@ test(\`does something really long and complicated so I have to write a very long
console.log("hello!");
});
-test("does something really long and complicated so I have to write a very long name for the test", (done) => {
- console.log("hello!");
-});
-
describe("does something really long and complicated so I have to write a very long name for the describe block", () => {
it("an example test", (done) => {
console.log("hello!");
@@ -1246,10 +1234,6 @@ test(\`does something really long and complicated so I have to write a very long
console.log("hello!");
});
-test("does something really long and complicated so I have to write a very long name for the test", (done) => {
- console.log("hello!");
-});
-
describe("does something really long and complicated so I have to write a very long name for the describe block", () => {
it("an example test", (done) => {
console.log("hello!");
diff --git a/tests/js/test-declarations/test_declarations.js b/tests/js/test-declarations/test_declarations.js
index 6f7139b6d..879976d40 100644
--- a/tests/js/test-declarations/test_declarations.js
+++ b/tests/js/test-declarations/test_declarations.js
@@ -39,10 +39,6 @@ test(`does something really long and complicated so I have to write a very long
console.log("hello!");
});
-test("does something really long and complicated so I have to write a very long name for the test", (done) => {
- console.log("hello!");
-});
-
describe("does something really long and complicated so I have to write a very long name for the describe block", () => {
it("an example test", (done) => {
console.log("hello!");
diff --git a/tests/typescript/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/arrows/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..3731dea63
--- /dev/null
+++ b/tests/typescript/arrows/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,111 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`arrow_function_expression.ts - {"arrowParens":"always"} format 1`] = `
+====================================options=====================================
+arrowParens: "always"
+parsers: ["typescript", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+a = (b?) => c;
+
+=====================================output=====================================
+a = (b?) => c;
+
+================================================================================
+`;
+
+exports[`arrow_function_expression.ts - {"arrowParens":"avoid"} format 1`] = `
+====================================options=====================================
+arrowParens: "avoid"
+parsers: ["typescript", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+a = (b?) => c;
+
+=====================================output=====================================
+a = (b?) => c;
+
+================================================================================
+`;
+
+exports[`short_body.ts - {"arrowParens":"always"} format 1`] = `
+====================================options=====================================
+arrowParens: "always"
+parsers: ["typescript", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+const initializeSnapshotState = (
+ testFile: Path,
+ update: boolean,
+ testPath: string,
+ expand: boolean,
+) => new SnapshotState(testFile, update, testPath, expand);
+
+=====================================output=====================================
+const initializeSnapshotState = (
+ testFile: Path,
+ update: boolean,
+ testPath: string,
+ expand: boolean
+) => new SnapshotState(testFile, update, testPath, expand);
+
+================================================================================
+`;
+
+exports[`short_body.ts - {"arrowParens":"avoid"} format 1`] = `
+====================================options=====================================
+arrowParens: "avoid"
+parsers: ["typescript", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+const initializeSnapshotState = (
+ testFile: Path,
+ update: boolean,
+ testPath: string,
+ expand: boolean,
+) => new SnapshotState(testFile, update, testPath, expand);
+
+=====================================output=====================================
+const initializeSnapshotState = (
+ testFile: Path,
+ update: boolean,
+ testPath: string,
+ expand: boolean
+) => new SnapshotState(testFile, update, testPath, expand);
+
+================================================================================
+`;
+
+exports[`type_params.ts - {"arrowParens":"always"} format 1`] = `
+====================================options=====================================
+arrowParens: "always"
+parsers: ["typescript", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+(a) => { }
+
+=====================================output=====================================
+(a) => {};
+
+================================================================================
+`;
+
+exports[`type_params.ts - {"arrowParens":"avoid"} format 1`] = `
+====================================options=====================================
+arrowParens: "avoid"
+parsers: ["typescript", "babel"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+(a) => { }
+
+=====================================output=====================================
+(a) => {};
+
+================================================================================
+`;
diff --git a/tests/typescript/arrows/arrow_function_expression.ts b/tests/typescript/arrows/arrow_function_expression.ts
new file mode 100644
index 000000000..4e406bdbc
--- /dev/null
+++ b/tests/typescript/arrows/arrow_function_expression.ts
@@ -0,0 +1 @@
+a = (b?) => c;
diff --git a/tests/typescript/arrows/jsfmt.spec.js b/tests/typescript/arrows/jsfmt.spec.js
new file mode 100644
index 000000000..7274564b6
--- /dev/null
+++ b/tests/typescript/arrows/jsfmt.spec.js
@@ -0,0 +1,2 @@
+run_spec(__dirname, ["typescript", "babel"], { arrowParens: "always" });
+run_spec(__dirname, ["typescript", "babel"], { arrowParens: "avoid" });
diff --git a/tests/js/arrows/short_body.js b/tests/typescript/arrows/short_body.ts
similarity index 100%
rename from tests/js/arrows/short_body.js
rename to tests/typescript/arrows/short_body.ts
diff --git a/tests/js/arrows/type_params.js b/tests/typescript/arrows/type_params.ts
similarity index 100%
rename from tests/js/arrows/type_params.js
rename to tests/typescript/arrows/type_params.ts
diff --git a/tests/typescript/class-comment/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/class-comment/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..e3639e298
--- /dev/null
+++ b/tests/typescript/class-comment/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,280 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`class-implements.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+class a1 extends b // comment
+implements z
+{
+ constructor() {}
+}
+
+class a2 extends b implements z { // comment
+ constructor() {}
+}
+
+class a3 extends b
+implements
+// comment
+z,
+y {
+ constructor() {}
+}
+
+class a4 extends b
+implements z, // comment
+y {
+ constructor() {}
+}
+
+class a5 extends b implements
+ z, // comment-z
+ y // comment-y
+ {
+ constructor() {}
+}
+
+class a6 extends b implements
+// comment-z1
+ z, // comment-z2
+ // comment-y1
+ y // comment-y2
+ {
+ constructor() {}
+}
+
+class a7 extends b implements
+// comment-z1
+ z, // comment-z2
+ // comment-y1
+ y // comment-y2
+ // comment-y3
+ {
+ //comment-body
+ constructor() {}
+}
+
+class a8 extends b // comment-b
+ implements
+// comment-z1
+ z, // comment-z2
+ // comment-y1
+ y // comment-y2
+ {
+ constructor() {}
+}
+
+class a9 extends
+// comment-b1
+b // comment-b2
+// comment-b3
+ implements
+// comment-z1
+ z, // comment-z2
+ // comment-y1
+ y // comment-y2
+ {
+ constructor() {}
+}
+
+=====================================output=====================================
+class a1
+ extends b // comment
+ implements z {
+ constructor() {}
+}
+
+class a2 extends b implements z {
+ // comment
+ constructor() {}
+}
+
+class a3
+ extends b
+ // comment
+ implements z, y {
+ constructor() {}
+}
+
+class a4
+ extends b
+ implements
+ z, // comment
+ y {
+ constructor() {}
+}
+
+class a5
+ extends b
+ implements
+ z, // comment-z
+ y {
+ // comment-y
+ constructor() {}
+}
+
+class a6
+ extends b
+ // comment-z1
+ implements
+ z, // comment-z2
+ // comment-y1
+ y {
+ // comment-y2
+ constructor() {}
+}
+
+class a7
+ extends b
+ // comment-z1
+ implements
+ z, // comment-z2
+ // comment-y1
+ y {
+ // comment-y2
+ // comment-y3
+ //comment-body
+ constructor() {}
+}
+
+class a8
+ extends b // comment-b
+ // comment-z1
+ implements
+ z, // comment-z2
+ // comment-y1
+ y {
+ // comment-y2
+ constructor() {}
+}
+
+class a9
+ // comment-b1
+ extends b // comment-b2
+ // comment-b3
+ // comment-z1
+ implements
+ z, // comment-z2
+ // comment-y1
+ y {
+ // comment-y2
+ constructor() {}
+}
+
+================================================================================
+`;
+
+exports[`declare.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+declare class a // 1
+ // extends b // 2
+ implements z,x // 3
+{
+ doo:boolean
+}
+
+declare class A1 // 1
+// 2
+extends B // 3
+{}
+
+=====================================output=====================================
+declare class a // 1
+ // extends b // 2
+ implements z, x {
+ // 3
+ doo: boolean;
+}
+
+declare class A1 // 1
+ // 2
+ extends B {
+ // 3
+}
+
+================================================================================
+`;
+
+exports[`generic.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+class G1 implements IPoly {
+ x: T;
+}
+
+class G2 // g2
+ implements IPoly {
+ x: T;
+}
+
+class G3 // g3
+ extends U implements IPoly {
+ x: T;
+}
+
+class G4 extends U implements IPoly {
+ x: T;
+}
+
+=====================================output=====================================
+class G1 implements IPoly {
+ x: T;
+}
+
+class G2 // g2
+ implements IPoly {
+ x: T;
+}
+
+class G3 // g3
+ extends U
+ implements IPoly {
+ x: T;
+}
+
+class G4<
+ T // g4
+ >
+ extends U
+ implements IPoly {
+ x: T;
+}
+
+================================================================================
+`;
+
+exports[`misc.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+export class SnapshotLogger {
+ constructor(
+ retentionPeriod: number = 5 * 60 * 1000, // retain past five minutes
+ snapshotInterval: number = 30 * 1000, // snapshot no more than every 30s
+ ) {
+ }
+}
+
+=====================================output=====================================
+export class SnapshotLogger {
+ constructor(
+ retentionPeriod: number = 5 * 60 * 1000, // retain past five minutes
+ snapshotInterval: number = 30 * 1000 // snapshot no more than every 30s
+ ) {}
+}
+
+================================================================================
+`;
diff --git a/tests/js/class-comment/class-implements.js b/tests/typescript/class-comment/class-implements.ts
similarity index 100%
rename from tests/js/class-comment/class-implements.js
rename to tests/typescript/class-comment/class-implements.ts
diff --git a/tests/js/class-comment/declare.js b/tests/typescript/class-comment/declare.ts
similarity index 100%
rename from tests/js/class-comment/declare.js
rename to tests/typescript/class-comment/declare.ts
diff --git a/tests/js/class-comment/generic.js b/tests/typescript/class-comment/generic.ts
similarity index 100%
rename from tests/js/class-comment/generic.js
rename to tests/typescript/class-comment/generic.ts
diff --git a/tests/typescript/class-comment/jsfmt.spec.js b/tests/typescript/class-comment/jsfmt.spec.js
new file mode 100644
index 000000000..2cc2617c4
--- /dev/null
+++ b/tests/typescript/class-comment/jsfmt.spec.js
@@ -0,0 +1 @@
+run_spec(__dirname, ["typescript", "babel", "flow"]);
diff --git a/tests/typescript/class-comment/misc.ts b/tests/typescript/class-comment/misc.ts
new file mode 100644
index 000000000..af22863dd
--- /dev/null
+++ b/tests/typescript/class-comment/misc.ts
@@ -0,0 +1,7 @@
+export class SnapshotLogger {
+ constructor(
+ retentionPeriod: number = 5 * 60 * 1000, // retain past five minutes
+ snapshotInterval: number = 30 * 1000, // snapshot no more than every 30s
+ ) {
+ }
+}
diff --git a/tests/typescript/classes/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/classes/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..867c4ec84
--- /dev/null
+++ b/tests/typescript/classes/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,91 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`break.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+class MyContractSelectionWidget extends React.Component implements SomethingLarge {
+ method() {}
+}
+
+class DisplayObject1
+ extends utils.EventEmitter
+ implements interaction_InteractiveTarget {
+}
+
+class DisplayObject2 extends utils.EventEmitter
+ implements interaction_InteractiveTarget {
+}
+
+class DisplayObject3 extends utils.EventEmitter
+ implements interaction_InteractiveTarget,
+ somethingElse_SomeOtherThing,
+ somethingElseAgain_RunningOutOfNames {
+}
+
+class DisplayObject4 extends utils.EventEmitter implements interaction_InteractiveTarget {}
+class Readable extends events.EventEmitter implements NodeJS_ReadableStream {}
+class InMemoryAppender extends log4javascript.Appender implements ICachedLogMessageProvider {}
+
+class Foo extends Immutable.Record({
+ ipaddress: '',
+}) {
+ ipaddress: string;
+}
+
+export class VisTimelineComponent
+ implements AfterViewInit, OnChanges, OnDestroy {
+}
+export class VisTimelineComponent2
+ implements AfterViewInit, OnChanges, OnDestroy, AndSomethingReallyReallyLong {
+}
+
+=====================================output=====================================
+class MyContractSelectionWidget
+ extends React.Component
+ implements SomethingLarge {
+ method() {}
+}
+
+class DisplayObject1
+ extends utils.EventEmitter
+ implements interaction_InteractiveTarget {}
+
+class DisplayObject2
+ extends utils.EventEmitter
+ implements interaction_InteractiveTarget {}
+
+class DisplayObject3
+ extends utils.EventEmitter
+ implements
+ interaction_InteractiveTarget,
+ somethingElse_SomeOtherThing,
+ somethingElseAgain_RunningOutOfNames {}
+
+class DisplayObject4
+ extends utils.EventEmitter
+ implements interaction_InteractiveTarget {}
+class Readable extends events.EventEmitter implements NodeJS_ReadableStream {}
+class InMemoryAppender
+ extends log4javascript.Appender
+ implements ICachedLogMessageProvider {}
+
+class Foo extends Immutable.Record({
+ ipaddress: "",
+}) {
+ ipaddress: string;
+}
+
+export class VisTimelineComponent
+ implements AfterViewInit, OnChanges, OnDestroy {}
+export class VisTimelineComponent2
+ implements
+ AfterViewInit,
+ OnChanges,
+ OnDestroy,
+ AndSomethingReallyReallyLong {}
+
+================================================================================
+`;
diff --git a/tests/js/classes/break.js b/tests/typescript/classes/break.ts
similarity index 100%
rename from tests/js/classes/break.js
rename to tests/typescript/classes/break.ts
diff --git a/tests/typescript/classes/jsfmt.spec.js b/tests/typescript/classes/jsfmt.spec.js
new file mode 100644
index 000000000..2cc2617c4
--- /dev/null
+++ b/tests/typescript/classes/jsfmt.spec.js
@@ -0,0 +1 @@
+run_spec(__dirname, ["typescript", "babel", "flow"]);
diff --git a/tests/typescript/comments-2/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/comments-2/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..6a966bbc7
--- /dev/null
+++ b/tests/typescript/comments-2/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,320 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`dangling.ts - {"semi":false} format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+semi: false
+ | printWidth
+=====================================input======================================
+
+Thing?.(/* dangling */);
+declare class Foo extends Qux {/* dangling */}
+
+=====================================output=====================================
+Thing?.(/* dangling */)
+declare class Foo extends Qux {
+ /* dangling */
+}
+
+================================================================================
+`;
+
+exports[`dangling.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+
+Thing?.(/* dangling */);
+declare class Foo extends Qux {/* dangling */}
+
+=====================================output=====================================
+Thing?.(/* dangling */);
+declare class Foo extends Qux {
+ /* dangling */
+}
+
+================================================================================
+`;
+
+exports[`issues.ts - {"semi":false} format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+semi: false
+ | printWidth
+=====================================input======================================
+function f(
+ someReallyLongArgument: WithSomeLongType,
+ someReallyLongArgument2: WithSomeLongType,
+ // Trailing comment should stay after
+) {}
+
+
+=====================================output=====================================
+function f(
+ someReallyLongArgument: WithSomeLongType,
+ someReallyLongArgument2: WithSomeLongType
+ // Trailing comment should stay after
+) {}
+
+================================================================================
+`;
+
+exports[`issues.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+function f(
+ someReallyLongArgument: WithSomeLongType,
+ someReallyLongArgument2: WithSomeLongType,
+ // Trailing comment should stay after
+) {}
+
+
+=====================================output=====================================
+function f(
+ someReallyLongArgument: WithSomeLongType,
+ someReallyLongArgument2: WithSomeLongType
+ // Trailing comment should stay after
+) {}
+
+================================================================================
+`;
+
+exports[`last-arg.ts - {"semi":false} format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+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 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 {
+ }
+}
+
+class X2 {
+ getSectionMode(
+ pageMetaData: PageMetaData,
+ sectionMetaData: SectionMetaData = ['unknown']
+ /* $FlowFixMe This error was exposed while converting keyMirror
+ * to keyMirrorRecursive */
+ ): $Enum {
+ }
+}
+
+=====================================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 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 {},
+}
+
+class X2 {
+ getSectionMode(
+ pageMetaData: PageMetaData,
+ sectionMetaData: SectionMetaData = ["unknown"]
+ /* $FlowFixMe This error was exposed while converting keyMirror
+ * to keyMirrorRecursive */
+ ): $Enum {}
+}
+
+================================================================================
+`;
+
+exports[`last-arg.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript", "babel", "flow"]
+printWidth: 80
+ | 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 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 {
+ }
+}
+
+class X2 {
+ getSectionMode(
+ pageMetaData: PageMetaData,
+ sectionMetaData: SectionMetaData = ['unknown']
+ /* $FlowFixMe This error was exposed while converting keyMirror
+ * to keyMirrorRecursive */
+ ): $Enum {
+ }
+}
+
+=====================================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 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 {},
+};
+
+class X2 {
+ getSectionMode(
+ pageMetaData: PageMetaData,
+ sectionMetaData: SectionMetaData = ["unknown"]
+ /* $FlowFixMe This error was exposed while converting keyMirror
+ * to keyMirrorRecursive */
+ ): $Enum {}
+}
+
+================================================================================
+`;
diff --git a/tests/typescript/comments-2/dangling.ts b/tests/typescript/comments-2/dangling.ts
new file mode 100644
index 000000000..515d29e5f
--- /dev/null
+++ b/tests/typescript/comments-2/dangling.ts
@@ -0,0 +1,3 @@
+
+Thing?.(/* dangling */);
+declare class Foo extends Qux {/* dangling */}
diff --git a/tests/typescript/comments-2/issues.ts b/tests/typescript/comments-2/issues.ts
new file mode 100644
index 000000000..71ad24e1e
--- /dev/null
+++ b/tests/typescript/comments-2/issues.ts
@@ -0,0 +1,6 @@
+function f(
+ someReallyLongArgument: WithSomeLongType,
+ someReallyLongArgument2: WithSomeLongType,
+ // Trailing comment should stay after
+) {}
+
diff --git a/tests/typescript/comments-2/jsfmt.spec.js b/tests/typescript/comments-2/jsfmt.spec.js
new file mode 100644
index 000000000..ef508a5ba
--- /dev/null
+++ b/tests/typescript/comments-2/jsfmt.spec.js
@@ -0,0 +1,2 @@
+run_spec(__dirname, ["typescript", "babel", "flow"]);
+run_spec(__dirname, ["typescript", "babel", "flow"], { semi: false });
diff --git a/tests/typescript/comments-2/last-arg.ts b/tests/typescript/comments-2/last-arg.ts
new file mode 100644
index 000000000..2912bcce8
--- /dev/null
+++ b/tests/typescript/comments-2/last-arg.ts
@@ -0,0 +1,53 @@
+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 {
+ }
+}
+
+class X2 {
+ getSectionMode(
+ pageMetaData: PageMetaData,
+ sectionMetaData: SectionMetaData = ['unknown']
+ /* $FlowFixMe This error was exposed while converting keyMirror
+ * to keyMirrorRecursive */
+ ): $Enum {
+ }
+}
diff --git a/tests/typescript/end-of-line/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/end-of-line/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000..1da4dc639
--- /dev/null
+++ b/tests/typescript/end-of-line/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,178 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`multiline.ts - {"endOfLine":"cr"} format 1`] = `
+====================================options=====================================
+endOfLine: "cr"
+parsers: ["typescript", "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\`