Update babylon & flow (#4536)
* Support new node types for optionals * Update babylon * Fix decorator tests * fix manual errors * Update flow * pretty print * enable option for flow to support ?? * fix AST_COMPARE=1 * fix lint and explicitly test 1_2_3 syntax for flowmaster
parent
ded8524acd
commit
8f141bfafe
|
@ -16,7 +16,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "7.0.0-beta.40",
|
"@babel/code-frame": "7.0.0-beta.40",
|
||||||
"@glimmer/syntax": "0.30.3",
|
"@glimmer/syntax": "0.30.3",
|
||||||
"babylon": "7.0.0-beta.34",
|
"babylon": "7.0.0-beta.47",
|
||||||
"camelcase": "4.1.0",
|
"camelcase": "4.1.0",
|
||||||
"chalk": "2.1.0",
|
"chalk": "2.1.0",
|
||||||
"cjk-regex": "1.0.2",
|
"cjk-regex": "1.0.2",
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
"esutils": "2.0.2",
|
"esutils": "2.0.2",
|
||||||
"find-parent-dir": "0.3.0",
|
"find-parent-dir": "0.3.0",
|
||||||
"find-project-root": "1.1.1",
|
"find-project-root": "1.1.1",
|
||||||
"flow-parser": "0.70",
|
"flow-parser": "0.72.0",
|
||||||
"get-stream": "3.0.0",
|
"get-stream": "3.0.0",
|
||||||
"globby": "6.1.0",
|
"globby": "6.1.0",
|
||||||
"graphql": "0.13.2",
|
"graphql": "0.13.2",
|
||||||
|
|
|
@ -89,6 +89,11 @@ function clean(ast, newObj, parent) {
|
||||||
delete newObj.key;
|
delete newObj.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ast.type === "OptionalMemberExpression" && ast.optional === false) {
|
||||||
|
newObj.type = "MemberExpression";
|
||||||
|
delete newObj.optional;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove raw and cooked values from TemplateElement when it's CSS
|
// Remove raw and cooked values from TemplateElement when it's CSS
|
||||||
// styled-jsx
|
// styled-jsx
|
||||||
if (
|
if (
|
||||||
|
@ -123,12 +128,13 @@ function clean(ast, newObj, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CSS template literals in Angular Component decorator
|
// CSS template literals in Angular Component decorator
|
||||||
|
const expression = ast.expression || ast.callee;
|
||||||
if (
|
if (
|
||||||
ast.type === "Decorator" &&
|
ast.type === "Decorator" &&
|
||||||
ast.expression.type === "CallExpression" &&
|
expression.type === "CallExpression" &&
|
||||||
ast.expression.callee.name === "Component" &&
|
expression.callee.name === "Component" &&
|
||||||
ast.expression.arguments.length === 1 &&
|
expression.arguments.length === 1 &&
|
||||||
ast.expression.arguments[0].properties.some(
|
expression.arguments[0].properties.some(
|
||||||
prop =>
|
prop =>
|
||||||
prop.key.name === "styles" && prop.value.type === "ArrayExpression"
|
prop.key.name === "styles" && prop.value.type === "ArrayExpression"
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@ function parse(text, parsers, opts) {
|
||||||
"flow",
|
"flow",
|
||||||
"doExpressions",
|
"doExpressions",
|
||||||
"objectRestSpread",
|
"objectRestSpread",
|
||||||
"decorators",
|
"decorators-legacy",
|
||||||
"classProperties",
|
"classProperties",
|
||||||
"exportDefaultFrom",
|
"exportDefaultFrom",
|
||||||
"exportNamespaceFrom",
|
"exportNamespaceFrom",
|
||||||
|
|
|
@ -15,7 +15,8 @@ function parse(text /*, parsers, opts*/) {
|
||||||
esproposal_class_instance_fields: true,
|
esproposal_class_instance_fields: true,
|
||||||
esproposal_class_static_fields: true,
|
esproposal_class_static_fields: true,
|
||||||
esproposal_export_star_as: true,
|
esproposal_export_star_as: true,
|
||||||
esproposal_optional_chaining: true
|
esproposal_optional_chaining: true,
|
||||||
|
esproposal_nullish_coalescing: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ast.errors.length > 0) {
|
if (ast.errors.length > 0) {
|
||||||
|
|
|
@ -76,11 +76,11 @@ function genericPrint(path, options, printPath, args) {
|
||||||
) {
|
) {
|
||||||
let separator = hardline;
|
let separator = hardline;
|
||||||
path.each(decoratorPath => {
|
path.each(decoratorPath => {
|
||||||
let prefix = "@";
|
|
||||||
let decorator = decoratorPath.getValue();
|
let decorator = decoratorPath.getValue();
|
||||||
if (decorator.expression) {
|
if (decorator.expression) {
|
||||||
decorator = decorator.expression;
|
decorator = decorator.expression;
|
||||||
prefix = "";
|
} else {
|
||||||
|
decorator = decorator.callee;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -90,17 +90,21 @@ function genericPrint(path, options, printPath, args) {
|
||||||
node.type !== "ClassMethod" &&
|
node.type !== "ClassMethod" &&
|
||||||
(decorator.type === "Identifier" ||
|
(decorator.type === "Identifier" ||
|
||||||
decorator.type === "MemberExpression" ||
|
decorator.type === "MemberExpression" ||
|
||||||
(decorator.type === "CallExpression" &&
|
decorator.type === "OptionalMemberExpression" ||
|
||||||
|
((decorator.type === "CallExpression" ||
|
||||||
|
decorator.type === "OptionalCallExpression") &&
|
||||||
(decorator.arguments.length === 0 ||
|
(decorator.arguments.length === 0 ||
|
||||||
(decorator.arguments.length === 1 &&
|
(decorator.arguments.length === 1 &&
|
||||||
(isStringLiteral(decorator.arguments[0]) ||
|
(isStringLiteral(decorator.arguments[0]) ||
|
||||||
decorator.arguments[0].type === "Identifier" ||
|
decorator.arguments[0].type === "Identifier" ||
|
||||||
decorator.arguments[0].type === "MemberExpression")))))
|
decorator.arguments[0].type === "MemberExpression" ||
|
||||||
|
decorator.arguments[0].type ===
|
||||||
|
"OptionalMemberExpression")))))
|
||||||
) {
|
) {
|
||||||
separator = line;
|
separator = line;
|
||||||
}
|
}
|
||||||
|
|
||||||
decorators.push(prefix, printPath(decoratorPath), separator);
|
decorators.push(printPath(decoratorPath), separator);
|
||||||
}, "decorators");
|
}, "decorators");
|
||||||
} else if (
|
} else if (
|
||||||
privateUtil.isExportDeclaration(node) &&
|
privateUtil.isExportDeclaration(node) &&
|
||||||
|
@ -294,7 +298,10 @@ function formatTernaryOperator(path, options, print, operatorOptions) {
|
||||||
// : c
|
// : c
|
||||||
// ).call()
|
// ).call()
|
||||||
const breakClosingParen =
|
const breakClosingParen =
|
||||||
!jsxMode && parent.type === "MemberExpression" && !parent.computed;
|
!jsxMode &&
|
||||||
|
(parent.type === "MemberExpression" ||
|
||||||
|
parent.type === "OptionalMemberExpression") &&
|
||||||
|
!parent.computed;
|
||||||
|
|
||||||
return maybeGroup(
|
return maybeGroup(
|
||||||
concat(
|
concat(
|
||||||
|
@ -430,7 +437,9 @@ function printPathNoParens(path, options, print, args) {
|
||||||
// ).call()
|
// ).call()
|
||||||
if (
|
if (
|
||||||
parent.type === "UnaryExpression" ||
|
parent.type === "UnaryExpression" ||
|
||||||
(parent.type === "MemberExpression" && !parent.computed)
|
((parent.type === "MemberExpression" ||
|
||||||
|
parent.type === "OptionalMemberExpression") &&
|
||||||
|
!parent.computed)
|
||||||
) {
|
) {
|
||||||
return group(
|
return group(
|
||||||
concat([indent(concat([softline, concat(parts)])), softline])
|
concat([indent(concat([softline, concat(parts)])), softline])
|
||||||
|
@ -518,6 +527,7 @@ function printPathNoParens(path, options, print, args) {
|
||||||
}
|
}
|
||||||
return group(concat([castGroup, path.call(print, "expression")]));
|
return group(concat([castGroup, path.call(print, "expression")]));
|
||||||
}
|
}
|
||||||
|
case "OptionalMemberExpression":
|
||||||
case "MemberExpression": {
|
case "MemberExpression": {
|
||||||
const parent = path.getParentNode();
|
const parent = path.getParentNode();
|
||||||
let firstNonMemberParent;
|
let firstNonMemberParent;
|
||||||
|
@ -528,6 +538,7 @@ function printPathNoParens(path, options, print, args) {
|
||||||
} while (
|
} while (
|
||||||
firstNonMemberParent &&
|
firstNonMemberParent &&
|
||||||
(firstNonMemberParent.type === "MemberExpression" ||
|
(firstNonMemberParent.type === "MemberExpression" ||
|
||||||
|
firstNonMemberParent.type === "OptionalMemberExpression" ||
|
||||||
firstNonMemberParent.type === "TSNonNullExpression")
|
firstNonMemberParent.type === "TSNonNullExpression")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -542,7 +553,8 @@ function printPathNoParens(path, options, print, args) {
|
||||||
n.computed ||
|
n.computed ||
|
||||||
(n.object.type === "Identifier" &&
|
(n.object.type === "Identifier" &&
|
||||||
n.property.type === "Identifier" &&
|
n.property.type === "Identifier" &&
|
||||||
parent.type !== "MemberExpression");
|
parent.type !== "MemberExpression" &&
|
||||||
|
parent.type !== "OptionalMemberExpression");
|
||||||
|
|
||||||
return concat([
|
return concat([
|
||||||
path.call(print, "object"),
|
path.call(print, "object"),
|
||||||
|
@ -990,6 +1002,7 @@ function printPathNoParens(path, options, print, args) {
|
||||||
|
|
||||||
return concat(parts);
|
return concat(parts);
|
||||||
case "NewExpression":
|
case "NewExpression":
|
||||||
|
case "OptionalCallExpression":
|
||||||
case "CallExpression": {
|
case "CallExpression": {
|
||||||
const isNew = n.type === "NewExpression";
|
const isNew = n.type === "NewExpression";
|
||||||
|
|
||||||
|
@ -1262,7 +1275,11 @@ function printPathNoParens(path, options, print, args) {
|
||||||
case "ObjectMethod":
|
case "ObjectMethod":
|
||||||
return printObjectMethod(path, options, print);
|
return printObjectMethod(path, options, print);
|
||||||
case "Decorator":
|
case "Decorator":
|
||||||
return concat(["@", path.call(print, "expression")]);
|
return concat([
|
||||||
|
"@",
|
||||||
|
path.call(print, "expression"),
|
||||||
|
path.call(print, "callee")
|
||||||
|
]);
|
||||||
case "ArrayExpression":
|
case "ArrayExpression":
|
||||||
case "ArrayPattern":
|
case "ArrayPattern":
|
||||||
if (n.elements.length === 0) {
|
if (n.elements.length === 0) {
|
||||||
|
@ -1837,6 +1854,7 @@ function printPathNoParens(path, options, print, args) {
|
||||||
n.expression.type === "ObjectExpression" ||
|
n.expression.type === "ObjectExpression" ||
|
||||||
n.expression.type === "ArrowFunctionExpression" ||
|
n.expression.type === "ArrowFunctionExpression" ||
|
||||||
n.expression.type === "CallExpression" ||
|
n.expression.type === "CallExpression" ||
|
||||||
|
n.expression.type === "OptionalCallExpression" ||
|
||||||
n.expression.type === "FunctionExpression" ||
|
n.expression.type === "FunctionExpression" ||
|
||||||
n.expression.type === "JSXEmptyExpression" ||
|
n.expression.type === "JSXEmptyExpression" ||
|
||||||
n.expression.type === "TemplateLiteral" ||
|
n.expression.type === "TemplateLiteral" ||
|
||||||
|
@ -2235,6 +2253,7 @@ function printPathNoParens(path, options, print, args) {
|
||||||
if (
|
if (
|
||||||
(n.expressions[i].comments && n.expressions[i].comments.length) ||
|
(n.expressions[i].comments && n.expressions[i].comments.length) ||
|
||||||
n.expressions[i].type === "MemberExpression" ||
|
n.expressions[i].type === "MemberExpression" ||
|
||||||
|
n.expressions[i].type === "OptionalMemberExpression" ||
|
||||||
n.expressions[i].type === "ConditionalExpression"
|
n.expressions[i].type === "ConditionalExpression"
|
||||||
) {
|
) {
|
||||||
printed = concat([indent(concat([softline, printed])), softline]);
|
printed = concat([indent(concat([softline, printed])), softline]);
|
||||||
|
@ -3331,6 +3350,7 @@ function couldGroupArg(arg) {
|
||||||
arg.body.type === "ObjectExpression" ||
|
arg.body.type === "ObjectExpression" ||
|
||||||
arg.body.type === "ArrayExpression" ||
|
arg.body.type === "ArrayExpression" ||
|
||||||
arg.body.type === "CallExpression" ||
|
arg.body.type === "CallExpression" ||
|
||||||
|
arg.body.type === "OptionalCallExpression" ||
|
||||||
isJSXNode(arg.body)))
|
isJSXNode(arg.body)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3378,6 +3398,7 @@ const functionCompositionFunctionNames = {
|
||||||
};
|
};
|
||||||
function isFunctionCompositionFunction(node) {
|
function isFunctionCompositionFunction(node) {
|
||||||
switch (node.type) {
|
switch (node.type) {
|
||||||
|
case "OptionalMemberExpression":
|
||||||
case "MemberExpression": {
|
case "MemberExpression": {
|
||||||
return isFunctionCompositionFunction(node.property);
|
return isFunctionCompositionFunction(node.property);
|
||||||
}
|
}
|
||||||
|
@ -4126,8 +4147,8 @@ function printOptionalToken(path) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
node.type === "CallExpression" ||
|
node.type === "OptionalCallExpression" ||
|
||||||
(node.type === "MemberExpression" && node.computed)
|
(node.type === "OptionalMemberExpression" && node.computed)
|
||||||
) {
|
) {
|
||||||
return "?.";
|
return "?.";
|
||||||
}
|
}
|
||||||
|
@ -4204,8 +4225,11 @@ function printMemberChain(path, options, print) {
|
||||||
function rec(path) {
|
function rec(path) {
|
||||||
const node = path.getValue();
|
const node = path.getValue();
|
||||||
if (
|
if (
|
||||||
node.type === "CallExpression" &&
|
(node.type === "CallExpression" ||
|
||||||
(isMemberish(node.callee) || node.callee.type === "CallExpression")
|
node.type === "OptionalCallExpression") &&
|
||||||
|
(isMemberish(node.callee) ||
|
||||||
|
node.callee.type === "CallExpression" ||
|
||||||
|
node.callee.type === "OptionalCallExpression")
|
||||||
) {
|
) {
|
||||||
printedNodes.unshift({
|
printedNodes.unshift({
|
||||||
node: node,
|
node: node,
|
||||||
|
@ -4230,6 +4254,7 @@ function printMemberChain(path, options, print) {
|
||||||
printed: comments.printComments(
|
printed: comments.printComments(
|
||||||
path,
|
path,
|
||||||
() =>
|
() =>
|
||||||
|
node.type === "OptionalMemberExpression" ||
|
||||||
node.type === "MemberExpression"
|
node.type === "MemberExpression"
|
||||||
? printMemberLookup(path, options, print)
|
? printMemberLookup(path, options, print)
|
||||||
: printBindExpressionCallee(path, options, print),
|
: printBindExpressionCallee(path, options, print),
|
||||||
|
@ -4294,8 +4319,10 @@ function printMemberChain(path, options, print) {
|
||||||
for (; i < printedNodes.length; ++i) {
|
for (; i < printedNodes.length; ++i) {
|
||||||
if (
|
if (
|
||||||
printedNodes[i].node.type === "TSNonNullExpression" ||
|
printedNodes[i].node.type === "TSNonNullExpression" ||
|
||||||
|
printedNodes[i].node.type === "OptionalCallExpression" ||
|
||||||
printedNodes[i].node.type === "CallExpression" ||
|
printedNodes[i].node.type === "CallExpression" ||
|
||||||
(printedNodes[i].node.type === "MemberExpression" &&
|
((printedNodes[i].node.type === "MemberExpression" ||
|
||||||
|
printedNodes[i].node.type === "OptionalMemberExpression") &&
|
||||||
printedNodes[i].node.computed &&
|
printedNodes[i].node.computed &&
|
||||||
isNumericLiteral(printedNodes[i].node.property))
|
isNumericLiteral(printedNodes[i].node.property))
|
||||||
) {
|
) {
|
||||||
|
@ -4304,7 +4331,10 @@ function printMemberChain(path, options, print) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (printedNodes[0].node.type !== "CallExpression") {
|
if (
|
||||||
|
printedNodes[0].node.type !== "CallExpression" &&
|
||||||
|
printedNodes[0].node.type !== "OptionalCallExpression"
|
||||||
|
) {
|
||||||
for (; i + 1 < printedNodes.length; ++i) {
|
for (; i + 1 < printedNodes.length; ++i) {
|
||||||
if (
|
if (
|
||||||
isMemberish(printedNodes[i].node) &&
|
isMemberish(printedNodes[i].node) &&
|
||||||
|
@ -4341,7 +4371,10 @@ function printMemberChain(path, options, print) {
|
||||||
hasSeenCallExpression = false;
|
hasSeenCallExpression = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (printedNodes[i].node.type === "CallExpression") {
|
if (
|
||||||
|
printedNodes[i].node.type === "CallExpression" ||
|
||||||
|
printedNodes[i].node.type === "OptionalCallExpression"
|
||||||
|
) {
|
||||||
hasSeenCallExpression = true;
|
hasSeenCallExpression = true;
|
||||||
}
|
}
|
||||||
currentGroup.push(printedNodes[i]);
|
currentGroup.push(printedNodes[i]);
|
||||||
|
@ -4403,7 +4436,8 @@ function printMemberChain(path, options, print) {
|
||||||
|
|
||||||
const lastNode = privateUtil.getLast(groups[0]).node;
|
const lastNode = privateUtil.getLast(groups[0]).node;
|
||||||
return (
|
return (
|
||||||
lastNode.type === "MemberExpression" &&
|
(lastNode.type === "MemberExpression" ||
|
||||||
|
lastNode.type === "OptionalMemberExpression") &&
|
||||||
lastNode.property.type === "Identifier" &&
|
lastNode.property.type === "Identifier" &&
|
||||||
(isFactory(lastNode.property.name) ||
|
(isFactory(lastNode.property.name) ||
|
||||||
(isExpression && isShort(lastNode.property.name)) ||
|
(isExpression && isShort(lastNode.property.name)) ||
|
||||||
|
@ -4453,6 +4487,7 @@ function printMemberChain(path, options, print) {
|
||||||
).node;
|
).node;
|
||||||
const shouldHaveEmptyLineBeforeIndent =
|
const shouldHaveEmptyLineBeforeIndent =
|
||||||
lastNodeBeforeIndent.type !== "CallExpression" &&
|
lastNodeBeforeIndent.type !== "CallExpression" &&
|
||||||
|
lastNodeBeforeIndent.type !== "OptionalCallExpression" &&
|
||||||
shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
|
shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
|
||||||
|
|
||||||
const expanded = concat([
|
const expanded = concat([
|
||||||
|
@ -4463,7 +4498,9 @@ function printMemberChain(path, options, print) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const callExpressionCount = printedNodes.filter(
|
const callExpressionCount = printedNodes.filter(
|
||||||
tuple => tuple.node.type === "CallExpression"
|
tuple =>
|
||||||
|
tuple.node.type === "CallExpression" ||
|
||||||
|
tuple.node.type === "OptionalCallExpression"
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
// We don't want to print in one line if there's:
|
// We don't want to print in one line if there's:
|
||||||
|
@ -4952,6 +4989,7 @@ function maybeWrapJSXElementInParens(path, elem) {
|
||||||
TSJsxFragment: true,
|
TSJsxFragment: true,
|
||||||
ExpressionStatement: true,
|
ExpressionStatement: true,
|
||||||
CallExpression: true,
|
CallExpression: true,
|
||||||
|
OptionalCallExpression: true,
|
||||||
ConditionalExpression: true
|
ConditionalExpression: true
|
||||||
};
|
};
|
||||||
if (NO_WRAP_PARENTS[parent.type]) {
|
if (NO_WRAP_PARENTS[parent.type]) {
|
||||||
|
@ -4975,6 +5013,7 @@ function isBinaryish(node) {
|
||||||
function isMemberish(node) {
|
function isMemberish(node) {
|
||||||
return (
|
return (
|
||||||
node.type === "MemberExpression" ||
|
node.type === "MemberExpression" ||
|
||||||
|
node.type === "OptionalMemberExpression" ||
|
||||||
(node.type === "BindExpression" && node.object)
|
(node.type === "BindExpression" && node.object)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -5203,7 +5242,9 @@ function hasNakedLeftSide(node) {
|
||||||
node.type === "LogicalExpression" ||
|
node.type === "LogicalExpression" ||
|
||||||
node.type === "ConditionalExpression" ||
|
node.type === "ConditionalExpression" ||
|
||||||
node.type === "CallExpression" ||
|
node.type === "CallExpression" ||
|
||||||
|
node.type === "OptionalCallExpression" ||
|
||||||
node.type === "MemberExpression" ||
|
node.type === "MemberExpression" ||
|
||||||
|
node.type === "OptionalMemberExpression" ||
|
||||||
node.type === "SequenceExpression" ||
|
node.type === "SequenceExpression" ||
|
||||||
node.type === "TaggedTemplateExpression" ||
|
node.type === "TaggedTemplateExpression" ||
|
||||||
(node.type === "BindExpression" && !node.object) ||
|
(node.type === "BindExpression" && !node.object) ||
|
||||||
|
@ -5396,7 +5437,10 @@ function returnArgumentHasLeadingComment(options, argument) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMemberExpressionChain(node) {
|
function isMemberExpressionChain(node) {
|
||||||
if (node.type !== "MemberExpression") {
|
if (
|
||||||
|
node.type !== "MemberExpression" &&
|
||||||
|
node.type !== "OptionalMemberExpression"
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (node.object.type === "Identifier") {
|
if (node.object.type === "Identifier") {
|
||||||
|
@ -5640,7 +5684,8 @@ function isTestCall(n, parent) {
|
||||||
|
|
||||||
function isSkipOrOnlyBlock(node) {
|
function isSkipOrOnlyBlock(node) {
|
||||||
return (
|
return (
|
||||||
node.callee.type === "MemberExpression" &&
|
(node.callee.type === "MemberExpression" ||
|
||||||
|
node.callee.type === "OptionalMemberExpression") &&
|
||||||
node.callee.object.type === "Identifier" &&
|
node.callee.object.type === "Identifier" &&
|
||||||
node.callee.property.type === "Identifier" &&
|
node.callee.property.type === "Identifier" &&
|
||||||
unitTestRe.test(node.callee.object.name) &&
|
unitTestRe.test(node.callee.object.name) &&
|
||||||
|
@ -5657,7 +5702,8 @@ function isTemplateLiteral(node) {
|
||||||
// example: https://docs.angularjs.org/guide/unit-testing#using-beforeall-
|
// example: https://docs.angularjs.org/guide/unit-testing#using-beforeall-
|
||||||
function isAngularTestWrapper(node) {
|
function isAngularTestWrapper(node) {
|
||||||
return (
|
return (
|
||||||
node.type === "CallExpression" &&
|
(node.type === "CallExpression" ||
|
||||||
|
node.type === "OptionalCallExpression") &&
|
||||||
node.callee.type === "Identifier" &&
|
node.callee.type === "Identifier" &&
|
||||||
(node.callee.name === "async" || node.callee.name === "inject")
|
(node.callee.name === "async" || node.callee.name === "inject")
|
||||||
);
|
);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
run_spec(__dirname, ["babylon", "typescript"]);
|
run_spec(__dirname, ["babylon", "flow", "typescript"]);
|
||||||
|
|
|
@ -13,9 +13,6 @@ foo ?? baz || baz;
|
||||||
|
|
||||||
(foo && baz) ?? baz;
|
(foo && baz) ?? baz;
|
||||||
foo && (baz ?? baz);
|
foo && (baz ?? baz);
|
||||||
|
|
||||||
foo |> (bar ?? baz);
|
|
||||||
(foo |> bar) ?? baz;
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
obj.foo ?? "default";
|
obj.foo ?? "default";
|
||||||
|
|
||||||
|
@ -30,7 +27,4 @@ foo ?? baz || baz;
|
||||||
(foo && baz) ?? baz;
|
(foo && baz) ?? baz;
|
||||||
foo && (baz ?? baz);
|
foo && (baz ?? baz);
|
||||||
|
|
||||||
foo |> bar ?? baz;
|
|
||||||
(foo |> bar) ?? baz;
|
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
run_spec(__dirname, ["babylon"]);
|
run_spec(__dirname, ["babylon", "flow"]);
|
||||||
|
|
|
@ -10,6 +10,3 @@ foo ?? baz || baz;
|
||||||
|
|
||||||
(foo && baz) ?? baz;
|
(foo && baz) ?? baz;
|
||||||
foo && (baz ?? baz);
|
foo && (baz ?? baz);
|
||||||
|
|
||||||
foo |> (bar ?? baz);
|
|
||||||
(foo |> bar) ?? baz;
|
|
||||||
|
|
|
@ -25,6 +25,9 @@ function createPerson (attrs) {
|
||||||
|> format('name', /^[a-z]$/i)
|
|> format('name', /^[a-z]$/i)
|
||||||
|> Person.insertIntoDatabase;
|
|> Person.insertIntoDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foo |> (bar ?? baz);
|
||||||
|
(foo |> bar) ?? baz;
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
a |> b |> c;
|
a |> b |> c;
|
||||||
|
|
||||||
|
@ -49,4 +52,7 @@ function createPerson(attrs) {
|
||||||
|> Person.insertIntoDatabase;
|
|> Person.insertIntoDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foo |> bar ?? baz;
|
||||||
|
(foo |> bar) ?? baz;
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -22,3 +22,6 @@ function createPerson (attrs) {
|
||||||
|> format('name', /^[a-z]$/i)
|
|> format('name', /^[a-z]$/i)
|
||||||
|> Person.insertIntoDatabase;
|
|> Person.insertIntoDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foo |> (bar ?? baz);
|
||||||
|
(foo |> bar) ?? baz;
|
||||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -962,9 +962,9 @@ babel-types@^6.26.0:
|
||||||
lodash "^4.17.4"
|
lodash "^4.17.4"
|
||||||
to-fast-properties "^1.0.3"
|
to-fast-properties "^1.0.3"
|
||||||
|
|
||||||
babylon@7.0.0-beta.34:
|
babylon@7.0.0-beta.47:
|
||||||
version "7.0.0-beta.34"
|
version "7.0.0-beta.47"
|
||||||
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.34.tgz#2ccdf97bb4fbc1617619a030a6c0390b2c8f16d6"
|
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.47.tgz#6d1fa44f0abec41ab7c780481e62fd9aafbdea80"
|
||||||
|
|
||||||
babylon@7.0.0-beta.40:
|
babylon@7.0.0-beta.40:
|
||||||
version "7.0.0-beta.40"
|
version "7.0.0-beta.40"
|
||||||
|
@ -2094,9 +2094,9 @@ flatten@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
|
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
|
||||||
|
|
||||||
flow-parser@0.70:
|
flow-parser@0.72.0:
|
||||||
version "0.70.0"
|
version "0.72.0"
|
||||||
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.70.0.tgz#9c310187efe4380ba9a251284e9b83b95c49e857"
|
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.72.0.tgz#6c8041e76ac7d0be1a71ce29c00cd1435fb6013c"
|
||||||
|
|
||||||
for-in@^1.0.1:
|
for-in@^1.0.1:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
|
|
Loading…
Reference in New Issue