Fix running flow on travis and update flow (#9128)
* Fix running flow on travis and update flow - ensure bootstrap is run before running flow as we need some generated files for correctly doing typechecks - ensure that we only ignore the build directory inside the babel folder as currently we ignore everything because travis checks out into ‘/home/travis/build/’ * Fix all flow errors
This commit is contained in:
parent
4b73818c87
commit
4ca35ef8b9
13
.flowconfig
13
.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
|
||||
|
||||
15
.travis.yml
15
.travis.yml
@ -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
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -54,6 +55,7 @@ function makeCachedFunction<
|
||||
ArgT,
|
||||
ResultT,
|
||||
SideChannel,
|
||||
// $FlowIssue https://github.com/facebook/flow/issues/4528
|
||||
Cache: CacheMap<ArgT, ResultT, SideChannel>,
|
||||
>(
|
||||
callCache: Cache,
|
||||
|
||||
@ -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]);
|
||||
});
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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" ||
|
||||
|
||||
@ -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>;
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user