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

144 lines
3.5 KiB
Plaintext
Raw Normal View History

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`arrow.js - flow-verify 1`] = `
// Error
const beep = (data/*: Object */) => {}
// OK
const beep = (data/*: Object */, secondData/*: Object */) => {}
const beep = (data/*: /* this is an object *-/ Object */) => {};
const run = (cmd /*: string */) /*: Promise<void> */ => {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Error
const beep = (data /*: Object */) => {};
// OK
const beep = (data /*: Object */, secondData /*: Object */) => {};
const beep = (data /*: /* this is an object *-/ Object */) => {};
const run = (cmd /*: string */) /*: Promise<void> */ => {};
`;
exports[`class.js - flow-verify 1`] = `
class A {
x /*: string */;
method(a /*: T */, b /*: T */) /*: T */ {}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class A {
x /*: string */;
method(a /*: T */, b /*: T */) /*: T */ {}
}
`;
exports[`functions.js - flow-verify 1`] = `
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
`;
exports[`generics.js - flow-verify 1`] = `
const Component = branch/*:: <Props, ExternalProps> */(
({ src }) => !src,
// $FlowFixMe
renderNothing,
)(BaseComponent);
const C = b/*:: <A> */(foo) + c/*:: <B> */(bar);
foo/*::<bar>*/(baz);
foo/*::<bar>*/();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 - flow-verify 1`] = `
let foo /*: Groups<T> */;
let foo /*: string */ = 'a';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let foo /*: Groups<T> */;
let foo /*: string */ = "a";
`;
exports[`object_type_annotation.js - flow-verify 1`] = `
type Props = // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
{
isPlaying: boolean,
};
type Props = { // (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
isPlaying: boolean
};
type Props = {
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
isPlaying: boolean
};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
type Props = {
isPlaying: boolean
};
type Props = {
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
isPlaying: boolean
};
type Props = {
// (DispatchProps & StateProps); WHY DON'T YOU WORK FLOW!!!!!!!!!
isPlaying: boolean
};
`;
exports[`type_annotations.js - flow-verify 1`] = `
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 */ => {};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 */ => {};
`;