Don't pass too many arguments to functions (#1750)

Found using Flow.
master
Simon Lydell 2017-05-26 22:01:03 +02:00 committed by Christopher Chedeau
parent f9e324c4d0
commit fe48638376
2 changed files with 7 additions and 9 deletions

View File

@ -954,9 +954,7 @@ function printComments(path, print, options, needsSemi) {
leadingParts.push(hardline);
}
} else if (trailing) {
trailingParts.push(
printTrailingComment(commentPath, print, options, parent)
);
trailingParts.push(printTrailingComment(commentPath, print, options));
}
}, "comments");

View File

@ -1559,7 +1559,7 @@ function genericPrintNoParens(path, options, print, args) {
() => printJSXElement(path, options, print),
options
);
return maybeWrapJSXElementInParens(path, elem, options);
return maybeWrapJSXElementInParens(path, elem);
}
case "JSXOpeningElement": {
const n = path.getValue();
@ -1658,7 +1658,7 @@ function genericPrintNoParens(path, options, print, args) {
if (n.static) {
parts.push("static ");
}
const variance = getFlowVariance(n, options);
const variance = getFlowVariance(n);
if (variance) {
parts.push(variance);
}
@ -1870,7 +1870,7 @@ function genericPrintNoParens(path, options, print, args) {
const parentParentParent = path.getParentNode(2);
let isArrowFunctionTypeAnnotation =
n.type === "TSFunctionType" ||
!((!getFlowVariance(parent, options) &&
!((!getFlowVariance(parent) &&
!parent.optional &&
parent.type === "ObjectTypeProperty") ||
parent.type === "ObjectTypeCallProperty" ||
@ -2052,7 +2052,7 @@ function genericPrintNoParens(path, options, print, args) {
return concat(parts);
case "ObjectTypeIndexer": {
const variance = getFlowVariance(n, options);
const variance = getFlowVariance(n);
return concat([
variance || "",
"[",
@ -2064,7 +2064,7 @@ function genericPrintNoParens(path, options, print, args) {
]);
}
case "ObjectTypeProperty": {
const variance = getFlowVariance(n, options);
const variance = getFlowVariance(n);
return concat([
n.static ? "static " : "",
@ -2135,7 +2135,7 @@ function genericPrintNoParens(path, options, print, args) {
case "TypeParameterInstantiation":
return printTypeParameters(path, options, print, "params");
case "TypeParameter": {
const variance = getFlowVariance(n, options);
const variance = getFlowVariance(n);
if (variance) {
parts.push(variance);