chore: enable flowcheck on CI (#11945)

* chore: enable flowcheck on CI

* fix: flow errors
This commit is contained in:
Huáng Jùnliàng 2020-08-10 16:57:29 -04:00 committed by GitHub
parent 00b974298b
commit a3893129ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 7 deletions

View File

@ -85,8 +85,7 @@ watch: build-no-bundle
BABEL_ENV=development $(YARN) gulp watch BABEL_ENV=development $(YARN) gulp watch
code-quality-ci: build-no-bundle-ci code-quality-ci: build-no-bundle-ci
$(MAKE) flowcheck-ci & $(MAKE) lint-ci $(MAKE) flowcheck-ci lint-ci
flowcheck-ci: flowcheck-ci:
$(MAKE) flow $(MAKE) flow

View File

@ -639,7 +639,7 @@ export default class StatementParser extends ExpressionParser {
return this.finishNode(node, "ThrowStatement"); return this.finishNode(node, "ThrowStatement");
} }
parseCatchClauseParam(): N.Identifier { parseCatchClauseParam(): N.Pattern {
const param = this.parseBindingAtom(); const param = this.parseBindingAtom();
const simple = param.type === "Identifier"; const simple = param.type === "Identifier";
@ -1199,7 +1199,7 @@ export default class StatementParser extends ExpressionParser {
// https://tc39.es/ecma262/#prod-ClassBody // https://tc39.es/ecma262/#prod-ClassBody
parseClassBody( parseClassBody(
constructorAllowsSuper: boolean, constructorAllowsSuper: boolean,
oldStrict?: boolean, oldStrict: boolean,
): N.ClassBody { ): N.ClassBody {
this.classScope.enter(); this.classScope.enter();

View File

@ -45,7 +45,6 @@ export default (superClass: Class<Parser>): Class<Parser> =>
estreeParseDecimalLiteral(value: any): N.Node { estreeParseDecimalLiteral(value: any): N.Node {
// https://github.com/estree/estree/blob/master/experimental/decimal.md // https://github.com/estree/estree/blob/master/experimental/decimal.md
// $FlowIgnore
// todo: use BigDecimal when node supports it. // todo: use BigDecimal when node supports it.
const decimal = null; const decimal = null;
const node = this.estreeParseLiteral(decimal); const node = this.estreeParseLiteral(decimal);

View File

@ -203,6 +203,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.next(); this.next();
this.takeDecorators(node); this.takeDecorators(node);
const oldStrict = this.state.strict;
const placeholder = this.parsePlaceholder("Identifier"); const placeholder = this.parsePlaceholder("Identifier");
if (placeholder) { if (placeholder) {
@ -226,7 +227,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.parseClassSuper(node); this.parseClassSuper(node);
node.body = node.body =
this.parsePlaceholder("ClassBody") || this.parsePlaceholder("ClassBody") ||
this.parseClassBody(!!node.superClass); this.parseClassBody(!!node.superClass, oldStrict);
return this.finishNode(node, type); return this.finishNode(node, type);
} }

View File

@ -2727,7 +2727,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
return hasContextParam ? baseCount + 1 : baseCount; return hasContextParam ? baseCount + 1 : baseCount;
} }
parseCatchClauseParam(): N.Identifier { parseCatchClauseParam(): N.Pattern {
const param = super.parseCatchClauseParam(); const param = super.parseCatchClauseParam();
const type = this.tsTryParseTypeAnnotation(); const type = this.tsTryParseTypeAnnotation();