diff --git a/package.json b/package.json index ef1bc6cb3..ba1d8ac69 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "mdast-util-from-markdown": "2.0.3", "mdast-util-gfm": "3.1.0", "mdast-util-math": "3.0.0", - "meriyah": "7.1.2", + "meriyah": "7.2.0", "micromark-extension-gfm": "3.0.0", "micromark-extension-math": "3.1.0", "micromark-util-character": "2.1.1", diff --git a/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap b/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap index 150f09c2a..739f2a17e 100644 --- a/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap +++ b/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap @@ -903,17 +903,6 @@ function* g() { ================================================================================ `; -exports[`explicit-resource-management.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (2:9) - 1 | function * g() { -> 2 | using handle = acquireFileHandle(); // block-scoped critical resource - | ^^^^^^ - 3 | } // cleanup - 4 | - 5 | { -Cause: [2:8-2:14]: Unexpected token: 'identifier'" -`; - exports[`export-default-from.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] diff --git a/tests/format/js/babel-plugins/format.test.js b/tests/format/js/babel-plugins/format.test.js index b8e254f25..32b3f64c7 100644 --- a/tests/format/js/babel-plugins/format.test.js +++ b/tests/format/js/babel-plugins/format.test.js @@ -67,7 +67,6 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], { "v8intrinsic.js", "module-blocks.js", "async-do-expressions.js", - "explicit-resource-management.js", "source-phase-imports.js", "deferred-import-evaluation.js", "optional-chaining-assignment.js", diff --git a/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap b/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap index 66e6aabd0..9864da8c9 100644 --- a/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap +++ b/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap @@ -31,14 +31,6 @@ Cause: '(' expected after 'for' (1:18) ~~~~~~~~~~~~^" `; -exports[`for-await-using-of-comments.js format[meriyah] 1`] = ` -"for await (... of ...) is only valid in async functions and async generators (1:51) -> 1 | /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - | ^^ - 2 | -Cause: [1:50-1:52]: for await (... of ...) is only valid in async functions and async generators" -`; - exports[`invalid-duplicate-using-bindings.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -114,17 +106,6 @@ note: previous declaration (2:8) ^" `; -exports[`invalid-duplicate-using-bindings.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (2:9) - 1 | { -> 2 | using f = foo(), f = foo(); - | ^ - 3 | } - 4 | { - 5 | using g = foo(); -Cause: [2:8-2:9]: Unexpected token: 'identifier'" -`; - exports[`invalid-script-top-level-using-binding.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -146,14 +127,6 @@ exports[`invalid-script-top-level-using-binding.js format[flow] 1`] = ` Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (1:6)" `; -exports[`invalid-script-top-level-using-binding.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (1:7) -> 1 | using x = bar(); - | ^ - 2 | -Cause: [1:6-1:7]: Unexpected token: 'identifier'" -`; - exports[`using-declarations.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -205,17 +178,6 @@ for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); ~~~~~~~~~~~~~~~~~~~~^" `; -exports[`using-declarations.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (2:17) - 1 | { -> 2 | using /* 1 */ a = foo(), /* 2 */ b = foo() - | ^ - 3 | } - 4 | - 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); -Cause: [2:16-2:17]: Unexpected token: 'identifier'" -`; - exports[`valid-await-expr-using.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -339,16 +301,6 @@ exports[`valid-await-using-binding-basic.js format[flow] 1`] = ` Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:14)" `; -exports[`valid-await-using-binding-basic.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (2:15) - 1 | async function f() { -> 2 | await using basic = getReader(); - | ^^^^^ - 3 | } - 4 | -Cause: [2:14-2:19]: Unexpected token: 'identifier'" -`; - exports[`valid-await-using-binding-escaped.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -376,16 +328,6 @@ exports[`valid-await-using-binding-escaped.js format[flow] 1`] = ` Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:14)" `; -exports[`valid-await-using-binding-escaped.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (2:15) - 1 | async function f() { -> 2 | await using \\u0061b = c; - | ^^^^^^^ - 3 | } - 4 | -Cause: [2:14-2:21]: Unexpected token: 'identifier'" -`; - exports[`valid-await-using-binding-non-bmp.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -413,16 +355,6 @@ exports[`valid-await-using-binding-non-bmp.js format[flow] 1`] = ` Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:14)" `; -exports[`valid-await-using-binding-non-bmp.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (2:15) - 1 | async function f() { -> 2 | await using 𠮷 = foo(); - | ^^ - 3 | } - 4 | -Cause: [2:14-2:16]: Unexpected token: 'identifier'" -`; - exports[`valid-await-using-binding-using.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -453,17 +385,6 @@ exports[`valid-await-using-binding-using.js format[flow] 1`] = ` Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:14)" `; -exports[`valid-await-using-binding-using.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (2:15) - 1 | async function f() { -> 2 | await using using = of; - | ^^^^^ - 3 | for (await using using of of); - 4 | } - 5 | -Cause: [2:14-2:19]: Unexpected token: 'identifier'" -`; - exports[`valid-await-using-comments.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -532,18 +453,6 @@ Cause: ';' or 'in' expected inside 'for' (6:47) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^" `; -exports[`valid-await-using-comments.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (3:28) - 1 | async function f() { - 2 | { -> 3 | /*0*/await/*1*/using/*2*/b/*3*/=/*4*/f()/*5*/; - | ^ - 4 | } - 5 | { - 6 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; -Cause: [3:27-3:28]: Unexpected token: 'identifier'" -`; - exports[`valid-for-await-using-binding-escaped-of-of.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -604,17 +513,6 @@ exports[`valid-for-using-binding-of-of.js format[flow] 1`] = ` Cause: Invalid left-hand side in for-of (2:7)" `; -exports[`valid-for-using-binding-of-of.js format[meriyah] 1`] = ` -"Invalid left-hand side in for-of (2:20) - 1 | async function f() { -> 2 | for (await using of of of); - | ^^ - 3 | for await (await using of of of); - 4 | } - 5 | -Cause: [2:19-2:21]: Invalid left-hand side in for-of" -`; - exports[`valid-for-using-declaration.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -654,16 +552,6 @@ Cause: ';' or 'in' expected inside 'for' (2:25) ~~~~~~~~~~~~~~~~~~~~~~~^" `; -exports[`valid-for-using-declaration.js format[meriyah] 1`] = ` -"Expected ';' (2:20) - 1 | async function f() { -> 2 | for (await using basic = reader();;); - | ^^^^^ - 3 | } - 4 | -Cause: [2:19-2:24]: Expected ';'" -`; - exports[`valid-module-block-top-level-await-using-binding.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -1066,16 +954,6 @@ exports[`valid-using-binding-basic.js format[flow] 1`] = ` Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:8)" `; -exports[`valid-using-binding-basic.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (2:9) - 1 | { -> 2 | using basic = getReader(); - | ^^^^^ - 3 | } - 4 | -Cause: [2:8-2:13]: Unexpected token: 'identifier'" -`; - exports[`valid-using-binding-escaped.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -1099,14 +977,6 @@ exports[`valid-using-binding-escaped.js format[flow] 1`] = ` Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (1:8)" `; -exports[`valid-using-binding-escaped.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (1:9) -> 1 | { using \\u0061b = c; } - | ^^^^^^^ - 2 | -Cause: [1:8-1:15]: Unexpected token: 'identifier'" -`; - exports[`valid-using-binding-non-bmp.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -1130,14 +1000,6 @@ exports[`valid-using-binding-non-bmp.js format[flow] 1`] = ` Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (1:8)" `; -exports[`valid-using-binding-non-bmp.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (1:9) -> 1 | { using 𠮷 = foo(); } - | ^^ - 2 | -Cause: [1:8-1:10]: Unexpected token: 'identifier'" -`; - exports[`valid-using-binding-using.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -1167,14 +1029,3 @@ exports[`valid-using-binding-using.js format[flow] 1`] = ` 5 | Cause: Unexpected identifier, expected the end of an expression statement (\`;\`) (2:8)" `; - -exports[`valid-using-binding-using.js format[meriyah] 1`] = ` -"Unexpected token: 'identifier' (2:9) - 1 | { -> 2 | using using = of; - | ^^^^^ - 3 | for (using using of of); - 4 | } - 5 | -Cause: [2:8-2:13]: Unexpected token: 'identifier'" -`; diff --git a/tests/format/js/explicit-resource-management/format.test.js b/tests/format/js/explicit-resource-management/format.test.js index da6906888..90504917d 100644 --- a/tests/format/js/explicit-resource-management/format.test.js +++ b/tests/format/js/explicit-resource-management/format.test.js @@ -43,7 +43,8 @@ runFormatTest(import.meta, ["babel", "flow", "typescript"], { "valid-await-expr-using-in.js", ], typescript: [ - // TypeScript does not support module expr + // "invalid-duplicate-using-bindings.js", + // "invalid-script-top-level-using-binding.js", "valid-module-block-top-level-using-binding.js", "valid-module-block-top-level-await-using-binding.js", ], @@ -60,26 +61,9 @@ runFormatTest(import.meta, ["babel", "flow", "typescript"], { "valid-module-block-top-level-await-using-binding.js", ], meriyah: [ - "for-await-using-of-comments.js", - "invalid-duplicate-using-bindings.js", - "invalid-script-top-level-using-binding.js", - "using-declarations.js", - // "valid-for-await-using-binding-escaped-of-of.js", - // "valid-for-using-binding-escaped-of-of.js", + // "invalid-duplicate-using-bindings.js", + // "invalid-script-top-level-using-binding.js", "valid-module-block-top-level-using-binding.js", - "valid-using-binding-basic.js", - "valid-using-binding-escaped.js", - "valid-using-binding-non-bmp.js", - "valid-using-binding-using.js", - - "valid-await-using-binding-basic.js", - "valid-await-using-binding-escaped.js", - "valid-await-using-binding-non-bmp.js", - "valid-await-using-binding-using.js", - "valid-await-using-comments.js", - "valid-for-lhs-await-as-identifier.js", - "valid-for-using-binding-of-of.js", - "valid-for-using-declaration.js", "valid-module-block-top-level-await-using-binding.js", ], oxc: [ diff --git a/tests/format/js/optional-chaining-assignment/__snapshots__/format.test.js.snap b/tests/format/js/optional-chaining-assignment/__snapshots__/format.test.js.snap index 37030e1c3..f520d84a9 100644 --- a/tests/format/js/optional-chaining-assignment/__snapshots__/format.test.js.snap +++ b/tests/format/js/optional-chaining-assignment/__snapshots__/format.test.js.snap @@ -627,6 +627,14 @@ exports[`valid-lhs-eq.js format[espree] 1`] = ` Cause: Optional chaining cannot appear in left-hand side" `; +exports[`valid-lhs-eq.js format[meriyah] 1`] = ` +"Invalid left-hand side in assignment (1:8) +> 1 | a?.b.c = d; + | ^ + 2 | +Cause: [1:7-1:8]: Invalid left-hand side in assignment" +`; + exports[`valid-lhs-eq.js format[oxc] 1`] = ` "Cannot assign to this expression (1:1) > 1 | a?.b.c = d; @@ -670,6 +678,14 @@ exports[`valid-lhs-plus-eq.js format[espree] 1`] = ` Cause: Optional chaining cannot appear in left-hand side" `; +exports[`valid-lhs-plus-eq.js format[meriyah] 1`] = ` +"Invalid left-hand side in assignment (1:8) +> 1 | a?.b.c += d; + | ^^ + 2 | +Cause: [1:7-1:9]: Invalid left-hand side in assignment" +`; + exports[`valid-lhs-plus-eq.js format[oxc] 1`] = ` "Cannot assign to this expression (1:1) > 1 | a?.b.c += d; diff --git a/tests/format/js/optional-chaining-assignment/format.test.js b/tests/format/js/optional-chaining-assignment/format.test.js index 1ecd0997e..a8a2cf65d 100644 --- a/tests/format/js/optional-chaining-assignment/format.test.js +++ b/tests/format/js/optional-chaining-assignment/format.test.js @@ -18,19 +18,11 @@ const optionalChainingAssignTests = [ "valid-complex-case.js", ]; -// meriyah can parse these files -const meriyahCanParse = new Set(["valid-lhs-eq.js", "valid-lhs-plus-eq.js"]); - runFormatTest(import.meta, ["babel"], { errors: { acorn: [...optionalChainingAssignTests, ...invalidSyntaxTests], espree: [...optionalChainingAssignTests, ...invalidSyntaxTests], - meriyah: [ - ...optionalChainingAssignTests.filter( - (test) => !meriyahCanParse.has(test), - ), - ...invalidSyntaxTests, - ], + meriyah: [...optionalChainingAssignTests, ...invalidSyntaxTests], oxc: [...optionalChainingAssignTests, ...invalidSyntaxTests], "oxc-ts": [...optionalChainingAssignTests, ...invalidSyntaxTests], yuku: [...optionalChainingAssignTests, ...invalidSyntaxTests], diff --git a/yarn.lock b/yarn.lock index f49bdccd7..30616bf8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7028,10 +7028,10 @@ __metadata: languageName: node linkType: hard -"meriyah@npm:7.1.2": - version: 7.1.2 - resolution: "meriyah@npm:7.1.2" - checksum: 10/cc9686b436349e73bbf21b7db1d83bb1479a5d7e9270775911598e8b2a8a4d35dd4d5e29a865ba2be5abd53f896c82fb682893f9236b7265ccbdba39448fe37c +"meriyah@npm:7.2.0": + version: 7.2.0 + resolution: "meriyah@npm:7.2.0" + checksum: 10/27730efc5524ef0dca0419b73b503b5486cf1535fb689a9c16224367e45df7c9f1dea0d6d354dbc002185feba642f95fae4e0ee8f2912b06a0a6a36686122a1c languageName: node linkType: hard @@ -8335,7 +8335,7 @@ __metadata: mdast-util-from-markdown: "npm:2.0.3" mdast-util-gfm: "npm:3.1.0" mdast-util-math: "npm:3.0.0" - meriyah: "npm:7.1.2" + meriyah: "npm:7.2.0" micromark-extension-gfm: "npm:3.0.0" micromark-extension-math: "npm:3.1.0" micromark-util-character: "npm:2.1.1"