Fix Flow.

Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow.

Closes #3064
This commit is contained in:
Daniel Lo Nigro 2015-11-15 21:29:59 -08:00
parent 1d34d19ce9
commit 0076204f80
84 changed files with 55 additions and 194 deletions

View File

@ -9,6 +9,7 @@ lib/types.js
[options]
strip_root=true
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
[version]
0.16.0
0.18.1

View File

@ -20,7 +20,7 @@ watch: clean
lint:
node node_modules/.bin/eslint packages/*/src
#flow check
flow
clean: test-clean
rm -rf packages/babel-polyfill/browser*

View File

@ -51,7 +51,7 @@ declare class BabelNodeAssignmentExpression extends BabelNode {
declare class BabelNodeBinaryExpression extends BabelNode {
type: "BinaryExpression";
operator: string;
operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=";
left: BabelNodeExpression;
right: BabelNodeExpression;
}
@ -136,9 +136,9 @@ declare class BabelNodeForInStatement extends BabelNode {
declare class BabelNodeForStatement extends BabelNode {
type: "ForStatement";
init: BabelNodeVariableDeclaration | BabelNodeExpression;
test: BabelNodeExpression;
update: BabelNodeExpression;
init?: ?BabelNodeVariableDeclaration | BabelNodeExpression;
test?: ?BabelNodeExpression;
update?: ?BabelNodeExpression;
body: BabelNodeStatement;
}
@ -173,7 +173,7 @@ declare class BabelNodeIdentifier extends BabelNode {
declare class BabelNodeIfStatement extends BabelNode {
type: "IfStatement";
test: BabelNodeExpression;
consequent?: ?BabelNodeStatement;
consequent: BabelNodeStatement;
alternate?: ?BabelNodeStatement;
}
@ -210,7 +210,7 @@ declare class BabelNodeRegExpLiteral extends BabelNode {
declare class BabelNodeLogicalExpression extends BabelNode {
type: "LogicalExpression";
operator: any;
operator: "||" | "&&";
left: BabelNodeExpression;
right: BabelNodeExpression;
}
@ -280,13 +280,13 @@ declare class BabelNodeSequenceExpression extends BabelNode {
declare class BabelNodeSwitchCase extends BabelNode {
type: "SwitchCase";
test: any;
test?: ?BabelNodeExpression;
consequent: any;
}
declare class BabelNodeSwitchStatement extends BabelNode {
type: "SwitchStatement";
discriminant: any;
discriminant: BabelNodeExpression;
cases: any;
}
@ -311,14 +311,14 @@ declare class BabelNodeUnaryExpression extends BabelNode {
type: "UnaryExpression";
prefix?: boolean;
argument: BabelNodeExpression;
operator: any;
operator: "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof";
}
declare class BabelNodeUpdateExpression extends BabelNode {
type: "UpdateExpression";
prefix?: boolean;
argument: BabelNodeExpression;
operator: any;
operator: "++" | "--";
}
declare class BabelNodeVariableDeclaration extends BabelNode {
@ -392,19 +392,19 @@ declare class BabelNodeClassExpression extends BabelNode {
declare class BabelNodeExportAllDeclaration extends BabelNode {
type: "ExportAllDeclaration";
source: any;
source: BabelNodeStringLiteral;
}
declare class BabelNodeExportDefaultDeclaration extends BabelNode {
type: "ExportDefaultDeclaration";
declaration: any;
declaration: BabelNodeFunctionDeclaration | BabelNodeClassDeclaration | BabelNodeExpression;
}
declare class BabelNodeExportNamedDeclaration extends BabelNode {
type: "ExportNamedDeclaration";
declaration: any;
declaration?: ?BabelNodeDeclaration;
specifiers: any;
source: any;
source?: ?BabelNodeStringLiteral;
}
declare class BabelNodeExportSpecifier extends BabelNode {
@ -556,6 +556,10 @@ declare class BabelNodeDeclareVariable extends BabelNode {
id: any;
}
declare class BabelNodeExistentialTypeParam extends BabelNode {
type: "ExistentialTypeParam";
}
declare class BabelNodeFunctionTypeAnnotation extends BabelNode {
type: "FunctionTypeAnnotation";
typeParameters: any;
@ -809,7 +813,7 @@ declare class BabelNodeSpreadProperty extends BabelNode {
argument: BabelNodeExpression;
}
type BabelNodeExpression = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeCallExpression | BabelNodeConditionalExpression | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeObjectExpression | BabelNodeSequenceExpression | BabelNodeThisExpression | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeMetaProperty | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeParenthesizedExpression | BabelNodeAwaitExpression | BabelNodeDoExpression;
type BabelNodeExpression = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeCallExpression | BabelNodeConditionalExpression | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeObjectExpression | BabelNodeSequenceExpression | BabelNodeThisExpression | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeMetaProperty | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeTypeCastExpression | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeParenthesizedExpression | BabelNodeAwaitExpression | BabelNodeDoExpression;
type BabelNodeBinary = BabelNodeBinaryExpression | BabelNodeLogicalExpression;
type BabelNodeScopable = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeClassDeclaration | BabelNodeClassExpression | BabelNodeForOfStatement | BabelNodeClassMethod;
type BabelNodeBlockParent = BabelNodeBlockStatement | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeForOfStatement | BabelNodeClassMethod;
@ -839,7 +843,7 @@ type BabelNodeClass = BabelNodeClassDeclaration | BabelNodeClassExpression;
type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration;
type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration;
type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier;
type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumericLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation;
type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeExistentialTypeParam | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumericLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation;
type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeVoidTypeAnnotation;
type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeInterfaceDeclaration | BabelNodeTypeAlias;
type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText;
@ -847,7 +851,7 @@ type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNo
declare module "babel-types" {
declare function arrayExpression(elements: Array<any>): BabelNodeArrayExpression;
declare function assignmentExpression(operator: string, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression;
declare function binaryExpression(operator: string, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeBinaryExpression;
declare function binaryExpression(operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=", left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeBinaryExpression;
declare function directive(value: BabelNodeDirectiveLiteral): BabelNodeDirective;
declare function directiveLiteral(value: string): BabelNodeDirectiveLiteral;
declare function blockStatement(directives?: any, body: any): BabelNodeBlockStatement;
@ -862,18 +866,18 @@ declare module "babel-types" {
declare function expressionStatement(expression: BabelNodeExpression): BabelNodeExpressionStatement;
declare function file(program: BabelNodeProgram, comments: any, tokens: any): BabelNodeFile;
declare function forInStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForInStatement;
declare function forStatement(init: BabelNodeVariableDeclaration | BabelNodeExpression, test: BabelNodeExpression, update: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForStatement;
declare function forStatement(init?: ?BabelNodeVariableDeclaration | BabelNodeExpression, test?: ?BabelNodeExpression, update?: ?BabelNodeExpression, body: BabelNodeStatement): BabelNodeForStatement;
declare function functionDeclaration(id: BabelNodeIdentifier, params: any, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, returnType: any, typeParameters: any): BabelNodeFunctionDeclaration;
declare function functionExpression(id?: ?BabelNodeIdentifier, params: any, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, returnType: any, typeParameters: any): BabelNodeFunctionExpression;
declare function identifier(name: any, typeAnnotation: any): BabelNodeIdentifier;
declare function ifStatement(test: BabelNodeExpression, consequent?: ?BabelNodeStatement, alternate?: ?BabelNodeStatement): BabelNodeIfStatement;
declare function ifStatement(test: BabelNodeExpression, consequent: BabelNodeStatement, alternate?: ?BabelNodeStatement): BabelNodeIfStatement;
declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement;
declare function stringLiteral(value: string): BabelNodeStringLiteral;
declare function NumericLiteral(value: number): BabelNodeNumericLiteral;
declare function numericLiteral(value: number): BabelNodeNumericLiteral;
declare function nullLiteral(): BabelNodeNullLiteral;
declare function booleanLiteral(value: boolean): BabelNodeBooleanLiteral;
declare function RegExpLiteral(pattern: string, flags?: string): BabelNodeRegExpLiteral;
declare function logicalExpression(operator: any, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression;
declare function regExpLiteral(pattern: string, flags?: string): BabelNodeRegExpLiteral;
declare function logicalExpression(operator: "||" | "&&", left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression;
declare function memberExpression(object: BabelNodeExpression, property: any, computed?: boolean): BabelNodeMemberExpression;
declare function newExpression(callee: BabelNodeExpression, _arguments: any): BabelNodeNewExpression;
declare function program(directives?: any, body: any): BabelNodeProgram;
@ -883,13 +887,13 @@ declare module "babel-types" {
declare function restElement(argument: BabelNodeLVal, typeAnnotation: any): BabelNodeRestElement;
declare function returnStatement(argument?: ?BabelNodeExpression): BabelNodeReturnStatement;
declare function sequenceExpression(expressions: Array<any>): BabelNodeSequenceExpression;
declare function switchCase(test: any, consequent: any): BabelNodeSwitchCase;
declare function switchStatement(discriminant: any, cases: any): BabelNodeSwitchStatement;
declare function switchCase(test?: ?BabelNodeExpression, consequent: any): BabelNodeSwitchCase;
declare function switchStatement(discriminant: BabelNodeExpression, cases: any): BabelNodeSwitchStatement;
declare function thisExpression(): BabelNodeThisExpression;
declare function throwStatement(argument: BabelNodeExpression): BabelNodeThrowStatement;
declare function tryStatement(body: BabelNodeBlockStatement, handler?: any, finalizer?: ?BabelNodeBlockStatement, block: any): BabelNodeTryStatement;
declare function unaryExpression(prefix?: boolean, argument: BabelNodeExpression, operator: any): BabelNodeUnaryExpression;
declare function updateExpression(prefix?: boolean, argument: BabelNodeExpression, operator: any): BabelNodeUpdateExpression;
declare function unaryExpression(prefix?: boolean, argument: BabelNodeExpression, operator: "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof"): BabelNodeUnaryExpression;
declare function updateExpression(prefix?: boolean, argument: BabelNodeExpression, operator: "++" | "--"): BabelNodeUpdateExpression;
declare function variableDeclaration(kind: any, declarations: any): BabelNodeVariableDeclaration;
declare function variableDeclarator(id: BabelNodeLVal, init?: ?BabelNodeExpression): BabelNodeVariableDeclarator;
declare function whileStatement(test: BabelNodeExpression, body: BabelNodeBlockStatement | BabelNodeStatement): BabelNodeWhileStatement;
@ -900,9 +904,9 @@ declare module "babel-types" {
declare function classBody(body: any): BabelNodeClassBody;
declare function classDeclaration(id: BabelNodeIdentifier, body: BabelNodeClassBody, superClass?: ?BabelNodeExpression, decorators: any, typeParameters: any, superTypeParameters: any, _implements: any): BabelNodeClassDeclaration;
declare function classExpression(id?: ?BabelNodeIdentifier, body: BabelNodeClassBody, superClass?: ?BabelNodeExpression, decorators: any, typeParameters: any, superTypeParameters: any, _implements: any): BabelNodeClassExpression;
declare function exportAllDeclaration(source: any): BabelNodeExportAllDeclaration;
declare function exportDefaultDeclaration(declaration: any): BabelNodeExportDefaultDeclaration;
declare function exportNamedDeclaration(declaration: any, specifiers: any, source: any): BabelNodeExportNamedDeclaration;
declare function exportAllDeclaration(source: BabelNodeStringLiteral): BabelNodeExportAllDeclaration;
declare function exportDefaultDeclaration(declaration: BabelNodeFunctionDeclaration | BabelNodeClassDeclaration | BabelNodeExpression): BabelNodeExportDefaultDeclaration;
declare function exportNamedDeclaration(declaration?: ?BabelNodeDeclaration, specifiers: any, source?: ?BabelNodeStringLiteral): BabelNodeExportNamedDeclaration;
declare function exportSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier, exported: any): BabelNodeExportSpecifier;
declare function forOfStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForOfStatement;
declare function importDeclaration(specifiers: any, source: BabelNodeStringLiteral): BabelNodeImportDeclaration;
@ -913,7 +917,6 @@ declare module "babel-types" {
declare function classMethod(kind?: any, computed?: boolean, _static?: boolean, key: any, params: any, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, decorators: any, returnType: any, typeParameters: any): BabelNodeClassMethod;
declare function objectPattern(properties: any, typeAnnotation: any): BabelNodeObjectPattern;
declare function spreadElement(argument: BabelNodeExpression): BabelNodeSpreadElement;
declare function super(): BabelNodeSuper;
declare function taggedTemplateExpression(tag: BabelNodeExpression, quasi: BabelNodeTemplateLiteral): BabelNodeTaggedTemplateExpression;
declare function templateElement(value: any, tail?: boolean): BabelNodeTemplateElement;
declare function templateLiteral(quasis: any, expressions: any): BabelNodeTemplateLiteral;
@ -928,6 +931,7 @@ declare module "babel-types" {
declare function declareFunction(id: any): BabelNodeDeclareFunction;
declare function declareModule(id: any, body: any): BabelNodeDeclareModule;
declare function declareVariable(id: any): BabelNodeDeclareVariable;
declare function existentialTypeParam(): BabelNodeExistentialTypeParam;
declare function functionTypeAnnotation(typeParameters: any, params: any, rest: any, returnType: any): BabelNodeFunctionTypeAnnotation;
declare function functionTypeParam(name: any, typeAnnotation: any): BabelNodeFunctionTypeParam;
declare function genericTypeAnnotation(id: any, typeParameters: any): BabelNodeGenericTypeAnnotation;
@ -936,7 +940,7 @@ declare module "babel-types" {
declare function intersectionTypeAnnotation(types: any): BabelNodeIntersectionTypeAnnotation;
declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation;
declare function nullableTypeAnnotation(typeAnnotation: any): BabelNodeNullableTypeAnnotation;
declare function NumericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation;
declare function numericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation;
declare function numberTypeAnnotation(): BabelNodeNumberTypeAnnotation;
declare function stringLiteralTypeAnnotation(): BabelNodeStringLiteralTypeAnnotation;
declare function stringTypeAnnotation(): BabelNodeStringTypeAnnotation;
@ -1058,6 +1062,7 @@ declare module "babel-types" {
declare function isDeclareFunction(node: Object, opts?: Object): boolean;
declare function isDeclareModule(node: Object, opts?: Object): boolean;
declare function isDeclareVariable(node: Object, opts?: Object): boolean;
declare function isExistentialTypeParam(node: Object, opts?: Object): boolean;
declare function isFunctionTypeAnnotation(node: Object, opts?: Object): boolean;
declare function isFunctionTypeParam(node: Object, opts?: Object): boolean;
declare function isGenericTypeAnnotation(node: Object, opts?: Object): boolean;
@ -1139,6 +1144,8 @@ declare module "babel-types" {
declare function isFlowBaseAnnotation(node: Object, opts?: Object): boolean;
declare function isFlowDeclaration(node: Object, opts?: Object): boolean;
declare function isJSX(node: Object, opts?: Object): boolean;
declare function isNumberLiteral(node: Object, opts?: Object): boolean;
declare function isRegexLiteral(node: Object, opts?: Object): boolean;
declare function isReferencedIdentifier(node: Object, opts?: Object): boolean;
declare function isReferencedMemberExpression(node: Object, opts?: Object): boolean;
declare function isBindingIdentifier(node: Object, opts?: Object): boolean;

View File

@ -1,5 +1,3 @@
/* @flow */
/* eslint no-new-func: 0 */
import { transform } from "./node";

View File

@ -1,5 +1,3 @@
/* @flow */
import isFunction from "lodash/lang/isFunction";
import fs from "fs";

View File

@ -1,5 +1,3 @@
/* @flow */
import * as t from "babel-types";
/**

View File

@ -1,5 +1,3 @@
/* @flow */
import Module from "module";
let relativeModules = {};

View File

@ -1,5 +1,3 @@
/* @flow */
export default class Store extends Map {
constructor() {
super();

View File

@ -1,5 +1,3 @@
/* @flow */
import * as helpers from "babel-helpers";
import generator from "babel-generator";
import * as messages from "babel-messages";

View File

@ -1,4 +1,3 @@
/* @flow */
/* global BabelParserOptions */
/* global BabelFileMetadata */
/* global BabelFileResult */

View File

@ -1,5 +1,3 @@
/* @flow */
import type File from "./index";
import buildDebug from "debug/node";

View File

@ -1,5 +1,3 @@
/* @flow */
import * as t from "babel-types";
export let ModuleDeclaration = {

View File

@ -1,5 +1,3 @@
/* @flow */
import * as context from "../../../api/node";
import type Logger from "../logger";
import Plugin from "../../plugin";

View File

@ -1,5 +1,3 @@
/* @flow */
import Plugin from "../plugin";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import type Plugin from "./plugin";
import Store from "../store";
import traverse from "babel-traverse";

View File

@ -1,5 +1,3 @@
/* @flow */
import OptionManager from "./file/options/option-manager"
import * as messages from "babel-messages";
import Store from "../store";

View File

@ -1,5 +1,3 @@
/* @flow */
import escapeRegExp from "lodash/string/escapeRegExp";
import startsWith from "lodash/string/startsWith";
import isBoolean from "lodash/lang/isBoolean";

View File

@ -1,5 +1,3 @@
/* @flow */
import type Position from "./position";
import repeating from "repeating";
import trimRight from "trim-right";

View File

@ -1,5 +1,3 @@
/* @flow */
export function JSXAttribute(node: Object) {
this.print(node.name, node);
if (node.value) {

View File

@ -1,5 +1,3 @@
/* @flow */
import repeating from "repeating";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import detectIndent from "detect-indent";
import Whitespace from "./whitespace";
import SourceMap from "./source-map";

View File

@ -1,5 +1,3 @@
/* @flow */
import whitespace from "./whitespace";
import * as parens from "./parentheses";
import each from "lodash/collection/each";

View File

@ -1,5 +1,3 @@
/* @flow */
import isBoolean from "lodash/lang/isBoolean";
import each from "lodash/collection/each";
import map from "lodash/collection/map";

View File

@ -5,6 +5,9 @@
*/
export default class Position {
column: number;
line: number;
constructor() {
this.line = 1;
this.column = 0;
@ -14,7 +17,7 @@ export default class Position {
* Push a string to the current position, mantaining the current line and column.
*/
push(str) {
push(str: string): void {
for (let i = 0; i < str.length; i++) {
if (str[i] === "\n") {
this.line++;
@ -29,7 +32,7 @@ export default class Position {
* Unshift a string from the current position, mantaining the current line and column.
*/
unshift(str) {
unshift(str: string): void {
for (let i = 0; i < str.length; i++) {
if (str[i] === "\n") {
this.line--;

View File

@ -1,5 +1,3 @@
/* @flow */
import repeating from "repeating";
import Buffer from "./buffer";
import n from "./node";

View File

@ -1,5 +1,3 @@
/* @flow */
import sourceMap from "source-map";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
/**
* Returns `i`th number from `base`, continuing from 0 when `max` is reached.
* Useful for shifting `for` loop by a fixed number but going over all items.

View File

@ -1,5 +1,3 @@
/* @flow */
import esutils from "esutils";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import hoistVariables from "babel-helper-hoist-variables";
import type { NodePath } from "babel-traverse";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import nameFunction from "babel-helper-function-name";
import each from "lodash/collection/each";
import has from "lodash/object/has";

View File

@ -1,5 +1,3 @@
/* @flow */
import type { Scope } from "babel-traverse";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import getFunctionArity from "babel-helper-get-function-arity";
import template from "babel-template";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import * as t from "babel-types";
export default function (node): number {

View File

@ -1,5 +1,3 @@
/* @flow */
import type { NodePath, Scope } from "babel-traverse";
import optimiseCall from "babel-helper-optimise-call-expression";
import * as messages from "babel-messages";

View File

@ -47,7 +47,7 @@ export const MESSAGES = {
* Get a message with $0 placeholders replaced by arguments.
*/
export function get(key: string, ...args): string {
export function get(key: string, ...args: Array<any>): string {
let msg = MESSAGES[key];
if (!msg) throw new ReferenceError(`Unknown message ${JSON.stringify(key)}`);

View File

@ -1,5 +1,3 @@
/* @flow */
import type { Scope } from "babel-traverse";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import path from "path";
import fs from "fs";
import homeOrTmp from "home-or-tmp";

View File

@ -1,5 +1,3 @@
/* @flow */
import cloneDeep from "lodash/lang/cloneDeep";
import has from "lodash/object/has";
import traverse from "babel-traverse";

View File

@ -1,5 +1,3 @@
/* @flow */
import NodePath from "./path";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
export default class Hub {
constructor(file, options) {
this.file = file;

View File

@ -1,5 +1,3 @@
/* @flow */
import TraversalContext from "./context";
import * as visitors from "./visitors";
import * as messages from "babel-messages";

View File

@ -1,5 +1,3 @@
/* @flow */
// This file contains that retrieve or validate anything related to the current paths ancestry.
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
// This file contains methods responsible for dealing with comments.
/**

View File

@ -1,5 +1,3 @@
/* @flow */
// This file contains methods responsible for maintaining a TraversalContext.
import traverse from "../index";

View File

@ -1,5 +1,3 @@
/* @flow */
// This file contains methods that convert the path node into another node or some other type of data.
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import type NodePath from "./index";
// This file contains Babels metainterpreter that can evaluate static code.

View File

@ -1,5 +1,3 @@
/* @flow */
// This file contains methods responsible for dealing with/retrieving children or siblings.
import type TraversalContext from "../index";

View File

@ -1,5 +1,3 @@
/* @flow */
import type Hub from "../hub";
import type TraversalContext from "../context";
import * as virtualTypes from "./lib/virtual-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import type NodePath from "./index";
import * as inferers from "./inferers";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import type NodePath from "../index";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import * as t from "babel-types";
export { default as Identifier } from "./inferer-reference";

View File

@ -1,5 +1,3 @@
/* @flow */
// This file contains methods responsible for introspecting the current path for certain values.
import type NodePath from "./index";

View File

@ -1,5 +1,3 @@
/* @flow */
import { react } from "babel-types";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
// this file contains hooks that handle ancestry cleanup of parent nodes when removing children
/**

View File

@ -1,5 +1,3 @@
/* @flow */
import type NodePath from "../index";
import { react } from "babel-types";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
// This file contains methods that modify the path/node in some ways.
import { PATH_CACHE_KEY } from "./constants";

View File

@ -1,5 +1,3 @@
/* @flow */
// This file contains methods responsible for removing a node.
import { hooks } from "./lib/removal-hooks";

View File

@ -1,5 +1,3 @@
/* @flow */
// This file contains methods responsible for replacing a node with another.
import codeFrame from "babel-code-frame";

View File

@ -1,5 +1,3 @@
/* @flow */
import type NodePath from "../path";
/**

View File

@ -1,5 +1,3 @@
/* @flow */
import includes from "lodash/collection/includes";
import repeating from "repeating";
import Renamer from "./lib/renamer";

View File

@ -1,5 +1,3 @@
/* @flow */
import Binding from "../binding";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import * as virtualTypes from "./path/lib/virtual-types";
import * as messages from "babel-messages";
import * as t from "babel-types";

View File

@ -1,5 +1,3 @@
/* @flow */
import isPlainObject from "lodash/lang/isPlainObject";
import isNumber from "lodash/lang/isNumber";
import isRegExp from "lodash/lang/isRegExp";

View File

@ -1,5 +1,3 @@
/* @flow */
import * as t from "../index";
export let VISITOR_KEYS = {};

View File

@ -1,5 +1,3 @@
/* @flow */
import * as t from "./index";
/**

View File

@ -1,5 +1,3 @@
/* @flow */
import toFastProperties from "to-fast-properties";
import compact from "lodash/array/compact";
import loClone from "lodash/lang/clone";

View File

@ -1,5 +1,3 @@
/* @flow */
import { getBindingIdentifiers } from "./retrievers";
import esutils from "esutils";
import * as t from "./index";

View File

@ -1,5 +1,3 @@
/* @flow */
import Parser, { plugins } from "./parser";
import "./parser/util";
import "./parser/statement";

View File

@ -1,5 +1,3 @@
/* @flow */
// A second optional argument can be given to further configure
// the parser process. These options are recognized:

View File

@ -1,5 +1,3 @@
/* @flow */
// A recursive descent parser operates by defining functions for all
// syntactic elements, and recursively calling those, each function
// advancing the input stream and returning an AST node. Precedence

View File

@ -1,5 +1,3 @@
/* @flow */
import { reservedWords } from "../util/identifier";
import { getOptions } from "../options";
import Tokenizer from "../tokenizer";

View File

@ -1,5 +1,3 @@
/* @flow */
import { getLineInfo } from "../util/location";
import Parser from "./index";

View File

@ -1,5 +1,3 @@
/* @flow */
import { types as tt } from "../tokenizer/types";
import Parser from "./index";
import { reservedWords } from "../util/identifier";

View File

@ -1,5 +1,3 @@
/* @flow */
import Parser from "./index";
import { SourceLocation } from "../util/location";

View File

@ -1,5 +1,3 @@
/* @flow */
import { types as tt } from "../tokenizer/types";
import Parser from "./index";
import { lineBreak } from "../util/whitespace";

View File

@ -1,5 +1,3 @@
/* @flow */
import { types as tt } from "../tokenizer/types";
import Parser from "../parser";

View File

@ -1,5 +1,3 @@
/* @flow */
import XHTMLEntities from "./xhtml";
import { TokenType, types as tt } from "../../tokenizer/types";
import { TokContext, types as tc } from "../../tokenizer/context";

View File

@ -1,5 +1,3 @@
/* @flow */
import type { TokenType } from "./types";
import { isIdentifierStart, isIdentifierChar, isKeyword } from "../util/identifier";
import { types as tt, keywords as keywordTypes } from "./types";

View File

@ -1,5 +1,3 @@
/* @flow */
import type { TokContext } from "./context";
import type { Token } from "./index";
import { Position } from "../util/location";

View File

@ -1,5 +1,3 @@
/* @flow */
// ## Token types
// The assignment of fine-grained, information-carrying type objects

View File

@ -1,5 +1,3 @@
/* @flow */
// This is a trick taken from Esprima. It turns out that, on
// non-Chrome browsers, to check whether a string is in a set, a
// predicate containing a big ugly `switch` statement is faster than

View File

@ -1,5 +1,3 @@
/* @flow */
import { lineBreakG } from "./whitespace";
// These are used when `options.locations` is on, for the

View File

@ -6,7 +6,7 @@
export const lineBreak = /\r\n?|\n|\u2028|\u2029/;
export const lineBreakG = new RegExp(lineBreak.source, "g");
export function isNewLine(code) {
export function isNewLine(code: number): boolean {
return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
}

View File

@ -96,8 +96,11 @@ for (var type in t.NODE_FIELDS) {
${struct.join("\n ").trim()}
}\n\n`;
// Flow chokes on super() :/
if (type !== 'Super') {
lines.push(`declare function ${type[0].toLowerCase() + type.slice(1)}(${args.join(", ")}): ${NODE_PREFIX}${type};`);
}
}
for (var i = 0; i < t.TYPES.length; i++) {
lines.push(`declare function is${t.TYPES[i]}(node: Object, opts?: Object): boolean;`);