prettier/tests/flow_comments/__snapshots__/jsfmt.spec.js.snap

193 lines
6.0 KiB
Plaintext

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`arrow.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel"]
printWidth: 80
| printWidth
=====================================input======================================
// Error
const a = (data/*: Object */) => {}
// OK
const b = (data/*: Object */, secondData/*: Object */) => {}
const c = (data/*: /* this is an object *-/ Object */) => {};
const run = (cmd /*: string */) /*: Promise<void> */ => {}
=====================================output=====================================
// Error
const a = (data /*: Object */) => {};
// OK
const b = (data /*: Object */, secondData /*: Object */) => {};
const c = (data /*: /* this is an object *-/ Object */) => {};
const run = (cmd /*: string */) /*: Promise<void> */ => {};
================================================================================
`;
exports[`class.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel"]
printWidth: 80
| printWidth
=====================================input======================================
class A {
x /*: string */;
method(a /*: T */, b /*: T */) /*: T */ {}
}
=====================================output=====================================
class A {
x /*: string */;
method(a /*: T */, b /*: T */) /*: T */ {}
}
================================================================================
`;
exports[`functions.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel"]
printWidth: 80
| printWidth
=====================================input======================================
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
=====================================output=====================================
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
================================================================================
`;
exports[`generics.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel"]
printWidth: 80
| printWidth
=====================================input======================================
const Component = branch/*:: <Props, ExternalProps> */(
({ src }) => !src,
// $FlowFixMe
renderNothing,
)(BaseComponent);
const C = b/*:: <A> */(foo) + c/*:: <B> */(bar);
foo/*::<bar>*/(baz);
foo/*::<bar>*/();
=====================================output=====================================
const Component = branch/*:: <Props, ExternalProps> */(
({ src }) => !src,
// $FlowFixMe
renderNothing
)(BaseComponent);
const C = b/*:: <A> */(foo) + c/*:: <B> */(bar);
foo/*:: <bar> */(baz);
foo/*:: <bar> */();
================================================================================
`;
exports[`let.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel"]
printWidth: 80
| printWidth
=====================================input======================================
let foo /*: Groups<T> */;
let bar /*: string */ = 'a';
=====================================output=====================================
let foo /*: Groups<T> */;
let bar /*: string */ = "a";
================================================================================
`;
exports[`object_type_annotation.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel"]
printWidth: 80
| printWidth
=====================================input======================================
type Props1 = // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
{
isPlaying: boolean,
};
type Props2 = { // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
isPlaying: boolean
};
type Props3 = {
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
isPlaying: boolean
};
=====================================output=====================================
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
type Props1 = {
isPlaying: boolean
};
type Props2 = {
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
isPlaying: boolean
};
type Props3 = {
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
isPlaying: boolean
};
================================================================================
`;
exports[`type_annotations.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel"]
printWidth: 80
| printWidth
=====================================input======================================
new (window.Request/*: Class<Request> */)("");
(this/*: any */).foo = 5;
(this/* : any */).foo = 5;
// This next example illustrates that Prettier will not remove a line break
// and unintentionally create a type annotation that was not there before.
(this/*
: any */).foo = 5;
const x = (input /*: string */) /*: string */ => {};
=====================================output=====================================
new (window.Request /*: Class<Request> */)("");
(this /*: any */).foo = 5;
(this /*: any */).foo = 5;
// This next example illustrates that Prettier will not remove a line break
// and unintentionally create a type annotation that was not there before.
this /*
: any */.foo = 5;
const x = (input /*: string */) /*: string */ => {};
================================================================================
`;