flow - allow type parameter defaults in function declarations (#10084)
* flow - allow type parameter defaults in function declarations * fix flow test * add intern_comments option * fix flow parser test * remove allowdefault from flowParseTypeParameterDeclaration * rename test cases
This commit is contained in:
committed by
Nicolò Ribaudo
parent
6852bf6415
commit
fdbbb743b6
@@ -9,24 +9,33 @@
|
||||
# Entries should be removed incrementally as the babel parser is improved.
|
||||
|
||||
JSX_invalid/migrated_0000.js
|
||||
arrow_function/tuple_return_type.js
|
||||
arrow_function_invalid/migrated_0002.js
|
||||
async_await/migrated_0007.js
|
||||
async_await/migrated_0020.js
|
||||
async_await/migrated_0024.js
|
||||
async_await/migrated_0027.js
|
||||
async_generators/migrated_0007.js
|
||||
class_properties/migrated_0000.js
|
||||
class_properties/migrated_0005.js
|
||||
class_properties/migrated_0011.js
|
||||
class_properties/migrated_0016.js
|
||||
class_properties/migrated_0021.js
|
||||
class_properties/migrated_0026.js
|
||||
decorators/migrated_0003.js
|
||||
decorators/migrated_0007.js
|
||||
private_class_properties/multiple.js
|
||||
private_class_properties/super.js
|
||||
private_class_properties/getter_and_field.js
|
||||
private_class_properties/getter_duplicate.js
|
||||
private_class_properties/setter_and_field.js
|
||||
private_class_properties/setter_duplicate.js
|
||||
types/member/reserved_words.js
|
||||
types/parameter_defaults/migrated_0032.js
|
||||
types/bigint_literal/migrated_0000.js
|
||||
types/bigint_literal/migrated_0002.js
|
||||
types/bigint_literal/migrated_0003.js
|
||||
types/bigint_literal/migrated_0004.js
|
||||
types/bigint_literal/migrated_0005.js
|
||||
types/bigint_literal/migrated_0006.js
|
||||
types/bigint_literal/migrated_0007.js
|
||||
types/bigint_literal/migrated_0008.js
|
||||
types/bigint_literal/migrated_0009.js
|
||||
class_method_kinds/polymorphic_getter.js
|
||||
numbers/underscored_bin.js
|
||||
numbers/underscored_float.js
|
||||
|
||||
@@ -113,7 +113,10 @@ const options = {
|
||||
["flow", { all: true }],
|
||||
"flowComments",
|
||||
"jsx",
|
||||
"classProperties",
|
||||
"classPrivateProperties",
|
||||
"classPrivateMethods",
|
||||
"bigInt",
|
||||
],
|
||||
sourceType: "module",
|
||||
ranges: true,
|
||||
@@ -127,6 +130,7 @@ const flowOptionsMapping = {
|
||||
esproposal_nullish_coalescing: "nullishCoalescingOperator",
|
||||
esproposal_optional_chaining: "optionalChaining",
|
||||
types: "flowComments",
|
||||
intern_comments: false,
|
||||
};
|
||||
|
||||
const summary = {
|
||||
@@ -169,10 +173,12 @@ tests.forEach(section => {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!flowOptionsMapping[option]) {
|
||||
if (!(option in flowOptionsMapping)) {
|
||||
throw new Error("Parser options not mapped " + option);
|
||||
}
|
||||
babelParserOptions.plugins.push(flowOptionsMapping[option]);
|
||||
if (flowOptionsMapping[option]) {
|
||||
babelParserOptions.plugins.push(flowOptionsMapping[option]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user