diff --git a/package.json b/package.json index a5f14b834..67327139b 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@prettier/parse-srcset": "3.1.0", "@typescript-eslint/typescript-estree": "8.55.0", "@typescript-eslint/visitor-keys": "8.55.0", - "acorn": "8.15.0", + "acorn": "8.16.0", "acorn-jsx": "5.3.2", "angular-estree-parser": "15.3.0", "angular-html-parser": "10.4.0", 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 08f5aa8d1..53d3ce6b8 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 @@ -237,28 +237,6 @@ async function f() { ================================================================================ `; -exports[`valid-await-expr-using.js format[acorn] 1`] = ` -"Unexpected token (2:14) - 1 | async function f() { -> 2 | await using[x]; - | ^ - 3 | await using.x + await using(x) ? await using?.x : await using\`x\`; - 4 | } - 5 | -Cause: Unexpected token (2:13)" -`; - -exports[`valid-await-expr-using.js format[espree] 1`] = ` -"Unexpected token [ (2:14) - 1 | async function f() { -> 2 | await using[x]; - | ^ - 3 | await using.x + await using(x) ? await using?.x : await using\`x\`; - 4 | } - 5 | -Cause: Unexpected token [" -`; - exports[`valid-await-expr-using-in.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -276,26 +254,6 @@ async function f() { ================================================================================ `; -exports[`valid-await-expr-using-in.js format[acorn] 1`] = ` -"Unexpected keyword 'in' (2:15) - 1 | async function f() { -> 2 | await using in foo; - | ^ - 3 | } - 4 | -Cause: Unexpected keyword 'in' (2:14)" -`; - -exports[`valid-await-expr-using-in.js format[espree] 1`] = ` -"Unexpected keyword 'in' (2:15) - 1 | async function f() { -> 2 | await using in foo; - | ^ - 3 | } - 4 | -Cause: Unexpected keyword 'in'" -`; - exports[`valid-await-expr-using-instanceof.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -313,26 +271,6 @@ async function f() { ================================================================================ `; -exports[`valid-await-expr-using-instanceof.js format[acorn] 1`] = ` -"Unexpected keyword 'instanceof' (2:15) - 1 | async function f() { -> 2 | await using instanceof foo; - | ^ - 3 | } - 4 | -Cause: Unexpected keyword 'instanceof' (2:14)" -`; - -exports[`valid-await-expr-using-instanceof.js format[espree] 1`] = ` -"Unexpected keyword 'instanceof' (2:15) - 1 | async function f() { -> 2 | await using instanceof foo; - | ^ - 3 | } - 4 | -Cause: Unexpected keyword 'instanceof'" -`; - exports[`valid-await-using-asi-assignment.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -676,6 +614,28 @@ async function f() { ================================================================================ `; +exports[`valid-for-using-binding-of-of.js format[acorn] 1`] = ` +"Assigning to rvalue (2:8) + 1 | async function f() { +> 2 | for (await using of of of); + | ^ + 3 | for await (await using of of of); + 4 | } + 5 | +Cause: Assigning to rvalue (2:7)" +`; + +exports[`valid-for-using-binding-of-of.js format[espree] 1`] = ` +"Assigning to rvalue (2:8) + 1 | async function f() { +> 2 | for (await using of of of); + | ^ + 3 | for await (await using of of of); + 4 | } + 5 | +Cause: Assigning to rvalue" +`; + exports[`valid-for-using-binding-of-of.js format[flow] 1`] = ` "Invalid left-hand side in for-of (2:8) 1 | async function f() { @@ -1029,26 +989,6 @@ for (using\`\`.foo in []); ================================================================================ `; -exports[`valid-using-as-identifier-for-in.js format[acorn] 1`] = ` -"Unexpected keyword 'in' (1:12) -> 1 | for (using in []); - | ^ - 2 | for (using.foo in []); - 3 | for (using().foo in []); - 4 | for (using\`\`.foo in []); -Cause: Unexpected keyword 'in' (1:11)" -`; - -exports[`valid-using-as-identifier-for-in.js format[espree] 1`] = ` -"Unexpected keyword 'in' (1:12) -> 1 | for (using in []); - | ^ - 2 | for (using.foo in []); - 3 | for (using().foo in []); - 4 | for (using\`\`.foo in []); -Cause: Unexpected keyword 'in'" -`; - exports[`valid-using-as-identifier-for-init.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -1096,22 +1036,6 @@ using in using instanceof using; ================================================================================ `; -exports[`valid-using-as-identifier-in.js format[acorn] 1`] = ` -"Unexpected keyword 'in' (1:7) -> 1 | using in using instanceof using; - | ^ - 2 | -Cause: Unexpected keyword 'in' (1:6)" -`; - -exports[`valid-using-as-identifier-in.js format[espree] 1`] = ` -"Unexpected keyword 'in' (1:7) -> 1 | using in using instanceof using; - | ^ - 2 | -Cause: Unexpected keyword 'in'" -`; - exports[`valid-using-binding-basic.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -1215,22 +1139,6 @@ parsers: ["babel", "flow", "typescript"] ================================================================================ `; -exports[`valid-using-binding-non-bmp.js format[acorn] 1`] = ` -"Unexpected token (1:9) -> 1 | { using 𠮷 = foo(); } - | ^ - 2 | -Cause: Unexpected token (1:8)" -`; - -exports[`valid-using-binding-non-bmp.js format[espree] 1`] = ` -"Unexpected token 𠮷 (1:9) -> 1 | { using 𠮷 = foo(); } - | ^ - 2 | -Cause: Unexpected token 𠮷" -`; - exports[`valid-using-binding-non-bmp.js format[flow] 1`] = ` "Unexpected identifier, expected the end of an expression statement (\`;\`) (1:9) > 1 | { using 𠮷 = foo(); } diff --git a/tests/format/js/explicit-resource-management/format.test.js b/tests/format/js/explicit-resource-management/format.test.js index ac05610ad..f3a3ac3db 100644 --- a/tests/format/js/explicit-resource-management/format.test.js +++ b/tests/format/js/explicit-resource-management/format.test.js @@ -56,26 +56,16 @@ runFormatTest(import.meta, ["babel", "flow", "typescript"], { acorn: [ "invalid-duplicate-using-bindings.js", // "invalid-script-top-level-using-binding.js", - "valid-await-expr-using-in.js", - "valid-await-expr-using-instanceof.js", - "valid-await-expr-using.js", "valid-module-block-top-level-using-binding.js", "valid-module-block-top-level-await-using-binding.js", - "valid-using-as-identifier-for-in.js", - "valid-using-as-identifier-in.js", - "valid-using-binding-non-bmp.js", + "valid-for-using-binding-of-of.js", ], espree: [ "invalid-duplicate-using-bindings.js", // "invalid-script-top-level-using-binding.js", - "valid-await-expr-using-in.js", - "valid-await-expr-using-instanceof.js", - "valid-await-expr-using.js", "valid-module-block-top-level-using-binding.js", "valid-module-block-top-level-await-using-binding.js", - "valid-using-as-identifier-for-in.js", - "valid-using-as-identifier-in.js", - "valid-using-binding-non-bmp.js", + "valid-for-using-binding-of-of.js", ], meriyah: [ "for-await-using-of-comments.js", diff --git a/yarn.lock b/yarn.lock index 12d482b76..d6aa820f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2877,12 +2877,12 @@ __metadata: languageName: node linkType: hard -"acorn@npm:8.15.0, acorn@npm:^8.15.0": - version: 8.15.0 - resolution: "acorn@npm:8.15.0" +"acorn@npm:8.16.0, acorn@npm:^8.15.0": + version: 8.16.0 + resolution: "acorn@npm:8.16.0" bin: acorn: bin/acorn - checksum: 10/77f2de5051a631cf1729c090e5759148459cdb76b5f5c70f890503d629cf5052357b0ce783c0f976dd8a93c5150f59f6d18df1def3f502396a20f81282482fa4 + checksum: 10/690c673bb4d61b38ef82795fab58526471ad7f7e67c0e40c4ff1e10ecd80ce5312554ef633c9995bfc4e6d170cef165711f9ca9e49040b62c0c66fbf2dd3df2b languageName: node linkType: hard @@ -8401,7 +8401,7 @@ __metadata: "@typescript-eslint/parser": "npm:8.55.0" "@typescript-eslint/typescript-estree": "npm:8.55.0" "@typescript-eslint/visitor-keys": "npm:8.55.0" - acorn: "npm:8.15.0" + acorn: "npm:8.16.0" acorn-jsx: "npm:5.3.2" angular-estree-parser: "npm:15.3.0" angular-html-parser: "npm:10.4.0"