Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running flow on travis and update flow #9128

Merged
merged 2 commits into from Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions .flowconfig
@@ -1,11 +1,10 @@
[ignore]
.*/build/.*
.*/packages/.*/lib
.*/packages/.*/test
.*/codemods/.*/lib
.*/codemods/.*/test
.*/node_modules/conventional-changelog-core/
.*/node_modules/module-deps/
<PROJECT_ROOT>/build/.*
<PROJECT_ROOT>/packages/.*/lib
<PROJECT_ROOT>/packages/.*/test
<PROJECT_ROOT>/codemods/.*/lib
<PROJECT_ROOT>/codemods/.*/test
<PROJECT_ROOT>/node_modules/module-deps/

[include]
packages/*/src
Expand Down
15 changes: 8 additions & 7 deletions .travis.yml
Expand Up @@ -20,17 +20,18 @@ before_install:

install:
# the `make test-ci` script runs this command already
- if [ "$JOB" != "test" ]; then yarn install; fi
- if [ "$JOB" != "test" ] && [ "$JOB" != "lint" ]; then yarn install; fi
- if [ "$JOB" = "lint" ]; then make bootstrap; fi

before_script:
- 'if [ "$JOB" = "babel-parser-flow-tests" ]; then make bootstrap-flow; fi'
- 'if [ "$JOB" = "babel-parser-test262-tests" ]; then make bootstrap-test262; fi'
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make bootstrap-flow; fi
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make bootstrap-test262; fi

script:
- 'if [ "$JOB" = "test" ]; then make test-ci; fi'
- 'if [ "$JOB" = "lint" ]; then make lint && make flow; fi'
- 'if [ "$JOB" = "babel-parser-flow-tests" ]; then make test-flow-ci; fi'
- 'if [ "$JOB" = "babel-parser-test262-tests" ]; then make test-test262-ci; fi'
- if [ "$JOB" = "test" ]; then make test-ci; fi
- if [ "$JOB" = "lint" ]; then make lint && make flow; fi
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make test-flow-ci; fi
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make test-test262-ci; fi

matrix:
fast_finish: true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -36,7 +36,7 @@
"eslint-plugin-flowtype": "^3.2.0",
"eslint-plugin-local-rules": "0.1.0",
"eslint-plugin-prettier": "^3.0.0",
"flow-bin": "^0.82.0",
"flow-bin": "^0.87.0",
"graceful-fs": "^4.1.11",
"gulp": "^4.0.0",
"gulp-babel": "^8.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/babel-core/src/config/caching.js
Expand Up @@ -43,6 +43,7 @@ export function makeWeakCache<
>(
handler: (ArgT, CacheConfigurator<SideChannel>) => ResultT,
): (ArgT, SideChannel) => ResultT {
// $FlowIssue https://github.com/facebook/flow/issues/4528
return makeCachedFunction(new WeakMap(), handler);
}

Expand All @@ -54,6 +55,7 @@ function makeCachedFunction<
ArgT,
ResultT,
SideChannel,
// $FlowIssue https://github.com/facebook/flow/issues/4528
Cache: CacheMap<ArgT, ResultT, SideChannel>,
>(
callCache: Cache,
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-core/src/config/validation/options.js
Expand Up @@ -350,7 +350,7 @@ function validateNested(loc: NestingPath, opts: {}) {
NONPRESET_VALIDATORS[key] ||
BABELRC_VALIDATORS[key] ||
ROOT_VALIDATORS[key] ||
throwUnknownError;
(throwUnknownError: Validator<void>);

validator(optLoc, opts[key]);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/src/parser/expression.js
Expand Up @@ -1759,7 +1759,7 @@ export default class ExpressionParser extends LValParser {
parseArrowExpression(
node: N.ArrowFunctionExpression,
params?: ?(N.Expression[]),
isAsync?: boolean,
isAsync?: boolean = false,
): N.ArrowFunctionExpression {
// if we got there, it's no more "yield in possible arrow parameters";
// it's just "yield in arrow parameters"
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-parser/src/parser/statement.js
Expand Up @@ -896,9 +896,9 @@ export default class StatementParser extends ExpressionParser {
parseFunction<T: N.NormalFunction>(
node: T,
isStatement: boolean,
allowExpressionBody?: boolean,
isAsync?: boolean,
optionalId?: boolean,
allowExpressionBody?: boolean = false,
isAsync?: boolean = false,
optionalId?: boolean = false,
): T {
const oldInFunc = this.state.inFunction;
const oldInMethod = this.state.inMethod;
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/src/plugins/estree.js
Expand Up @@ -300,7 +300,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>

if (node) {
node.type = "Property";
if (node.kind === "method") node.kind = "init";
if (((node: any): N.ClassMethod).kind === "method") node.kind = "init";
node.shorthand = false;
}

Expand Down
4 changes: 3 additions & 1 deletion packages/babel-parser/src/plugins/flow.js
Expand Up @@ -1842,7 +1842,9 @@ export default (superClass: Class<Parser>): Class<Parser> =>
super.assertModuleNodeAllowed(node);
}

parseExport(node: N.ExportNamedDeclaration): N.ExportNamedDeclaration {
parseExport(
node: N.ExportNamedDeclaration | N.ExportAllDeclaration,
): N.ExportNamedDeclaration | N.ExportAllDeclaration {
node = super.parseExport(node);
if (
node.type === "ExportNamedDeclaration" ||
Expand Down
5 changes: 4 additions & 1 deletion packages/babel-parser/src/tokenizer/state.js
Expand Up @@ -140,7 +140,10 @@ export default class State {
// The first yield or await expression inside parenthesized expressions
// and arrow function parameters. It is used to disallow yield and await in
// arrow function parameters.
yieldOrAwaitInPossibleArrowParameters: ?N.YieldExpression;
yieldOrAwaitInPossibleArrowParameters:
| N.YieldExpression
| N.AwaitExpression
| null;

// Token store.
tokens: Array<Token | N.Comment>;
Expand Down
10 changes: 5 additions & 5 deletions packages/babel-template/src/index.js
Expand Up @@ -3,11 +3,11 @@
import * as formatters from "./formatters";
import createTemplateBuilder from "./builder";

export const smart = createTemplateBuilder(formatters.smart);
export const statement = createTemplateBuilder(formatters.statement);
export const statements = createTemplateBuilder(formatters.statements);
export const expression = createTemplateBuilder(formatters.expression);
export const program = createTemplateBuilder(formatters.program);
export const smart = createTemplateBuilder<*>(formatters.smart);
export const statement = createTemplateBuilder<*>(formatters.statement);
export const statements = createTemplateBuilder<*>(formatters.statements);
export const expression = createTemplateBuilder<*>(formatters.expression);
export const program = createTemplateBuilder<*>(formatters.program);

type DefaultTemplateBuilder = typeof smart & {
smart: typeof smart,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -4028,10 +4028,10 @@ flat-cache@^1.2.1:
graceful-fs "^4.1.2"
write "^0.2.1"

flow-bin@^0.82.0:
version "0.82.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.82.0.tgz#fbec84c0d6cab7877565eca8214d655f3aefb8db"
integrity sha512-D7ViTCVJSVv19CB6dFWS9k2iKQlavtkRXn9el0ofVTTpGuybe+EPE8DZwdyohzEt6wRhHV8gwkteWvxdcVuOzg==
flow-bin@^0.87.0:
version "0.87.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.87.0.tgz#fab7f984d8cc767e93fa9eb01cf7d57ed744f19d"
integrity sha512-mnvBXXZkUp4y6A96bR5BHa3q1ioIIN2L10w5osxJqagAakTXFYZwjl0t9cT3y2aCEf1wnK6n91xgYypQS/Dqbw==

flush-write-stream@^1.0.2:
version "1.0.3"
Expand Down