Indent conditions inside of !() (#1731)
This has been a longstanding issue and I thought it would be hard to do, but turns out it is pretty easy! Fixes #774master
parent
198ba3c065
commit
62679f20f0
|
@ -254,6 +254,12 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
return concat(parts);
|
||||
}
|
||||
|
||||
if (parent.type === "UnaryExpression") {
|
||||
return group(
|
||||
concat([indent(concat([softline, concat(parts)])), softline])
|
||||
);
|
||||
}
|
||||
|
||||
// Avoid indenting sub-expressions in assignment/return/etc statements.
|
||||
if (
|
||||
parent.type === "AssignmentExpression" ||
|
||||
|
|
|
@ -272,3 +272,16 @@ foo(
|
|||
);
|
||||
|
||||
`;
|
||||
|
||||
exports[`unary.js 1`] = `
|
||||
const anyTestFailures = !(
|
||||
aggregatedResults.numFailedTests === 0 &&
|
||||
aggregatedResults.numRuntimeErrorTestSuites === 0
|
||||
);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const anyTestFailures = !(
|
||||
aggregatedResults.numFailedTests === 0 &&
|
||||
aggregatedResults.numRuntimeErrorTestSuites === 0
|
||||
);
|
||||
|
||||
`;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
const anyTestFailures = !(
|
||||
aggregatedResults.numFailedTests === 0 &&
|
||||
aggregatedResults.numRuntimeErrorTestSuites === 0
|
||||
);
|
|
@ -95,9 +95,11 @@ function hasObjectMode_bad(options: DuplexStreamOptions): boolean {
|
|||
}
|
||||
|
||||
function hasObjectMode_ok(options: DuplexStreamOptions): boolean {
|
||||
return !!(options.objectMode ||
|
||||
return !!(
|
||||
options.objectMode ||
|
||||
options.readableObjectMode ||
|
||||
options.writableObjectMode);
|
||||
options.writableObjectMode
|
||||
);
|
||||
}
|
||||
|
||||
`;
|
||||
|
|
Loading…
Reference in New Issue