From 4e1a313064b1e7cff14b2f1d7b137c6fe007aa05 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:23:14 +0800 Subject: [PATCH] chore(deps): update dependency acorn to v8.14.0 (#16793) * chore(deps): update dependency acorn to v8.14.0 * Fix tests * Fix test --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: fisker --- package.json | 2 +- .../__snapshots__/format.test.js.snap | 64 ------- tests/format/js/babel-plugins/format.test.js | 8 - .../__snapshots__/format.test.js.snap | 16 -- tests/format/js/dynamic-import/format.test.js | 4 +- .../__snapshots__/format.test.js.snap | 16 -- .../__snapshots__/format.test.js.snap | 16 -- .../bracket-spacing/format.test.js | 14 +- .../js/import-assertions/format.test.js | 2 - .../__snapshots__/format.test.js.snap | 158 +-------------- .../__snapshots__/format.test.js.snap | 62 ------ .../bracket-spacing/format.test.js | 18 +- .../js/import-attributes/format.test.js | 24 +-- .../__snapshots__/format.test.js.snap | 180 ++++++------------ .../quote-props/format.test.js | 12 +- .../quote-props/quoted-keys.js | 20 +- .../regex/__snapshots__/format.test.js.snap | 20 -- tests/format/js/regex/format.test.js | 2 - yarn.lock | 10 +- 19 files changed, 91 insertions(+), 557 deletions(-) diff --git a/package.json b/package.json index cc20ef16b..6c1528acc 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@prettier/parse-srcset": "3.1.0", "@typescript-eslint/typescript-estree": "8.10.0", "@typescript-eslint/visitor-keys": "8.10.0", - "acorn": "8.13.0", + "acorn": "8.14.0", "acorn-jsx": "5.3.2", "angular-estree-parser": "10.0.4", "angular-html-parser": "7.0.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 b33461be0..84acbb112 100644 --- a/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap +++ b/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap @@ -1141,22 +1141,6 @@ iterator.next(2); // Logs "Yield 2" ================================================================================ `; -exports[`import-assertions-dynamic.js [acorn] format 1`] = ` -"Unexpected token (1:20) -> 1 | import("./foo.json", { assert: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token (1:19)" -`; - -exports[`import-assertions-dynamic.js [espree] format 1`] = ` -"Unexpected token , (1:20) -> 1 | import("./foo.json", { assert: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token ," -`; - exports[`import-assertions-dynamic.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1209,22 +1193,6 @@ import json from "./foo.json" assert { type: "json" }; ================================================================================ `; -exports[`import-attributes-dynamic.js [acorn] format 1`] = ` -"Unexpected token (1:20) -> 1 | import("./foo.json", { with: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token (1:19)" -`; - -exports[`import-attributes-dynamic.js [espree] format 1`] = ` -"Unexpected token , (1:20) -> 1 | import("./foo.json", { with: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token ," -`; - exports[`import-attributes-dynamic.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1239,22 +1207,6 @@ import("./foo.json", { with: { type: "json" } }); ================================================================================ `; -exports[`import-attributes-static.js [acorn] format 1`] = ` -"Unexpected token (1:31) -> 1 | import json from "./foo.json" with { type: "json" }; - | ^ - 2 | -Cause: Unexpected token (1:30)" -`; - -exports[`import-attributes-static.js [espree] format 1`] = ` -"Unexpected token with (1:31) -> 1 | import json from "./foo.json" with { type: "json" }; - | ^ - 2 | -Cause: Unexpected token with" -`; - exports[`import-attributes-static.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -2395,22 +2347,6 @@ printWidth: 80 ================================================================================ `; -exports[`regexp-modifiers.js [acorn] format 1`] = ` -"Invalid regular expression: /^(?i:[a-z])[a-z]$/: Invalid group (1:13) -> 1 | const re = /^(?i:[a-z])[a-z]$/; - | ^ - 2 | -Cause: Invalid regular expression: /^(?i:[a-z])[a-z]$/: Invalid group (1:12)" -`; - -exports[`regexp-modifiers.js [espree] format 1`] = ` -"Invalid regular expression: /^(?i:[a-z])[a-z]$/: Invalid group (1:13) -> 1 | const re = /^(?i:[a-z])[a-z]$/; - | ^ - 2 | -Cause: Invalid regular expression: /^(?i:[a-z])[a-z]$/: Invalid group" -`; - exports[`regexp-modifiers.js [meriyah] format 1`] = ` "Unterminated regular expression (1:12) > 1 | const re = /^(?i:[a-z])[a-z]$/; diff --git a/tests/format/js/babel-plugins/format.test.js b/tests/format/js/babel-plugins/format.test.js index 9020ff7f5..7ac7aa658 100644 --- a/tests/format/js/babel-plugins/format.test.js +++ b/tests/format/js/babel-plugins/format.test.js @@ -11,10 +11,7 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], { "flow.js", "function-bind.js", "function-sent.js", - "import-assertions-dynamic.js", "import-assertions-static.js", - "import-attributes-dynamic.js", - "import-attributes-static.js", "partial-application.js", "pipeline-operator-fsharp.js", "pipeline-operator-minimal.js", @@ -28,7 +25,6 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], { "async-do-expressions.js", "decorator-auto-accessors.js", "explicit-resource-management.js", - "regexp-modifiers.js", "source-phase-imports.js", "deferred-import-evaluation.js", "optional-chaining-assignment.js", @@ -41,10 +37,7 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], { "flow.js", "function-bind.js", "function-sent.js", - "import-assertions-dynamic.js", "import-assertions-static.js", - "import-attributes-dynamic.js", - "import-attributes-static.js", "partial-application.js", "pipeline-operator-fsharp.js", "pipeline-operator-minimal.js", @@ -58,7 +51,6 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], { "async-do-expressions.js", "decorator-auto-accessors.js", "explicit-resource-management.js", - "regexp-modifiers.js", "source-phase-imports.js", "deferred-import-evaluation.js", "optional-chaining-assignment.js", diff --git a/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap b/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap index cc7303890..5d3be58b6 100644 --- a/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap +++ b/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap @@ -1,21 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`assertions.js [acorn] format 1`] = ` -"Unexpected token (1:20) -> 1 | import("./foo.json", { assert: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token (1:19)" -`; - -exports[`assertions.js [espree] format 1`] = ` -"Unexpected token , (1:20) -> 1 | import("./foo.json", { assert: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token ," -`; - exports[`assertions.js [flow] format 1`] = ` "Unexpected token \`,\`, expected the token \`)\` (1:20) > 1 | import("./foo.json", { assert: { type: "json" } }); diff --git a/tests/format/js/dynamic-import/format.test.js b/tests/format/js/dynamic-import/format.test.js index 713986b86..ae118cb7d 100644 --- a/tests/format/js/dynamic-import/format.test.js +++ b/tests/format/js/dynamic-import/format.test.js @@ -1,8 +1,8 @@ runFormatTest(import.meta, ["babel", "flow", "typescript"], { errors: { flow: ["assertions.js", "template-literal.js", "import-phase.js"], - acorn: ["assertions.js", "import-phase.js"], - espree: ["assertions.js", "import-phase.js"], + acorn: ["import-phase.js"], + espree: ["import-phase.js"], meriyah: ["import-phase.js"], }, }); diff --git a/tests/format/js/import-assertions/__snapshots__/format.test.js.snap b/tests/format/js/import-assertions/__snapshots__/format.test.js.snap index 4fd518858..95188e769 100644 --- a/tests/format/js/import-assertions/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-assertions/__snapshots__/format.test.js.snap @@ -1,21 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`dynamic-import.js [acorn] format 1`] = ` -"Unexpected token (1:20) -> 1 | import("./foo.json", { assert: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token (1:19)" -`; - -exports[`dynamic-import.js [espree] format 1`] = ` -"Unexpected token , (1:20) -> 1 | import("./foo.json", { assert: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token ," -`; - exports[`dynamic-import.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] diff --git a/tests/format/js/import-assertions/bracket-spacing/__snapshots__/format.test.js.snap b/tests/format/js/import-assertions/bracket-spacing/__snapshots__/format.test.js.snap index cc7c84a3a..1ebf0774b 100644 --- a/tests/format/js/import-assertions/bracket-spacing/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-assertions/bracket-spacing/__snapshots__/format.test.js.snap @@ -1,21 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`dynamic-import.js - {"bracketSpacing":false} [acorn] format 1`] = ` -"Unexpected token (1:20) -> 1 | import("./foo.json", { assert: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token (1:19)" -`; - -exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = ` -"Unexpected token , (1:20) -> 1 | import("./foo.json", { assert: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token ," -`; - exports[`dynamic-import.js - {"bracketSpacing":false} format 1`] = ` ====================================options===================================== bracketSpacing: false diff --git a/tests/format/js/import-assertions/bracket-spacing/format.test.js b/tests/format/js/import-assertions/bracket-spacing/format.test.js index 0d6f1b107..22128e084 100644 --- a/tests/format/js/import-assertions/bracket-spacing/format.test.js +++ b/tests/format/js/import-assertions/bracket-spacing/format.test.js @@ -1,18 +1,8 @@ runFormatTest(import.meta, ["babel"], { bracketSpacing: false, errors: { - acorn: [ - "dynamic-import.js", - "static-import.js", - "re-export.js", - "empty.js", - ], - espree: [ - "dynamic-import.js", - "static-import.js", - "re-export.js", - "empty.js", - ], + acorn: ["static-import.js", "re-export.js", "empty.js"], + espree: ["static-import.js", "re-export.js", "empty.js"], meriyah: ["static-import.js", "re-export.js", "empty.js"], }, }); diff --git a/tests/format/js/import-assertions/format.test.js b/tests/format/js/import-assertions/format.test.js index 057403037..65202051a 100644 --- a/tests/format/js/import-assertions/format.test.js +++ b/tests/format/js/import-assertions/format.test.js @@ -1,7 +1,6 @@ runFormatTest(import.meta, ["babel", "typescript"], { errors: { acorn: [ - "dynamic-import.js", "empty.js", "multi-types.js", "static-import.js", @@ -11,7 +10,6 @@ runFormatTest(import.meta, ["babel", "typescript"], { "keyword-detect.js", ], espree: [ - "dynamic-import.js", "empty.js", "multi-types.js", "static-import.js", diff --git a/tests/format/js/import-attributes/__snapshots__/format.test.js.snap b/tests/format/js/import-attributes/__snapshots__/format.test.js.snap index b0c7a07d7..88598227a 100644 --- a/tests/format/js/import-attributes/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-attributes/__snapshots__/format.test.js.snap @@ -1,21 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`dynamic-import.js [acorn] format 1`] = ` -"Unexpected token (1:20) -> 1 | import("./foo.json", { with: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token (1:19)" -`; - -exports[`dynamic-import.js [espree] format 1`] = ` -"Unexpected token , (1:20) -> 1 | import("./foo.json", { with: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token ," -`; - exports[`dynamic-import.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -30,28 +14,6 @@ import("./foo.json", { with: { type: "json" } }); ================================================================================ `; -exports[`empty.js [acorn] format 1`] = ` -"Unexpected token (2:33) - 1 | export * as foo from "foo.json" -> 2 | export * as bar from "bar.json" with { } - | ^ - 3 | export * as baz from "baz.json" with { /* comment */ } - 4 | - 5 | import * as foo from "foo.json" -Cause: Unexpected token (2:32)" -`; - -exports[`empty.js [espree] format 1`] = ` -"Unexpected token with (2:33) - 1 | export * as foo from "foo.json" -> 2 | export * as bar from "bar.json" with { } - | ^ - 3 | export * as baz from "baz.json" with { /* comment */ } - 4 | - 5 | import * as foo from "foo.json" -Cause: Unexpected token with" -`; - exports[`empty.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -78,26 +40,6 @@ import * as baz from "baz.json" /* comment */ with {}; ================================================================================ `; -exports[`keyword-detect.js [acorn] format 1`] = ` -"Unexpected token (1:35) -> 1 | import "./test.json" /* assert */ with /* assert */ { type: "json" } - | ^ - 2 | import a from "./test.json" /* assert */ with /* assert */ { type: "json" } - 3 | - 4 | export {default as c} from "./test.json" /* assert */ with /* assert */ { type: "json" } -Cause: Unexpected token (1:34)" -`; - -exports[`keyword-detect.js [espree] format 1`] = ` -"Unexpected token with (1:35) -> 1 | import "./test.json" /* assert */ with /* assert */ { type: "json" } - | ^ - 2 | import a from "./test.json" /* assert */ with /* assert */ { type: "json" } - 3 | - 4 | export {default as c} from "./test.json" /* assert */ with /* assert */ { type: "json" } -Cause: Unexpected token with" -`; - exports[`keyword-detect.js [meriyah] format 1`] = ` "Invalid binding in JSON import (1:69) > 1 | import "./test.json" /* assert */ with /* assert */ { type: "json" } @@ -132,26 +74,6 @@ export * from "./test.json" /* assert */ /* assert */ with { type: "json" }; ================================================================================ `; -exports[`long-sources.js [acorn] format 1`] = ` -"Unexpected token (1:37) -> 1 | import a10 from "./aaaaaaaaaa.json" with { - | ^ - 2 | type: "json" }; - 3 | import a20 from "./aaaaaaaaaaaaaaaaaaaa.json" with { type: "json" }; - 4 | import a30 from "./aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" with { type: "json" }; -Cause: Unexpected token (1:36)" -`; - -exports[`long-sources.js [espree] format 1`] = ` -"Unexpected token with (1:37) -> 1 | import a10 from "./aaaaaaaaaa.json" with { - | ^ - 2 | type: "json" }; - 3 | import a20 from "./aaaaaaaaaaaaaaaaaaaa.json" with { type: "json" }; - 4 | import a30 from "./aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json" with { type: "json" }; -Cause: Unexpected token with" -`; - exports[`long-sources.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -214,19 +136,19 @@ import( `; exports[`multi-types.js [acorn] format 1`] = ` -"Unexpected token (1:31) +"Duplicate attribute key 'type' (1:52) > 1 | import json from "./foo.json" with { type: "json", type: "bar" }; - | ^ + | ^ 2 | -Cause: Unexpected token (1:30)" +Cause: Duplicate attribute key 'type' (1:51)" `; exports[`multi-types.js [espree] format 1`] = ` -"Unexpected token with (1:31) +"Duplicate attribute key 'type' (1:52) > 1 | import json from "./foo.json" with { type: "json", type: "bar" }; - | ^ + | ^ 2 | -Cause: Unexpected token with" +Cause: Duplicate attribute key 'type'" `; exports[`multi-types.js [meriyah] format 1`] = ` @@ -251,22 +173,6 @@ import json from "./foo.json" with { type: "json", type: "bar" }; ================================================================================ `; -exports[`non-type.js [acorn] format 1`] = ` -"Unexpected token (1:28) -> 1 | import foo from "foo.json" with { lazy: "true" }; - | ^ - 2 | -Cause: Unexpected token (1:27)" -`; - -exports[`non-type.js [espree] format 1`] = ` -"Unexpected token with (1:28) -> 1 | import foo from "foo.json" with { lazy: "true" }; - | ^ - 2 | -Cause: Unexpected token with" -`; - exports[`non-type.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -281,26 +187,6 @@ import foo from "foo.json" with { lazy: "true" }; ================================================================================ `; -exports[`re-export.js [acorn] format 1`] = ` -"Unexpected token (1:44) -> 1 | export { default as foo2 } from "foo.json" with { type: "json" }; - | ^ - 2 | export * from "foo.json" with { type: "json" }; - 3 | export * as foo3 from "foo.json" with { type: "json" }; - 4 | -Cause: Unexpected token (1:43)" -`; - -exports[`re-export.js [espree] format 1`] = ` -"Unexpected token with (1:44) -> 1 | export { default as foo2 } from "foo.json" with { type: "json" }; - | ^ - 2 | export * from "foo.json" with { type: "json" }; - 3 | export * as foo3 from "foo.json" with { type: "json" }; - 4 | -Cause: Unexpected token with" -`; - exports[`re-export.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -319,22 +205,6 @@ export * as foo3 from "foo.json" with { type: "json" }; ================================================================================ `; -exports[`static-import.js [acorn] format 1`] = ` -"Unexpected token (1:31) -> 1 | import json from "./foo.json" with { type: "json" }; - | ^ - 2 | -Cause: Unexpected token (1:30)" -`; - -exports[`static-import.js [espree] format 1`] = ` -"Unexpected token with (1:31) -> 1 | import json from "./foo.json" with { type: "json" }; - | ^ - 2 | -Cause: Unexpected token with" -`; - exports[`static-import.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -349,22 +219,6 @@ import json from "./foo.json" with { type: "json" }; ================================================================================ `; -exports[`without-from.js [acorn] format 1`] = ` -"Unexpected token (1:14) -> 1 | import "foo" with { type: "json" } - | ^ - 2 | -Cause: Unexpected token (1:13)" -`; - -exports[`without-from.js [espree] format 1`] = ` -"Unexpected token with (1:14) -> 1 | import "foo" with { type: "json" } - | ^ - 2 | -Cause: Unexpected token with" -`; - exports[`without-from.js [meriyah] format 1`] = ` "Invalid binding in JSON import (1:34) > 1 | import "foo" with { type: "json" } diff --git a/tests/format/js/import-attributes/bracket-spacing/__snapshots__/format.test.js.snap b/tests/format/js/import-attributes/bracket-spacing/__snapshots__/format.test.js.snap index 125cfae80..c137c69e5 100644 --- a/tests/format/js/import-attributes/bracket-spacing/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-attributes/bracket-spacing/__snapshots__/format.test.js.snap @@ -1,21 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`dynamic-import.js - {"bracketSpacing":false} [acorn] format 1`] = ` -"Unexpected token (1:20) -> 1 | import("./foo.json", { with: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token (1:19)" -`; - -exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = ` -"Unexpected token , (1:20) -> 1 | import("./foo.json", { with: { type: "json" } }); - | ^ - 2 | -Cause: Unexpected token ," -`; - exports[`dynamic-import.js - {"bracketSpacing":false} format 1`] = ` ====================================options===================================== bracketSpacing: false @@ -31,20 +15,6 @@ import("./foo.json", {with: {type: "json"}}); ================================================================================ `; -exports[`empty.js - {"bracketSpacing":false} [acorn] format 1`] = ` -"Unexpected token (1:33) -> 1 | export * as bar from "bar.json" with { } - | ^ -Cause: Unexpected token (1:32)" -`; - -exports[`empty.js - {"bracketSpacing":false} [espree] format 1`] = ` -"Unexpected token with (1:33) -> 1 | export * as bar from "bar.json" with { } - | ^ -Cause: Unexpected token with" -`; - exports[`empty.js - {"bracketSpacing":false} format 1`] = ` ====================================options===================================== bracketSpacing: false @@ -59,22 +29,6 @@ export * as bar from "bar.json" with {}; ================================================================================ `; -exports[`re-export.js - {"bracketSpacing":false} [acorn] format 1`] = ` -"Unexpected token (1:44) -> 1 | export { default as foo2 } from "foo.json" with { type: "json" }; - | ^ - 2 | -Cause: Unexpected token (1:43)" -`; - -exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = ` -"Unexpected token with (1:44) -> 1 | export { default as foo2 } from "foo.json" with { type: "json" }; - | ^ - 2 | -Cause: Unexpected token with" -`; - exports[`re-export.js - {"bracketSpacing":false} format 1`] = ` ====================================options===================================== bracketSpacing: false @@ -90,22 +44,6 @@ export {default as foo2} from "foo.json" with {type: "json"}; ================================================================================ `; -exports[`static-import.js - {"bracketSpacing":false} [acorn] format 1`] = ` -"Unexpected token (1:31) -> 1 | import json from "./foo.json" with { type: "json" }; - | ^ - 2 | -Cause: Unexpected token (1:30)" -`; - -exports[`static-import.js - {"bracketSpacing":false} [espree] format 1`] = ` -"Unexpected token with (1:31) -> 1 | import json from "./foo.json" with { type: "json" }; - | ^ - 2 | -Cause: Unexpected token with" -`; - exports[`static-import.js - {"bracketSpacing":false} format 1`] = ` ====================================options===================================== bracketSpacing: false diff --git a/tests/format/js/import-attributes/bracket-spacing/format.test.js b/tests/format/js/import-attributes/bracket-spacing/format.test.js index 5bd80afe6..f4c9bb466 100644 --- a/tests/format/js/import-attributes/bracket-spacing/format.test.js +++ b/tests/format/js/import-attributes/bracket-spacing/format.test.js @@ -1,17 +1 @@ -runFormatTest(import.meta, ["babel"], { - bracketSpacing: false, - errors: { - acorn: [ - "dynamic-import.js", - "static-import.js", - "re-export.js", - "empty.js", - ], - espree: [ - "dynamic-import.js", - "static-import.js", - "re-export.js", - "empty.js", - ], - }, -}); +runFormatTest(import.meta, ["babel"], { bracketSpacing: false }); diff --git a/tests/format/js/import-attributes/format.test.js b/tests/format/js/import-attributes/format.test.js index 78121ca48..3e25a96fb 100644 --- a/tests/format/js/import-attributes/format.test.js +++ b/tests/format/js/import-attributes/format.test.js @@ -1,26 +1,6 @@ const errors = { - acorn: [ - "dynamic-import.js", - "empty.js", - "multi-types.js", - "static-import.js", - "re-export.js", - "without-from.js", - "non-type.js", - "keyword-detect.js", - "long-sources.js", - ], - espree: [ - "dynamic-import.js", - "empty.js", - "multi-types.js", - "static-import.js", - "re-export.js", - "without-from.js", - "non-type.js", - "keyword-detect.js", - "long-sources.js", - ], + acorn: ["multi-types.js"], + espree: ["multi-types.js"], meriyah: ["multi-types.js", "without-from.js", "keyword-detect.js"], }; runFormatTest(import.meta, ["babel", "typescript"], { errors }); diff --git a/tests/format/js/import-attributes/quote-props/__snapshots__/format.test.js.snap b/tests/format/js/import-attributes/quote-props/__snapshots__/format.test.js.snap index 9b813d54b..20bec1c6c 100644 --- a/tests/format/js/import-attributes/quote-props/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-attributes/quote-props/__snapshots__/format.test.js.snap @@ -1,45 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`quoted-keys.js [acorn] format 1`] = ` -"Unexpected token (1:29) -> 1 | import json from './mod.js' with { "type":"json" }; - | ^ - 2 | import json from './mod.js' with { "foobar":"json" }; - 3 | import json from './mod.js' with { "type-foo" :"json" }; - 4 | import json from './mod.js' with { "333foo" :"json" }; -Cause: Unexpected token (1:28)" -`; - -exports[`quoted-keys.js [espree] format 1`] = ` -"Unexpected token with (1:29) -> 1 | import json from './mod.js' with { "type":"json" }; - | ^ - 2 | import json from './mod.js' with { "foobar":"json" }; - 3 | import json from './mod.js' with { "type-foo" :"json" }; - 4 | import json from './mod.js' with { "333foo" :"json" }; -Cause: Unexpected token with" -`; - -exports[`quoted-keys.js - {"quoteProps":"consistent"} [acorn] format 1`] = ` -"Unexpected token (1:29) -> 1 | import json from './mod.js' with { "type":"json" }; - | ^ - 2 | import json from './mod.js' with { "foobar":"json" }; - 3 | import json from './mod.js' with { "type-foo" :"json" }; - 4 | import json from './mod.js' with { "333foo" :"json" }; -Cause: Unexpected token (1:28)" -`; - -exports[`quoted-keys.js - {"quoteProps":"consistent"} [espree] format 1`] = ` -"Unexpected token with (1:29) -> 1 | import json from './mod.js' with { "type":"json" }; - | ^ - 2 | import json from './mod.js' with { "foobar":"json" }; - 3 | import json from './mod.js' with { "type-foo" :"json" }; - 4 | import json from './mod.js' with { "333foo" :"json" }; -Cause: Unexpected token with" -`; - exports[`quoted-keys.js - {"quoteProps":"consistent"} format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -47,52 +7,32 @@ printWidth: 80 quoteProps: "consistent" | printWidth =====================================input====================================== -import json from './mod.js' with { "type":"json" }; -import json from './mod.js' with { "foobar":"json" }; -import json from './mod.js' with { "type-foo" :"json" }; -import json from './mod.js' with { "333foo" :"json" }; -import json from './mod.js' with { "0" :"json" }; -import json from './mod.js' with { "0n" :"json" }; -import json from './mod.js' with { "33333" :"json" }; -import json from './mod.js' with { "33333n" :"json" }; -import json from './mod.js' with { "33333b" :"json" }; -import json from './mod.js' with { "03333" :"json" }; +import json1 from './mod.js' with { "type":"json" }; +import json2 from './mod.js' with { "foobar":"json" }; +import json3 from './mod.js' with { "type-foo" :"json" }; +import json4 from './mod.js' with { "333foo" :"json" }; +import json5 from './mod.js' with { "0" :"json" }; +import json6 from './mod.js' with { "0n" :"json" }; +import json7 from './mod.js' with { "33333" :"json" }; +import json8 from './mod.js' with { "33333n" :"json" }; +import json9 from './mod.js' with { "33333b" :"json" }; +import json10 from './mod.js' with { "03333" :"json" }; =====================================output===================================== -import json from "./mod.js" with { type: "json" }; -import json from "./mod.js" with { foobar: "json" }; -import json from "./mod.js" with { "type-foo": "json" }; -import json from "./mod.js" with { "333foo": "json" }; -import json from "./mod.js" with { "0": "json" }; -import json from "./mod.js" with { "0n": "json" }; -import json from "./mod.js" with { "33333": "json" }; -import json from "./mod.js" with { "33333n": "json" }; -import json from "./mod.js" with { "33333b": "json" }; -import json from "./mod.js" with { "03333": "json" }; +import json1 from "./mod.js" with { type: "json" }; +import json2 from "./mod.js" with { foobar: "json" }; +import json3 from "./mod.js" with { "type-foo": "json" }; +import json4 from "./mod.js" with { "333foo": "json" }; +import json5 from "./mod.js" with { "0": "json" }; +import json6 from "./mod.js" with { "0n": "json" }; +import json7 from "./mod.js" with { "33333": "json" }; +import json8 from "./mod.js" with { "33333n": "json" }; +import json9 from "./mod.js" with { "33333b": "json" }; +import json10 from "./mod.js" with { "03333": "json" }; ================================================================================ `; -exports[`quoted-keys.js - {"quoteProps":"preserve"} [acorn] format 1`] = ` -"Unexpected token (1:29) -> 1 | import json from './mod.js' with { "type":"json" }; - | ^ - 2 | import json from './mod.js' with { "foobar":"json" }; - 3 | import json from './mod.js' with { "type-foo" :"json" }; - 4 | import json from './mod.js' with { "333foo" :"json" }; -Cause: Unexpected token (1:28)" -`; - -exports[`quoted-keys.js - {"quoteProps":"preserve"} [espree] format 1`] = ` -"Unexpected token with (1:29) -> 1 | import json from './mod.js' with { "type":"json" }; - | ^ - 2 | import json from './mod.js' with { "foobar":"json" }; - 3 | import json from './mod.js' with { "type-foo" :"json" }; - 4 | import json from './mod.js' with { "333foo" :"json" }; -Cause: Unexpected token with" -`; - exports[`quoted-keys.js - {"quoteProps":"preserve"} format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -100,28 +40,28 @@ printWidth: 80 quoteProps: "preserve" | printWidth =====================================input====================================== -import json from './mod.js' with { "type":"json" }; -import json from './mod.js' with { "foobar":"json" }; -import json from './mod.js' with { "type-foo" :"json" }; -import json from './mod.js' with { "333foo" :"json" }; -import json from './mod.js' with { "0" :"json" }; -import json from './mod.js' with { "0n" :"json" }; -import json from './mod.js' with { "33333" :"json" }; -import json from './mod.js' with { "33333n" :"json" }; -import json from './mod.js' with { "33333b" :"json" }; -import json from './mod.js' with { "03333" :"json" }; +import json1 from './mod.js' with { "type":"json" }; +import json2 from './mod.js' with { "foobar":"json" }; +import json3 from './mod.js' with { "type-foo" :"json" }; +import json4 from './mod.js' with { "333foo" :"json" }; +import json5 from './mod.js' with { "0" :"json" }; +import json6 from './mod.js' with { "0n" :"json" }; +import json7 from './mod.js' with { "33333" :"json" }; +import json8 from './mod.js' with { "33333n" :"json" }; +import json9 from './mod.js' with { "33333b" :"json" }; +import json10 from './mod.js' with { "03333" :"json" }; =====================================output===================================== -import json from "./mod.js" with { "type": "json" }; -import json from "./mod.js" with { "foobar": "json" }; -import json from "./mod.js" with { "type-foo": "json" }; -import json from "./mod.js" with { "333foo": "json" }; -import json from "./mod.js" with { "0": "json" }; -import json from "./mod.js" with { "0n": "json" }; -import json from "./mod.js" with { "33333": "json" }; -import json from "./mod.js" with { "33333n": "json" }; -import json from "./mod.js" with { "33333b": "json" }; -import json from "./mod.js" with { "03333": "json" }; +import json1 from "./mod.js" with { "type": "json" }; +import json2 from "./mod.js" with { "foobar": "json" }; +import json3 from "./mod.js" with { "type-foo": "json" }; +import json4 from "./mod.js" with { "333foo": "json" }; +import json5 from "./mod.js" with { "0": "json" }; +import json6 from "./mod.js" with { "0n": "json" }; +import json7 from "./mod.js" with { "33333": "json" }; +import json8 from "./mod.js" with { "33333n": "json" }; +import json9 from "./mod.js" with { "33333b": "json" }; +import json10 from "./mod.js" with { "03333": "json" }; ================================================================================ `; @@ -132,28 +72,28 @@ parsers: ["babel", "typescript"] printWidth: 80 | printWidth =====================================input====================================== -import json from './mod.js' with { "type":"json" }; -import json from './mod.js' with { "foobar":"json" }; -import json from './mod.js' with { "type-foo" :"json" }; -import json from './mod.js' with { "333foo" :"json" }; -import json from './mod.js' with { "0" :"json" }; -import json from './mod.js' with { "0n" :"json" }; -import json from './mod.js' with { "33333" :"json" }; -import json from './mod.js' with { "33333n" :"json" }; -import json from './mod.js' with { "33333b" :"json" }; -import json from './mod.js' with { "03333" :"json" }; +import json1 from './mod.js' with { "type":"json" }; +import json2 from './mod.js' with { "foobar":"json" }; +import json3 from './mod.js' with { "type-foo" :"json" }; +import json4 from './mod.js' with { "333foo" :"json" }; +import json5 from './mod.js' with { "0" :"json" }; +import json6 from './mod.js' with { "0n" :"json" }; +import json7 from './mod.js' with { "33333" :"json" }; +import json8 from './mod.js' with { "33333n" :"json" }; +import json9 from './mod.js' with { "33333b" :"json" }; +import json10 from './mod.js' with { "03333" :"json" }; =====================================output===================================== -import json from "./mod.js" with { type: "json" }; -import json from "./mod.js" with { foobar: "json" }; -import json from "./mod.js" with { "type-foo": "json" }; -import json from "./mod.js" with { "333foo": "json" }; -import json from "./mod.js" with { "0": "json" }; -import json from "./mod.js" with { "0n": "json" }; -import json from "./mod.js" with { "33333": "json" }; -import json from "./mod.js" with { "33333n": "json" }; -import json from "./mod.js" with { "33333b": "json" }; -import json from "./mod.js" with { "03333": "json" }; +import json1 from "./mod.js" with { type: "json" }; +import json2 from "./mod.js" with { foobar: "json" }; +import json3 from "./mod.js" with { "type-foo": "json" }; +import json4 from "./mod.js" with { "333foo": "json" }; +import json5 from "./mod.js" with { "0": "json" }; +import json6 from "./mod.js" with { "0n": "json" }; +import json7 from "./mod.js" with { "33333": "json" }; +import json8 from "./mod.js" with { "33333n": "json" }; +import json9 from "./mod.js" with { "33333b": "json" }; +import json10 from "./mod.js" with { "03333": "json" }; ================================================================================ `; diff --git a/tests/format/js/import-attributes/quote-props/format.test.js b/tests/format/js/import-attributes/quote-props/format.test.js index 42a953772..3182f6060 100644 --- a/tests/format/js/import-attributes/quote-props/format.test.js +++ b/tests/format/js/import-attributes/quote-props/format.test.js @@ -1,13 +1,5 @@ -const errors = { - acorn: ["quoted-keys.js"], - espree: ["quoted-keys.js"], -}; -runFormatTest(import.meta, ["babel", "typescript"], { errors }); +runFormatTest(import.meta, ["babel", "typescript"]); runFormatTest(import.meta, ["babel", "typescript"], { quoteProps: "consistent", - errors, -}); -runFormatTest(import.meta, ["babel", "typescript"], { - quoteProps: "preserve", - errors, }); +runFormatTest(import.meta, ["babel", "typescript"], { quoteProps: "preserve" }); diff --git a/tests/format/js/import-attributes/quote-props/quoted-keys.js b/tests/format/js/import-attributes/quote-props/quoted-keys.js index d4c764774..3e2be9d05 100644 --- a/tests/format/js/import-attributes/quote-props/quoted-keys.js +++ b/tests/format/js/import-attributes/quote-props/quoted-keys.js @@ -1,10 +1,10 @@ -import json from './mod.js' with { "type":"json" }; -import json from './mod.js' with { "foobar":"json" }; -import json from './mod.js' with { "type-foo" :"json" }; -import json from './mod.js' with { "333foo" :"json" }; -import json from './mod.js' with { "0" :"json" }; -import json from './mod.js' with { "0n" :"json" }; -import json from './mod.js' with { "33333" :"json" }; -import json from './mod.js' with { "33333n" :"json" }; -import json from './mod.js' with { "33333b" :"json" }; -import json from './mod.js' with { "03333" :"json" }; +import json1 from './mod.js' with { "type":"json" }; +import json2 from './mod.js' with { "foobar":"json" }; +import json3 from './mod.js' with { "type-foo" :"json" }; +import json4 from './mod.js' with { "333foo" :"json" }; +import json5 from './mod.js' with { "0" :"json" }; +import json6 from './mod.js' with { "0n" :"json" }; +import json7 from './mod.js' with { "33333" :"json" }; +import json8 from './mod.js' with { "33333n" :"json" }; +import json9 from './mod.js' with { "33333b" :"json" }; +import json10 from './mod.js' with { "03333" :"json" }; diff --git a/tests/format/js/regex/__snapshots__/format.test.js.snap b/tests/format/js/regex/__snapshots__/format.test.js.snap index aa625f184..21183469a 100644 --- a/tests/format/js/regex/__snapshots__/format.test.js.snap +++ b/tests/format/js/regex/__snapshots__/format.test.js.snap @@ -30,26 +30,6 @@ printWidth: 80 ================================================================================ `; -exports[`regexp-modifiers.js [acorn] format 1`] = ` -"Invalid regular expression: /(?ims:^[a-z])/: Invalid group (1:2) -> 1 | /(?ims:^[a-z])/u; - | ^ - 2 | /(?-ims:^[a-z].)(^[a-z].)/uims; - 3 | /(?ims:^[a-z].1$)/; - 4 | -Cause: Invalid regular expression: /(?ims:^[a-z])/: Invalid group (1:1)" -`; - -exports[`regexp-modifiers.js [espree] format 1`] = ` -"Invalid regular expression: /(?ims:^[a-z])/: Invalid group (1:2) -> 1 | /(?ims:^[a-z])/u; - | ^ - 2 | /(?-ims:^[a-z].)(^[a-z].)/uims; - 3 | /(?ims:^[a-z].1$)/; - 4 | -Cause: Invalid regular expression: /(?ims:^[a-z])/: Invalid group" -`; - exports[`regexp-modifiers.js [meriyah] format 1`] = ` "Unterminated regular expression (1:1) > 1 | /(?ims:^[a-z])/u; diff --git a/tests/format/js/regex/format.test.js b/tests/format/js/regex/format.test.js index af153b7c0..1005e8831 100644 --- a/tests/format/js/regex/format.test.js +++ b/tests/format/js/regex/format.test.js @@ -1,7 +1,5 @@ runFormatTest(import.meta, ["babel", "flow", "typescript"], { errors: { - acorn: ["regexp-modifiers.js"], - espree: ["regexp-modifiers.js"], meriyah: ["regexp-modifiers.js"], }, }); diff --git a/yarn.lock b/yarn.lock index e37fdd0ed..0c952ba3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2119,12 +2119,12 @@ __metadata: languageName: node linkType: hard -"acorn@npm:8.13.0, acorn@npm:^8.11.3, acorn@npm:^8.12.0": - version: 8.13.0 - resolution: "acorn@npm:8.13.0" +"acorn@npm:8.14.0, acorn@npm:^8.11.3, acorn@npm:^8.12.0": + version: 8.14.0 + resolution: "acorn@npm:8.14.0" bin: acorn: bin/acorn - checksum: 10/33e3a03114b02b3bc5009463b3d9549b31a90ee38ebccd5e66515830a02acf62a90edcc12abfb6c9fb3837b6c17a3ec9b72b3bf52ac31d8ad8248a4af871e0f5 + checksum: 10/6df29c35556782ca9e632db461a7f97947772c6c1d5438a81f0c873a3da3a792487e83e404d1c6c25f70513e91aa18745f6eafb1fcc3a43ecd1920b21dd173d2 languageName: node linkType: hard @@ -7249,7 +7249,7 @@ __metadata: "@typescript-eslint/eslint-plugin": "npm:8.10.0" "@typescript-eslint/typescript-estree": "npm:8.10.0" "@typescript-eslint/visitor-keys": "npm:8.10.0" - acorn: "npm:8.13.0" + acorn: "npm:8.14.0" acorn-jsx: "npm:5.3.2" angular-estree-parser: "npm:10.0.4" angular-html-parser: "npm:7.0.1"