remove noisy comments/documentation
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
import each from "lodash/collection/each";
|
||||
import * as t from "babel-types";
|
||||
|
||||
/**
|
||||
* Create a mapping of operators to precendence.
|
||||
*
|
||||
* @example
|
||||
* { "==": 6, "+": 9 }
|
||||
*/
|
||||
const PRECEDENCE = {};
|
||||
|
||||
each([
|
||||
@@ -27,24 +21,12 @@ each([
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Test if NullableTypeAnnotation needs parentheses.
|
||||
*/
|
||||
|
||||
export function NullableTypeAnnotation(node, parent) {
|
||||
return t.isArrayTypeAnnotation(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias NullableTypeAnnotation test as FunctionTypeAnnotation.
|
||||
*/
|
||||
|
||||
export { NullableTypeAnnotation as FunctionTypeAnnotation };
|
||||
|
||||
/**
|
||||
* Test if UpdateExpression needs parentheses.
|
||||
*/
|
||||
|
||||
export function UpdateExpression(node, parent) {
|
||||
if (t.isMemberExpression(parent) && parent.object === node) {
|
||||
// (foo++).test()
|
||||
@@ -52,10 +34,6 @@ export function UpdateExpression(node, parent) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if ObjectExpression needs parentheses.
|
||||
*/
|
||||
|
||||
export function ObjectExpression(node, parent) {
|
||||
if (t.isExpressionStatement(parent)) {
|
||||
// ({ foo: "bar" });
|
||||
@@ -70,10 +48,6 @@ export function ObjectExpression(node, parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if Binary needs parentheses.
|
||||
*/
|
||||
|
||||
export function Binary(node, parent) {
|
||||
if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) {
|
||||
return true;
|
||||
@@ -104,10 +78,6 @@ export function Binary(node, parent) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if BinaryExpression needs parentheses.
|
||||
*/
|
||||
|
||||
export function BinaryExpression(node, parent) {
|
||||
if (node.operator === "in") {
|
||||
// var i = (1 in []);
|
||||
@@ -122,10 +92,6 @@ export function BinaryExpression(node, parent) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if SequenceExpression needs parentheses.
|
||||
*/
|
||||
|
||||
export function SequenceExpression(node, parent) {
|
||||
if (t.isForStatement(parent)) {
|
||||
// Although parentheses wouldn't hurt around sequence
|
||||
@@ -144,10 +110,6 @@ export function SequenceExpression(node, parent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if YieldExpression needs parentheses.
|
||||
*/
|
||||
|
||||
export function YieldExpression(node, parent) {
|
||||
return t.isBinary(parent) ||
|
||||
t.isUnaryLike(parent) ||
|
||||
@@ -158,26 +120,14 @@ export function YieldExpression(node, parent) {
|
||||
t.isYieldExpression(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if ClassExpression needs parentheses.
|
||||
*/
|
||||
|
||||
export function ClassExpression(node, parent) {
|
||||
return t.isExpressionStatement(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if UnaryLike needs parentheses.
|
||||
*/
|
||||
|
||||
export function UnaryLike(node, parent) {
|
||||
return t.isMemberExpression(parent) && parent.object === node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if FunctionExpression needs parentheses.
|
||||
*/
|
||||
|
||||
export function FunctionExpression(node, parent) {
|
||||
// function () {};
|
||||
if (t.isExpressionStatement(parent)) {
|
||||
@@ -195,10 +145,6 @@ export function FunctionExpression(node, parent) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if ConditionalExpression needs parentheses.
|
||||
*/
|
||||
|
||||
export function ConditionalExpression(node, parent) {
|
||||
if (t.isUnaryLike(parent)) {
|
||||
return true;
|
||||
@@ -225,10 +171,6 @@ export function ConditionalExpression(node, parent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if AssignmentExpression needs parentheses.
|
||||
*/
|
||||
|
||||
export function AssignmentExpression(node) {
|
||||
if (t.isObjectPattern(node.left)) {
|
||||
return true;
|
||||
|
||||
@@ -48,10 +48,6 @@ function isHelper(node) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [Please add a description.]
|
||||
*/
|
||||
|
||||
function isType(node) {
|
||||
return t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) ||
|
||||
t.isIdentifier(node) || t.isMemberExpression(node);
|
||||
|
||||
Reference in New Issue
Block a user