Update flow-parser (#18598)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
renovate[bot]andfisker authored and GitHub committed 2026-01-15 01:44:39 +08:00
1 parent 2c2b494943
commit 48f7598e57
12 files changed
+115 -52

No files matched your search

+2 -2
View File
@@ -73,11 +73,11 @@
"fast-json-stable-stringify": "2.1.0",
"file-entry-cache": "11.1.1",
"find-cache-directory": "6.0.0",
"flow-parser": "0.295.0",
"flow-parser": "0.296.0",
"get-east-asian-width": "1.4.0",
"get-stdin": "9.0.0",
"graphql": "16.12.0",
"hermes-parser": "0.33.1",
"hermes-parser": "0.33.3",
"html-element-attributes": "3.5.0",
"html-ua-styles": "0.3.1",
"ignore": "7.0.5",
+2 -1
View File
@@ -704,7 +704,8 @@ function handleLastComponentArgComments({
if (
(precedingNode?.type === "ComponentParameter" ||
precedingNode?.type === "RestElement") &&
enclosingNode?.type === "ComponentDeclaration" &&
(enclosingNode?.type === "ComponentDeclaration" ||
enclosingNode?.type === "DeclareComponent") &&
getNextNonSpaceNonCommentCharacter(text, locEnd(comment)) === ")"
) {
addTrailingComment(precedingNode, comment);
@@ -337,11 +337,11 @@ declare component MyComponent(bar: string);
declare component MyComponent(bar?: string);
declare component MyComponent('data-bar': string);
// declare component MyComponent('data-bar': string);
declare component MyComponent(...restProps: $ReadOnly<{k: string}>);
declare component MyComponent(...$ReadOnly<{k: string}>);
// declare component MyComponent(...$ReadOnly<{k: string}>);
declare component MyComponent(bar: string, baz: $ReadOnly<{k: string}>);
@@ -355,7 +355,11 @@ declare component MyComponent(
bar: string, // Trailing comment
// preceding comment
'data-baz': $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
dataBaz: $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
// preceding comment
// 'data-baz': $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
);
@@ -368,6 +372,7 @@ declare component MyComponent(
...props: $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
) renders SomeComponent;
=====================================output=====================================
declare component MyComponent();
@@ -387,11 +392,11 @@ declare component MyComponent(bar: string);
declare component MyComponent(bar?: string);
declare component MyComponent("data-bar": string);
// declare component MyComponent('data-bar': string);
declare component MyComponent(...restProps: $ReadOnly<{ k: string }>);
declare component MyComponent(...$ReadOnly<{ k: string }>);
// declare component MyComponent(...$ReadOnly<{k: string}>);
declare component MyComponent(bar: string, baz: $ReadOnly<{ k: string }>);
@@ -409,11 +414,15 @@ declare component MyComponent(
bar: string, // Trailing comment
// preceding comment
"data-baz": $ReadOnly<{
dataBaz: $ReadOnly<{
k: string,
reallllllllllllllllllllllllllllllllllllllyLong: string,
}>,
// Trailing comment
// preceding comment
// 'data-baz': $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
);
declare component MyComponent(
@@ -12,11 +12,11 @@ declare component MyComponent(bar: string);
declare component MyComponent(bar?: string);
declare component MyComponent('data-bar': string);
// declare component MyComponent('data-bar': string);
declare component MyComponent(...restProps: $ReadOnly<{k: string}>);
declare component MyComponent(...$ReadOnly<{k: string}>);
// declare component MyComponent(...$ReadOnly<{k: string}>);
declare component MyComponent(bar: string, baz: $ReadOnly<{k: string}>);
@@ -30,7 +30,11 @@ declare component MyComponent(
bar: string, // Trailing comment
// preceding comment
'data-baz': $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
dataBaz: $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
// preceding comment
// 'data-baz': $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
);
@@ -42,4 +46,4 @@ declare component MyComponent(
declare component MyComponent(
...props: $ReadOnly<{k: string, reallllllllllllllllllllllllllllllllllllllyLong: string}>
// Trailing comment
) renders SomeComponent;
) renders SomeComponent;
@@ -0,0 +1,21 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`expression.js format 1`] = `
====================================options=====================================
parsers: ["flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
// Not a \`RecordExpression\`
const x = Foo
{
};
=====================================output=====================================
// Not a \`RecordExpression\`
const x = Foo;
{
}
================================================================================
`;
@@ -0,0 +1,4 @@
// Not a `RecordExpression`
const x = Foo
{
};
@@ -0,0 +1 @@
runFormatTest(import.meta, ["flow", "typescript"]);
@@ -796,24 +796,24 @@ Cause: Unexpected token {"
`;
exports[`valid-module-block-top-level-await-using-binding.js [flow] format 1`] = `
"Unexpected identifier, expected the token \`,\` (2:9)
1 | const m = module {
> 2 | await using foo = bar();
| ^^^^^
"Unexpected token \`{\`, expected the token \`;\` (1:18)
> 1 | const m = module {
| ^
2 | await using foo = bar();
3 | }
4 |"
`;
exports[`valid-module-block-top-level-await-using-binding.js [hermes] format 1`] = `
"':' expected in property initialization (2:8)
1 | const m = module {
> 2 | await using foo = bar();
| ^
"';' expected (1:17)
> 1 | const m = module {
| ^
2 | await using foo = bar();
3 | }
4 |
Cause: ':' expected in property initialization (2:8)
await using foo = bar();
~~~~~~^"
Cause: ';' expected (1:17)
const m = module {
^"
`;
exports[`valid-module-block-top-level-await-using-binding.js [meriyah] format 1`] = `
@@ -893,24 +893,24 @@ Cause: Unexpected token {"
`;
exports[`valid-module-block-top-level-using-binding.js [flow] format 1`] = `
"Unexpected identifier, expected the token \`,\` (2:9)
1 | module {
> 2 | using foo = bar();
| ^^^
"Unexpected token \`{\`, expected the end of an expression statement (\`;\`) (1:8)
> 1 | module {
| ^
2 | using foo = bar();
3 | }
4 |"
`;
exports[`valid-module-block-top-level-using-binding.js [hermes] format 1`] = `
"':' expected in property initialization (2:8)
1 | module {
> 2 | using foo = bar();
| ^
"';' expected (1:7)
> 1 | module {
| ^
2 | using foo = bar();
3 | }
4 |
Cause: ':' expected in property initialization (2:8)
using foo = bar();
~~~~~~^"
Cause: ';' expected (1:7)
module {
^"
`;
exports[`valid-module-block-top-level-using-binding.js [meriyah] format 1`] = `
@@ -0,0 +1,16 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`snippet: #0 [flow] format 1`] = `
"Unexpected token \`{\`, expected the token \`;\` (1:24)
> 1 | const a = not_a_record {}
| ^"
`;
exports[`snippet: #0 [hermes] format 1`] = `
"';' expected (1:23)
> 1 | const a = not_a_record {}
| ^
Cause: ';' expected (1:23)
const a = not_a_record {}
^"
`;
@@ -0,0 +1,7 @@
runFormatTest(
{
importMeta: import.meta,
snippets: ["const a = not_a_record {}"],
},
["flow", "hermes"],
);
@@ -92,10 +92,10 @@ Cause: Unexpected token, expected ")" (4:24)"
`;
exports[`invalid-using-binding-pattern.js [flow] format 1`] = `
"Invalid left-hand side in assignment (2:3)
"Unexpected token \`{\`, expected the end of an expression statement (\`;\`) (2:9)
1 | {
> 2 | using { foo } = f();
| ^^^^^^^^^^^^^
| ^
3 | using [ bar ] = g();
4 | for (using { qux } of h());
5 | for (using [ quux ] of i());"
+15 -15
View File
@@ -5080,10 +5080,10 @@ __metadata:
languageName: node
linkType: hard
"flow-parser@npm:0.295.0":
version: 0.295.0
resolution: "flow-parser@npm:0.295.0"
checksum: 10/a70b90d6a9e754199749eef58f69f203a807c857318baac144746f336c5f5266e4de5457c2976f2aee0a593736c9ac7c2501673e627f451acccf1f6305730120
"flow-parser@npm:0.296.0":
version: 0.296.0
resolution: "flow-parser@npm:0.296.0"
checksum: 10/bc7a799dc90ce8c1011356df99405cb88154182988448483e2b23b166e5fedecbe56a089dd6895a21bd2c7974ec158f21f2390db9532a74e4620bc3cfafd1ebd
languageName: node
linkType: hard
@@ -5429,19 +5429,19 @@ __metadata:
languageName: node
linkType: hard
"hermes-estree@npm:0.33.1":
version: 0.33.1
resolution: "hermes-estree@npm:0.33.1"
checksum: 10/8da08418f10c70bd943db3acfd6be3bca28de6974ab85034f087513d771546b7410246c8c03d7781ce3b613d2f03769058caa7f82e21028df7545284ba485caa
"hermes-estree@npm:0.33.3":
version: 0.33.3
resolution: "hermes-estree@npm:0.33.3"
checksum: 10/dfaac7eb91e282cf04f26c8f557fcadbfb78f630062c7abc1e75b9765918103ebee1359dffbe6c5e42a52c7cee0b14420affda984d534f76ba3d7e8d9ba98215
languageName: node
linkType: hard
"hermes-parser@npm:0.33.1":
version: 0.33.1
resolution: "hermes-parser@npm:0.33.1"
"hermes-parser@npm:0.33.3":
version: 0.33.3
resolution: "hermes-parser@npm:0.33.3"
dependencies:
hermes-estree: "npm:0.33.1"
checksum: 10/f7caeb5609b47b44fcc3fc0be5d171ec1c5747db854e43eded16c1ff4de1bda4c6e00c115361e3bd62cbaca4518683f8e2bcab94034d6d762a1c3b4ab0af2bd8
hermes-estree: "npm:0.33.3"
checksum: 10/709dac7283a9eab706f3fff5c6f09deee5197a1a38751da66fdf499a307120ba3ef14ce734715430a838145531973a8c0b69874bf5bc615cca10059ee87f5ff3
languageName: node
linkType: hard
@@ -8417,14 +8417,14 @@ __metadata:
fast-json-stable-stringify: "npm:2.1.0"
file-entry-cache: "npm:11.1.1"
find-cache-directory: "npm:6.0.0"
flow-parser: "npm:0.295.0"
flow-parser: "npm:0.296.0"
get-east-asian-width: "npm:1.4.0"
get-port: "npm:7.1.0"
get-stdin: "npm:9.0.0"
gfm-test-suite: "npm:0.0.2"
globals: "npm:17.0.0"
graphql: "npm:16.12.0"
hermes-parser: "npm:0.33.1"
hermes-parser: "npm:0.33.3"
html-element-attributes: "npm:3.5.0"
html-ua-styles: "npm:0.3.1"
ignore: "npm:7.0.5"