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

1244 lines
27 KiB
Plaintext

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`arrow_function_expression.js 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
(a => {}).length
typeof (() => {});
export default (() => {})();
(() => {})()\`\`;
(() => {})\`\`;
new (() => {});
if ((() => {}) ? 1 : 0) {}
let f = () => ({}())
let a = () => ({} instanceof a);
a = () => ({} && a);
a = () => ({}() && a);
a = () => ({} && a && b);
a = () => ({} + a);
a = () => ({}()() && a);
a = () => ({}.b && a);
a = () => ({}[b] && a);
a = () => ({}\`\` && a);
a = () => ({} = 0);
a = () => ({}, a);
a => a instanceof {};
a => ({}().b && 0)
a => ({}().c = 0)
x => ({}()())
x => ({}()\`\`)
x => ({}().b);
a = b => c;
a = (b?) => c;
x => (y = z);
x => (y += z);
f(a => ({})) + 1;
(a => ({})) || 0;
a = b => c;
a = b => {
return c
};
=====================================output=====================================
(a => {}).length;
typeof (() => {});
export default (() => {})();
(() => {})()\`\`;
(() => {})\`\`;
new (() => {})();
if ((() => {}) ? 1 : 0) {
}
let f = () => ({}());
let a = () => ({} instanceof a);
a = () => ({} && a);
a = () => ({}() && a);
a = () => ({} && a && b);
a = () => ({} + a);
a = () => ({}()() && a);
a = () => ({}.b && a);
a = () => ({}[b] && a);
a = () => ({}\`\` && a);
a = () => ({} = 0);
a = () => ({}, a);
a => a instanceof {};
a => ({}().b && 0);
a => ({}().c = 0);
x => ({}()());
x => ({}()\`\`);
x => ({}().b);
a = b => c;
a = (b?) => c;
x => (y = z);
x => (y += z);
f(a => ({})) + 1;
(a => ({})) || 0;
a = b => c;
a = b => {
return c;
};
================================================================================
`;
exports[`arrow_function_expression.js 2`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
(a => {}).length
typeof (() => {});
export default (() => {})();
(() => {})()\`\`;
(() => {})\`\`;
new (() => {});
if ((() => {}) ? 1 : 0) {}
let f = () => ({}())
let a = () => ({} instanceof a);
a = () => ({} && a);
a = () => ({}() && a);
a = () => ({} && a && b);
a = () => ({} + a);
a = () => ({}()() && a);
a = () => ({}.b && a);
a = () => ({}[b] && a);
a = () => ({}\`\` && a);
a = () => ({} = 0);
a = () => ({}, a);
a => a instanceof {};
a => ({}().b && 0)
a => ({}().c = 0)
x => ({}()())
x => ({}()\`\`)
x => ({}().b);
a = b => c;
a = (b?) => c;
x => (y = z);
x => (y += z);
f(a => ({})) + 1;
(a => ({})) || 0;
a = b => c;
a = b => {
return c
};
=====================================output=====================================
((a) => {}).length;
typeof (() => {});
export default (() => {})();
(() => {})()\`\`;
(() => {})\`\`;
new (() => {})();
if ((() => {}) ? 1 : 0) {
}
let f = () => ({}());
let a = () => ({} instanceof a);
a = () => ({} && a);
a = () => ({}() && a);
a = () => ({} && a && b);
a = () => ({} + a);
a = () => ({}()() && a);
a = () => ({}.b && a);
a = () => ({}[b] && a);
a = () => ({}\`\` && a);
a = () => ({} = 0);
a = () => ({}, a);
(a) => a instanceof {};
(a) => ({}().b && 0);
(a) => ({}().c = 0);
(x) => ({}()());
(x) => ({}()\`\`);
(x) => ({}().b);
a = (b) => c;
a = (b?) => c;
(x) => (y = z);
(x) => (y += z);
f((a) => ({})) + 1;
((a) => ({})) || 0;
a = (b) => c;
a = (b) => {
return c;
};
================================================================================
`;
exports[`block_like.js 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
a = () => ({} = this);
=====================================output=====================================
a = () => ({} = this);
================================================================================
`;
exports[`block_like.js 2`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
a = () => ({} = this);
=====================================output=====================================
a = () => ({} = this);
================================================================================
`;
exports[`call.js 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Seq(typeDef.interface.groups).forEach(group =>
Seq(group.members).forEach((member, memberName) =>
markdownDoc(
member.doc,
{ typePath: typePath.concat(memberName.slice(1)),
signatures: member.signatures }
)
)
)
const promiseFromCallback = fn =>
new Promise((resolve, reject) =>
fn((err, result) => {
if (err) return reject(err);
return resolve(result);
})
);
runtimeAgent.getProperties(
objectId,
false, // ownProperties
false, // accessorPropertiesOnly
false, // generatePreview
(error, properties, internalProperties) => {
return 1
},
);
function render() {
return (
<View>
<Image
onProgress={(e) => this.setState({progress: Math.round(100 * e.nativeEvent.loaded / e.nativeEvent.total)})}
/>
</View>
);
}
function render() {
return (
<View>
<Image
onProgress={e =>
this.setState({
progress: Math.round(
100 * e.nativeEvent.loaded / e.nativeEvent.total,
),
})}
/>
</View>
);
}
function render() {
return (
<View>
<Image
onProgress={e =>
this.setState({
progress: Math.round(
100 * e.nativeEvent.loaded / e.nativeEvent.total,
),
})}
/>
</View>
);
}
jest.mock(
'../SearchSource',
() => class {
findMatchingTests(pattern) {
return {paths: []};
}
},
);
fooooooooooooooooooooooooooooooooooooooooooooooooooo(action => next =>
dispatch(action),
);
foo(
({
a,
b
}) => {}
);
foo(
({
a,
b
}) => {}
);
foo(
({
a,
b
}) => {}
);
foo(
a,
({
a,
b
}) => {}
)
foo(
({
a,
b
}) => a
);
foo(
({
a,
b
}) => a
);
foo(
({
a,
b
}) => a
);
=====================================output=====================================
Seq(typeDef.interface.groups).forEach(group =>
Seq(group.members).forEach((member, memberName) =>
markdownDoc(member.doc, {
typePath: typePath.concat(memberName.slice(1)),
signatures: member.signatures
})
)
);
const promiseFromCallback = fn =>
new Promise((resolve, reject) =>
fn((err, result) => {
if (err) return reject(err);
return resolve(result);
})
);
runtimeAgent.getProperties(
objectId,
false, // ownProperties
false, // accessorPropertiesOnly
false, // generatePreview
(error, properties, internalProperties) => {
return 1;
}
);
function render() {
return (
<View>
<Image
onProgress={e =>
this.setState({
progress: Math.round(
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
)
})
}
/>
</View>
);
}
function render() {
return (
<View>
<Image
onProgress={e =>
this.setState({
progress: Math.round(
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
)
})
}
/>
</View>
);
}
function render() {
return (
<View>
<Image
onProgress={e =>
this.setState({
progress: Math.round(
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
)
})
}
/>
</View>
);
}
jest.mock(
"../SearchSource",
() =>
class {
findMatchingTests(pattern) {
return { paths: [] };
}
}
);
fooooooooooooooooooooooooooooooooooooooooooooooooooo(action => next =>
dispatch(action)
);
foo(
({
a,
b
}) => {}
);
foo(({ a, b }) => {});
foo(({ a, b }) => {});
foo(
a,
({
a,
b
}) => {}
);
foo(
({
a,
b
}) => a
);
foo(({ a, b }) => a);
foo(({ a, b }) => a);
================================================================================
`;
exports[`call.js 2`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Seq(typeDef.interface.groups).forEach(group =>
Seq(group.members).forEach((member, memberName) =>
markdownDoc(
member.doc,
{ typePath: typePath.concat(memberName.slice(1)),
signatures: member.signatures }
)
)
)
const promiseFromCallback = fn =>
new Promise((resolve, reject) =>
fn((err, result) => {
if (err) return reject(err);
return resolve(result);
})
);
runtimeAgent.getProperties(
objectId,
false, // ownProperties
false, // accessorPropertiesOnly
false, // generatePreview
(error, properties, internalProperties) => {
return 1
},
);
function render() {
return (
<View>
<Image
onProgress={(e) => this.setState({progress: Math.round(100 * e.nativeEvent.loaded / e.nativeEvent.total)})}
/>
</View>
);
}
function render() {
return (
<View>
<Image
onProgress={e =>
this.setState({
progress: Math.round(
100 * e.nativeEvent.loaded / e.nativeEvent.total,
),
})}
/>
</View>
);
}
function render() {
return (
<View>
<Image
onProgress={e =>
this.setState({
progress: Math.round(
100 * e.nativeEvent.loaded / e.nativeEvent.total,
),
})}
/>
</View>
);
}
jest.mock(
'../SearchSource',
() => class {
findMatchingTests(pattern) {
return {paths: []};
}
},
);
fooooooooooooooooooooooooooooooooooooooooooooooooooo(action => next =>
dispatch(action),
);
foo(
({
a,
b
}) => {}
);
foo(
({
a,
b
}) => {}
);
foo(
({
a,
b
}) => {}
);
foo(
a,
({
a,
b
}) => {}
)
foo(
({
a,
b
}) => a
);
foo(
({
a,
b
}) => a
);
foo(
({
a,
b
}) => a
);
=====================================output=====================================
Seq(typeDef.interface.groups).forEach((group) =>
Seq(group.members).forEach((member, memberName) =>
markdownDoc(member.doc, {
typePath: typePath.concat(memberName.slice(1)),
signatures: member.signatures
})
)
);
const promiseFromCallback = (fn) =>
new Promise((resolve, reject) =>
fn((err, result) => {
if (err) return reject(err);
return resolve(result);
})
);
runtimeAgent.getProperties(
objectId,
false, // ownProperties
false, // accessorPropertiesOnly
false, // generatePreview
(error, properties, internalProperties) => {
return 1;
}
);
function render() {
return (
<View>
<Image
onProgress={(e) =>
this.setState({
progress: Math.round(
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
)
})
}
/>
</View>
);
}
function render() {
return (
<View>
<Image
onProgress={(e) =>
this.setState({
progress: Math.round(
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
)
})
}
/>
</View>
);
}
function render() {
return (
<View>
<Image
onProgress={(e) =>
this.setState({
progress: Math.round(
(100 * e.nativeEvent.loaded) / e.nativeEvent.total
)
})
}
/>
</View>
);
}
jest.mock(
"../SearchSource",
() =>
class {
findMatchingTests(pattern) {
return { paths: [] };
}
}
);
fooooooooooooooooooooooooooooooooooooooooooooooooooo((action) => (next) =>
dispatch(action)
);
foo(
({
a,
b
}) => {}
);
foo(({ a, b }) => {});
foo(({ a, b }) => {});
foo(
a,
({
a,
b
}) => {}
);
foo(
({
a,
b
}) => a
);
foo(({ a, b }) => a);
foo(({ a, b }) => a);
================================================================================
`;
exports[`comment.js 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
/**
* Curried function that ends with a BEM CSS Selector
*
* @param {String} block - the BEM Block you'd like to select.
* @returns {Function}
*/
export const bem = block =>
/**
* @param {String} [element] - the BEM Element within that block; if undefined, selects the block itself.
* @returns {Function}
*/
element =>
/**
* @param {?String} [modifier] - the BEM Modifier for the Block or Element; if undefined, selects the Block or Element unmodified.
* @returns {String}
*/
modifier =>
[
".",
css(block),
element ? \`__\${css(element)}\` : "",
modifier ? \`--\${css(modifier)}\` : ""
].join("");
<FlatList
renderItem={(
info, // $FlowExpectedError - bad widgetCount type 6, should be Object
) => <span>{info.item.widget.missingProp}</span>}
data={data}
/>
=====================================output=====================================
/**
* Curried function that ends with a BEM CSS Selector
*
* @param {String} block - the BEM Block you'd like to select.
* @returns {Function}
*/
export const bem = block =>
/**
* @param {String} [element] - the BEM Element within that block; if undefined, selects the block itself.
* @returns {Function}
*/
element =>
/**
* @param {?String} [modifier] - the BEM Modifier for the Block or Element; if undefined, selects the Block or Element unmodified.
* @returns {String}
*/
modifier =>
[
".",
css(block),
element ? \`__\${css(element)}\` : "",
modifier ? \`--\${css(modifier)}\` : ""
].join("");
<FlatList
renderItem={(
info // $FlowExpectedError - bad widgetCount type 6, should be Object
) => <span>{info.item.widget.missingProp}</span>}
data={data}
/>;
================================================================================
`;
exports[`comment.js 2`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
/**
* Curried function that ends with a BEM CSS Selector
*
* @param {String} block - the BEM Block you'd like to select.
* @returns {Function}
*/
export const bem = block =>
/**
* @param {String} [element] - the BEM Element within that block; if undefined, selects the block itself.
* @returns {Function}
*/
element =>
/**
* @param {?String} [modifier] - the BEM Modifier for the Block or Element; if undefined, selects the Block or Element unmodified.
* @returns {String}
*/
modifier =>
[
".",
css(block),
element ? \`__\${css(element)}\` : "",
modifier ? \`--\${css(modifier)}\` : ""
].join("");
<FlatList
renderItem={(
info, // $FlowExpectedError - bad widgetCount type 6, should be Object
) => <span>{info.item.widget.missingProp}</span>}
data={data}
/>
=====================================output=====================================
/**
* Curried function that ends with a BEM CSS Selector
*
* @param {String} block - the BEM Block you'd like to select.
* @returns {Function}
*/
export const bem = (block) =>
/**
* @param {String} [element] - the BEM Element within that block; if undefined, selects the block itself.
* @returns {Function}
*/
(element) =>
/**
* @param {?String} [modifier] - the BEM Modifier for the Block or Element; if undefined, selects the Block or Element unmodified.
* @returns {String}
*/
(modifier) =>
[
".",
css(block),
element ? \`__\${css(element)}\` : "",
modifier ? \`--\${css(modifier)}\` : ""
].join("");
<FlatList
renderItem={(
info // $FlowExpectedError - bad widgetCount type 6, should be Object
) => <span>{info.item.widget.missingProp}</span>}
data={data}
/>;
================================================================================
`;
exports[`currying.js 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
const fn = b => c => d => {
return 3;
};
const foo = (a, b) => c => d => {
return 3;
};
const bar = a => b => c => a + b + c
const mw = store => next => action => {
return next(action)
}
const middleware = options => (req, res, next) => {
// ...
};
=====================================output=====================================
const fn = b => c => d => {
return 3;
};
const foo = (a, b) => c => d => {
return 3;
};
const bar = a => b => c => a + b + c;
const mw = store => next => action => {
return next(action);
};
const middleware = options => (req, res, next) => {
// ...
};
================================================================================
`;
exports[`currying.js 2`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
const fn = b => c => d => {
return 3;
};
const foo = (a, b) => c => d => {
return 3;
};
const bar = a => b => c => a + b + c
const mw = store => next => action => {
return next(action)
}
const middleware = options => (req, res, next) => {
// ...
};
=====================================output=====================================
const fn = (b) => (c) => (d) => {
return 3;
};
const foo = (a, b) => (c) => (d) => {
return 3;
};
const bar = (a) => (b) => (c) => a + b + c;
const mw = (store) => (next) => (action) => {
return next(action);
};
const middleware = (options) => (req, res, next) => {
// ...
};
================================================================================
`;
exports[`long-call-no-args.js 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
veryLongCall(VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT, () => {})
=====================================output=====================================
veryLongCall(
VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT,
() => {}
);
================================================================================
`;
exports[`long-call-no-args.js 2`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
veryLongCall(VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT, () => {})
=====================================output=====================================
veryLongCall(
VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT,
() => {}
);
================================================================================
`;
exports[`long-contents.js 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
const foo = () => {
expect(arg1, arg2, arg3).toEqual({message: 'test', messageType: 'SMS', status: 'Unknown', created: '11/01/2017 13:36'});
};
=====================================output=====================================
const foo = () => {
expect(arg1, arg2, arg3).toEqual({
message: "test",
messageType: "SMS",
status: "Unknown",
created: "11/01/2017 13:36"
});
};
================================================================================
`;
exports[`long-contents.js 2`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
const foo = () => {
expect(arg1, arg2, arg3).toEqual({message: 'test', messageType: 'SMS', status: 'Unknown', created: '11/01/2017 13:36'});
};
=====================================output=====================================
const foo = () => {
expect(arg1, arg2, arg3).toEqual({
message: "test",
messageType: "SMS",
status: "Unknown",
created: "11/01/2017 13:36"
});
};
================================================================================
`;
exports[`parens.js 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
promise.then(
(result) => result,
(err) => err
)
promise.then(
(result) => { f(); return result },
(err) => { f(); return err }
)
foo(a => b)
foo(a => { return b })
foo(c, a => b)
foo(c, a => b, d)
foo(a => b, d)
=====================================output=====================================
promise.then(
result => result,
err => err
);
promise.then(
result => {
f();
return result;
},
err => {
f();
return err;
}
);
foo(a => b);
foo(a => {
return b;
});
foo(c, a => b);
foo(c, a => b, d);
foo(a => b, d);
================================================================================
`;
exports[`parens.js 2`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
promise.then(
(result) => result,
(err) => err
)
promise.then(
(result) => { f(); return result },
(err) => { f(); return err }
)
foo(a => b)
foo(a => { return b })
foo(c, a => b)
foo(c, a => b, d)
foo(a => b, d)
=====================================output=====================================
promise.then(
(result) => result,
(err) => err
);
promise.then(
(result) => {
f();
return result;
},
(err) => {
f();
return err;
}
);
foo((a) => b);
foo((a) => {
return b;
});
foo(c, (a) => b);
foo(c, (a) => b, d);
foo((a) => b, d);
================================================================================
`;
exports[`short_body.js 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[`short_body.js 2`] = `
====================================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[`type_params.js 1`] = `
====================================options=====================================
arrowParens: "avoid"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
<T>(a) => { }
=====================================output=====================================
<T>(a) => {};
================================================================================
`;
exports[`type_params.js 2`] = `
====================================options=====================================
arrowParens: "always"
parsers: ["babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
<T>(a) => { }
=====================================output=====================================
<T>(a) => {};
================================================================================
`;