2017-02-22 00:59:19 +03:00
|
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
2019-05-15 18:46:12 +03:00
|
|
|
|
exports[`arrow.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
|
|
|
|
parsers: ["flow", "babel"]
|
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
|
|
|
|
const fn = (/*event, data*/) => doSomething();
|
|
|
|
|
|
|
|
|
|
const fn2 = (/*event, data*/) => doSomething(anything);
|
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
|
|
|
|
const fn = (/*event, data*/) => doSomething();
|
|
|
|
|
|
|
|
|
|
const fn2 = (/*event, data*/) => doSomething(anything);
|
|
|
|
|
|
|
|
|
|
================================================================================
|
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`assignment-pattern.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
const { a /* comment */ = 1 } = b;
|
2017-02-22 00:59:19 +03:00
|
|
|
|
|
|
|
|
|
const { c = 1 /* comment */ } = d;
|
2017-03-06 01:40:03 +03:00
|
|
|
|
|
|
|
|
|
let {a //comment
|
|
|
|
|
= b} = c
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-02-22 00:59:19 +03:00
|
|
|
|
const { a /* comment */ = 1 } = b;
|
|
|
|
|
|
|
|
|
|
const { c = 1 /* comment */ } = d;
|
2017-03-06 01:40:03 +03:00
|
|
|
|
|
|
|
|
|
let {
|
2017-03-20 20:21:54 +03:00
|
|
|
|
a = b //comment
|
2017-03-06 01:40:03 +03:00
|
|
|
|
} = c;
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-22 00:59:19 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`before-comma.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
const foo = {
|
2017-04-10 21:03:35 +03:00
|
|
|
|
a: 'a' /* comment for this line */,
|
|
|
|
|
|
|
|
|
|
/* Section B */
|
|
|
|
|
b: 'b',
|
|
|
|
|
};
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-04-10 21:03:35 +03:00
|
|
|
|
const foo = {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
a: "a" /* comment for this line */,
|
2017-04-10 21:03:35 +03:00
|
|
|
|
|
|
|
|
|
/* Section B */
|
2017-04-12 23:41:51 +03:00
|
|
|
|
b: "b"
|
2017-04-10 21:03:35 +03:00
|
|
|
|
};
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-04-10 21:03:35 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`binary-expressions.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2018-09-02 01:38:19 +03:00
|
|
|
|
function addition() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
+ x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function multiplication() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
* x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function division() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
/ x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function substraction() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
- x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function remainder() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
% x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function exponentiation() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
** x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function leftShift() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
<< x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function rightShift() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
>> x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function unsignedRightShift() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
>>> x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bitwiseAnd() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
& x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bitwiseOr() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
| x
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bitwiseXor() {
|
|
|
|
|
0
|
|
|
|
|
// Comment
|
|
|
|
|
^ x
|
|
|
|
|
}
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2018-09-02 01:38:19 +03:00
|
|
|
|
function addition() {
|
|
|
|
|
0 +
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function multiplication() {
|
|
|
|
|
0 *
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function division() {
|
|
|
|
|
0 /
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function substraction() {
|
|
|
|
|
0 -
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function remainder() {
|
|
|
|
|
0 %
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function exponentiation() {
|
|
|
|
|
0 **
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function leftShift() {
|
|
|
|
|
0 <<
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function rightShift() {
|
|
|
|
|
0 >>
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function unsignedRightShift() {
|
|
|
|
|
0 >>>
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bitwiseAnd() {
|
|
|
|
|
0 &
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bitwiseOr() {
|
|
|
|
|
0 |
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bitwiseXor() {
|
|
|
|
|
0 ^
|
|
|
|
|
// Comment
|
|
|
|
|
x;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2018-09-02 01:38:19 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`blank.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
// This file only
|
2017-01-26 22:57:43 +03:00
|
|
|
|
// has comments. This comment
|
|
|
|
|
// should still exist
|
|
|
|
|
//
|
|
|
|
|
// when printed.
|
2017-03-07 22:02:45 +03:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @typedef {DataDrivenMapping|ConstantMapping} Mapping
|
|
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
* @typedef {Object.<String, Mapping>} ConfigurationMapping
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @typedef {Function} D3Scale - a D3 scale
|
|
|
|
|
* @property {Function} ticks
|
|
|
|
|
* @property {Function} tickFormat
|
|
|
|
|
*/
|
|
|
|
|
// comment
|
|
|
|
|
|
|
|
|
|
// comment
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-02-05 05:36:29 +03:00
|
|
|
|
// This file only
|
|
|
|
|
// has comments. This comment
|
|
|
|
|
// should still exist
|
|
|
|
|
//
|
|
|
|
|
// when printed.
|
2017-03-07 22:02:45 +03:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @typedef {DataDrivenMapping|ConstantMapping} Mapping
|
|
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
* @typedef {Object.<String, Mapping>} ConfigurationMapping
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @typedef {Function} D3Scale - a D3 scale
|
|
|
|
|
* @property {Function} ticks
|
|
|
|
|
* @property {Function} tickFormat
|
|
|
|
|
*/
|
|
|
|
|
// comment
|
|
|
|
|
|
|
|
|
|
// comment
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-01-26 22:57:43 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`break-continue-statements.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2018-04-07 19:38:37 +03:00
|
|
|
|
for (;;) {
|
|
|
|
|
break /* comment */;
|
|
|
|
|
continue /* comment */;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loop: for (;;) {
|
|
|
|
|
break /* comment */ loop;
|
|
|
|
|
break loop /* comment */;
|
|
|
|
|
continue /* comment */ loop;
|
|
|
|
|
continue loop /* comment */;
|
|
|
|
|
}
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2018-04-07 19:38:37 +03:00
|
|
|
|
for (;;) {
|
|
|
|
|
break; /* comment */
|
|
|
|
|
continue; /* comment */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loop: for (;;) {
|
|
|
|
|
break /* comment */ loop;
|
|
|
|
|
break loop /* comment */;
|
|
|
|
|
continue /* comment */ loop;
|
|
|
|
|
continue loop /* comment */;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2018-04-07 19:38:37 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`call_comment.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
render( // Warm any cache
|
2017-03-04 00:47:13 +03:00
|
|
|
|
<ChildUpdates renderAnchor={true} anchorClassOn={true} />,
|
|
|
|
|
container
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
React.render( // Warm any cache
|
|
|
|
|
<ChildUpdates renderAnchor={true} anchorClassOn={true} />,
|
|
|
|
|
container
|
|
|
|
|
);
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-03-04 00:47:13 +03:00
|
|
|
|
render(
|
|
|
|
|
// Warm any cache
|
|
|
|
|
<ChildUpdates renderAnchor={true} anchorClassOn={true} />,
|
|
|
|
|
container
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
React.render(
|
|
|
|
|
// Warm any cache
|
|
|
|
|
<ChildUpdates renderAnchor={true} anchorClassOn={true} />,
|
|
|
|
|
container
|
|
|
|
|
);
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-03-04 00:47:13 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`dangling.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
var x = {/* dangling */};
|
2017-01-31 17:52:05 +03:00
|
|
|
|
var x = {
|
|
|
|
|
// dangling
|
|
|
|
|
};
|
2017-01-28 00:09:15 +03:00
|
|
|
|
var x = [/* dangling */];
|
|
|
|
|
function x() {
|
|
|
|
|
/* dangling */
|
|
|
|
|
}
|
2018-08-27 04:23:14 +03:00
|
|
|
|
new Thing(/* dangling */);
|
|
|
|
|
Thing(/* dangling */);
|
2017-01-28 00:09:15 +03:00
|
|
|
|
declare class Foo extends Qux<string> {/* dangling */}
|
2017-02-20 01:39:09 +03:00
|
|
|
|
export /* dangling */{};
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-02-14 04:08:58 +03:00
|
|
|
|
var x = {
|
|
|
|
|
/* dangling */
|
|
|
|
|
};
|
2017-01-31 17:52:05 +03:00
|
|
|
|
var x = {
|
|
|
|
|
// dangling
|
|
|
|
|
};
|
2017-02-14 04:08:58 +03:00
|
|
|
|
var x = [
|
|
|
|
|
/* dangling */
|
|
|
|
|
];
|
2017-01-28 00:09:15 +03:00
|
|
|
|
function x() {
|
|
|
|
|
/* dangling */
|
|
|
|
|
}
|
2018-08-27 04:23:14 +03:00
|
|
|
|
new Thing(/* dangling */);
|
|
|
|
|
Thing(/* dangling */);
|
2017-02-14 04:08:58 +03:00
|
|
|
|
declare class Foo extends Qux<string> {
|
|
|
|
|
/* dangling */
|
|
|
|
|
}
|
2017-02-20 01:39:09 +03:00
|
|
|
|
export /* dangling */{};
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-01-28 00:09:15 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`dangling_array.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
expect(() => {}).toTriggerReadyStateChanges([
|
2017-02-18 06:44:55 +03:00
|
|
|
|
// Nothing.
|
|
|
|
|
]);
|
2017-02-20 04:25:18 +03:00
|
|
|
|
|
|
|
|
|
[1 /* first comment */, 2 /* second comment */, 3];
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-09-05 22:22:25 +03:00
|
|
|
|
expect(() => {}).toTriggerReadyStateChanges([
|
|
|
|
|
// Nothing.
|
|
|
|
|
]);
|
2017-02-20 04:25:18 +03:00
|
|
|
|
|
|
|
|
|
[1 /* first comment */, 2 /* second comment */, 3];
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-18 06:44:55 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`dangling_for.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
for // comment
|
2017-02-20 17:17:10 +03:00
|
|
|
|
(;;);
|
|
|
|
|
|
|
|
|
|
for /* comment */(;;);
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-02-20 17:17:10 +03:00
|
|
|
|
// comment
|
|
|
|
|
for (;;);
|
|
|
|
|
|
|
|
|
|
/* comment */
|
|
|
|
|
for (;;);
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-20 17:17:10 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`dynamic_imports.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-09-05 04:57:36 +03:00
|
|
|
|
import(/* Hello */ 'something')
|
|
|
|
|
|
|
|
|
|
import('something' /* Hello */)
|
|
|
|
|
|
|
|
|
|
import(/* Hello */ 'something' /* Hello */)
|
|
|
|
|
|
|
|
|
|
import('something' /* Hello */ + 'else')
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
2019-04-02 22:35:03 +03:00
|
|
|
|
import(
|
|
|
|
|
/* Hello */
|
|
|
|
|
'something'
|
|
|
|
|
/* Hello */
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
wrap(
|
|
|
|
|
import(/* Hello */
|
|
|
|
|
'something'
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
=====================================output=====================================
|
2017-09-05 04:57:36 +03:00
|
|
|
|
import(/* Hello */ "something");
|
|
|
|
|
|
|
|
|
|
import("something" /* Hello */);
|
|
|
|
|
|
|
|
|
|
import(/* Hello */ "something" /* Hello */);
|
|
|
|
|
|
|
|
|
|
import("something" /* Hello */ + "else");
|
|
|
|
|
|
2019-04-02 22:35:03 +03:00
|
|
|
|
import(
|
|
|
|
|
/* Hello */
|
|
|
|
|
"something"
|
|
|
|
|
/* Hello */
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
wrap(
|
|
|
|
|
import(
|
|
|
|
|
/* Hello */
|
|
|
|
|
"something"
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-09-05 04:57:36 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`export.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
export //comment
|
2017-03-06 08:49:07 +03:00
|
|
|
|
{}
|
2018-04-10 23:05:49 +03:00
|
|
|
|
|
|
|
|
|
export /* comment */ {};
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
foo // comment
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
// comment
|
|
|
|
|
bar
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
fooo, // comment
|
|
|
|
|
barr, // comment
|
|
|
|
|
}
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2018-04-10 23:05:49 +03:00
|
|
|
|
export //comment
|
|
|
|
|
{};
|
|
|
|
|
|
|
|
|
|
export /* comment */{};
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
foo // comment
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
// comment
|
|
|
|
|
bar
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
fooo, // comment
|
|
|
|
|
barr // comment
|
|
|
|
|
};
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-03-06 08:49:07 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`first-line.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
a // comment
|
2017-02-05 05:36:48 +03:00
|
|
|
|
b
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-02-05 05:36:48 +03:00
|
|
|
|
a; // comment
|
|
|
|
|
b;
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-05 05:36:48 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`flow_union.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type UploadState<E, EM, D>
|
2017-03-04 00:54:45 +03:00
|
|
|
|
// The upload hasnt begun yet
|
2017-04-12 23:41:51 +03:00
|
|
|
|
= {type: "Not_begun"}
|
2017-03-04 00:54:45 +03:00
|
|
|
|
// The upload timed out
|
2017-04-12 23:41:51 +03:00
|
|
|
|
| {type: "Timed_out"}
|
2017-03-04 00:54:45 +03:00
|
|
|
|
// Failed somewhere on the line
|
2017-04-12 23:41:51 +03:00
|
|
|
|
| {type: "Failed", error: E, errorMsg: EM}
|
2017-03-04 00:54:45 +03:00
|
|
|
|
// Uploading to aws3 and CreatePostMutation succeeded
|
2017-04-12 23:41:51 +03:00
|
|
|
|
| {type: "Success", data: D};
|
2017-03-20 19:33:42 +03:00
|
|
|
|
|
|
|
|
|
type UploadState<E, EM, D>
|
|
|
|
|
// The upload hasnt begun yet
|
|
|
|
|
= A
|
|
|
|
|
// The upload timed out
|
|
|
|
|
| B
|
|
|
|
|
// Failed somewhere on the line
|
|
|
|
|
| C
|
|
|
|
|
// Uploading to aws3 and CreatePostMutation succeeded
|
|
|
|
|
| D;
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-03-04 00:54:45 +03:00
|
|
|
|
type UploadState<E, EM, D> =
|
|
|
|
|
// The upload hasnt begun yet
|
2017-04-12 23:41:51 +03:00
|
|
|
|
| { type: "Not_begun" }
|
2017-03-04 00:54:45 +03:00
|
|
|
|
// The upload timed out
|
2017-04-12 23:41:51 +03:00
|
|
|
|
| { type: "Timed_out" }
|
2017-03-04 00:54:45 +03:00
|
|
|
|
// Failed somewhere on the line
|
2017-04-12 23:41:51 +03:00
|
|
|
|
| { type: "Failed", error: E, errorMsg: EM }
|
2017-03-04 00:54:45 +03:00
|
|
|
|
// Uploading to aws3 and CreatePostMutation succeeded
|
2017-04-12 23:41:51 +03:00
|
|
|
|
| { type: "Success", data: D };
|
2017-03-20 19:33:42 +03:00
|
|
|
|
|
|
|
|
|
type UploadState<E, EM, D> =
|
|
|
|
|
// The upload hasnt begun yet
|
|
|
|
|
| A
|
|
|
|
|
// The upload timed out
|
|
|
|
|
| B
|
|
|
|
|
// Failed somewhere on the line
|
|
|
|
|
| C
|
|
|
|
|
// Uploading to aws3 and CreatePostMutation succeeded
|
|
|
|
|
| D;
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-03-04 00:54:45 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`function-declaration.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
function a(/* comment */) {} // comment
|
2017-02-24 18:26:30 +03:00
|
|
|
|
function b() {} // comment
|
|
|
|
|
function c(/* comment */ argA, argB, argC) {} // comment
|
2017-04-19 20:43:31 +03:00
|
|
|
|
call((/*object*/ row) => {});
|
2017-05-06 07:44:42 +03:00
|
|
|
|
KEYPAD_NUMBERS.map(num => ( // Buttons 0-9
|
|
|
|
|
<div />
|
|
|
|
|
));
|
2017-10-06 12:07:58 +03:00
|
|
|
|
|
|
|
|
|
function f /* f */() {}
|
|
|
|
|
function f (/* args */) {}
|
|
|
|
|
function f () /* returns */ {}
|
|
|
|
|
function f /* f */(/* args */) /* returns */ {}
|
|
|
|
|
|
|
|
|
|
function f /* f */(/* a */ a) {}
|
|
|
|
|
function f /* f */(a /* a */) {}
|
|
|
|
|
function f /* f */(/* a */ a) /* returns */ {}
|
|
|
|
|
|
|
|
|
|
const obj = {
|
|
|
|
|
f1 /* f */() {},
|
|
|
|
|
f2 (/* args */) {},
|
|
|
|
|
f3 () /* returns */ {},
|
|
|
|
|
f4 /* f */(/* args */) /* returns */ {},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
(function f /* f */() {})();
|
|
|
|
|
(function f (/* args */) {})();
|
|
|
|
|
(function f () /* returns */ {})();
|
|
|
|
|
(function f /* f */(/* args */) /* returns */ {})();
|
|
|
|
|
|
|
|
|
|
class C {
|
|
|
|
|
f/* f */() {}
|
|
|
|
|
}
|
|
|
|
|
class C {
|
|
|
|
|
f(/* args */) {}
|
|
|
|
|
}
|
|
|
|
|
class C {
|
|
|
|
|
f() /* returns */ {}
|
|
|
|
|
}
|
|
|
|
|
class C {
|
|
|
|
|
f/* f */(/* args */) /* returns */ {}
|
|
|
|
|
}
|
2018-11-01 22:55:33 +03:00
|
|
|
|
|
|
|
|
|
function foo()
|
|
|
|
|
// this is a function
|
|
|
|
|
{
|
|
|
|
|
return 42
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function foo() // this is a function
|
|
|
|
|
{
|
|
|
|
|
return 42
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function foo() { // this is a function
|
|
|
|
|
return 42
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function foo() {
|
|
|
|
|
// this is a function
|
|
|
|
|
return 42;
|
|
|
|
|
}
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-02-24 18:26:30 +03:00
|
|
|
|
function a(/* comment */) {} // comment
|
|
|
|
|
function b() {} // comment
|
|
|
|
|
function c(/* comment */ argA, argB, argC) {} // comment
|
2017-04-19 20:43:31 +03:00
|
|
|
|
call((/*object*/ row) => {});
|
2017-06-25 05:30:09 +03:00
|
|
|
|
KEYPAD_NUMBERS.map((
|
|
|
|
|
num // Buttons 0-9
|
|
|
|
|
) => <div />);
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2017-10-06 12:07:58 +03:00
|
|
|
|
function f /* f */() {}
|
|
|
|
|
function f(/* args */) {}
|
2017-12-15 10:11:48 +03:00
|
|
|
|
function f() /* returns */ {}
|
|
|
|
|
function f /* f */(/* args */) /* returns */ {}
|
2017-10-06 12:07:58 +03:00
|
|
|
|
|
|
|
|
|
function f /* f */(/* a */ a) {}
|
|
|
|
|
function f /* f */(a /* a */) {}
|
2017-12-15 10:11:48 +03:00
|
|
|
|
function f /* f */(/* a */ a) /* returns */ {}
|
2017-10-06 12:07:58 +03:00
|
|
|
|
|
|
|
|
|
const obj = {
|
|
|
|
|
f1 /* f */() {},
|
|
|
|
|
f2(/* args */) {},
|
2017-12-15 10:11:48 +03:00
|
|
|
|
f3() /* returns */ {},
|
|
|
|
|
f4 /* f */(/* args */) /* returns */ {}
|
2017-10-06 12:07:58 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
(function f /* f */() {})();
|
|
|
|
|
(function f(/* args */) {})();
|
2017-12-15 10:11:48 +03:00
|
|
|
|
(function f() /* returns */ {})();
|
|
|
|
|
(function f /* f */(/* args */) /* returns */ {})();
|
2017-10-06 12:07:58 +03:00
|
|
|
|
|
|
|
|
|
class C {
|
|
|
|
|
f /* f */() {}
|
|
|
|
|
}
|
|
|
|
|
class C {
|
|
|
|
|
f(/* args */) {}
|
|
|
|
|
}
|
|
|
|
|
class C {
|
2017-12-15 10:11:48 +03:00
|
|
|
|
f() /* returns */ {}
|
2017-10-06 12:07:58 +03:00
|
|
|
|
}
|
|
|
|
|
class C {
|
2017-12-15 10:11:48 +03:00
|
|
|
|
f /* f */(/* args */) /* returns */ {}
|
2017-10-06 12:07:58 +03:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-01 22:55:33 +03:00
|
|
|
|
function foo() {
|
|
|
|
|
// this is a function
|
|
|
|
|
return 42;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function foo() {
|
|
|
|
|
// this is a function
|
|
|
|
|
return 42;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function foo() {
|
|
|
|
|
// this is a function
|
|
|
|
|
return 42;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function foo() {
|
|
|
|
|
// this is a function
|
|
|
|
|
return 42;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-24 18:26:30 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`if.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
if (1)
|
2017-02-02 03:23:49 +03:00
|
|
|
|
// comment
|
|
|
|
|
{
|
|
|
|
|
false
|
|
|
|
|
}
|
|
|
|
|
// comment
|
|
|
|
|
else if (2)
|
|
|
|
|
true
|
|
|
|
|
// multi
|
|
|
|
|
// ple
|
|
|
|
|
// lines
|
|
|
|
|
else if (3)
|
|
|
|
|
// existing comment
|
|
|
|
|
true
|
|
|
|
|
// okay?
|
|
|
|
|
else if (4) {
|
|
|
|
|
// empty with existing comment
|
|
|
|
|
}
|
|
|
|
|
// comment
|
|
|
|
|
else {
|
|
|
|
|
}
|
2017-04-10 20:46:44 +03:00
|
|
|
|
|
2017-09-08 20:12:10 +03:00
|
|
|
|
if (5) // comment
|
|
|
|
|
true
|
|
|
|
|
|
|
|
|
|
if (6) // comment
|
|
|
|
|
{true}
|
|
|
|
|
else if (7) // comment
|
|
|
|
|
true
|
2017-04-10 20:46:44 +03:00
|
|
|
|
else // comment
|
2017-09-08 20:12:10 +03:00
|
|
|
|
{true}
|
|
|
|
|
|
|
|
|
|
if (8) // comment
|
|
|
|
|
// comment
|
|
|
|
|
{true}
|
|
|
|
|
else if (9) // comment
|
|
|
|
|
// comment
|
|
|
|
|
true
|
|
|
|
|
else // comment
|
|
|
|
|
// comment
|
|
|
|
|
{true}
|
|
|
|
|
|
|
|
|
|
if (10) /* comment */ // comment
|
|
|
|
|
{true}
|
|
|
|
|
else if (11) /* comment */
|
|
|
|
|
true
|
|
|
|
|
else if (12) // comment /* comment */ // comment
|
|
|
|
|
true
|
|
|
|
|
else if (13) /* comment */ /* comment */ // comment
|
|
|
|
|
true
|
|
|
|
|
else /* comment */
|
|
|
|
|
{true}
|
|
|
|
|
|
|
|
|
|
if (14) // comment
|
|
|
|
|
/* comment */
|
|
|
|
|
// comment
|
|
|
|
|
{true}
|
|
|
|
|
else if (15) // comment
|
|
|
|
|
/* comment */
|
|
|
|
|
/* comment */ // comment
|
|
|
|
|
true
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-02-02 03:23:49 +03:00
|
|
|
|
if (1) {
|
|
|
|
|
// comment
|
|
|
|
|
false;
|
2018-04-05 21:53:41 +03:00
|
|
|
|
}
|
|
|
|
|
// comment
|
|
|
|
|
else if (2) true;
|
|
|
|
|
// multi
|
|
|
|
|
// ple
|
|
|
|
|
// lines
|
2017-02-02 03:23:49 +03:00
|
|
|
|
else if (3)
|
|
|
|
|
// existing comment
|
|
|
|
|
true;
|
2018-04-05 21:53:41 +03:00
|
|
|
|
// okay?
|
2017-02-02 03:23:49 +03:00
|
|
|
|
else if (4) {
|
|
|
|
|
// empty with existing comment
|
2018-04-05 21:53:41 +03:00
|
|
|
|
}
|
|
|
|
|
// comment
|
|
|
|
|
else {
|
2017-02-02 03:23:49 +03:00
|
|
|
|
}
|
2017-04-10 20:46:44 +03:00
|
|
|
|
|
2017-09-08 20:12:10 +03:00
|
|
|
|
if (5)
|
|
|
|
|
// comment
|
|
|
|
|
true;
|
|
|
|
|
|
|
|
|
|
if (6) {
|
|
|
|
|
// comment
|
|
|
|
|
true;
|
|
|
|
|
} else if (7)
|
2017-04-10 20:46:44 +03:00
|
|
|
|
// comment
|
2017-09-08 20:12:10 +03:00
|
|
|
|
true;
|
2018-04-05 21:53:41 +03:00
|
|
|
|
// comment
|
2017-09-08 20:12:10 +03:00
|
|
|
|
else {
|
|
|
|
|
true;
|
2017-04-10 20:46:44 +03:00
|
|
|
|
}
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2017-09-08 20:12:10 +03:00
|
|
|
|
if (8) {
|
|
|
|
|
// comment
|
|
|
|
|
// comment
|
|
|
|
|
true;
|
|
|
|
|
} else if (9)
|
|
|
|
|
// comment
|
|
|
|
|
// comment
|
|
|
|
|
true;
|
2018-04-05 21:53:41 +03:00
|
|
|
|
// comment
|
|
|
|
|
// comment
|
2017-09-08 20:12:10 +03:00
|
|
|
|
else {
|
|
|
|
|
true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (10) {
|
|
|
|
|
/* comment */ // comment
|
|
|
|
|
true;
|
|
|
|
|
} else if (11)
|
|
|
|
|
/* comment */
|
|
|
|
|
true;
|
|
|
|
|
else if (12)
|
|
|
|
|
// comment /* comment */ // comment
|
|
|
|
|
true;
|
|
|
|
|
else if (13)
|
|
|
|
|
/* comment */ /* comment */ // comment
|
|
|
|
|
true;
|
2018-04-05 21:53:41 +03:00
|
|
|
|
/* comment */ else {
|
2017-09-08 20:12:10 +03:00
|
|
|
|
true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (14) {
|
|
|
|
|
// comment
|
|
|
|
|
/* comment */
|
|
|
|
|
// comment
|
|
|
|
|
true;
|
|
|
|
|
} else if (15)
|
|
|
|
|
// comment
|
|
|
|
|
/* comment */
|
|
|
|
|
/* comment */ // comment
|
|
|
|
|
true;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-02 03:23:49 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`issues.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
// Does not need to break as it fits in 80 columns
|
2017-01-19 22:28:40 +03:00
|
|
|
|
this.call(a, /* comment */ b);
|
|
|
|
|
|
|
|
|
|
function f(
|
|
|
|
|
someReallyLongArgument: WithSomeLongType,
|
|
|
|
|
someReallyLongArgument2: WithSomeLongType,
|
|
|
|
|
// Trailing comment should stay after
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
// Comments should either stay at the end of the line or always before, but
|
|
|
|
|
// not one before and one after.
|
|
|
|
|
throw new ProcessSystemError({
|
|
|
|
|
code: acc.error.code, // Alias of errno
|
|
|
|
|
originalError: acc.error, // Just in case.
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Adding a comment stops the pretty printing process and everything is
|
|
|
|
|
// squished in a single line afterward
|
|
|
|
|
export type BuckWebSocketMessage = {
|
|
|
|
|
// Not actually from Buck - this is to let the receiver know that the socket is connected.
|
2017-02-22 00:59:19 +03:00
|
|
|
|
type: 'SocketConnected',
|
2017-01-19 22:28:40 +03:00
|
|
|
|
} | {
|
2017-02-22 00:59:19 +03:00
|
|
|
|
type: 'BuildProgressUpdated',
|
2017-01-19 22:28:40 +03:00
|
|
|
|
progressValue: number,
|
|
|
|
|
} | {
|
2017-02-22 00:59:19 +03:00
|
|
|
|
type: 'BuildFinished',
|
2017-01-19 22:28:40 +03:00
|
|
|
|
exitCode: number,
|
|
|
|
|
} | {
|
2017-02-22 00:59:19 +03:00
|
|
|
|
type: 'BuildStarted',
|
2017-01-19 22:28:40 +03:00
|
|
|
|
} | {
|
2017-02-22 00:59:19 +03:00
|
|
|
|
type: 'ParseStarted',
|
2017-01-19 22:28:40 +03:00
|
|
|
|
} | {
|
2017-02-22 00:59:19 +03:00
|
|
|
|
type: 'ParseFinished',
|
2017-01-19 22:28:40 +03:00
|
|
|
|
} | {
|
2017-02-22 00:59:19 +03:00
|
|
|
|
type: 'RunStarted',
|
2017-01-19 22:28:40 +03:00
|
|
|
|
} | {
|
2017-02-22 00:59:19 +03:00
|
|
|
|
type: 'RunComplete',
|
2017-01-19 22:28:40 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Missing one level of indentation because of the comment
|
|
|
|
|
const rootEpic = (actions, store) => (
|
|
|
|
|
combineEpics(...epics)(actions, store)
|
|
|
|
|
// Log errors and continue.
|
|
|
|
|
.catch((err, stream) => {
|
|
|
|
|
getLogger().error(err);
|
|
|
|
|
return stream;
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Two extra levels of indentation because of the comment
|
|
|
|
|
export type AsyncExecuteOptions = child_process$execFileOpts & {
|
|
|
|
|
// The contents to write to stdin.
|
|
|
|
|
stdin?: ?string,
|
|
|
|
|
dontLogInNuclide?: ?boolean,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// optional trailing comma gets moved all the way to the beginning
|
|
|
|
|
const regex = new RegExp(
|
2017-04-12 23:41:51 +03:00
|
|
|
|
'^\\\\s*' + // beginning of the line
|
|
|
|
|
'name\\\\s*=\\\\s*' + // name =
|
|
|
|
|
'[\\'"]' + // opening quotation mark
|
2017-01-19 22:28:40 +03:00
|
|
|
|
escapeStringRegExp(target.name) + // target name
|
2017-04-12 23:41:51 +03:00
|
|
|
|
'[\\'"]' + // closing quotation mark
|
2017-02-22 00:59:19 +03:00
|
|
|
|
',?$', // optional trailing comma
|
2017-01-19 22:28:40 +03:00
|
|
|
|
);
|
|
|
|
|
|
2017-02-22 00:59:19 +03:00
|
|
|
|
// The comment is moved and doesn't trigger the eslint rule anymore
|
|
|
|
|
import path from 'path'; // eslint-disable-line nuclide-internal/prefer-nuclide-uri
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
|
|
|
|
// Comments disappear in-between MemberExpressions
|
|
|
|
|
Observable.of(process)
|
2017-02-22 00:59:19 +03:00
|
|
|
|
// Don't complete until we say so!
|
2017-01-19 22:28:40 +03:00
|
|
|
|
.merge(Observable.never())
|
|
|
|
|
// Get the errors.
|
|
|
|
|
.takeUntil(throwOnError ? errors.flatMap(Observable.throw) : errors)
|
|
|
|
|
.takeUntil(exit);
|
|
|
|
|
|
|
|
|
|
// Comments disappear inside of JSX
|
|
|
|
|
<div>
|
|
|
|
|
{/* Some comment */}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
// Comments in JSX tag are placed in a non optimal way
|
|
|
|
|
<div
|
|
|
|
|
// comment
|
|
|
|
|
/>;
|
|
|
|
|
|
|
|
|
|
// Comments disappear in empty blocks
|
|
|
|
|
if (1) {
|
|
|
|
|
// Comment
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Comments trigger invalid JavaScript in-between else if
|
|
|
|
|
if (1) {
|
|
|
|
|
}
|
|
|
|
|
// Comment
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The comment makes the line break in a weird way
|
2017-02-22 00:59:19 +03:00
|
|
|
|
const result = asyncExecute('non_existing_command', /* args */ []);
|
2017-01-31 17:52:53 +03:00
|
|
|
|
|
|
|
|
|
// The closing paren is printed on the same line as the comment
|
|
|
|
|
foo({}
|
|
|
|
|
// Hi
|
|
|
|
|
);
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-01-19 22:28:40 +03:00
|
|
|
|
// Does not need to break as it fits in 80 columns
|
2017-01-26 22:57:43 +03:00
|
|
|
|
this.call(a, /* comment */ b);
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
|
|
|
|
function f(
|
|
|
|
|
someReallyLongArgument: WithSomeLongType,
|
|
|
|
|
someReallyLongArgument2: WithSomeLongType
|
2017-04-10 20:55:29 +03:00
|
|
|
|
// Trailing comment should stay after
|
|
|
|
|
) {}
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
|
|
|
|
// Comments should either stay at the end of the line or always before, but
|
|
|
|
|
// not one before and one after.
|
|
|
|
|
throw new ProcessSystemError({
|
2017-01-26 22:57:43 +03:00
|
|
|
|
code: acc.error.code, // Alias of errno
|
|
|
|
|
originalError: acc.error // Just in case.
|
2017-01-19 22:28:40 +03:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Adding a comment stops the pretty printing process and everything is
|
|
|
|
|
// squished in a single line afterward
|
2017-01-27 05:41:50 +03:00
|
|
|
|
export type BuckWebSocketMessage =
|
|
|
|
|
| {
|
2017-02-13 20:03:56 +03:00
|
|
|
|
// Not actually from Buck - this is to let the receiver know that the socket is connected.
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type: "SocketConnected"
|
2017-02-13 20:03:56 +03:00
|
|
|
|
}
|
2017-01-30 20:08:55 +03:00
|
|
|
|
| {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type: "BuildProgressUpdated",
|
2017-02-13 20:03:56 +03:00
|
|
|
|
progressValue: number
|
|
|
|
|
}
|
2017-01-30 20:08:55 +03:00
|
|
|
|
| {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type: "BuildFinished",
|
2017-02-13 20:03:56 +03:00
|
|
|
|
exitCode: number
|
|
|
|
|
}
|
2017-01-30 20:08:55 +03:00
|
|
|
|
| {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type: "BuildStarted"
|
2017-02-13 20:03:56 +03:00
|
|
|
|
}
|
2017-01-30 20:08:55 +03:00
|
|
|
|
| {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type: "ParseStarted"
|
2017-02-13 20:03:56 +03:00
|
|
|
|
}
|
2017-01-30 20:08:55 +03:00
|
|
|
|
| {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type: "ParseFinished"
|
2017-02-13 20:03:56 +03:00
|
|
|
|
}
|
2017-01-30 20:08:55 +03:00
|
|
|
|
| {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type: "RunStarted"
|
2017-02-13 20:03:56 +03:00
|
|
|
|
}
|
2017-01-30 20:08:55 +03:00
|
|
|
|
| {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type: "RunComplete"
|
2017-02-13 20:03:56 +03:00
|
|
|
|
};
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
|
|
|
|
// Missing one level of indentation because of the comment
|
2017-03-09 20:08:12 +03:00
|
|
|
|
const rootEpic = (actions, store) =>
|
|
|
|
|
combineEpics(...epics)(actions, store)
|
|
|
|
|
// Log errors and continue.
|
|
|
|
|
.catch((err, stream) => {
|
|
|
|
|
getLogger().error(err);
|
|
|
|
|
return stream;
|
|
|
|
|
});
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
|
|
|
|
// Two extra levels of indentation because of the comment
|
2017-02-20 18:18:39 +03:00
|
|
|
|
export type AsyncExecuteOptions = child_process$execFileOpts & {
|
|
|
|
|
// The contents to write to stdin.
|
|
|
|
|
stdin?: ?string,
|
|
|
|
|
dontLogInNuclide?: ?boolean
|
|
|
|
|
};
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
|
|
|
|
// optional trailing comma gets moved all the way to the beginning
|
|
|
|
|
const regex = new RegExp(
|
2017-04-12 23:41:51 +03:00
|
|
|
|
"^\\\\s*" + // beginning of the line
|
|
|
|
|
"name\\\\s*=\\\\s*" + // name =
|
|
|
|
|
"['\\"]" + // opening quotation mark
|
2017-03-21 22:13:13 +03:00
|
|
|
|
escapeStringRegExp(target.name) + // target name
|
2017-04-12 23:41:51 +03:00
|
|
|
|
"['\\"]" + // closing quotation mark
|
|
|
|
|
",?$" // optional trailing comma
|
2017-01-19 22:28:40 +03:00
|
|
|
|
);
|
|
|
|
|
|
2017-02-22 00:59:19 +03:00
|
|
|
|
// The comment is moved and doesn't trigger the eslint rule anymore
|
2017-04-12 23:41:51 +03:00
|
|
|
|
import path from "path"; // eslint-disable-line nuclide-internal/prefer-nuclide-uri
|
2017-01-31 19:27:44 +03:00
|
|
|
|
|
2017-01-19 22:28:40 +03:00
|
|
|
|
// Comments disappear in-between MemberExpressions
|
2017-01-31 23:32:42 +03:00
|
|
|
|
Observable.of(process)
|
2017-02-22 00:59:19 +03:00
|
|
|
|
// Don't complete until we say so!
|
2017-02-02 03:26:55 +03:00
|
|
|
|
.merge(Observable.never())
|
|
|
|
|
// Get the errors.
|
|
|
|
|
.takeUntil(throwOnError ? errors.flatMap(Observable.throw) : errors)
|
2017-01-31 23:32:42 +03:00
|
|
|
|
.takeUntil(exit);
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
2017-02-25 02:46:20 +03:00
|
|
|
|
// Comments disappear inside of JSX
|
2017-07-10 22:02:30 +03:00
|
|
|
|
<div>{/* Some comment */}</div>;
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
2017-02-25 02:46:20 +03:00
|
|
|
|
// Comments in JSX tag are placed in a non optimal way
|
2017-01-19 22:28:40 +03:00
|
|
|
|
<div
|
2017-02-25 02:46:20 +03:00
|
|
|
|
// comment
|
2017-01-24 21:54:01 +03:00
|
|
|
|
/>;
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
|
|
|
|
// Comments disappear in empty blocks
|
|
|
|
|
if (1) {
|
2017-01-19 22:46:37 +03:00
|
|
|
|
// Comment
|
2017-01-19 22:28:40 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Comments trigger invalid JavaScript in-between else if
|
|
|
|
|
if (1) {
|
2018-04-05 21:53:41 +03:00
|
|
|
|
}
|
|
|
|
|
// Comment
|
|
|
|
|
else {
|
2017-02-02 03:23:49 +03:00
|
|
|
|
}
|
2017-01-19 22:28:40 +03:00
|
|
|
|
|
|
|
|
|
// The comment makes the line break in a weird way
|
2017-04-12 23:41:51 +03:00
|
|
|
|
const result = asyncExecute("non_existing_command", /* args */ []);
|
2017-01-31 17:52:53 +03:00
|
|
|
|
|
|
|
|
|
// The closing paren is printed on the same line as the comment
|
|
|
|
|
foo(
|
|
|
|
|
{}
|
|
|
|
|
// Hi
|
|
|
|
|
);
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-01-19 22:28:40 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`jsx.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
<div>
|
2017-02-05 05:37:18 +03:00
|
|
|
|
{
|
|
|
|
|
/* comment */
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
2017-02-04 00:56:06 +03:00
|
|
|
|
{/* comment */
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{/* comment
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{a/* comment
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{/* comment
|
|
|
|
|
*/
|
|
|
|
|
a
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{/* comment */
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{/* comment */}
|
|
|
|
|
</div>;
|
2017-03-03 06:27:08 +03:00
|
|
|
|
|
2017-03-11 05:23:11 +03:00
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
// single line comment
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
// multiple line comments 1
|
|
|
|
|
// multiple line comments 2
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
// multiple mixed comments 1
|
|
|
|
|
/* multiple mixed comments 2 */
|
|
|
|
|
/* multiple mixed comments 3 */
|
|
|
|
|
// multiple mixed comments 4
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
// Some very v ery very very merry (xmas) very very long line to break line width limit
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
2017-03-03 06:27:08 +03:00
|
|
|
|
<div>{/*<div> Some very v ery very very long line to break line width limit </div>*/}</div>;
|
2017-08-25 04:02:44 +03:00
|
|
|
|
|
2017-10-08 12:34:24 +03:00
|
|
|
|
<div>
|
|
|
|
|
{/**
|
|
|
|
|
* JSDoc-y comment in JSX. I wonder what will happen to it?
|
|
|
|
|
*/}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Another JSDoc comment in JSX.
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
/**
|
|
|
|
|
* Handles clicks.
|
|
|
|
|
*/
|
|
|
|
|
onClick={() => {}}>
|
|
|
|
|
|
|
|
|
|
</div>;
|
|
|
|
|
|
2017-10-23 09:13:12 +03:00
|
|
|
|
<div
|
|
|
|
|
// comment
|
|
|
|
|
>
|
|
|
|
|
{foo}
|
|
|
|
|
</div>;
|
|
|
|
|
|
2017-11-07 00:05:59 +03:00
|
|
|
|
<div
|
|
|
|
|
className="foo" // comment
|
|
|
|
|
>
|
|
|
|
|
{foo}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
className="foo"
|
|
|
|
|
// comment
|
|
|
|
|
>
|
|
|
|
|
{foo}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div // comment
|
|
|
|
|
id="foo"
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</div>;
|
2017-10-23 09:13:12 +03:00
|
|
|
|
|
2017-08-25 04:02:44 +03:00
|
|
|
|
<Wrapper>
|
|
|
|
|
{}
|
|
|
|
|
<Component />
|
|
|
|
|
</Wrapper>
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-07-10 22:02:30 +03:00
|
|
|
|
<div>{/* comment */}</div>;
|
2017-02-05 05:37:18 +03:00
|
|
|
|
|
2017-07-10 22:02:30 +03:00
|
|
|
|
<div>{/* comment */}</div>;
|
2017-02-04 00:56:06 +03:00
|
|
|
|
|
2018-10-23 22:04:24 +03:00
|
|
|
|
<div>
|
|
|
|
|
{/* comment
|
|
|
|
|
*/}
|
|
|
|
|
</div>;
|
2017-02-04 00:56:06 +03:00
|
|
|
|
|
2018-10-23 22:04:24 +03:00
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
a
|
|
|
|
|
/* comment
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
2017-02-04 00:56:06 +03:00
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
/* comment
|
2018-10-23 22:04:24 +03:00
|
|
|
|
*/
|
2017-02-04 00:56:06 +03:00
|
|
|
|
a
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
2017-07-10 22:02:30 +03:00
|
|
|
|
<div>{/* comment */}</div>;
|
2017-02-04 00:56:06 +03:00
|
|
|
|
|
2017-07-10 22:02:30 +03:00
|
|
|
|
<div>{/* comment */}</div>;
|
2017-03-03 06:27:08 +03:00
|
|
|
|
|
2017-03-11 05:23:11 +03:00
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
// single line comment
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
// multiple line comments 1
|
|
|
|
|
// multiple line comments 2
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
// multiple mixed comments 1
|
|
|
|
|
/* multiple mixed comments 2 */
|
|
|
|
|
/* multiple mixed comments 3 */
|
|
|
|
|
// multiple mixed comments 4
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{
|
|
|
|
|
// Some very v ery very very merry (xmas) very very long line to break line width limit
|
|
|
|
|
}
|
|
|
|
|
</div>;
|
|
|
|
|
|
2017-03-03 06:27:08 +03:00
|
|
|
|
<div>
|
|
|
|
|
{/*<div> Some very v ery very very long line to break line width limit </div>*/}
|
|
|
|
|
</div>;
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2017-10-08 12:34:24 +03:00
|
|
|
|
<div>
|
|
|
|
|
{/**
|
|
|
|
|
* JSDoc-y comment in JSX. I wonder what will happen to it?
|
|
|
|
|
*/}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{/**
|
|
|
|
|
* Another JSDoc comment in JSX.
|
|
|
|
|
*/}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
/**
|
|
|
|
|
* Handles clicks.
|
|
|
|
|
*/
|
|
|
|
|
onClick={() => {}}
|
2019-05-16 21:14:35 +03:00
|
|
|
|
></div>;
|
2017-10-08 12:34:24 +03:00
|
|
|
|
|
2017-10-23 09:13:12 +03:00
|
|
|
|
<div
|
|
|
|
|
// comment
|
|
|
|
|
>
|
|
|
|
|
{foo}
|
|
|
|
|
</div>;
|
|
|
|
|
|
2017-11-07 00:05:59 +03:00
|
|
|
|
<div
|
|
|
|
|
className="foo" // comment
|
|
|
|
|
>
|
|
|
|
|
{foo}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
className="foo"
|
|
|
|
|
// comment
|
|
|
|
|
>
|
|
|
|
|
{foo}
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
<div // comment
|
|
|
|
|
id="foo"
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</div>;
|
|
|
|
|
|
2017-08-25 04:02:44 +03:00
|
|
|
|
<Wrapper>
|
|
|
|
|
{}
|
|
|
|
|
<Component />
|
|
|
|
|
</Wrapper>;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-04 00:56:06 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`last-arg.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
type f = (
|
2017-03-25 18:10:17 +03:00
|
|
|
|
currentRequest: {a: number},
|
|
|
|
|
// TODO this is a very very very very long comment that makes it go > 80 columns
|
|
|
|
|
) => number;
|
2017-02-05 05:37:18 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
f = (
|
|
|
|
|
currentRequest: {a: number},
|
|
|
|
|
// TODO this is a very very very very long comment that makes it go > 80 columns
|
|
|
|
|
): number => {};
|
2017-02-04 00:56:06 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
f = (
|
|
|
|
|
currentRequest: {a: number},
|
|
|
|
|
// TODO this is a very very very very long comment that makes it go > 80 columns
|
|
|
|
|
) => {};
|
2017-03-03 06:17:22 +03:00
|
|
|
|
|
|
|
|
|
f = function(
|
|
|
|
|
currentRequest: {a: number},
|
2017-03-25 18:10:17 +03:00
|
|
|
|
// 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
|
|
|
|
|
) {}
|
2017-03-09 04:06:18 +03:00
|
|
|
|
}
|
2017-04-10 20:55:29 +03:00
|
|
|
|
|
|
|
|
|
function f(
|
|
|
|
|
a: number
|
|
|
|
|
// some comment here
|
|
|
|
|
): number {
|
|
|
|
|
return a + 1;
|
|
|
|
|
}
|
2017-04-13 02:32:04 +03:00
|
|
|
|
|
|
|
|
|
var x = {
|
|
|
|
|
getSectionMode(
|
|
|
|
|
pageMetaData: PageMetaData,
|
|
|
|
|
sectionMetaData: SectionMetaData
|
|
|
|
|
/* $FlowFixMe This error was exposed while converting keyMirror
|
|
|
|
|
* to keyMirrorRecursive */
|
|
|
|
|
): $Enum<SectionMode> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class X {
|
|
|
|
|
getSectionMode(
|
|
|
|
|
pageMetaData: PageMetaData,
|
|
|
|
|
sectionMetaData: SectionMetaData = ['unknown']
|
|
|
|
|
/* $FlowFixMe This error was exposed while converting keyMirror
|
|
|
|
|
* to keyMirrorRecursive */
|
|
|
|
|
): $Enum<SectionMode> {
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-02 00:29:03 +03:00
|
|
|
|
|
|
|
|
|
class Foo {
|
|
|
|
|
a(lol /*string*/) {}
|
|
|
|
|
|
|
|
|
|
b(lol /*string*/
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
d(
|
|
|
|
|
lol /*string*/,
|
|
|
|
|
lol2 /*string*/,
|
|
|
|
|
lol3 /*string*/,
|
|
|
|
|
lol4 /*string*/
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
d(
|
|
|
|
|
lol /*string*/,
|
|
|
|
|
lol2 /*string*/,
|
|
|
|
|
lol3 /*string*/,
|
|
|
|
|
lol4 /*string*/
|
|
|
|
|
) /*string*/ {}
|
|
|
|
|
|
|
|
|
|
// prettier-ignore
|
|
|
|
|
c(lol /*string*/
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
// prettier-ignore
|
|
|
|
|
d(
|
|
|
|
|
lol /*string*/,
|
|
|
|
|
lol2 /*string*/,
|
|
|
|
|
lol3 /*string*/,
|
|
|
|
|
lol4 /*string*/
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
// prettier-ignore
|
|
|
|
|
e(
|
|
|
|
|
lol /*string*/,
|
|
|
|
|
lol2 /*string*/,
|
|
|
|
|
lol3 /*string*/,
|
|
|
|
|
lol4 /*string*/
|
|
|
|
|
) {} /* string*/
|
|
|
|
|
}
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-03-25 18:10:17 +03:00
|
|
|
|
type f = (
|
|
|
|
|
currentRequest: { a: number }
|
|
|
|
|
// TODO this is a very very very very long comment that makes it go > 80 columns
|
|
|
|
|
) => number;
|
2017-02-14 05:35:42 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
f = (
|
|
|
|
|
currentRequest: { a: number }
|
|
|
|
|
// TODO this is a very very very very long comment that makes it go > 80 columns
|
|
|
|
|
): number => {};
|
2017-02-14 05:35:42 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
f = (
|
|
|
|
|
currentRequest: { a: number }
|
|
|
|
|
// TODO this is a very very very very long comment that makes it go > 80 columns
|
|
|
|
|
) => {};
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
f = function(
|
|
|
|
|
currentRequest: { a: number }
|
|
|
|
|
// TODO this is a very very very very long comment that makes it go > 80 columns
|
|
|
|
|
) {};
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
class X {
|
|
|
|
|
f(
|
|
|
|
|
currentRequest: { a: number }
|
|
|
|
|
// TODO this is a very very very very long comment that makes it go > 80 columns
|
|
|
|
|
) {}
|
2017-03-09 04:06:18 +03:00
|
|
|
|
}
|
2017-04-10 20:55:29 +03:00
|
|
|
|
|
|
|
|
|
function f(
|
|
|
|
|
a: number
|
|
|
|
|
// some comment here
|
|
|
|
|
): number {
|
|
|
|
|
return a + 1;
|
|
|
|
|
}
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2017-04-13 02:32:04 +03:00
|
|
|
|
var x = {
|
|
|
|
|
getSectionMode(
|
|
|
|
|
pageMetaData: PageMetaData,
|
|
|
|
|
sectionMetaData: SectionMetaData
|
|
|
|
|
/* $FlowFixMe This error was exposed while converting keyMirror
|
|
|
|
|
* to keyMirrorRecursive */
|
|
|
|
|
): $Enum<SectionMode> {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class X {
|
|
|
|
|
getSectionMode(
|
|
|
|
|
pageMetaData: PageMetaData,
|
|
|
|
|
sectionMetaData: SectionMetaData = ["unknown"]
|
|
|
|
|
/* $FlowFixMe This error was exposed while converting keyMirror
|
|
|
|
|
* to keyMirrorRecursive */
|
|
|
|
|
): $Enum<SectionMode> {}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-02 00:29:03 +03:00
|
|
|
|
class Foo {
|
|
|
|
|
a(lol /*string*/) {}
|
|
|
|
|
|
|
|
|
|
b(lol /*string*/) {}
|
|
|
|
|
|
|
|
|
|
d(lol /*string*/, lol2 /*string*/, lol3 /*string*/, lol4 /*string*/) {}
|
|
|
|
|
|
|
|
|
|
d(
|
|
|
|
|
lol /*string*/,
|
|
|
|
|
lol2 /*string*/,
|
|
|
|
|
lol3 /*string*/,
|
|
|
|
|
lol4 /*string*/
|
2017-12-15 10:11:48 +03:00
|
|
|
|
) /*string*/ {}
|
2017-05-02 00:29:03 +03:00
|
|
|
|
|
|
|
|
|
// prettier-ignore
|
|
|
|
|
c(lol /*string*/
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
// prettier-ignore
|
|
|
|
|
d(
|
|
|
|
|
lol /*string*/,
|
|
|
|
|
lol2 /*string*/,
|
|
|
|
|
lol3 /*string*/,
|
|
|
|
|
lol4 /*string*/
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
// prettier-ignore
|
|
|
|
|
e(
|
|
|
|
|
lol /*string*/,
|
|
|
|
|
lol2 /*string*/,
|
|
|
|
|
lol3 /*string*/,
|
|
|
|
|
lol4 /*string*/
|
|
|
|
|
) {} /* string*/
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-03-25 18:10:17 +03:00
|
|
|
|
`;
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`preserve-new-line-last.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
function f() {
|
2017-03-25 18:10:17 +03:00
|
|
|
|
a
|
|
|
|
|
/* eslint-disable */
|
2017-03-09 04:06:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
function f() {
|
|
|
|
|
a
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
/* eslint-disable */
|
2017-03-09 04:06:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
function name() {
|
|
|
|
|
// comment1
|
|
|
|
|
func1()
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
// comment2
|
|
|
|
|
func2()
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
// comment3 why func3 commented
|
|
|
|
|
// func3()
|
2017-03-09 04:06:18 +03:00
|
|
|
|
}
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-03-25 18:10:17 +03:00
|
|
|
|
function f() {
|
|
|
|
|
a;
|
|
|
|
|
/* eslint-disable */
|
2017-03-09 04:06:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
function f() {
|
|
|
|
|
a;
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
/* eslint-disable */
|
2017-03-09 04:06:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
function name() {
|
|
|
|
|
// comment1
|
|
|
|
|
func1();
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
// comment2
|
|
|
|
|
func2();
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-03-25 18:10:17 +03:00
|
|
|
|
// comment3 why func3 commented
|
|
|
|
|
// func3()
|
2017-03-09 04:06:18 +03:00
|
|
|
|
}
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-14 05:35:42 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`return-statement.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
function jsx() {
|
2017-02-14 05:35:42 +03:00
|
|
|
|
return (
|
|
|
|
|
// Comment
|
|
|
|
|
<div />
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 04:06:18 +03:00
|
|
|
|
function unary() {
|
2017-02-14 05:35:42 +03:00
|
|
|
|
return (
|
|
|
|
|
// Comment
|
|
|
|
|
!!x
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 04:06:18 +03:00
|
|
|
|
function numericLiteralNoParen() {
|
2017-02-14 05:35:42 +03:00
|
|
|
|
return 1337; // Comment
|
|
|
|
|
}
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
|
|
|
|
function logical() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42
|
|
|
|
|
) && 84
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function binary() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42
|
|
|
|
|
) * 84
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function binaryInBinaryLeft() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42
|
|
|
|
|
) * 84 + 2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function binaryInBinaryRight() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42
|
|
|
|
|
) + 84 * 2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function conditional() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42
|
|
|
|
|
) ? 1 : 2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function binaryInConditional() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42
|
|
|
|
|
) * 3 ? 1 : 2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function call() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a
|
|
|
|
|
a
|
|
|
|
|
)()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function memberInside() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a.b
|
|
|
|
|
a.b
|
|
|
|
|
).c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function memberOutside() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a
|
|
|
|
|
a
|
|
|
|
|
).b.c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function memberInAndOutWithCalls() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a
|
2018-04-24 13:54:45 +03:00
|
|
|
|
aFunction.b()
|
2017-03-09 04:06:18 +03:00
|
|
|
|
).c.d()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function excessiveEverything() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for stuff
|
|
|
|
|
a.b() * 3 + 4 ? (a\`hi\`, 1) ? 1 : 1 : 1
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-04 23:50:57 +03:00
|
|
|
|
// See https://github.com/prettier/prettier/issues/2392
|
|
|
|
|
// function sequenceExpression() {
|
|
|
|
|
// return (
|
|
|
|
|
// // Reason for a
|
|
|
|
|
// a
|
|
|
|
|
// ), b
|
|
|
|
|
// }
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-04-05 23:41:35 +03:00
|
|
|
|
function sequenceExpressionInside() {
|
|
|
|
|
return ( // Reason for a
|
|
|
|
|
a, b
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 04:06:18 +03:00
|
|
|
|
function taggedTemplate() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a
|
|
|
|
|
a
|
|
|
|
|
)\`b\`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function inlineComment() {
|
|
|
|
|
return (
|
|
|
|
|
/* hi */ 42
|
|
|
|
|
) || 42
|
|
|
|
|
}
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-03-09 04:06:18 +03:00
|
|
|
|
function jsx() {
|
2017-02-14 05:35:42 +03:00
|
|
|
|
return (
|
|
|
|
|
// Comment
|
|
|
|
|
<div />
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 04:06:18 +03:00
|
|
|
|
function unary() {
|
2017-02-14 05:35:42 +03:00
|
|
|
|
return (
|
|
|
|
|
// Comment
|
|
|
|
|
!!x
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 04:06:18 +03:00
|
|
|
|
function numericLiteralNoParen() {
|
2017-02-14 05:35:42 +03:00
|
|
|
|
return 1337; // Comment
|
|
|
|
|
}
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
|
|
|
|
function logical() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42 && 84
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function binary() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42 * 84
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function binaryInBinaryLeft() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42 *
|
|
|
|
|
84 +
|
2017-03-19 05:35:09 +03:00
|
|
|
|
2
|
2017-03-09 04:06:18 +03:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function binaryInBinaryRight() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42 +
|
2017-03-19 05:35:09 +03:00
|
|
|
|
84 * 2
|
2017-03-09 04:06:18 +03:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function conditional() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42
|
|
|
|
|
? 1
|
|
|
|
|
: 2
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function binaryInConditional() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for 42
|
|
|
|
|
42 * 3
|
|
|
|
|
? 1
|
|
|
|
|
: 2
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function call() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a
|
|
|
|
|
a()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function memberInside() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a.b
|
|
|
|
|
a.b.c
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function memberOutside() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a
|
|
|
|
|
a.b.c
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function memberInAndOutWithCalls() {
|
|
|
|
|
return (
|
2018-04-24 13:54:45 +03:00
|
|
|
|
aFunction
|
2017-03-09 04:06:18 +03:00
|
|
|
|
.b// Reason for a
|
|
|
|
|
()
|
|
|
|
|
.c.d()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function excessiveEverything() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for stuff
|
2017-05-02 00:28:36 +03:00
|
|
|
|
a.b() * 3 + 4 ? ((a\`hi\`, 1) ? 1 : 1) : 1
|
2017-03-09 04:06:18 +03:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-04 23:50:57 +03:00
|
|
|
|
// See https://github.com/prettier/prettier/issues/2392
|
|
|
|
|
// function sequenceExpression() {
|
|
|
|
|
// return (
|
|
|
|
|
// // Reason for a
|
|
|
|
|
// a
|
|
|
|
|
// ), b
|
|
|
|
|
// }
|
2017-03-09 04:06:18 +03:00
|
|
|
|
|
2017-04-05 23:41:35 +03:00
|
|
|
|
function sequenceExpressionInside() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a
|
|
|
|
|
a, b
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 04:06:18 +03:00
|
|
|
|
function taggedTemplate() {
|
|
|
|
|
return (
|
|
|
|
|
// Reason for a
|
|
|
|
|
a\`b\`
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function inlineComment() {
|
|
|
|
|
return /* hi */ 42 || 42;
|
|
|
|
|
}
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-14 05:35:42 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`single-star-jsdoc.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2018-10-23 22:04:24 +03:00
|
|
|
|
/*
|
|
|
|
|
* Looking good!
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if(true) {
|
|
|
|
|
/*
|
|
|
|
|
* Oh no
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** first line
|
|
|
|
|
* second line
|
|
|
|
|
* third line */
|
|
|
|
|
|
|
|
|
|
/* first line
|
|
|
|
|
* second line
|
|
|
|
|
* third line */
|
2018-11-03 22:53:24 +03:00
|
|
|
|
|
|
|
|
|
/*! first line
|
|
|
|
|
*second line
|
|
|
|
|
* third line */
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* Extracted from vue codebase
|
|
|
|
|
* https://github.com/vuejs/vue/blob/cfd73c2386623341fdbb3ac636c4baf84ea89c2c/src/compiler/parser/html-parser.js
|
|
|
|
|
* HTML Parser By John Resig (ejohn.org)
|
|
|
|
|
* Modified by Juriy "kangax" Zaytsev
|
|
|
|
|
* Original code by Erik Arvidsson, Mozilla Public License
|
|
|
|
|
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
|
|
|
|
|
*/
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2018-10-23 22:04:24 +03:00
|
|
|
|
/*
|
|
|
|
|
* Looking good!
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (true) {
|
|
|
|
|
/*
|
|
|
|
|
* Oh no
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** first line
|
|
|
|
|
* second line
|
|
|
|
|
* third line */
|
|
|
|
|
|
|
|
|
|
/* first line
|
|
|
|
|
* second line
|
|
|
|
|
* third line */
|
|
|
|
|
|
2018-11-03 22:53:24 +03:00
|
|
|
|
/*! first line
|
|
|
|
|
*second line
|
|
|
|
|
* third line */
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* Extracted from vue codebase
|
|
|
|
|
* https://github.com/vuejs/vue/blob/cfd73c2386623341fdbb3ac636c4baf84ea89c2c/src/compiler/parser/html-parser.js
|
|
|
|
|
* HTML Parser By John Resig (ejohn.org)
|
|
|
|
|
* Modified by Juriy "kangax" Zaytsev
|
|
|
|
|
* Original code by Erik Arvidsson, Mozilla Public License
|
|
|
|
|
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
|
|
|
|
|
*/
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2018-10-23 22:04:24 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`switch.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
switch (node && node.type) {
|
|
|
|
|
case "Property":
|
|
|
|
|
case "MethodDefinition":
|
2017-03-17 18:08:36 +03:00
|
|
|
|
prop = node.key;
|
|
|
|
|
break;
|
|
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "MemberExpression":
|
2017-03-17 18:08:36 +03:00
|
|
|
|
prop = node.property;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// no default
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (foo) {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "bar":
|
2017-03-17 18:08:36 +03:00
|
|
|
|
doThing()
|
|
|
|
|
|
|
|
|
|
// no default
|
|
|
|
|
}
|
2017-04-06 02:27:14 +03:00
|
|
|
|
|
|
|
|
|
switch (foo) {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "bar": //comment
|
2017-04-06 02:27:14 +03:00
|
|
|
|
doThing(); //comment
|
|
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "baz":
|
2017-04-06 02:27:14 +03:00
|
|
|
|
doOtherThing(); //comment
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (foo) {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "bar": {
|
2017-04-06 02:27:14 +03:00
|
|
|
|
doThing();
|
|
|
|
|
} //comment
|
|
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "baz": {
|
2017-04-06 02:27:14 +03:00
|
|
|
|
doThing();
|
|
|
|
|
} //comment
|
|
|
|
|
}
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-03-17 18:08:36 +03:00
|
|
|
|
switch (node && node.type) {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "Property":
|
|
|
|
|
case "MethodDefinition":
|
2017-03-17 18:08:36 +03:00
|
|
|
|
prop = node.key;
|
|
|
|
|
break;
|
|
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "MemberExpression":
|
2017-03-17 18:08:36 +03:00
|
|
|
|
prop = node.property;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// no default
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (foo) {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "bar":
|
2017-03-17 18:08:36 +03:00
|
|
|
|
doThing();
|
|
|
|
|
|
|
|
|
|
// no default
|
|
|
|
|
}
|
2017-04-06 02:27:14 +03:00
|
|
|
|
|
|
|
|
|
switch (foo) {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "bar": //comment
|
2017-04-06 02:27:14 +03:00
|
|
|
|
doThing(); //comment
|
|
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "baz":
|
2017-04-06 02:27:14 +03:00
|
|
|
|
doOtherThing(); //comment
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (foo) {
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "bar": {
|
2017-04-06 02:27:14 +03:00
|
|
|
|
doThing();
|
|
|
|
|
} //comment
|
|
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
|
case "baz": {
|
2017-04-06 02:27:14 +03:00
|
|
|
|
doThing();
|
|
|
|
|
} //comment
|
|
|
|
|
}
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-03-17 18:08:36 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`template-literal.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
\`
|
2017-02-23 20:23:56 +03:00
|
|
|
|
\${a // comment
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
\${b /* comment */}
|
|
|
|
|
|
|
|
|
|
\${/* comment */ c /* comment */}
|
|
|
|
|
|
|
|
|
|
\${// comment
|
|
|
|
|
d //comment
|
|
|
|
|
};
|
|
|
|
|
\`
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-02-23 20:23:56 +03:00
|
|
|
|
\`
|
2017-10-31 23:31:27 +03:00
|
|
|
|
\${
|
|
|
|
|
a // comment
|
2017-05-24 23:19:56 +03:00
|
|
|
|
}
|
2017-02-23 20:23:56 +03:00
|
|
|
|
|
2017-05-12 20:04:22 +03:00
|
|
|
|
\${b /* comment */}
|
2017-02-23 20:23:56 +03:00
|
|
|
|
|
2017-05-24 23:19:56 +03:00
|
|
|
|
\${/* comment */ c /* comment */}
|
2017-02-23 20:23:56 +03:00
|
|
|
|
|
2017-10-31 23:31:27 +03:00
|
|
|
|
\${
|
|
|
|
|
// comment
|
|
|
|
|
d //comment
|
2017-05-12 20:04:22 +03:00
|
|
|
|
};
|
2017-02-23 20:23:56 +03:00
|
|
|
|
\`;
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-23 20:23:56 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`trailing_space.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-07-16 10:45:27 +03:00
|
|
|
|
#!/there/is-space-here->
|
|
|
|
|
|
|
|
|
|
// Do not trim trailing whitespace from this source file!
|
|
|
|
|
|
|
|
|
|
// There is some space here ->
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-07-16 10:45:27 +03:00
|
|
|
|
#!/there/is-space-here->
|
|
|
|
|
|
|
|
|
|
// Do not trim trailing whitespace from this source file!
|
|
|
|
|
|
|
|
|
|
// There is some space here ->
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-07-16 10:45:27 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`trailing-jsdocs.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2018-05-04 16:15:30 +03:00
|
|
|
|
const CONNECTION_STATUS = exports.CONNECTION_STATUS = {
|
|
|
|
|
CLOSED: Object.freeze({ kind: 'CLOSED' }),
|
|
|
|
|
CONNECTED: Object.freeze({ kind: 'CONNECTED' }),
|
|
|
|
|
CONNECTING: Object.freeze({ kind: 'CONNECTING' }),
|
|
|
|
|
NOT_CONNECTED: Object.freeze({ kind: 'NOT_CONNECTED' }) };
|
|
|
|
|
|
|
|
|
|
/* A comment */ /**
|
|
|
|
|
* A type that can be written to a buffer.
|
|
|
|
|
*/ /**
|
|
|
|
|
* Describes the connection status of a ReactiveSocket/DuplexConnection.
|
|
|
|
|
* - NOT_CONNECTED: no connection established or pending.
|
|
|
|
|
* - CONNECTING: when \`connect()\` has been called but a connection is not yet
|
|
|
|
|
* established.
|
|
|
|
|
* - CONNECTED: when a connection is established.
|
|
|
|
|
* - CLOSED: when the connection has been explicitly closed via \`close()\`.
|
|
|
|
|
* - ERROR: when the connection has been closed for any other reason.
|
|
|
|
|
*/ /**
|
|
|
|
|
* A contract providing different interaction models per the [ReactiveSocket protocol]
|
|
|
|
|
* (https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md).
|
|
|
|
|
*/ /**
|
|
|
|
|
* A single unit of data exchanged between the peers of a \`ReactiveSocket\`.
|
|
|
|
|
*/
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2018-05-04 16:15:30 +03:00
|
|
|
|
const CONNECTION_STATUS = (exports.CONNECTION_STATUS = {
|
|
|
|
|
CLOSED: Object.freeze({ kind: "CLOSED" }),
|
|
|
|
|
CONNECTED: Object.freeze({ kind: "CONNECTED" }),
|
|
|
|
|
CONNECTING: Object.freeze({ kind: "CONNECTING" }),
|
|
|
|
|
NOT_CONNECTED: Object.freeze({ kind: "NOT_CONNECTED" })
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/* A comment */
|
|
|
|
|
/**
|
|
|
|
|
* A type that can be written to a buffer.
|
|
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
* Describes the connection status of a ReactiveSocket/DuplexConnection.
|
|
|
|
|
* - NOT_CONNECTED: no connection established or pending.
|
|
|
|
|
* - CONNECTING: when \`connect()\` has been called but a connection is not yet
|
|
|
|
|
* established.
|
|
|
|
|
* - CONNECTED: when a connection is established.
|
|
|
|
|
* - CLOSED: when the connection has been explicitly closed via \`close()\`.
|
|
|
|
|
* - ERROR: when the connection has been closed for any other reason.
|
|
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
* A contract providing different interaction models per the [ReactiveSocket protocol]
|
|
|
|
|
* (https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md).
|
|
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
* A single unit of data exchanged between the peers of a \`ReactiveSocket\`.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2018-05-04 16:15:30 +03:00
|
|
|
|
`;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`try.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2018-10-12 19:48:49 +03:00
|
|
|
|
// Comment 1
|
|
|
|
|
try { // Comment 2
|
|
|
|
|
// Comment 3
|
2017-02-05 05:25:29 +03:00
|
|
|
|
}
|
2018-10-12 19:48:49 +03:00
|
|
|
|
// Comment 4
|
|
|
|
|
catch(e) { // Comment 5
|
|
|
|
|
// Comment 6
|
2017-02-05 05:25:29 +03:00
|
|
|
|
}
|
2018-10-12 19:48:49 +03:00
|
|
|
|
// Comment 7
|
|
|
|
|
finally { // Comment 8
|
|
|
|
|
// Comment 9
|
2017-02-05 05:25:29 +03:00
|
|
|
|
}
|
2018-10-12 19:48:49 +03:00
|
|
|
|
// Comment 10
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2018-10-12 19:48:49 +03:00
|
|
|
|
// Comment 1
|
2017-02-05 05:25:29 +03:00
|
|
|
|
try {
|
2018-10-12 19:48:49 +03:00
|
|
|
|
// Comment 2
|
|
|
|
|
// Comment 3
|
2017-02-05 05:25:29 +03:00
|
|
|
|
} catch (e) {
|
2018-10-12 19:48:49 +03:00
|
|
|
|
// Comment 4
|
|
|
|
|
// Comment 5
|
|
|
|
|
// Comment 6
|
|
|
|
|
} finally {
|
|
|
|
|
// Comment 7
|
|
|
|
|
// Comment 8
|
|
|
|
|
// Comment 9
|
|
|
|
|
}
|
|
|
|
|
// Comment 10
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-02-05 05:25:29 +03:00
|
|
|
|
`;
|
2017-04-07 17:57:44 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`variable_declarator.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
|
let obj = // Comment
|
2017-04-07 17:57:44 +03:00
|
|
|
|
{
|
|
|
|
|
key: 'val'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let obj // Comment
|
|
|
|
|
= {
|
|
|
|
|
key: 'val'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let obj = { // Comment
|
|
|
|
|
key: 'val'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let obj = {
|
|
|
|
|
// Comment
|
|
|
|
|
key: 'val'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let obj = // Comment
|
|
|
|
|
[
|
|
|
|
|
'val'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
let obj // Comment
|
|
|
|
|
= [
|
|
|
|
|
'val'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
let obj = [ // Comment
|
|
|
|
|
'val'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
let obj = [
|
|
|
|
|
// Comment
|
|
|
|
|
'val'
|
|
|
|
|
]
|
2018-05-28 17:08:18 +03:00
|
|
|
|
|
|
|
|
|
let obj = // Comment
|
|
|
|
|
\`val\`;
|
|
|
|
|
|
|
|
|
|
let obj = // Comment
|
|
|
|
|
\`
|
|
|
|
|
val
|
|
|
|
|
val
|
|
|
|
|
\`;
|
|
|
|
|
|
|
|
|
|
let obj = // Comment
|
|
|
|
|
tag\`val\`;
|
|
|
|
|
|
|
|
|
|
let obj = // Comment
|
|
|
|
|
tag\`
|
|
|
|
|
val
|
|
|
|
|
val
|
|
|
|
|
\`;
|
2018-10-05 14:40:16 +03:00
|
|
|
|
|
|
|
|
|
let // Comment
|
|
|
|
|
foo = 'val';
|
|
|
|
|
|
|
|
|
|
let // Comment
|
|
|
|
|
foo = 'val',
|
|
|
|
|
bar = 'val';
|
2018-11-10 19:26:11 +03:00
|
|
|
|
|
|
|
|
|
const foo = 123
|
|
|
|
|
// Nothing to see here.
|
|
|
|
|
;["2", "3"].forEach(x => console.log(x))
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2017-04-07 19:37:53 +03:00
|
|
|
|
let obj =
|
|
|
|
|
// Comment
|
|
|
|
|
{
|
2017-04-12 23:41:51 +03:00
|
|
|
|
key: "val"
|
2017-04-07 19:37:53 +03:00
|
|
|
|
};
|
2017-04-07 17:57:44 +03:00
|
|
|
|
|
2017-04-07 19:37:53 +03:00
|
|
|
|
let obj =
|
|
|
|
|
// Comment
|
|
|
|
|
{
|
2017-04-12 23:41:51 +03:00
|
|
|
|
key: "val"
|
2017-04-07 19:37:53 +03:00
|
|
|
|
};
|
2017-04-07 17:57:44 +03:00
|
|
|
|
|
|
|
|
|
let obj = {
|
|
|
|
|
// Comment
|
2017-04-12 23:41:51 +03:00
|
|
|
|
key: "val"
|
2017-04-07 17:57:44 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let obj = {
|
|
|
|
|
// Comment
|
2017-04-12 23:41:51 +03:00
|
|
|
|
key: "val"
|
2017-04-07 17:57:44 +03:00
|
|
|
|
};
|
|
|
|
|
|
2017-04-07 19:37:53 +03:00
|
|
|
|
let obj =
|
|
|
|
|
// Comment
|
2017-04-12 23:41:51 +03:00
|
|
|
|
["val"];
|
2017-04-07 17:57:44 +03:00
|
|
|
|
|
2017-04-07 19:37:53 +03:00
|
|
|
|
let obj =
|
|
|
|
|
// Comment
|
2017-04-12 23:41:51 +03:00
|
|
|
|
["val"];
|
2017-04-07 17:57:44 +03:00
|
|
|
|
|
|
|
|
|
let obj = [
|
|
|
|
|
// Comment
|
2017-04-12 23:41:51 +03:00
|
|
|
|
"val"
|
2017-04-07 17:57:44 +03:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
let obj = [
|
|
|
|
|
// Comment
|
2017-04-12 23:41:51 +03:00
|
|
|
|
"val"
|
2017-04-07 17:57:44 +03:00
|
|
|
|
];
|
2017-04-12 23:41:51 +03:00
|
|
|
|
|
2018-05-28 17:08:18 +03:00
|
|
|
|
let obj =
|
|
|
|
|
// Comment
|
|
|
|
|
\`val\`;
|
|
|
|
|
|
|
|
|
|
let obj =
|
|
|
|
|
// Comment
|
|
|
|
|
\`
|
|
|
|
|
val
|
|
|
|
|
val
|
|
|
|
|
\`;
|
|
|
|
|
|
|
|
|
|
let obj =
|
|
|
|
|
// Comment
|
|
|
|
|
tag\`val\`;
|
|
|
|
|
|
|
|
|
|
let obj =
|
|
|
|
|
// Comment
|
|
|
|
|
tag\`
|
|
|
|
|
val
|
|
|
|
|
val
|
|
|
|
|
\`;
|
|
|
|
|
|
2018-10-05 14:40:16 +03:00
|
|
|
|
let // Comment
|
|
|
|
|
foo = "val";
|
|
|
|
|
|
|
|
|
|
let // Comment
|
|
|
|
|
foo = "val",
|
|
|
|
|
bar = "val";
|
|
|
|
|
|
2018-11-10 19:26:11 +03:00
|
|
|
|
const foo = 123;
|
|
|
|
|
// Nothing to see here.
|
|
|
|
|
["2", "3"].forEach(x => console.log(x));
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2017-04-07 17:57:44 +03:00
|
|
|
|
`;
|
2018-10-25 17:48:09 +03:00
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
exports[`while.js 1`] = `
|
|
|
|
|
====================================options=====================================
|
2018-12-27 16:05:19 +03:00
|
|
|
|
parsers: ["flow", "babel"]
|
2018-11-25 11:21:14 +03:00
|
|
|
|
printWidth: 80
|
|
|
|
|
| printWidth
|
|
|
|
|
=====================================input======================================
|
2018-10-25 17:48:09 +03:00
|
|
|
|
while(
|
|
|
|
|
true
|
|
|
|
|
// Comment
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
while(true)// Comment
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
while(true){}// Comment
|
|
|
|
|
|
|
|
|
|
while(true)/*Comment*/{}
|
|
|
|
|
|
|
|
|
|
while(
|
|
|
|
|
true // Comment
|
|
|
|
|
&& true // Comment
|
|
|
|
|
){}
|
|
|
|
|
|
|
|
|
|
while(true) {} // comment
|
|
|
|
|
|
|
|
|
|
while(true) /* comment */ ++x;
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
|
|
=====================================output=====================================
|
2018-10-25 17:48:09 +03:00
|
|
|
|
while (
|
|
|
|
|
true
|
|
|
|
|
// Comment
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
// Comment
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (true) {} // Comment
|
|
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
/*Comment*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (
|
|
|
|
|
true && // Comment
|
|
|
|
|
true // Comment
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
while (true) {} // comment
|
|
|
|
|
|
|
|
|
|
while (true) /* comment */ ++x;
|
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
|
================================================================================
|
2018-10-25 17:48:09 +03:00
|
|
|
|
`;
|