From d2c415deae368e7224e315bf69bf2e89129cd4d9 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 18 Sep 2024 19:48:57 +0800 Subject: [PATCH] Update meriyah to v6 (#16667) --- package.json | 2 +- scripts/build/config.js | 7 +- scripts/build/transform/index.js | 3 +- src/language-js/parse/meriyah.js | 34 +++--- tests/config/run-format-test.js | 5 + .../arrays/__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 2 +- .../arrows/__snapshots__/format.test.js.snap | 4 +- .../__snapshots__/format.test.js.snap | 6 +- .../__snapshots__/format.test.js.snap | 6 +- .../__snapshots__/format.test.js.snap | 103 ++++++++---------- tests/format/js/babel-plugins/format.test.js | 2 - .../__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 24 ++-- .../invalid/__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 20 ---- .../js/classes-private-fields/format.test.js | 1 - .../__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 4 +- .../__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 8 +- .../__snapshots__/format.test.js.snap | 14 +-- .../js/do/__snapshots__/format.test.js.snap | 12 +- .../__snapshots__/format.test.js.snap | 6 +- .../__snapshots__/format.test.js.snap | 70 ++++++------ .../escaped/__snapshots__/format.test.js.snap | 6 +- .../__snapshots__/format.test.js.snap | 2 +- .../for-of/__snapshots__/format.test.js.snap | 12 ++ tests/format/js/for-of/format.test.js | 4 +- .../__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 36 +++--- .../__snapshots__/format.test.js.snap | 18 +-- .../__snapshots__/format.test.js.snap | 16 +-- .../__snapshots__/format.test.js.snap | 8 -- .../bracket-spacing/format.test.js | 1 - .../js/import-attributes/format.test.js | 7 +- .../__snapshots__/format.test.js.snap | 30 ++--- .../__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 8 +- .../__snapshots__/format.test.js.snap | 20 ---- .../js/module-string-names/format.test.js | 4 +- .../__snapshots__/format.test.js.snap | 6 +- .../__snapshots__/format.test.js.snap | 12 +- .../__snapshots__/format.test.js.snap | 4 +- .../objects/__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 56 +++++----- .../__snapshots__/format.test.js.snap | 2 +- .../__snapshots__/format.test.js.snap | 8 +- .../record/__snapshots__/format.test.js.snap | 12 +- .../regex/__snapshots__/format.test.js.snap | 14 +-- tests/format/js/regex/format.test.js | 2 +- .../__snapshots__/format.test.js.snap | 6 +- .../__snapshots__/format.test.js.snap | 32 +++--- .../strings/__snapshots__/format.test.js.snap | 24 ++++ tests/format/js/strings/format.test.js | 2 + .../__snapshots__/format.test.js.snap | 6 +- .../tuple/__snapshots__/format.test.js.snap | 10 +- .../__snapshots__/format.test.js.snap | 4 +- .../__snapshots__/format.test.js.snap | 11 -- tests/format/jsx/comments/format.test.js | 1 - .../jsx/do/__snapshots__/format.test.js.snap | 6 +- .../__snapshots__/format.test.js.snap | 12 -- tests/format/jsx/fragment/format.test.js | 4 +- .../tuple/__snapshots__/format.test.js.snap | 2 +- .../invalid/__snapshots__/format.test.js.snap | 32 +++--- .../__snapshots__/format.test.js.snap | 6 +- .../__snapshots__/format.test.js.snap | 38 +++---- .../for-of/__snapshots__/format.test.js.snap | 10 +- .../import/__snapshots__/format.test.js.snap | 8 +- .../__snapshots__/format.test.js.snap | 14 +-- .../literal/__snapshots__/format.test.js.snap | 6 +- .../object/__snapshots__/format.test.js.snap | 8 +- .../__snapshots__/format.test.js.snap | 36 +++--- .../record/__snapshots__/format.test.js.snap | 10 +- .../__snapshots__/format.test.js.snap | 12 +- .../__snapshots__/format.test.js.snap | 12 +- .../__snapshots__/format.test.js.snap | 2 +- tests/unit/doc-printer.js | 2 +- yarn.lock | 10 +- 81 files changed, 449 insertions(+), 518 deletions(-) diff --git a/package.json b/package.json index 804092484..13e2c55ed 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "leven": "4.0.0", "lines-and-columns": "2.0.4", "linguist-languages": "7.27.0", - "meriyah": "5.0.0", + "meriyah": "6.0.1", "micromatch": "4.0.8", "minimist": "1.2.8", "n-readlines": "1.0.1", diff --git a/scripts/build/config.js b/scripts/build/config.js index 7588b3e40..49b6d23a5 100644 --- a/scripts/build/config.js +++ b/scripts/build/config.js @@ -350,9 +350,14 @@ const pluginFiles = [ { input: "src/plugins/meriyah.js", replaceModule: [ + // Use non-minified version so we can replace code easier { - // We don't use value of JSXText module: resolveEsmModulePath("meriyah"), + path: getPackageFile("meriyah/dist/meriyah.mjs"), + }, + // We don't use value of JSXText + { + module: getPackageFile("meriyah/dist/meriyah.mjs"), find: "parser.tokenValue = decodeHTMLStrict(raw);", replacement: "parser.tokenValue = raw;", }, diff --git a/scripts/build/transform/index.js b/scripts/build/transform/index.js index ccf2663b3..7c5527545 100644 --- a/scripts/build/transform/index.js +++ b/scripts/build/transform/index.js @@ -27,7 +27,8 @@ function transform(original, file) { PROJECT_ROOT, "node_modules/@typescript-eslint/typescript-estree/", ), - ) + ) || + file.startsWith(path.join(PROJECT_ROOT, "node_modules/meriyah/")) ) ) { return original; diff --git a/src/language-js/parse/meriyah.js b/src/language-js/parse/meriyah.js index eeb2b0758..c710a3d64 100644 --- a/src/language-js/parse/meriyah.js +++ b/src/language-js/parse/meriyah.js @@ -56,29 +56,29 @@ function parseWithOptions(text, sourceType) { } function createParseError(error) { - let { message, line, column } = error; - - const matches = message.match( - /^\[(?\d+):(?\d+)\]: (?.*)$/u, - )?.groups; - - if (matches) { - message = matches.message; - - /* c8 ignore next 4 */ - if (typeof line !== "number") { - line = Number(matches.line); - column = Number(matches.column); - } - } + let { message, loc } = error; /* c8 ignore next 3 */ - if (typeof line !== "number") { + if (!loc) { return error; } + const prefix = `[${[loc.start, loc.end].map(({ line, column }) => [line, column].join(":")).join("-")}]: `; + if (message.startsWith(prefix)) { + message = message.slice(prefix.length); + } + return createError(message, { - loc: { start: { line, column } }, + loc: { + start: { + line: loc.start.line, + column: loc.start.column + 1, + }, + end: { + line: loc.end.line, + column: loc.end.column + 1, + }, + }, cause: error, }); } diff --git a/tests/config/run-format-test.js b/tests/config/run-format-test.js index 333b53c3f..f3b20c1b8 100644 --- a/tests/config/run-format-test.js +++ b/tests/config/run-format-test.js @@ -87,6 +87,11 @@ const meriyahDisabledTests = new Set([ "js/babel-plugins/decorator-auto-accessors.js", // Parsing to different ASTs "js/decorators/member-expression.js", + // Meriyah parse RegExp relay on runtime behavior + // The following fails on Node.js < 20 + "js/babel-plugins/regex-v-flag.js", + "js/regex/v-flag.js", + "js/regex/d-flag.js", ].map((file) => path.join(__dirname, "../format", file)), ]); const babelTsDisabledTest = new Set( diff --git a/tests/format/js/arrays/__snapshots__/format.test.js.snap b/tests/format/js/arrays/__snapshots__/format.test.js.snap index 8e45ff4bd..804e9cfd9 100644 --- a/tests/format/js/arrays/__snapshots__/format.test.js.snap +++ b/tests/format/js/arrays/__snapshots__/format.test.js.snap @@ -1048,7 +1048,7 @@ exports[`tuple-and-record.js [meriyah] format 1`] = ` 8 | #[1,2], 9 | ] 10 | -Cause: [7:3]: '#' not followed by identifier" +Cause: [7:2-7:3]: '#' not followed by identifier" `; exports[`tuple-and-record.js [typescript] format 1`] = ` diff --git a/tests/format/js/arrows-bind/__snapshots__/format.test.js.snap b/tests/format/js/arrows-bind/__snapshots__/format.test.js.snap index cc9b2c69d..cbaef4ad2 100644 --- a/tests/format/js/arrows-bind/__snapshots__/format.test.js.snap +++ b/tests/format/js/arrows-bind/__snapshots__/format.test.js.snap @@ -27,7 +27,7 @@ exports[`arrows-bind.js [meriyah] format 1`] = ` 2 | (a => b)::c; 3 | a::(b => c); 4 | -Cause: [1:9]: Expected ')'" +Cause: [1:8-1:9]: Expected ')'" `; exports[`arrows-bind.js format 1`] = ` diff --git a/tests/format/js/arrows/__snapshots__/format.test.js.snap b/tests/format/js/arrows/__snapshots__/format.test.js.snap index b86819a05..e7fbac09a 100644 --- a/tests/format/js/arrows/__snapshots__/format.test.js.snap +++ b/tests/format/js/arrows/__snapshots__/format.test.js.snap @@ -4573,7 +4573,7 @@ exports[`tuple-and-record.js - {"arrowParens":"always"} [meriyah] format 1`] = ` 6 | 7 | map(() => ([ 8 | // comment -Cause: [5:4]: '#' not followed by identifier" +Cause: [5:3-5:4]: '#' not followed by identifier" `; exports[`tuple-and-record.js - {"arrowParens":"always"} [typescript] format 1`] = ` @@ -4690,7 +4690,7 @@ exports[`tuple-and-record.js - {"arrowParens":"avoid"} [meriyah] format 1`] = ` 6 | 7 | map(() => ([ 8 | // comment -Cause: [5:4]: '#' not followed by identifier" +Cause: [5:3-5:4]: '#' not followed by identifier" `; exports[`tuple-and-record.js - {"arrowParens":"avoid"} [typescript] format 1`] = ` diff --git a/tests/format/js/arrows/newline-before-arrow/__snapshots__/format.test.js.snap b/tests/format/js/arrows/newline-before-arrow/__snapshots__/format.test.js.snap index 66010df20..308ed7311 100644 --- a/tests/format/js/arrows/newline-before-arrow/__snapshots__/format.test.js.snap +++ b/tests/format/js/arrows/newline-before-arrow/__snapshots__/format.test.js.snap @@ -19,12 +19,12 @@ Cause: Unexpected token =>" `; exports[`newline-before-arrow.js [meriyah] format 1`] = ` -"No line break is allowed after '=>' (2:2) +"No line break is allowed after '=>' (2:1) 1 | async x > 2 | => x - | ^ + | ^^ 3 | -Cause: [2:2]: No line break is allowed after '=>'" +Cause: [2:0-2:2]: No line break is allowed after '=>'" `; exports[`newline-before-arrow.js format 1`] = ` diff --git a/tests/format/js/async-do-expressions/__snapshots__/format.test.js.snap b/tests/format/js/async-do-expressions/__snapshots__/format.test.js.snap index ed2082d0e..6789d9e51 100644 --- a/tests/format/js/async-do-expressions/__snapshots__/format.test.js.snap +++ b/tests/format/js/async-do-expressions/__snapshots__/format.test.js.snap @@ -21,13 +21,13 @@ Cause: Unexpected token do" `; exports[`async-do-expressions.js [meriyah] format 1`] = ` -"Unexpected token: 'do' (1:8) +"Unexpected token: 'do' (1:7) > 1 | async do { - | ^ + | ^^ 2 | 1; 3 | }; 4 | -Cause: [1:8]: Unexpected token: 'do'" +Cause: [1:6-1:8]: Unexpected token: 'do'" `; exports[`async-do-expressions.js format 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 fe6176493..fc1aa9fcd 100644 --- a/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap +++ b/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap @@ -17,11 +17,11 @@ Cause: Unexpected token do" `; exports[`async-do-expressions.js [meriyah] format 1`] = ` -"Unexpected token: 'do' (1:8) +"Unexpected token: 'do' (1:7) > 1 | async do { await requestAPI().json() }; - | ^ + | ^^ 2 | -Cause: [1:8]: Unexpected token: 'do'" +Cause: [1:6-1:8]: Unexpected token: 'do'" `; exports[`async-do-expressions.js format 1`] = ` @@ -455,15 +455,15 @@ Cause: Identifier directly after number" `; exports[`decimal.js [meriyah] format 1`] = ` -"No identifiers allowed directly after numeric literal (3:3) +"No identifiers allowed directly after numeric literal (3:1) 1 | // https://github.com/babel/babel/pull/11640 2 | > 3 | 100m; - | ^ + | ^^^ 4 | 9223372036854775807m; 5 | 0.m; 6 | 3.1415926535897932m; -Cause: [3:3]: No identifiers allowed directly after numeric literal" +Cause: [3:0-3:3]: No identifiers allowed directly after numeric literal" `; exports[`decimal.js format 1`] = ` @@ -682,7 +682,7 @@ exports[`deferred-import-evaluation.js [meriyah] format 1`] = ` > 1 | import defer * as ns from "x"; | ^ 2 | -Cause: [1:14]: Expected 'from'" +Cause: [1:13-1:14]: Expected 'from'" `; exports[`deferred-import-evaluation.js format 1`] = ` @@ -732,7 +732,7 @@ exports[`destructuring-private.js [meriyah] format 1`] = ` 6 | console.log(x); // => 1 7 | } 8 | equals({ #x: otherX }) { -Cause: [5:13]: Unexpected token: 'PrivateField'" +Cause: [5:12-5:13]: Unexpected token: 'PrivateField'" `; exports[`destructuring-private.js format 1`] = ` @@ -796,15 +796,15 @@ Cause: Unexpected token do" `; exports[`do-expressions.js [meriyah] format 1`] = ` -"Unexpected token: 'do' (3:10) +"Unexpected token: 'do' (3:9) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions 2 | > 3 | let a = do { - | ^ + | ^^ 4 | if(x > 10) { 5 | 'big'; 6 | } else { -Cause: [3:10]: Unexpected token: 'do'" +Cause: [3:8-3:10]: Unexpected token: 'do'" `; exports[`do-expressions.js format 1`] = ` @@ -892,14 +892,14 @@ Cause: Unexpected token handle" `; exports[`explicit-resource-management.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (2:14) +"Unexpected token: 'identifier' (2:9) 1 | function * g() { > 2 | using handle = acquireFileHandle(); // block-scoped critical resource - | ^ + | ^^^^^^ 3 | } // cleanup 4 | 5 | { -Cause: [2:14]: Unexpected token: 'identifier'" +Cause: [2:8-2:14]: Unexpected token: 'identifier'" `; exports[`explicit-resource-management.js format 1`] = ` @@ -965,7 +965,7 @@ exports[`export-default-from.js [meriyah] format 1`] = ` > 4 | export v from 'mod'; | ^ 5 | -Cause: [4:8]: Unexpected token: 'identifier'" +Cause: [4:7-4:8]: Unexpected token: 'identifier'" `; exports[`export-default-from.js format 1`] = ` @@ -1088,7 +1088,7 @@ exports[`flow.js [meriyah] format 1`] = ` > 3 | function foo(one: any, two: number, three?): string {} | ^ 4 | -Cause: [3:17]: Expected ')'" +Cause: [3:16-3:17]: Expected ')'" `; exports[`function-bind.js [acorn] format 1`] = ` @@ -1124,7 +1124,7 @@ exports[`function-bind.js [meriyah] format 1`] = ` 4 | // is equivalent to: 5 | func.bind(obj) 6 | -Cause: [3:5]: Unexpected token: ':'" +Cause: [3:4-3:5]: Unexpected token: ':'" `; exports[`function-bind.js format 1`] = ` @@ -1205,7 +1205,7 @@ exports[`function-sent.js [meriyah] format 1`] = ` 5 | console.log("Yield", yield); 6 | } 7 | -Cause: [4:33]: Expected '('" +Cause: [4:32-4:33]: Expected '('" `; exports[`function-sent.js format 1`] = ` @@ -1287,11 +1287,11 @@ Cause: Unexpected token assert" `; exports[`import-assertions-static.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:36) +"Unexpected token: 'identifier' (1:31) > 1 | import json from "./foo.json" assert { type: "json" }; - | ^ + | ^^^^^^ 2 | -Cause: [1:36]: Unexpected token: 'identifier'" +Cause: [1:30-1:36]: Unexpected token: 'identifier'" `; exports[`import-assertions-static.js format 1`] = ` @@ -1433,11 +1433,11 @@ Cause: Unexpected token foo" `; exports[`import-reflection.js [meriyah] format 1`] = ` -"Expected 'from' (1:17) +"Expected 'from' (1:15) > 1 | import module foo from "./module.wasm"; - | ^ + | ^^^ 2 | -Cause: [1:17]: Expected 'from'" +Cause: [1:14-1:17]: Expected 'from'" `; exports[`import-reflection.js format 1`] = ` @@ -1533,7 +1533,7 @@ exports[`module-blocks.js [meriyah] format 1`] = ` 2 | export let m = 2; 3 | export let n = 3; 4 | }; -Cause: [1:16]: Unexpected token: '{'" +Cause: [1:15-1:16]: Unexpected token: '{'" `; exports[`module-blocks.js format 1`] = ` @@ -1556,15 +1556,6 @@ let m = module { ================================================================================ `; -exports[`module-string-names.js [meriyah] format 1`] = ` -"Expected '}' (1:13) -> 1 | import { "😄" as smile } from "./emojis.js"; - | ^ - 2 | export { smile as "😄" } from "./emojis.js"; - 3 | -Cause: [1:13]: Expected '}'" -`; - exports[`module-string-names.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1911,7 +1902,7 @@ exports[`optional-chaining-assignment.js [meriyah] format 1`] = ` > 1 | maybeAnObj?.prop = theValue; | ^ 2 | -Cause: [1:18]: Invalid left-hand side in assignment" +Cause: [1:17-1:18]: Invalid left-hand side in assignment" `; exports[`optional-chaining-assignment.js format 1`] = ` @@ -1961,7 +1952,7 @@ exports[`partial-application.js [meriyah] format 1`] = ` 6 | addOne(2); // 3 7 | 8 | const addTen = add(?, 10); // apply from the right -Cause: [5:23]: Unexpected token: '?'" +Cause: [5:22-5:23]: Unexpected token: '?'" `; exports[`partial-application.js format 1`] = ` @@ -2051,7 +2042,7 @@ exports[`pipeline-operator-fsharp.js [meriyah] format 1`] = ` 6 | |> x => doubleSay(x, ', ') 7 | |> capitalize 8 | |> x => x + '!' -Cause: [5:4]: Unexpected token: '>'" +Cause: [5:3-5:4]: Unexpected token: '>'" `; exports[`pipeline-operator-fsharp.js format 1`] = ` @@ -2162,7 +2153,7 @@ exports[`pipeline-operator-hack.js [meriyah] format 1`] = ` 6 | |> equals(%, prefix); 7 | 8 | // (The % token isn't final; it might instead be @ or ? or #.) -Cause: [5:3]: Unexpected token: '>'" +Cause: [5:2-5:3]: Unexpected token: '>'" `; exports[`pipeline-operator-hack.js format 1`] = ` @@ -2224,7 +2215,7 @@ exports[`pipeline-operator-minimal.js [meriyah] format 1`] = ` 9 | |> capitalize 10 | |> exclaim; 11 | -Cause: [8:4]: Unexpected token: '>'" +Cause: [8:3-8:4]: Unexpected token: '>'" `; exports[`pipeline-operator-minimal.js format 1`] = ` @@ -2460,7 +2451,7 @@ exports[`record-tuple-record.js [meriyah] format 1`] = ` 2 | a: 1, 3 | b: 2, 4 | c: 3, -Cause: [1:17]: '#' not followed by identifier" +Cause: [1:16-1:17]: '#' not followed by identifier" `; exports[`record-tuple-record.js format 1`] = ` @@ -2510,7 +2501,7 @@ exports[`record-tuple-tuple.js [meriyah] format 1`] = ` > 1 | const tuple1 = #[1, 2, 3]; | ^ 2 | -Cause: [1:16]: '#' not followed by identifier" +Cause: [1:15-1:16]: '#' not followed by identifier" `; exports[`record-tuple-tuple.js format 1`] = ` @@ -2527,14 +2518,6 @@ const tuple1 = #[1, 2, 3]; ================================================================================ `; -exports[`regex-v-flag.js [meriyah] format 1`] = ` -"Unexpected regular expression flag (1:3) -> 1 | /a/v; - | ^ - 2 | -Cause: [1:3]: Unexpected regular expression flag" -`; - exports[`regex-v-flag.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -2566,11 +2549,11 @@ Cause: Invalid regular expression: /^(?i:[a-z])[a-z]$/: Invalid group" `; exports[`regexp-modifiers.js [meriyah] format 1`] = ` -"Unterminated regular expression (1:30) +"Unterminated regular expression (1:12) > 1 | const re = /^(?i:[a-z])[a-z]$/; - | ^ + | ^^^^^^^^^^^^^^^^^^^ 2 | -Cause: [1:30]: Unterminated regular expression" +Cause: [1:11-1:30]: Unterminated regular expression" `; exports[`regexp-modifiers.js format 1`] = ` @@ -2606,12 +2589,12 @@ Cause: Unexpected token fooSource" `; exports[`source-phase-imports.js [meriyah] format 1`] = ` -"Expected 'from' (1:23) +"Expected 'from' (1:15) > 1 | import source fooSource from "foo"; - | ^ + | ^^^^^^^^^ 2 | import.source("x"); 3 | -Cause: [1:23]: Expected 'from'" +Cause: [1:14-1:23]: Expected 'from'" `; exports[`source-phase-imports.js format 1`] = ` @@ -2655,15 +2638,15 @@ Cause: Unexpected token throw" `; exports[`throw-expressions.js [meriyah] format 1`] = ` -"Unexpected token: 'throw' (3:27) +"Unexpected token: 'throw' (3:23) 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions 2 | > 3 | function test(param = throw new Error('required!')) { - | ^ + | ^^^^^ 4 | const test = param === true || throw new Error('Falsy!'); 5 | } 6 | -Cause: [3:27]: Unexpected token: 'throw'" +Cause: [3:22-3:27]: Unexpected token: 'throw'" `; exports[`throw-expressions.js format 1`] = ` @@ -2771,7 +2754,7 @@ exports[`typescript.js [meriyah] format 1`] = ` > 3 | const x: number = 0; | ^ 4 | -Cause: [3:8]: Missing initializer in const declaration" +Cause: [3:7-3:8]: Missing initializer in const declaration" `; exports[`v8intrinsic.js [acorn] format 1`] = ` @@ -2807,7 +2790,7 @@ exports[`v8intrinsic.js [meriyah] format 1`] = ` 4 | 5 | 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json -Cause: [3:1]: Unexpected token: '%'" +Cause: [3:0-3:1]: Unexpected token: '%'" `; exports[`v8intrinsic.js format 1`] = ` diff --git a/tests/format/js/babel-plugins/format.test.js b/tests/format/js/babel-plugins/format.test.js index e3d2cb73b..42c702453 100644 --- a/tests/format/js/babel-plugins/format.test.js +++ b/tests/format/js/babel-plugins/format.test.js @@ -87,10 +87,8 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], { "typescript.js", "v8intrinsic.js", "import-assertions-static.js", - "module-string-names.js", "module-blocks.js", "async-do-expressions.js", - "regex-v-flag.js", "import-reflection.js", "explicit-resource-management.js", "regexp-modifiers.js", diff --git a/tests/format/js/binary-expressions/__snapshots__/format.test.js.snap b/tests/format/js/binary-expressions/__snapshots__/format.test.js.snap index ca97eefda..b47380932 100644 --- a/tests/format/js/binary-expressions/__snapshots__/format.test.js.snap +++ b/tests/format/js/binary-expressions/__snapshots__/format.test.js.snap @@ -1195,7 +1195,7 @@ exports[`tuple-and-record.js [meriyah] format 1`] = ` 7 | // comment 8 | a, 9 | ] -Cause: [6:14]: '#' not followed by identifier" +Cause: [6:13-6:14]: '#' not followed by identifier" `; exports[`tuple-and-record.js [typescript] format 1`] = ` diff --git a/tests/format/js/bind-expressions/__snapshots__/format.test.js.snap b/tests/format/js/bind-expressions/__snapshots__/format.test.js.snap index 95ffe0f0c..a648eb95b 100644 --- a/tests/format/js/bind-expressions/__snapshots__/format.test.js.snap +++ b/tests/format/js/bind-expressions/__snapshots__/format.test.js.snap @@ -30,7 +30,7 @@ exports[`await.js [meriyah] format 1`] = ` | ^ 4 | }; 5 | -Cause: [3:27]: Unexpected token: ':'" +Cause: [3:26-3:27]: Unexpected token: ':'" `; exports[`await.js - {"semi":false} [acorn] format 1`] = ` @@ -63,7 +63,7 @@ exports[`await.js - {"semi":false} [meriyah] format 1`] = ` | ^ 4 | }; 5 | -Cause: [3:27]: Unexpected token: ':'" +Cause: [3:26-3:27]: Unexpected token: ':'" `; exports[`await.js - {"semi":false} format 1`] = ` @@ -134,7 +134,7 @@ exports[`bind_parens.js [meriyah] format 1`] = ` 2 | a || (b::c); 3 | ::obj.prop; 4 | (void 0)::func(); -Cause: [1:9]: Unexpected token: ':'" +Cause: [1:8-1:9]: Unexpected token: ':'" `; exports[`bind_parens.js - {"semi":false} [acorn] format 1`] = ` @@ -164,7 +164,7 @@ exports[`bind_parens.js - {"semi":false} [meriyah] format 1`] = ` 2 | a || (b::c); 3 | ::obj.prop; 4 | (void 0)::func(); -Cause: [1:9]: Unexpected token: ':'" +Cause: [1:8-1:9]: Unexpected token: ':'" `; exports[`bind_parens.js - {"semi":false} format 1`] = ` @@ -361,7 +361,7 @@ exports[`long_name_method.js [meriyah] format 1`] = ` 4 | } 5 | 6 | testLongNameMethodAndSomethingElseLallala() { -Cause: [3:54]: Unexpected token: ':'" +Cause: [3:53-3:54]: Unexpected token: ':'" `; exports[`long_name_method.js - {"semi":false} [acorn] format 1`] = ` @@ -397,7 +397,7 @@ exports[`long_name_method.js - {"semi":false} [meriyah] format 1`] = ` 4 | } 5 | 6 | testLongNameMethodAndSomethingElseLallala() { -Cause: [3:54]: Unexpected token: ':'" +Cause: [3:53-3:54]: Unexpected token: ':'" `; exports[`long_name_method.js - {"semi":false} format 1`] = ` @@ -494,7 +494,7 @@ exports[`method_chain.js [meriyah] format 1`] = ` 11 | ::throttle(() => 12 | interval(10) 13 | ::take(1) -Cause: [10:9]: Unexpected token: ':'" +Cause: [10:8-10:9]: Unexpected token: ':'" `; exports[`method_chain.js - {"semi":false} [acorn] format 1`] = ` @@ -530,7 +530,7 @@ exports[`method_chain.js - {"semi":false} [meriyah] format 1`] = ` 11 | ::throttle(() => 12 | interval(10) 13 | ::take(1) -Cause: [10:9]: Unexpected token: ':'" +Cause: [10:8-10:9]: Unexpected token: ':'" `; exports[`method_chain.js - {"semi":false} format 1`] = ` @@ -659,7 +659,7 @@ exports[`short_name_method.js [meriyah] format 1`] = ` 4 | } 5 | 6 | shortMethod() { -Cause: [3:24]: Unexpected token: ':'" +Cause: [3:23-3:24]: Unexpected token: ':'" `; exports[`short_name_method.js - {"semi":false} [acorn] format 1`] = ` @@ -695,7 +695,7 @@ exports[`short_name_method.js - {"semi":false} [meriyah] format 1`] = ` 4 | } 5 | 6 | shortMethod() { -Cause: [3:24]: Unexpected token: ':'" +Cause: [3:23-3:24]: Unexpected token: ':'" `; exports[`short_name_method.js - {"semi":false} format 1`] = ` @@ -784,7 +784,7 @@ exports[`unary.js [meriyah] format 1`] = ` 2 | !(x::y /* foo */); 3 | !(/* foo */ x::y); 4 | !( -Cause: [1:3]: Unexpected token: ':'" +Cause: [1:2-1:3]: Unexpected token: ':'" `; exports[`unary.js - {"semi":false} [acorn] format 1`] = ` @@ -814,7 +814,7 @@ exports[`unary.js - {"semi":false} [meriyah] format 1`] = ` 2 | !(x::y /* foo */); 3 | !(/* foo */ x::y); 4 | !( -Cause: [1:3]: Unexpected token: ':'" +Cause: [1:2-1:3]: Unexpected token: ':'" `; exports[`unary.js - {"semi":false} format 1`] = ` diff --git a/tests/format/js/call/invalid/__snapshots__/format.test.js.snap b/tests/format/js/call/invalid/__snapshots__/format.test.js.snap index 87b09e4a7..8f81c90fe 100644 --- a/tests/format/js/call/invalid/__snapshots__/format.test.js.snap +++ b/tests/format/js/call/invalid/__snapshots__/format.test.js.snap @@ -47,5 +47,5 @@ exports[`null-arguments-item.js [meriyah] format 1`] = ` 2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong'); 3 | foo("a", 4 | //1 -Cause: [1:11]: Unexpected token: ','" +Cause: [1:10-1:11]: Unexpected token: ','" `; diff --git a/tests/format/js/class-extends/__snapshots__/format.test.js.snap b/tests/format/js/class-extends/__snapshots__/format.test.js.snap index 99a11b72f..dd13b0806 100644 --- a/tests/format/js/class-extends/__snapshots__/format.test.js.snap +++ b/tests/format/js/class-extends/__snapshots__/format.test.js.snap @@ -214,7 +214,7 @@ exports[`tuple-and-record.js [meriyah] format 1`] = ` 3 | 4 | class C extends [] {} 5 | class D extends #[] {} -Cause: [2:17]: '#' not followed by identifier" +Cause: [2:16-2:17]: '#' not followed by identifier" `; exports[`tuple-and-record.js [typescript] format 1`] = ` diff --git a/tests/format/js/classes-private-fields/__snapshots__/format.test.js.snap b/tests/format/js/classes-private-fields/__snapshots__/format.test.js.snap index 3203c0439..9fc05ae4e 100644 --- a/tests/format/js/classes-private-fields/__snapshots__/format.test.js.snap +++ b/tests/format/js/classes-private-fields/__snapshots__/format.test.js.snap @@ -20,16 +20,6 @@ exports[`optional-chaining.js [espree] format 1`] = ` Cause: Private field '#x' must be declared in an enclosing class" `; -exports[`optional-chaining.js [meriyah] format 1`] = ` -"Dot property must be an identifier (3:13) - 1 | // https://github.com/babel/babel/pull/11669 - 2 | -> 3 | delete obj?.#x.a - | ^ - 4 | -Cause: [3:13]: Dot property must be an identifier" -`; - exports[`optional-chaining.js - {"semi":false} [acorn] format 1`] = ` "Private field '#x' must be declared in an enclosing class (3:13) 1 | // https://github.com/babel/babel/pull/11669 @@ -50,16 +40,6 @@ exports[`optional-chaining.js - {"semi":false} [espree] format 1`] = ` Cause: Private field '#x' must be declared in an enclosing class" `; -exports[`optional-chaining.js - {"semi":false} [meriyah] format 1`] = ` -"Dot property must be an identifier (3:13) - 1 | // https://github.com/babel/babel/pull/11669 - 2 | -> 3 | delete obj?.#x.a - | ^ - 4 | -Cause: [3:13]: Dot property must be an identifier" -`; - exports[`optional-chaining.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/format/js/classes-private-fields/format.test.js b/tests/format/js/classes-private-fields/format.test.js index 5e7d3a94f..6cee9ccd6 100644 --- a/tests/format/js/classes-private-fields/format.test.js +++ b/tests/format/js/classes-private-fields/format.test.js @@ -1,7 +1,6 @@ const errors = { acorn: ["optional-chaining.js"], espree: ["optional-chaining.js"], - meriyah: ["optional-chaining.js"], }; runFormatTest(import.meta, ["babel"], { errors, diff --git a/tests/format/js/classes/top-level-super/__snapshots__/format.test.js.snap b/tests/format/js/classes/top-level-super/__snapshots__/format.test.js.snap index 727838b7a..d4d8dcef0 100644 --- a/tests/format/js/classes/top-level-super/__snapshots__/format.test.js.snap +++ b/tests/format/js/classes/top-level-super/__snapshots__/format.test.js.snap @@ -21,7 +21,7 @@ exports[`example.js [meriyah] format 1`] = ` > 1 | super(); | ^ 2 | -Cause: [1:6]: Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass" +Cause: [1:5-1:6]: Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass" `; exports[`example.js format 1`] = ` diff --git a/tests/format/js/comments-pipeline-own-line/__snapshots__/format.test.js.snap b/tests/format/js/comments-pipeline-own-line/__snapshots__/format.test.js.snap index f4171f136..549d61af6 100644 --- a/tests/format/js/comments-pipeline-own-line/__snapshots__/format.test.js.snap +++ b/tests/format/js/comments-pipeline-own-line/__snapshots__/format.test.js.snap @@ -33,7 +33,7 @@ exports[`pipeline_own_line.js [meriyah] format 1`] = ` 5 | } 6 | 7 | bifornCringerMoshedPerplexSawder( -Cause: [4:3]: Unexpected token: '>'" +Cause: [4:2-4:3]: Unexpected token: '>'" `; exports[`pipeline_own_line.js format 1`] = ` diff --git a/tests/format/js/comments/__snapshots__/format.test.js.snap b/tests/format/js/comments/__snapshots__/format.test.js.snap index 20f4d1588..1232832c9 100644 --- a/tests/format/js/comments/__snapshots__/format.test.js.snap +++ b/tests/format/js/comments/__snapshots__/format.test.js.snap @@ -6463,7 +6463,7 @@ exports[`tuple-and-record.js [meriyah] format 1`] = ` 8 | key: 'value' 9 | } 10 | -Cause: [7:1]: '#' not followed by identifier" +Cause: [7:0-7:1]: '#' not followed by identifier" `; exports[`tuple-and-record.js [typescript] format 1`] = ` @@ -6522,7 +6522,7 @@ exports[`tuple-and-record.js - {"semi":false} [meriyah] format 1`] = ` 8 | key: 'value' 9 | } 10 | -Cause: [7:1]: '#' not followed by identifier" +Cause: [7:0-7:1]: '#' not followed by identifier" `; exports[`tuple-and-record.js - {"semi":false} [typescript] format 1`] = ` diff --git a/tests/format/js/decorators-export/__snapshots__/format.test.js.snap b/tests/format/js/decorators-export/__snapshots__/format.test.js.snap index 40a75b929..d7f6754c0 100644 --- a/tests/format/js/decorators-export/__snapshots__/format.test.js.snap +++ b/tests/format/js/decorators-export/__snapshots__/format.test.js.snap @@ -27,7 +27,7 @@ exports[`after_export.js [meriyah] format 1`] = ` 2 | 3 | export default @decorator class {} 4 | -Cause: [1:8]: Unexpected token: '@'" +Cause: [1:7-1:8]: Unexpected token: '@'" `; exports[`after_export.js format 1`] = ` diff --git a/tests/format/js/deferred-import-evaluation/__snapshots__/format.test.js.snap b/tests/format/js/deferred-import-evaluation/__snapshots__/format.test.js.snap index 0329dbba7..2f7ec0f89 100644 --- a/tests/format/js/deferred-import-evaluation/__snapshots__/format.test.js.snap +++ b/tests/format/js/deferred-import-evaluation/__snapshots__/format.test.js.snap @@ -21,7 +21,7 @@ exports[`import-defer.js [meriyah] format 1`] = ` > 1 | import defer * as ns from "x"; | ^ 2 | -Cause: [1:14]: Expected 'from'" +Cause: [1:13-1:14]: Expected 'from'" `; exports[`import-defer.js format 1`] = ` @@ -59,7 +59,7 @@ exports[`import-defer-attributes-declaration.js [meriyah] format 1`] = ` > 1 | import defer * as ns from "x" with { attr: "val" }; | ^ 2 | -Cause: [1:14]: Expected 'from'" +Cause: [1:13-1:14]: Expected 'from'" `; exports[`import-defer-attributes-declaration.js format 1`] = ` @@ -113,7 +113,7 @@ exports[`no-default.js [meriyah] format 1`] = ` > 1 | import defer x from "x"; | ^ 2 | -Cause: [1:14]: Expected 'from'" +Cause: [1:13-1:14]: Expected 'from'" `; exports[`no-named.js [__babel_estree] format 1`] = ` @@ -153,5 +153,5 @@ exports[`no-named.js [meriyah] format 1`] = ` > 1 | import defer { x } from "x"; | ^ 2 | -Cause: [1:14]: Expected 'from'" +Cause: [1:13-1:14]: Expected 'from'" `; diff --git a/tests/format/js/destructuring-private-fields/__snapshots__/format.test.js.snap b/tests/format/js/destructuring-private-fields/__snapshots__/format.test.js.snap index 3dd5e8d76..1981c93e8 100644 --- a/tests/format/js/destructuring-private-fields/__snapshots__/format.test.js.snap +++ b/tests/format/js/destructuring-private-fields/__snapshots__/format.test.js.snap @@ -30,7 +30,7 @@ exports[`arrow-params.js [meriyah] format 1`] = ` | ^ 4 | } 5 | -Cause: [3:11]: Unexpected token: 'PrivateField'" +Cause: [3:10-3:11]: Unexpected token: 'PrivateField'" `; exports[`arrow-params.js format 1`] = ` @@ -86,7 +86,7 @@ exports[`assignment.js [meriyah] format 1`] = ` 6 | } 7 | } 8 | -Cause: [5:8]: Unexpected token: 'PrivateField'" +Cause: [5:7-5:8]: Unexpected token: 'PrivateField'" `; exports[`assignment.js format 1`] = ` @@ -145,7 +145,7 @@ exports[`async-arrow-params.js [meriyah] format 1`] = ` | ^ 4 | } 5 | -Cause: [3:17]: Unexpected token: 'PrivateField'" +Cause: [3:16-3:17]: Unexpected token: 'PrivateField'" `; exports[`async-arrow-params.js format 1`] = ` @@ -201,7 +201,7 @@ exports[`bindings.js [meriyah] format 1`] = ` 5 | } 6 | } 7 | -Cause: [4:12]: Unexpected token: 'PrivateField'" +Cause: [4:11-4:12]: Unexpected token: 'PrivateField'" `; exports[`bindings.js format 1`] = ` @@ -261,7 +261,7 @@ exports[`for-lhs.js [meriyah] format 1`] = ` 6 | } 7 | } 8 | -Cause: [5:11]: Unexpected token: 'PrivateField'" +Cause: [5:10-5:11]: Unexpected token: 'PrivateField'" `; exports[`for-lhs.js format 1`] = ` @@ -323,7 +323,7 @@ exports[`nested-bindings.js [meriyah] format 1`] = ` 5 | } 6 | } 7 | -Cause: [4:17]: Unexpected token: 'PrivateField'" +Cause: [4:16-4:17]: Unexpected token: 'PrivateField'" `; exports[`nested-bindings.js format 1`] = ` @@ -388,7 +388,7 @@ exports[`valid-multiple-bindings.js [meriyah] format 1`] = ` 5 | } 6 | } 7 | -Cause: [4:12]: Unexpected token: 'PrivateField'" +Cause: [4:11-4:12]: Unexpected token: 'PrivateField'" `; exports[`valid-multiple-bindings.js format 1`] = ` diff --git a/tests/format/js/do/__snapshots__/format.test.js.snap b/tests/format/js/do/__snapshots__/format.test.js.snap index 809934681..f4dcf6cb2 100644 --- a/tests/format/js/do/__snapshots__/format.test.js.snap +++ b/tests/format/js/do/__snapshots__/format.test.js.snap @@ -25,15 +25,15 @@ Cause: Unexpected token do" `; exports[`call-arguments.js [meriyah] format 1`] = ` -"Unexpected token: 'do' (3:4) +"Unexpected token: 'do' (3:3) 1 | // from https://github.com/babel/babel/pull/13122/ 2 | expect( > 3 | do { - | ^ + | ^^ 4 | var bar = "foo"; 5 | if (!bar) throw new Error( 6 | "unreachable" -Cause: [3:4]: Unexpected token: 'do'" +Cause: [3:2-3:4]: Unexpected token: 'do'" `; exports[`call-arguments.js format 1`] = ` @@ -147,15 +147,15 @@ Cause: Unexpected token do" `; exports[`do.js [meriyah] format 1`] = ` -"Unexpected token: 'do' (3:6) +"Unexpected token: 'do' (3:5) 1 | const envSpecific = { 2 | domain: > 3 | do { - | ^ + | ^^ 4 | if(env === 'production') 'https://abc.mno.com/'; 5 | else if(env === 'development') 'http://localhost:4000'; 6 | } -Cause: [3:6]: Unexpected token: 'do'" +Cause: [3:4-3:6]: Unexpected token: 'do'" `; exports[`do.js format 1`] = ` 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 93fb563d5..cc7303890 100644 --- a/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap +++ b/tests/format/js/dynamic-import/__snapshots__/format.test.js.snap @@ -67,13 +67,13 @@ exports[`import-phase.js [flow] format 1`] = ` `; exports[`import-phase.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:13) +"The only valid meta property for import is 'import.meta' (1:8) > 1 | import.source(\`data:text/javascript, - | ^ + | ^^^^^^ 2 | console.log("RUN"); 3 | \`) 4 | -Cause: [1:13]: Unexpected token: 'identifier'" +Cause: [1:7-1:13]: The only valid meta property for import is 'import.meta'" `; exports[`import-phase.js format 1`] = ` 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 e617cd8d7..dcfdd3133 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 @@ -24,11 +24,11 @@ exports[`for-await-using-of-comments.js [flow] format 1`] = ` `; exports[`for-await-using-of-comments.js [meriyah] format 1`] = ` -"for await (... of ...) is only valid in async functions and async generators (1:52) +"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:52]: for await (... of ...) is only valid in async functions and async generators" +Cause: [1:50-1:52]: for await (... of ...) is only valid in async functions and async generators" `; exports[`for-await-using-of-comments.js format 1`] = ` @@ -85,7 +85,7 @@ exports[`invalid-duplicate-using-bindings.js [meriyah] format 1`] = ` 3 | } 4 | { 5 | using g = foo(); -Cause: [2:9]: Unexpected token: 'identifier'" +Cause: [2:8-2:9]: Unexpected token: 'identifier'" `; exports[`invalid-duplicate-using-bindings.js format 1`] = ` @@ -143,7 +143,7 @@ exports[`invalid-script-top-level-using-binding.js [meriyah] format 1`] = ` > 1 | using x = bar(); | ^ 2 | -Cause: [1:7]: Unexpected token: 'identifier'" +Cause: [1:6-1:7]: Unexpected token: 'identifier'" `; exports[`invalid-script-top-level-using-binding.js format 1`] = ` @@ -200,7 +200,7 @@ exports[`using-declarations.js [meriyah] format 1`] = ` 3 | } 4 | 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); -Cause: [2:17]: Unexpected token: 'identifier'" +Cause: [2:16-2:17]: Unexpected token: 'identifier'" `; exports[`using-declarations.js [typescript] format 1`] = ` @@ -348,13 +348,13 @@ exports[`valid-await-using-binding-basic.js [flow] format 1`] = ` `; exports[`valid-await-using-binding-basic.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (2:19) +"Unexpected token: 'identifier' (2:15) 1 | async function f() { > 2 | await using basic = getReader(); - | ^ + | ^^^^^ 3 | } 4 | -Cause: [2:19]: Unexpected token: 'identifier'" +Cause: [2:14-2:19]: Unexpected token: 'identifier'" `; exports[`valid-await-using-binding-basic.js format 1`] = ` @@ -411,7 +411,7 @@ exports[`valid-await-using-binding-escaped.js [meriyah] format 1`] = ` | ^ 3 | } 4 | -Cause: [2:15]: Unexpected token: 'identifier'" +Cause: [2:14-2:15]: Unexpected token: 'identifier'" `; exports[`valid-await-using-binding-escaped.js format 1`] = ` @@ -462,13 +462,13 @@ exports[`valid-await-using-binding-non-bmp.js [flow] format 1`] = ` `; exports[`valid-await-using-binding-non-bmp.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (2:17) +"Unexpected token: 'identifier' (2:15) 1 | async function f() { > 2 | await using 𠮷 = foo(); - | ^ + | ^^ 3 | } 4 | -Cause: [2:17]: Unexpected token: 'identifier'" +Cause: [2:14-2:16]: Unexpected token: 'identifier'" `; exports[`valid-await-using-binding-non-bmp.js format 1`] = ` @@ -522,14 +522,14 @@ exports[`valid-await-using-binding-using.js [flow] format 1`] = ` `; exports[`valid-await-using-binding-using.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (2:19) +"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:19]: Unexpected token: 'identifier'" +Cause: [2:14-2:19]: Unexpected token: 'identifier'" `; exports[`valid-await-using-binding-using.js format 1`] = ` @@ -596,7 +596,7 @@ exports[`valid-await-using-comments.js [meriyah] format 1`] = ` 4 | } 5 | { 6 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; -Cause: [3:28]: Unexpected token: 'identifier'" +Cause: [3:27-3:28]: Unexpected token: 'identifier'" `; exports[`valid-await-using-comments.js [typescript] format 1`] = ` @@ -721,14 +721,14 @@ exports[`valid-for-using-binding-of-of.js [flow] format 1`] = ` `; exports[`valid-for-using-binding-of-of.js [meriyah] format 1`] = ` -"Invalid left-hand side in for-of (2:21) +"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:21]: Invalid left-hand side in for-of" +Cause: [2:19-2:21]: Invalid left-hand side in for-of" `; exports[`valid-for-using-binding-of-of.js format 1`] = ` @@ -781,13 +781,13 @@ exports[`valid-for-using-declaration.js [flow] format 1`] = ` `; exports[`valid-for-using-declaration.js [meriyah] format 1`] = ` -"Expected ';' (2:24) +"Expected ';' (2:20) 1 | async function f() { > 2 | for (await using basic = reader();;); - | ^ + | ^^^^^ 3 | } 4 | -Cause: [2:24]: Expected ';'" +Cause: [2:19-2:24]: Expected ';'" `; exports[`valid-for-using-declaration.js [typescript] format 1`] = ` @@ -854,7 +854,7 @@ exports[`valid-module-block-top-level-await-using-binding.js [meriyah] format 1` 2 | await using foo = bar(); 3 | } 4 | -Cause: [1:18]: Unexpected token: '{'" +Cause: [1:17-1:18]: Unexpected token: '{'" `; exports[`valid-module-block-top-level-await-using-binding.js [typescript] format 1`] = ` @@ -921,7 +921,7 @@ exports[`valid-module-block-top-level-using-binding.js [meriyah] format 1`] = ` 2 | using foo = bar(); 3 | } 4 | -Cause: [1:8]: Unexpected token: '{'" +Cause: [1:7-1:8]: Unexpected token: '{'" `; exports[`valid-module-block-top-level-using-binding.js [typescript] format 1`] = ` @@ -1105,13 +1105,13 @@ exports[`valid-using-binding-basic.js [flow] format 1`] = ` `; exports[`valid-using-binding-basic.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (2:13) +"Unexpected token: 'identifier' (2:9) 1 | { > 2 | using basic = getReader(); - | ^ + | ^^^^^ 3 | } 4 | -Cause: [2:13]: Unexpected token: 'identifier'" +Cause: [2:8-2:13]: Unexpected token: 'identifier'" `; exports[`valid-using-binding-basic.js format 1`] = ` @@ -1160,7 +1160,7 @@ exports[`valid-using-binding-escaped.js [meriyah] format 1`] = ` > 1 | { using \\u0061b = c; } | ^ 2 | -Cause: [1:9]: Unexpected token: 'identifier'" +Cause: [1:8-1:9]: Unexpected token: 'identifier'" `; exports[`valid-using-binding-escaped.js format 1`] = ` @@ -1203,11 +1203,11 @@ exports[`valid-using-binding-non-bmp.js [flow] format 1`] = ` `; exports[`valid-using-binding-non-bmp.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:11) +"Unexpected token: 'identifier' (1:9) > 1 | { using 𠮷 = foo(); } - | ^ + | ^^ 2 | -Cause: [1:11]: Unexpected token: 'identifier'" +Cause: [1:8-1:10]: Unexpected token: 'identifier'" `; exports[`valid-using-binding-non-bmp.js format 1`] = ` @@ -1259,14 +1259,14 @@ exports[`valid-using-binding-using.js [flow] format 1`] = ` `; exports[`valid-using-binding-using.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (2:13) +"Unexpected token: 'identifier' (2:9) 1 | { > 2 | using using = of; - | ^ + | ^^^^^ 3 | for (using using of of); 4 | } 5 | -Cause: [2:13]: Unexpected token: 'identifier'" +Cause: [2:8-2:13]: Unexpected token: 'identifier'" `; exports[`valid-using-binding-using.js format 1`] = ` diff --git a/tests/format/js/export-default/escaped/__snapshots__/format.test.js.snap b/tests/format/js/export-default/escaped/__snapshots__/format.test.js.snap index 69728e9f7..6a0b488ba 100644 --- a/tests/format/js/export-default/escaped/__snapshots__/format.test.js.snap +++ b/tests/format/js/export-default/escaped/__snapshots__/format.test.js.snap @@ -24,11 +24,11 @@ exports[`default-escaped.js [flow] format 1`] = ` `; exports[`default-escaped.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (2:12) +"Unexpected token: 'identifier' (2:8) 1 | // export asyn\\u{63} from "async"; > 2 | export n\\u{63} from "async"; - | ^ -Cause: [2:12]: Unexpected token: 'identifier'" + | ^^^^^ +Cause: [2:7-2:12]: Unexpected token: 'identifier'" `; exports[`default-escaped.js format 1`] = ` diff --git a/tests/format/js/export-default/export-default-from/__snapshots__/format.test.js.snap b/tests/format/js/export-default/export-default-from/__snapshots__/format.test.js.snap index 556afb71d..723aed7bc 100644 --- a/tests/format/js/export-default/export-default-from/__snapshots__/format.test.js.snap +++ b/tests/format/js/export-default/export-default-from/__snapshots__/format.test.js.snap @@ -30,7 +30,7 @@ exports[`export.js [meriyah] format 1`] = ` 3 | export a, * as b from 'mod'; 4 | export c, { foo } from 'mod'; 5 | export * as d from 'mod'; -Cause: [2:8]: Unexpected token: 'identifier'" +Cause: [2:7-2:8]: Unexpected token: 'identifier'" `; exports[`export.js format 1`] = ` diff --git a/tests/format/js/for-of/__snapshots__/format.test.js.snap b/tests/format/js/for-of/__snapshots__/format.test.js.snap index 1aaf61bd1..ba300877d 100644 --- a/tests/format/js/for-of/__snapshots__/format.test.js.snap +++ b/tests/format/js/for-of/__snapshots__/format.test.js.snap @@ -1,5 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`async-identifier.js [meriyah] format 1`] = ` +"Expected '=>' (6:23) + 4 | + 5 | async function f() { +> 6 | for await (async of []); + | ^ + 7 | for await ((async) of []); + 8 | for await ((foo) of async); + 9 | for await ((foo) of []) async; +Cause: [6:22-6:23]: Expected '=>'" +`; + exports[`async-identifier.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/format/js/for-of/format.test.js b/tests/format/js/for-of/format.test.js index 67c251cce..8cd6851c5 100644 --- a/tests/format/js/for-of/format.test.js +++ b/tests/format/js/for-of/format.test.js @@ -1 +1,3 @@ -runFormatTest(import.meta, ["babel", "flow", "typescript"]); +runFormatTest(import.meta, ["babel", "flow", "typescript"], { + errors: { meriyah: ["async-identifier.js"] }, +}); diff --git a/tests/format/js/function-single-destructuring/__snapshots__/format.test.js.snap b/tests/format/js/function-single-destructuring/__snapshots__/format.test.js.snap index 864243cdb..d56eb9d72 100644 --- a/tests/format/js/function-single-destructuring/__snapshots__/format.test.js.snap +++ b/tests/format/js/function-single-destructuring/__snapshots__/format.test.js.snap @@ -279,7 +279,7 @@ exports[`tuple-and-record.js [meriyah] format 1`] = ` 23 | } 24 | 25 | function StatelessFunctionalComponent3([ -Cause: [22:5]: '#' not followed by identifier" +Cause: [22:4-22:5]: '#' not followed by identifier" `; exports[`tuple-and-record.js format 1`] = ` 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 ca34307f7..d136619cf 100644 --- a/tests/format/js/import-assertions/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-assertions/__snapshots__/format.test.js.snap @@ -53,14 +53,14 @@ Cause: Unexpected token assert" `; exports[`empty.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (2:38) +"Unexpected token: 'identifier' (2:33) 1 | export * as foo from "foo.json" > 2 | export * as bar from "bar.json" assert { } - | ^ + | ^^^^^^ 3 | export * as baz from "baz.json" assert { /* comment */ } 4 | 5 | import * as foo from "foo.json" -Cause: [2:38]: Unexpected token: 'identifier'" +Cause: [2:32-2:38]: Unexpected token: 'identifier'" `; exports[`empty.js format 1`] = ` @@ -105,11 +105,11 @@ Cause: Unexpected token assert" `; exports[`multi-types.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:36) +"Unexpected token: 'identifier' (1:31) > 1 | import json from "./foo.json" assert { type: "json", type: "bar" }; - | ^ + | ^^^^^^ 2 | -Cause: [1:36]: Unexpected token: 'identifier'" +Cause: [1:30-1:36]: Unexpected token: 'identifier'" `; exports[`multi-types.js format 1`] = ` @@ -143,11 +143,11 @@ Cause: Unexpected token assert" `; exports[`non-type.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:33) +"Unexpected token: 'identifier' (1:28) > 1 | import foo from "foo.json" assert { lazy: "true" }; - | ^ + | ^^^^^^ 2 | -Cause: [1:33]: Unexpected token: 'identifier'" +Cause: [1:27-1:33]: Unexpected token: 'identifier'" `; exports[`non-type.js format 1`] = ` @@ -201,13 +201,13 @@ Cause: Unexpected token assert" `; exports[`re-export.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:49) +"Unexpected token: 'identifier' (1:44) > 1 | export { default as foo2 } from "foo.json" assert { type: "json" }; - | ^ + | ^^^^^^ 2 | export * from "foo.json" assert { type: "json" }; 3 | export * as foo3 from "foo.json" assert { type: "json" }; 4 | -Cause: [1:49]: Unexpected token: 'identifier'" +Cause: [1:43-1:49]: Unexpected token: 'identifier'" `; exports[`re-export.js format 1`] = ` @@ -245,11 +245,11 @@ Cause: Unexpected token assert" `; exports[`static-import.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:36) +"Unexpected token: 'identifier' (1:31) > 1 | import json from "./foo.json" assert { type: "json" }; - | ^ + | ^^^^^^ 2 | -Cause: [1:36]: Unexpected token: 'identifier'" +Cause: [1:30-1:36]: Unexpected token: 'identifier'" `; exports[`static-import.js format 1`] = ` @@ -283,11 +283,11 @@ Cause: Unexpected token assert" `; exports[`without-from.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:19) +"Unexpected token: 'identifier' (1:14) > 1 | import "foo" assert { type: "json" } - | ^ + | ^^^^^^ 2 | -Cause: [1:19]: Unexpected token: 'identifier'" +Cause: [1:13-1:19]: Unexpected token: 'identifier'" `; exports[`without-from.js format 1`] = ` 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 ac9d5b2bd..cc7c84a3a 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 @@ -46,10 +46,10 @@ Cause: Unexpected token assert" `; exports[`empty.js - {"bracketSpacing":false} [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:38) +"Unexpected token: 'identifier' (1:33) > 1 | export * as bar from "bar.json" assert { } - | ^ -Cause: [1:38]: Unexpected token: 'identifier'" + | ^^^^^^ +Cause: [1:32-1:38]: Unexpected token: 'identifier'" `; exports[`empty.js - {"bracketSpacing":false} format 1`] = ` @@ -83,11 +83,11 @@ Cause: Unexpected token assert" `; exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:49) +"Unexpected token: 'identifier' (1:44) > 1 | export { default as foo2 } from "foo.json" assert { type: "json" }; - | ^ + | ^^^^^^ 2 | -Cause: [1:49]: Unexpected token: 'identifier'" +Cause: [1:43-1:49]: Unexpected token: 'identifier'" `; exports[`re-export.js - {"bracketSpacing":false} format 1`] = ` @@ -122,11 +122,11 @@ Cause: Unexpected token assert" `; exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:36) +"Unexpected token: 'identifier' (1:31) > 1 | import json from "./foo.json" assert { type: "json" }; - | ^ + | ^^^^^^ 2 | -Cause: [1:36]: Unexpected token: 'identifier'" +Cause: [1:30-1:36]: Unexpected token: 'identifier'" `; exports[`static-import.js - {"bracketSpacing":false} format 1`] = ` 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 baebb6ac5..f06352769 100644 --- a/tests/format/js/import-attributes/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-attributes/__snapshots__/format.test.js.snap @@ -105,7 +105,7 @@ exports[`keyword-detect.js [meriyah] format 1`] = ` 2 | import {} from "./test.json" /* assert */ with /* assert */ { type: "json" } 3 | import "./test.json" /* with */ assert /* with */ { type: "json" } 4 | import {} from "./test.json" /* with */ assert /* with */ { type: "json" } -Cause: [1:69]: Invalid binding in JSON import" +Cause: [1:68-1:69]: Invalid binding in JSON import" `; exports[`keyword-detect.js format 1`] = ` @@ -242,7 +242,7 @@ exports[`multi-types.js [meriyah] format 1`] = ` > 1 | import json from "./foo.json" with { type: "json", type: "bar" }; | ^ 2 | -Cause: [1:64]: Duplicate binding 'type'" +Cause: [1:63-1:64]: Duplicate binding 'type'" `; exports[`multi-types.js format 1`] = ` @@ -309,16 +309,6 @@ exports[`re-export.js [espree] format 1`] = ` Cause: Unexpected token with" `; -exports[`re-export.js [meriyah] format 1`] = ` -"Unexpected token: 'with' (1:47) -> 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: [1:47]: Unexpected token: 'with'" -`; - exports[`re-export.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -388,7 +378,7 @@ exports[`without-from.js [meriyah] format 1`] = ` > 1 | import "foo" with { type: "json" } | ^ 2 | -Cause: [1:34]: Invalid binding in JSON import" +Cause: [1:33-1:34]: Invalid binding in JSON import" `; exports[`without-from.js format 1`] = ` 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 a97c4574d..125cfae80 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 @@ -75,14 +75,6 @@ exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = ` Cause: Unexpected token with" `; -exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = ` -"Unexpected token: 'with' (1:47) -> 1 | export { default as foo2 } from "foo.json" with { type: "json" }; - | ^ - 2 | -Cause: [1:47]: Unexpected token: 'with'" -`; - exports[`re-export.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 367465867..5bd80afe6 100644 --- a/tests/format/js/import-attributes/bracket-spacing/format.test.js +++ b/tests/format/js/import-attributes/bracket-spacing/format.test.js @@ -13,6 +13,5 @@ runFormatTest(import.meta, ["babel"], { "re-export.js", "empty.js", ], - meriyah: ["re-export.js"], }, }); diff --git a/tests/format/js/import-attributes/format.test.js b/tests/format/js/import-attributes/format.test.js index 7e9d4361a..78121ca48 100644 --- a/tests/format/js/import-attributes/format.test.js +++ b/tests/format/js/import-attributes/format.test.js @@ -21,11 +21,6 @@ const errors = { "keyword-detect.js", "long-sources.js", ], - meriyah: [ - "multi-types.js", - "re-export.js", - "without-from.js", - "keyword-detect.js", - ], + meriyah: ["multi-types.js", "without-from.js", "keyword-detect.js"], }; runFormatTest(import.meta, ["babel", "typescript"], { errors }); diff --git a/tests/format/js/import-reflection/__snapshots__/format.test.js.snap b/tests/format/js/import-reflection/__snapshots__/format.test.js.snap index c5cd85a3b..3b313b12d 100644 --- a/tests/format/js/import-reflection/__snapshots__/format.test.js.snap +++ b/tests/format/js/import-reflection/__snapshots__/format.test.js.snap @@ -24,11 +24,11 @@ exports[`comments.js [flow] format 1`] = ` `; exports[`comments.js [meriyah] format 1`] = ` -"Import source must be string (1:51) +"Import source must be string (1:48) > 1 | /* 0 */import /* 1 */module /* 2 */from /* 3 */from /* 4 */"./module.wasm"/* 5 */; - | ^ + | ^^^^ 2 | -Cause: [1:51]: Import source must be string" +Cause: [1:47-1:51]: Import source must be string" `; exports[`comments.js [typescript] format 1`] = ` @@ -77,11 +77,11 @@ exports[`import-reflection.js [flow] format 1`] = ` `; exports[`import-reflection.js [meriyah] format 1`] = ` -"Expected 'from' (1:17) +"Expected 'from' (1:15) > 1 | import module foo from "./module.wasm"; - | ^ + | ^^^ 2 | -Cause: [1:17]: Expected 'from'" +Cause: [1:14-1:17]: Expected 'from'" `; exports[`import-reflection.js [typescript] format 1`] = ` @@ -133,12 +133,12 @@ exports[`valid-default-import.mjs [flow] format 1`] = ` `; exports[`valid-default-import.mjs [meriyah] format 1`] = ` -"Expected 'from' (1:17) +"Expected 'from' (1:15) > 1 | import module foo from "./module.wasm"; - | ^ + | ^^^ 2 | import bar from "./module.wasm"; 3 | -Cause: [1:17]: Expected 'from'" +Cause: [1:14-1:17]: Expected 'from'" `; exports[`valid-default-import.mjs [typescript] format 1`] = ` @@ -190,11 +190,11 @@ exports[`valid-from-as-default-module-binding.mjs [flow] format 1`] = ` `; exports[`valid-from-as-default-module-binding.mjs [meriyah] format 1`] = ` -"Import source must be string (1:23) +"Import source must be string (1:20) > 1 | import module from from "./module.wasm"; - | ^ + | ^^^^ 2 | -Cause: [1:23]: Import source must be string" +Cause: [1:19-1:23]: Import source must be string" `; exports[`valid-from-as-default-module-binding.mjs [typescript] format 1`] = ` @@ -243,11 +243,11 @@ exports[`valid-from-as-default-module-binding-escaped.mjs [flow] format 1`] = ` `; exports[`valid-from-as-default-module-binding-escaped.mjs [meriyah] format 1`] = ` -"Expected 'from' (1:17) +"Expected 'from' (1:15) > 1 | import module \\u0066rom from "./module.wasm"; - | ^ + | ^^^ 2 | -Cause: [1:17]: Expected 'from'" +Cause: [1:14-1:17]: Expected 'from'" `; exports[`valid-from-as-default-module-binding-escaped.mjs [typescript] format 1`] = ` diff --git a/tests/format/js/method-chain/__snapshots__/format.test.js.snap b/tests/format/js/method-chain/__snapshots__/format.test.js.snap index 61b00e014..9c38e05ac 100644 --- a/tests/format/js/method-chain/__snapshots__/format.test.js.snap +++ b/tests/format/js/method-chain/__snapshots__/format.test.js.snap @@ -1606,7 +1606,7 @@ exports[`tuple-and-record.js [meriyah] format 1`] = ` 3 | 4 | foo.a().b().c({n, o}) 5 | foo.a().b().c(#{n, o}) -Cause: [2:15]: '#' not followed by identifier" +Cause: [2:14-2:15]: '#' not followed by identifier" `; exports[`tuple-and-record.js [typescript] format 1`] = ` diff --git a/tests/format/js/module-blocks/__snapshots__/format.test.js.snap b/tests/format/js/module-blocks/__snapshots__/format.test.js.snap index 18a465121..edd263632 100644 --- a/tests/format/js/module-blocks/__snapshots__/format.test.js.snap +++ b/tests/format/js/module-blocks/__snapshots__/format.test.js.snap @@ -27,7 +27,7 @@ exports[`comments.js [meriyah] format 1`] = ` 2 | /*A4*/ 3 | export const foo = "foo"; 4 | export { foo }; /*A5*/ -Cause: [1:32]: Unexpected token: '{'" +Cause: [1:31-1:32]: Unexpected token: '{'" `; exports[`comments.js format 1`] = ` @@ -90,7 +90,7 @@ exports[`module-blocks.js [meriyah] format 1`] = ` 2 | 3 | class B { 4 | #p() { -Cause: [1:8]: Unexpected token: '{'" +Cause: [1:7-1:8]: Unexpected token: '{'" `; exports[`module-blocks.js format 1`] = ` @@ -237,7 +237,7 @@ exports[`range.js [meriyah] format 1`] = ` 2 | }; 3 | 4 | foo(module { export let foo = "foo"; }) -Cause: [1:26]: Unexpected token: '{'" +Cause: [1:25-1:26]: Unexpected token: '{'" `; exports[`range.js format 1`] = ` @@ -296,7 +296,7 @@ exports[`worker.js [meriyah] format 1`] = ` 2 | onmessage = function({data}) { 3 | let mod = import(data); 4 | postMessage(mod.fn()); -Cause: [1:32]: Expected ')'" +Cause: [1:31-1:32]: Expected ')'" `; exports[`worker.js format 1`] = ` diff --git a/tests/format/js/module-string-names/__snapshots__/format.test.js.snap b/tests/format/js/module-string-names/__snapshots__/format.test.js.snap index 2f1408a20..dadbde36f 100644 --- a/tests/format/js/module-string-names/__snapshots__/format.test.js.snap +++ b/tests/format/js/module-string-names/__snapshots__/format.test.js.snap @@ -1,15 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`module-string-names-export.js [meriyah] format 1`] = ` -"Only a identifier can be used to indicate alias (1:26) -> 1 | export { smile as "smile1" } from "./emojis.js"; - | ^ - 2 | export { "smile" as smile2 } from "./emojis.js"; - 3 | export { "smile" as "smile3" } from "./emojis.js"; - 4 | export { foo1, bar as "foo2" } from "./emojis.js"; -Cause: [1:26]: Only a identifier can be used to indicate alias" -`; - exports[`module-string-names-export.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -37,16 +27,6 @@ export { "smile4" } from "./emojis.js"; ================================================================================ `; -exports[`module-string-names-import.js [meriyah] format 1`] = ` -"Expected '}' (1:18) -> 1 | import { "default" as quotation1 } from "Confucius"; - | ^ - 2 | import { "foo" as bar, "default" as qux } from "module-a"; - 3 | import { "學而時習之,不亦說乎?" as quotation2 } from "Confucius"; - 4 | -Cause: [1:18]: Expected '}'" -`; - exports[`module-string-names-import.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/format/js/module-string-names/format.test.js b/tests/format/js/module-string-names/format.test.js index 8403310af..f509b709e 100644 --- a/tests/format/js/module-string-names/format.test.js +++ b/tests/format/js/module-string-names/format.test.js @@ -1,3 +1 @@ -runFormatTest(import.meta, ["babel"], { - errors: { meriyah: true }, -}); +runFormatTest(import.meta, ["babel"]); diff --git a/tests/format/js/multiparser-invalid/__snapshots__/format.test.js.snap b/tests/format/js/multiparser-invalid/__snapshots__/format.test.js.snap index 99efe4ece..039e53fa7 100644 --- a/tests/format/js/multiparser-invalid/__snapshots__/format.test.js.snap +++ b/tests/format/js/multiparser-invalid/__snapshots__/format.test.js.snap @@ -34,15 +34,15 @@ exports[`text.js [flow] format 1`] = ` `; exports[`text.js [meriyah] format 1`] = ` -"Invalid hexadecimal escape sequence (6:20) +"Invalid hexadecimal escape sequence (6:17) 4 | foo = markdown\`\\u{prettier}\\u{0065}\`; 5 | foo = css\`\\u{prettier}\\u{0065}\`; > 6 | foo = /* HTML */\`\\u{prettier}\\u{0065}\`; - | ^ + | ^^^^ 7 | foo = /* GraphQL */\`\\u{prettier}\\u{0065}\`; 8 | 9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`; -Cause: [6:20]: Invalid hexadecimal escape sequence" +Cause: [6:16-6:20]: Invalid hexadecimal escape sequence" `; exports[`text.js [typescript] format 1`] = ` diff --git a/tests/format/js/new-target/__snapshots__/format.test.js.snap b/tests/format/js/new-target/__snapshots__/format.test.js.snap index 26c0be5b8..5e8975105 100644 --- a/tests/format/js/new-target/__snapshots__/format.test.js.snap +++ b/tests/format/js/new-target/__snapshots__/format.test.js.snap @@ -24,11 +24,11 @@ exports[`outside-functions.js [flow] format 1`] = ` `; exports[`outside-functions.js [meriyah] format 1`] = ` -"new.target only allowed within functions (1:20) +"new.target only allowed within functions or static blocks (1:15) > 1 | const x = new.target; - | ^ + | ^^^^^^ 2 | -Cause: [1:20]: new.target only allowed within functions" +Cause: [1:14-1:20]: new.target only allowed within functions or static blocks" `; exports[`outside-functions.js format 1`] = ` @@ -69,11 +69,11 @@ exports[`range.js [flow] format 1`] = ` `; exports[`range.js [meriyah] format 1`] = ` -"new.target only allowed within functions (2:10) +"new.target only allowed within functions or static blocks (2:5) 1 | const x = > 2 | new.target; - | ^ -Cause: [2:10]: new.target only allowed within functions" + | ^^^^^^ +Cause: [2:4-2:10]: new.target only allowed within functions or static blocks" `; exports[`range.js format 1`] = ` diff --git a/tests/format/js/no-semi-babylon-extensions/__snapshots__/format.test.js.snap b/tests/format/js/no-semi-babylon-extensions/__snapshots__/format.test.js.snap index a41e9e189..a3f87b20e 100644 --- a/tests/format/js/no-semi-babylon-extensions/__snapshots__/format.test.js.snap +++ b/tests/format/js/no-semi-babylon-extensions/__snapshots__/format.test.js.snap @@ -30,7 +30,7 @@ exports[`no-semi.js [meriyah] format 1`] = ` 3 | 4 | class A { 5 | a = b; -Cause: [2:2]: Unexpected token: ':'" +Cause: [2:1-2:2]: Unexpected token: ':'" `; exports[`no-semi.js - {"semi":false} [acorn] format 1`] = ` @@ -63,7 +63,7 @@ exports[`no-semi.js - {"semi":false} [meriyah] format 1`] = ` 3 | 4 | class A { 5 | a = b; -Cause: [2:2]: Unexpected token: ':'" +Cause: [2:1-2:2]: Unexpected token: ':'" `; exports[`no-semi.js - {"semi":false} format 1`] = ` diff --git a/tests/format/js/objects/__snapshots__/format.test.js.snap b/tests/format/js/objects/__snapshots__/format.test.js.snap index 259a9b285..2b7480508 100644 --- a/tests/format/js/objects/__snapshots__/format.test.js.snap +++ b/tests/format/js/objects/__snapshots__/format.test.js.snap @@ -124,7 +124,7 @@ exports[`expression.js [meriyah] format 1`] = ` 6 | ({}::b()\`\`[''].c++ && 0 ? 0 : 0, 0); 7 | ({}(), 0); 8 | ({} = 0); -Cause: [5:4]: Expected ')'" +Cause: [5:3-5:4]: Expected ')'" `; exports[`expression.js [typescript] format 1`] = ` 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 2b0544122..3d2d45c7a 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 @@ -37,7 +37,7 @@ exports[`invalid-destructuring-arr.js [meriyah] format 1`] = ` > 1 | [a?.b] = []; | ^ 2 | -Cause: [1:10]: Invalid left-hand side in assignment" +Cause: [1:9-1:10]: Invalid left-hand side in assignment" `; exports[`invalid-destructuring-obj.js [__babel_estree] format 1`] = ` @@ -77,7 +77,7 @@ exports[`invalid-destructuring-obj.js [meriyah] format 1`] = ` > 1 | ({ prop: a?.b } = {}); | ^ 2 | -Cause: [1:19]: Invalid left-hand side in assignment" +Cause: [1:18-1:19]: Invalid left-hand side in assignment" `; exports[`invalid-fn-param.js [__babel_estree] format 1`] = ` @@ -113,11 +113,11 @@ Cause: Unexpected token ?." `; exports[`invalid-fn-param.js [meriyah] format 1`] = ` -"Expected ')' (1:14) +"Expected ')' (1:13) > 1 | function f(a?.b) {} - | ^ + | ^^ 2 | -Cause: [1:14]: Expected ')'" +Cause: [1:12-1:14]: Expected ')'" `; exports[`invalid-fn-param-arrow.js [__babel_estree] format 1`] = ` @@ -153,11 +153,11 @@ Cause: Optional chaining cannot appear in left-hand side" `; exports[`invalid-fn-param-arrow.js [meriyah] format 1`] = ` -"The left-hand side of the arrow can only be destructed through assignment (1:9) +"The left-hand side of the arrow can only be destructed through assignment (1:8) > 1 | (a?.b) => {} - | ^ + | ^^ 2 | -Cause: [1:9]: The left-hand side of the arrow can only be destructed through assignment" +Cause: [1:7-1:9]: The left-hand side of the arrow can only be destructed through assignment" `; exports[`invalid-fn-param-assign.js [__babel_estree] format 1`] = ` @@ -193,11 +193,11 @@ Cause: Unexpected token ?." `; exports[`invalid-fn-param-assign.js [meriyah] format 1`] = ` -"Expected ')' (1:14) +"Expected ')' (1:13) > 1 | function f(a?.b = c) {} - | ^ + | ^^ 2 | -Cause: [1:14]: Expected ')'" +Cause: [1:12-1:14]: Expected ')'" `; exports[`invalid-for-await-of.js [__babel_estree] format 1`] = ` @@ -233,11 +233,11 @@ Cause: Optional chaining cannot appear in left-hand side" `; exports[`invalid-for-await-of.js [meriyah] format 1`] = ` -"Invalid left-hand side in for-of (1:12) +"Invalid left-hand side in for-of (1:11) > 1 | for (a?.b of x); - | ^ + | ^^ 2 | -Cause: [1:12]: Invalid left-hand side in for-of" +Cause: [1:10-1:12]: Invalid left-hand side in for-of" `; exports[`invalid-for-in.js [__babel_estree] format 1`] = ` @@ -273,11 +273,11 @@ Cause: Optional chaining cannot appear in left-hand side" `; exports[`invalid-for-in.js [meriyah] format 1`] = ` -"Invalid left-hand side in for-in (1:12) +"Invalid left-hand side in for-in (1:11) > 1 | for (a?.b in x); - | ^ + | ^^ 2 | -Cause: [1:12]: Invalid left-hand side in for-in" +Cause: [1:10-1:12]: Invalid left-hand side in for-in" `; exports[`invalid-for-of.js [__babel_estree] format 1`] = ` @@ -313,11 +313,11 @@ Cause: Optional chaining cannot appear in left-hand side" `; exports[`invalid-for-of.js [meriyah] format 1`] = ` -"Invalid left-hand side in for-of (1:12) +"Invalid left-hand side in for-of (1:11) > 1 | for (a?.b of x); - | ^ + | ^^ 2 | -Cause: [1:12]: Invalid left-hand side in for-of" +Cause: [1:10-1:12]: Invalid left-hand side in for-of" `; exports[`invalid-inc-postfix.js [__babel_estree] format 1`] = ` @@ -353,11 +353,11 @@ Cause: Optional chaining cannot appear in left-hand side" `; exports[`invalid-inc-postfix.js [meriyah] format 1`] = ` -"Invalid increment/decrement operand (1:6) +"Invalid increment/decrement operand (1:5) > 1 | a?.b++; - | ^ + | ^^ 2 | -Cause: [1:6]: Invalid increment/decrement operand" +Cause: [1:4-1:6]: Invalid increment/decrement operand" `; exports[`invalid-inc-prefix.js [__babel_estree] format 1`] = ` @@ -397,7 +397,7 @@ exports[`invalid-inc-prefix.js [meriyah] format 1`] = ` > 1 | ++a?.b; | ^ 2 | -Cause: [1:7]: Invalid increment/decrement operand" +Cause: [1:6-1:7]: Invalid increment/decrement operand" `; exports[`valid-complex-case.js [acorn] format 1`] = ` @@ -419,12 +419,12 @@ Cause: The keyword 'let' is reserved" `; exports[`valid-complex-case.js [meriyah] format 1`] = ` -"\`let\` declaration not allowed here and \`let\` cannot be a regular var name in strict mode (1:5) +"\`let\` declaration not allowed here and \`let\` cannot be a regular var name in strict mode (1:4) > 1 | let?.()[a] =1; - | ^ + | ^^ 2 | let?.[a] = 1; 3 | -Cause: [1:5]: \`let\` declaration not allowed here and \`let\` cannot be a regular var name in strict mode" +Cause: [1:3-1:5]: \`let\` declaration not allowed here and \`let\` cannot be a regular var name in strict mode" `; exports[`valid-complex-case.js format 1`] = ` @@ -524,7 +524,7 @@ exports[`valid-parenthesized.js [meriyah] format 1`] = ` > 1 | (a?.b) = c; | ^ 2 | -Cause: [1:8]: Invalid left-hand side in assignment" +Cause: [1:7-1:8]: Invalid left-hand side in assignment" `; exports[`valid-parenthesized.js format 1`] = ` diff --git a/tests/format/js/partial-application/__snapshots__/format.test.js.snap b/tests/format/js/partial-application/__snapshots__/format.test.js.snap index 534fd87c8..54c068119 100644 --- a/tests/format/js/partial-application/__snapshots__/format.test.js.snap +++ b/tests/format/js/partial-application/__snapshots__/format.test.js.snap @@ -27,7 +27,7 @@ exports[`test.js [meriyah] format 1`] = ` 2 | addOne(2); // 3 3 | 4 | const addTen = add(?, 10); // apply from the right -Cause: [1:23]: Unexpected token: '?'" +Cause: [1:22-1:23]: Unexpected token: '?'" `; exports[`test.js format 1`] = ` diff --git a/tests/format/js/pipeline-operator/__snapshots__/format.test.js.snap b/tests/format/js/pipeline-operator/__snapshots__/format.test.js.snap index 4d736530d..5e8cf580c 100644 --- a/tests/format/js/pipeline-operator/__snapshots__/format.test.js.snap +++ b/tests/format/js/pipeline-operator/__snapshots__/format.test.js.snap @@ -30,7 +30,7 @@ exports[`block-comments.js [meriyah] format 1`] = ` 3 | |> foo2 /* comment1 */ 4 | |> foo3 /* comment2 */ 5 | |> kochabCooieGameOnOboleUnweave -Cause: [2:2]: Unexpected token: '>'" +Cause: [2:1-2:2]: Unexpected token: '>'" `; exports[`block-comments.js format 1`] = ` @@ -87,7 +87,7 @@ exports[`fsharp_style_pipeline_operator.js [meriyah] format 1`] = ` 3 | |> x => doubleSay(x, ', ') 4 | |> capitalize 5 | |> x => x + '!' -Cause: [2:4]: Unexpected token: '>'" +Cause: [2:3-2:4]: Unexpected token: '>'" `; exports[`fsharp_style_pipeline_operator.js format 1`] = ` @@ -212,7 +212,7 @@ exports[`hack_pipeline_operator.js [meriyah] format 1`] = ` 2 | 3 | foo 4 | |> await % -Cause: [1:4]: Unexpected token: '>'" +Cause: [1:3-1:4]: Unexpected token: '>'" `; exports[`hack_pipeline_operator.js format 1`] = ` @@ -356,7 +356,7 @@ exports[`minimal_pipeline_operator.js [meriyah] format 1`] = ` 2 | 3 | a |> (b |> c); 4 | -Cause: [1:4]: Unexpected token: '>'" +Cause: [1:3-1:4]: Unexpected token: '>'" `; exports[`minimal_pipeline_operator.js format 1`] = ` diff --git a/tests/format/js/record/__snapshots__/format.test.js.snap b/tests/format/js/record/__snapshots__/format.test.js.snap index a5a3007ea..8535fc7a7 100644 --- a/tests/format/js/record/__snapshots__/format.test.js.snap +++ b/tests/format/js/record/__snapshots__/format.test.js.snap @@ -30,7 +30,7 @@ exports[`computed.js [meriyah] format 1`] = ` 3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) 4 | 5 | assert(#{ [true]: 1 } === #{ true: 1 }) -Cause: [2:8]: '#' not followed by identifier" +Cause: [2:7-2:8]: '#' not followed by identifier" `; exports[`computed.js format 1`] = ` @@ -90,7 +90,7 @@ exports[`destructuring.js [meriyah] format 1`] = ` 2 | assert(a === 1); 3 | assert(b === 2); 4 | -Cause: [1:18]: '#' not followed by identifier" +Cause: [1:17-1:18]: '#' not followed by identifier" `; exports[`destructuring.js format 1`] = ` @@ -150,7 +150,7 @@ exports[`record.js [meriyah] format 1`] = ` 2 | a: 1, 3 | b: 2, 4 | c: 3, -Cause: [1:17]: '#' not followed by identifier" +Cause: [1:16-1:17]: '#' not followed by identifier" `; exports[`record.js format 1`] = ` @@ -224,7 +224,7 @@ exports[`shorthand.js [meriyah] format 1`] = ` | ^ 3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple 4 | -Cause: [2:16]: '#' not followed by identifier" +Cause: [2:15-2:16]: '#' not followed by identifier" `; exports[`shorthand.js format 1`] = ` @@ -272,7 +272,7 @@ exports[`spread.js [meriyah] format 1`] = ` 2 | const taskNow = #{ id: 42, status: "WIP", ...formData } 3 | const taskLater = #{ ...taskNow, status: "DONE" } 4 | -Cause: [1:18]: '#' not followed by identifier" +Cause: [1:17-1:18]: '#' not followed by identifier" `; exports[`spread.js format 1`] = ` @@ -326,7 +326,7 @@ exports[`syntax.js [meriyah] format 1`] = ` 2 | #{ a: 1, b: 2 } 3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] } 4 | -Cause: [1:1]: '#' not followed by identifier" +Cause: [1:0-1:1]: '#' not followed by identifier" `; exports[`syntax.js format 1`] = ` diff --git a/tests/format/js/regex/__snapshots__/format.test.js.snap b/tests/format/js/regex/__snapshots__/format.test.js.snap index fadd9276f..ad7ece7db 100644 --- a/tests/format/js/regex/__snapshots__/format.test.js.snap +++ b/tests/format/js/regex/__snapshots__/format.test.js.snap @@ -51,13 +51,13 @@ Cause: Invalid regular expression: /(?ims:^[a-z])/: Invalid group" `; exports[`regexp-modifiers.js [meriyah] format 1`] = ` -"Unterminated regular expression (1:16) +"Unterminated regular expression (1:1) > 1 | /(?ims:^[a-z])/u; - | ^ + | ^^^^^^^^^^^^^^^^ 2 | /(?-ims:^[a-z].)(^[a-z].)/uims; 3 | /(?ims:^[a-z].1$)/; 4 | -Cause: [1:16]: Unterminated regular expression" +Cause: [1:0-1:16]: Unterminated regular expression" `; exports[`regexp-modifiers.js format 1`] = ` @@ -99,14 +99,6 @@ exports[`v-flag.js [flow] format 1`] = ` 2 |" `; -exports[`v-flag.js [meriyah] format 1`] = ` -"Unexpected regular expression flag (1:3) -> 1 | /a/v; - | ^ - 2 | -Cause: [1:3]: Unexpected regular expression flag" -`; - exports[`v-flag.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/format/js/regex/format.test.js b/tests/format/js/regex/format.test.js index 4a42f2806..2ecb965cb 100644 --- a/tests/format/js/regex/format.test.js +++ b/tests/format/js/regex/format.test.js @@ -3,6 +3,6 @@ runFormatTest(import.meta, ["babel", "flow", "typescript"], { flow: ["v-flag.js"], acorn: ["regexp-modifiers.js"], espree: ["regexp-modifiers.js"], - meriyah: ["v-flag.js", "regexp-modifiers.js"], + meriyah: ["regexp-modifiers.js"], }, }); diff --git a/tests/format/js/sloppy-mode/__snapshots__/format.test.js.snap b/tests/format/js/sloppy-mode/__snapshots__/format.test.js.snap index 0b8385d1b..e399cae40 100644 --- a/tests/format/js/sloppy-mode/__snapshots__/format.test.js.snap +++ b/tests/format/js/sloppy-mode/__snapshots__/format.test.js.snap @@ -97,11 +97,11 @@ exports[`function-declaration-in-while.js [flow] format 1`] = ` `; exports[`function-declaration-in-while.js [meriyah] format 1`] = ` -"In strict mode code, functions can only be declared at top level or inside a block (1:22) +"In strict mode code, functions can only be declared at top level or inside a block (1:15) > 1 | while (false) function foo(){} - | ^ + | ^^^^^^^^ 2 | -Cause: [1:22]: In strict mode code, functions can only be declared at top level or inside a block" +Cause: [1:14-1:22]: In strict mode code, functions can only be declared at top level or inside a block" `; exports[`function-declaration-in-while.js format 1`] = ` diff --git a/tests/format/js/source-phase-imports/__snapshots__/format.test.js.snap b/tests/format/js/source-phase-imports/__snapshots__/format.test.js.snap index 8a6035367..6907e1c75 100644 --- a/tests/format/js/source-phase-imports/__snapshots__/format.test.js.snap +++ b/tests/format/js/source-phase-imports/__snapshots__/format.test.js.snap @@ -35,7 +35,7 @@ exports[`import-source.js [meriyah] format 1`] = ` > 1 | import source x from "x"; | ^ 2 | -Cause: [1:15]: Expected 'from'" +Cause: [1:14-1:15]: Expected 'from'" `; exports[`import-source.js format 1`] = ` @@ -73,7 +73,7 @@ exports[`import-source-attributes-declaration.js [meriyah] format 1`] = ` > 1 | import source s from "x" with { attr: "val" }; | ^ 2 | -Cause: [1:15]: Expected 'from'" +Cause: [1:14-1:15]: Expected 'from'" `; exports[`import-source-attributes-declaration.js format 1`] = ` @@ -107,11 +107,11 @@ Cause: The only valid meta property for import is 'import.meta'" `; exports[`import-source-attributes-expression.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:13) +"The only valid meta property for import is 'import.meta' (1:8) > 1 | import.source("x", { with: { attr: "val" } }); - | ^ + | ^^^^^^ 2 | -Cause: [1:13]: Unexpected token: 'identifier'" +Cause: [1:7-1:13]: The only valid meta property for import is 'import.meta'" `; exports[`import-source-attributes-expression.js format 1`] = ` @@ -145,11 +145,11 @@ Cause: Unexpected token from" `; exports[`import-source-binding-from.js [meriyah] format 1`] = ` -"Import source must be string (1:23) +"Import source must be string (1:20) > 1 | import source from from "x"; - | ^ + | ^^^^ 2 | -Cause: [1:23]: Import source must be string" +Cause: [1:19-1:23]: Import source must be string" `; exports[`import-source-binding-from.js format 1`] = ` @@ -183,11 +183,11 @@ Cause: Unexpected token source" `; exports[`import-source-binding-source.js [meriyah] format 1`] = ` -"Expected 'from' (1:20) +"Expected 'from' (1:15) > 1 | import source source from "x"; - | ^ + | ^^^^^^ 2 | -Cause: [1:20]: Expected 'from'" +Cause: [1:14-1:20]: Expected 'from'" `; exports[`import-source-binding-source.js format 1`] = ` @@ -221,11 +221,11 @@ Cause: The only valid meta property for import is 'import.meta'" `; exports[`import-source-dynamic-import.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:13) +"The only valid meta property for import is 'import.meta' (1:8) > 1 | import.source("foo"); - | ^ + | ^^^^^^ 2 | -Cause: [1:13]: Unexpected token: 'identifier'" +Cause: [1:7-1:13]: The only valid meta property for import is 'import.meta'" `; exports[`import-source-dynamic-import.js format 1`] = ` @@ -279,7 +279,7 @@ exports[`no-named.js [meriyah] format 1`] = ` > 1 | import source { x } from "x"; | ^ 2 | -Cause: [1:15]: Expected 'from'" +Cause: [1:14-1:15]: Expected 'from'" `; exports[`no-namespace.js [__babel_estree] format 1`] = ` @@ -319,5 +319,5 @@ exports[`no-namespace.js [meriyah] format 1`] = ` > 1 | import source * as x from "x"; | ^ 2 | -Cause: [1:15]: Expected 'from'" +Cause: [1:14-1:15]: Expected 'from'" `; diff --git a/tests/format/js/strings/__snapshots__/format.test.js.snap b/tests/format/js/strings/__snapshots__/format.test.js.snap index 7b3b62e09..7d9d43da8 100644 --- a/tests/format/js/strings/__snapshots__/format.test.js.snap +++ b/tests/format/js/strings/__snapshots__/format.test.js.snap @@ -136,6 +136,18 @@ exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [espree] format 1 Cause: Invalid escape sequence" `; +exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [meriyah] format 1`] = ` +"Escapes \\8 or \\9 are not syntactically valid escapes (3:1) + 1 | // https://github.com/babel/babel/pull/11852 + 2 | +> 3 | "\\8","\\9"; + | ^^ + 4 | () => { + 5 | "use strict"; + 6 | "\\8", "\\9"; +Cause: [3:0-3:2]: Escapes \\8 or \\9 are not syntactically valid escapes" +`; + exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["babel", "flow"] @@ -187,6 +199,18 @@ exports[`non-octal-eight-and-nine.js - {"trailingComma":"es5"} [espree] format 1 Cause: Invalid escape sequence" `; +exports[`non-octal-eight-and-nine.js - {"trailingComma":"es5"} [meriyah] format 1`] = ` +"Escapes \\8 or \\9 are not syntactically valid escapes (3:1) + 1 | // https://github.com/babel/babel/pull/11852 + 2 | +> 3 | "\\8","\\9"; + | ^^ + 4 | () => { + 5 | "use strict"; + 6 | "\\8", "\\9"; +Cause: [3:0-3:2]: Escapes \\8 or \\9 are not syntactically valid escapes" +`; + exports[`non-octal-eight-and-nine.js - {"trailingComma":"es5"} format 1`] = ` ====================================options===================================== parsers: ["babel", "flow"] diff --git a/tests/format/js/strings/format.test.js b/tests/format/js/strings/format.test.js index e0700d612..462c91638 100644 --- a/tests/format/js/strings/format.test.js +++ b/tests/format/js/strings/format.test.js @@ -3,6 +3,7 @@ runFormatTest(import.meta, ["babel", "flow"], { errors: { acorn: ["non-octal-eight-and-nine.js"], espree: ["non-octal-eight-and-nine.js"], + meriyah: ["non-octal-eight-and-nine.js"], }, }); runFormatTest(import.meta, ["babel", "flow"], { @@ -10,5 +11,6 @@ runFormatTest(import.meta, ["babel", "flow"], { errors: { acorn: ["non-octal-eight-and-nine.js"], espree: ["non-octal-eight-and-nine.js"], + meriyah: ["non-octal-eight-and-nine.js"], }, }); diff --git a/tests/format/js/throw_expressions/__snapshots__/format.test.js.snap b/tests/format/js/throw_expressions/__snapshots__/format.test.js.snap index a23a08385..61a64af90 100644 --- a/tests/format/js/throw_expressions/__snapshots__/format.test.js.snap +++ b/tests/format/js/throw_expressions/__snapshots__/format.test.js.snap @@ -21,13 +21,13 @@ Cause: Unexpected token throw" `; exports[`throw_expression.js [meriyah] format 1`] = ` -"Unexpected token: 'throw' (1:30) +"Unexpected token: 'throw' (1:26) > 1 | function save(filename = throw new TypeError("Argument required")) {} - | ^ + | ^^^^^ 2 | 3 | lint(ast, { 4 | with: () => throw new Error("avoid using 'with' statements.") -Cause: [1:30]: Unexpected token: 'throw'" +Cause: [1:25-1:30]: Unexpected token: 'throw'" `; exports[`throw_expression.js format 1`] = ` diff --git a/tests/format/js/tuple/__snapshots__/format.test.js.snap b/tests/format/js/tuple/__snapshots__/format.test.js.snap index 0ff3c3842..087d3c260 100644 --- a/tests/format/js/tuple/__snapshots__/format.test.js.snap +++ b/tests/format/js/tuple/__snapshots__/format.test.js.snap @@ -27,7 +27,7 @@ exports[`destructuring.js [meriyah] format 1`] = ` 2 | assert(a === 1); 3 | assert(b === 2); 4 | -Cause: [1:16]: '#' not followed by identifier" +Cause: [1:15-1:16]: '#' not followed by identifier" `; exports[`destructuring.js format 1`] = ` @@ -97,7 +97,7 @@ exports[`invalid-tuple-holes.js [meriyah] format 1`] = ` > 1 | #[,] | ^ 2 | -Cause: [1:1]: '#' not followed by identifier" +Cause: [1:0-1:1]: '#' not followed by identifier" `; exports[`syntax.js [acorn] format 1`] = ` @@ -127,7 +127,7 @@ exports[`syntax.js [meriyah] format 1`] = ` 2 | #[1, 2] 3 | #[1, 2, #{ a: 3 }] 4 | -Cause: [1:1]: '#' not followed by identifier" +Cause: [1:0-1:1]: '#' not followed by identifier" `; exports[`syntax.js format 1`] = ` @@ -175,7 +175,7 @@ exports[`tuple.js [meriyah] format 1`] = ` 2 | 3 | assert(tuple1[0] === 1); 4 | -Cause: [1:16]: '#' not followed by identifier" +Cause: [1:15-1:16]: '#' not followed by identifier" `; exports[`tuple.js format 1`] = ` @@ -245,7 +245,7 @@ exports[`tuple-trailing-comma.js [meriyah] format 1`] = ` > 1 | #[1,] | ^ 2 | -Cause: [1:1]: '#' not followed by identifier" +Cause: [1:0-1:1]: '#' not followed by identifier" `; exports[`tuple-trailing-comma.js format 1`] = ` diff --git a/tests/format/js/v8_intrinsic/__snapshots__/format.test.js.snap b/tests/format/js/v8_intrinsic/__snapshots__/format.test.js.snap index bd28b02ea..9cf17e690 100644 --- a/tests/format/js/v8_intrinsic/__snapshots__/format.test.js.snap +++ b/tests/format/js/v8_intrinsic/__snapshots__/format.test.js.snap @@ -24,7 +24,7 @@ exports[`avoid-conflicts-to-pipeline.js [meriyah] format 1`] = ` > 2 | const status = %GetOptimizationStatus(fn); | ^ 3 | -Cause: [2:16]: Unexpected token: '%'" +Cause: [2:15-2:16]: Unexpected token: '%'" `; exports[`avoid-conflicts-to-pipeline.js format 1`] = ` @@ -73,7 +73,7 @@ exports[`intrinsic_call.js [meriyah] format 1`] = ` 3 | ( 4 | foo ) 5 | } -Cause: [2:13]: Unexpected token: '%'" +Cause: [2:12-2:13]: Unexpected token: '%'" `; exports[`intrinsic_call.js format 1`] = ` diff --git a/tests/format/jsx/comments/__snapshots__/format.test.js.snap b/tests/format/jsx/comments/__snapshots__/format.test.js.snap index 339d80baa..b976d5c36 100644 --- a/tests/format/jsx/comments/__snapshots__/format.test.js.snap +++ b/tests/format/jsx/comments/__snapshots__/format.test.js.snap @@ -83,17 +83,6 @@ printWidth: 80 ================================================================================ `; -exports[`in-end-tag.js - {"bracketSameLine":true} [meriyah] format 1`] = ` -"Expected '>' (2:11) - 1 | /* =========== before slash =========== */ -> 2 | ; - 4 | ; -Cause: [2:11]: Expected '>'" -`; - exports[`in-end-tag.js - {"bracketSameLine":true} [typescript] format 1`] = ` "Identifier expected. (2:6) 1 | /* =========== before slash =========== */ diff --git a/tests/format/jsx/comments/format.test.js b/tests/format/jsx/comments/format.test.js index 7b9e5b20e..e1f7c3545 100644 --- a/tests/format/jsx/comments/format.test.js +++ b/tests/format/jsx/comments/format.test.js @@ -2,6 +2,5 @@ runFormatTest(import.meta, ["flow", "babel", "typescript"], { bracketSameLine: true, errors: { typescript: ["in-end-tag.js"], - meriyah: ["in-end-tag.js", "fragment.js"], }, }); diff --git a/tests/format/jsx/do/__snapshots__/format.test.js.snap b/tests/format/jsx/do/__snapshots__/format.test.js.snap index b81de0a07..38647183a 100644 --- a/tests/format/jsx/do/__snapshots__/format.test.js.snap +++ b/tests/format/jsx/do/__snapshots__/format.test.js.snap @@ -23,14 +23,14 @@ Cause: Unexpected token do" `; exports[`do.js [meriyah] format 1`] = ` -"Unexpected token: 'do' (2:5) +"Unexpected token: 'do' (2:4) 1 |
> 2 | {do { - | ^ + | ^^ 3 | 1 4 | }} 5 |
-Cause: [2:5]: Unexpected token: 'do'" +Cause: [2:3-2:5]: Unexpected token: 'do'" `; exports[`do.js format 1`] = ` diff --git a/tests/format/jsx/fragment/__snapshots__/format.test.js.snap b/tests/format/jsx/fragment/__snapshots__/format.test.js.snap index 8ed55fbe8..91f2a0cf2 100644 --- a/tests/format/jsx/fragment/__snapshots__/format.test.js.snap +++ b/tests/format/jsx/fragment/__snapshots__/format.test.js.snap @@ -1,17 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`fragment.js [meriyah] format 1`] = ` -"Unexpected token: '>' (38:21) - 36 | ); - 37 | -> 38 | - | ^ - 39 | - 40 | - 41 | ; -Cause: [38:21]: Unexpected token: '>'" -`; - exports[`fragment.js format 1`] = ` ====================================options===================================== parsers: ["flow", "babel", "typescript"] diff --git a/tests/format/jsx/fragment/format.test.js b/tests/format/jsx/fragment/format.test.js index 9b2d88ede..f80c543f9 100644 --- a/tests/format/jsx/fragment/format.test.js +++ b/tests/format/jsx/fragment/format.test.js @@ -1,3 +1 @@ -runFormatTest(import.meta, ["flow", "babel", "typescript"], { - errors: { meriyah: ["fragment.js"] }, -}); +runFormatTest(import.meta, ["flow", "babel", "typescript"]); diff --git a/tests/format/jsx/tuple/__snapshots__/format.test.js.snap b/tests/format/jsx/tuple/__snapshots__/format.test.js.snap index c2aa612da..6fcc346a0 100644 --- a/tests/format/jsx/tuple/__snapshots__/format.test.js.snap +++ b/tests/format/jsx/tuple/__snapshots__/format.test.js.snap @@ -33,7 +33,7 @@ exports[`tuple.js [meriyah] format 1`] = ` 7 |
, 8 |
, 9 | ] -Cause: [6:5]: '#' not followed by identifier" +Cause: [6:4-6:5]: '#' not followed by identifier" `; exports[`tuple.js format 1`] = ` diff --git a/tests/format/misc/errors/invalid/__snapshots__/format.test.js.snap b/tests/format/misc/errors/invalid/__snapshots__/format.test.js.snap index c0d8e1286..93074096d 100644 --- a/tests/format/misc/errors/invalid/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/invalid/__snapshots__/format.test.js.snap @@ -69,17 +69,17 @@ exports[`snippet: #0 [flow] format 2`] = ` `; exports[`snippet: #0 [meriyah] format 1`] = ` -"Expected '(' (1:8) +"Expected '(' (1:5) > 1 | for each (a in b) {} - | ^ -Cause: [1:8]: Expected '('" + | ^^^^ +Cause: [1:4-1:8]: Expected '('" `; exports[`snippet: #0 [meriyah] format 2`] = ` "Invalid left-hand side in assignment (1:9) > 1 | (a = b) = 1 | ^ -Cause: [1:9]: Invalid left-hand side in assignment" +Cause: [1:8-1:9]: Invalid left-hand side in assignment" `; exports[`snippet: #0 [typescript] format 1`] = ` @@ -158,17 +158,17 @@ exports[`snippet: #1 [flow] format 2`] = ` `; exports[`snippet: #1 [meriyah] format 1`] = ` -"Unexpected strict mode reserved word (1:12) +"Unexpected strict mode reserved word (1:7) > 1 | class switch() {} - | ^ -Cause: [1:12]: Unexpected strict mode reserved word" + | ^^^^^^ +Cause: [1:6-1:12]: Unexpected strict mode reserved word" `; exports[`snippet: #1 [meriyah] format 2`] = ` "Invalid left-hand side in assignment (1:7) > 1 | a = 1 = 2 | ^ -Cause: [1:7]: Invalid left-hand side in assignment" +Cause: [1:6-1:7]: Invalid left-hand side in assignment" `; exports[`snippet: #1 [typescript] format 1`] = ` @@ -250,14 +250,14 @@ exports[`snippet: #2 [meriyah] format 1`] = ` "Expected '{' (1:13) > 1 | ({ method() }) | ^ -Cause: [1:13]: Expected '{'" +Cause: [1:12-1:13]: Expected '{'" `; exports[`snippet: #2 [meriyah] format 2`] = ` "Invalid left-hand side in assignment (1:9) > 1 | (a = 1) = 2 | ^ -Cause: [1:9]: Invalid left-hand side in assignment" +Cause: [1:8-1:9]: Invalid left-hand side in assignment" `; exports[`snippet: #2 [typescript] format 1`] = ` @@ -339,14 +339,14 @@ exports[`snippet: #3 [meriyah] format 1`] = ` "Expected '{' (1:15) > 1 | ({ method({}) }) | ^ -Cause: [1:15]: Expected '{'" +Cause: [1:14-1:15]: Expected '{'" `; exports[`snippet: #3 [meriyah] format 2`] = ` "Invalid left-hand side in assignment (1:10) > 1 | (a += b) = 1 | ^ -Cause: [1:10]: Invalid left-hand side in assignment" +Cause: [1:9-1:10]: Invalid left-hand side in assignment" `; exports[`snippet: #3 [typescript] format 1`] = ` @@ -428,14 +428,14 @@ exports[`snippet: #4 [meriyah] format 1`] = ` "Expected '{' (1:23) > 1 | ({ method(parameter,) }) | ^ -Cause: [1:23]: Expected '{'" +Cause: [1:22-1:23]: Expected '{'" `; exports[`snippet: #4 [meriyah] format 2`] = ` -"Invalid left-hand side in assignment (1:10) +"Invalid left-hand side in assignment (1:9) > 1 | (a = b) += 1 - | ^ -Cause: [1:10]: Invalid left-hand side in assignment" + | ^^ +Cause: [1:8-1:10]: Invalid left-hand side in assignment" `; exports[`snippet: #4 [typescript] format 1`] = ` diff --git a/tests/format/misc/errors/js/assignment/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/assignment/__snapshots__/format.test.js.snap index b7202ac81..74fc3cb61 100644 --- a/tests/format/misc/errors/js/assignment/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/assignment/__snapshots__/format.test.js.snap @@ -53,19 +53,19 @@ exports[`snippet: #0 [meriyah] format 1`] = ` "Invalid left-hand side in assignment (1:6) > 1 | ({}) = x; | ^ -Cause: [1:6]: Invalid left-hand side in assignment" +Cause: [1:5-1:6]: Invalid left-hand side in assignment" `; exports[`snippet: #0 [meriyah] format 2`] = ` "The identifier 'let' must not be in expression position in strict mode (1:24) > 1 | class Foo extends ((let)[0] = 1) {} | ^ -Cause: [1:24]: The identifier 'let' must not be in expression position in strict mode" +Cause: [1:23-1:24]: The identifier 'let' must not be in expression position in strict mode" `; exports[`snippet: #0 [meriyah] format 3`] = ` "The identifier 'let' must not be in expression position in strict mode (1:21) > 1 | export default ((let)[0] = 1); | ^ -Cause: [1:21]: The identifier 'let' must not be in expression position in strict mode" +Cause: [1:20-1:21]: The identifier 'let' must not be in expression position in strict mode" `; diff --git a/tests/format/misc/errors/js/async-await/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/async-await/__snapshots__/format.test.js.snap index 624cdefaa..4e3f738a0 100644 --- a/tests/format/misc/errors/js/async-await/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/async-await/__snapshots__/format.test.js.snap @@ -63,12 +63,12 @@ exports[`snippet: #0 [flow] format 2`] = ` `; exports[`snippet: #0 [meriyah] format 1`] = ` -"Await is only valid in async functions (2:24) +"Await expression not allowed in formal parameter (2:20) 1 | async function foo() { > 2 | function bar(x = await 2) {} - | ^ + | ^^^^^ 3 | } -Cause: [2:24]: Await is only valid in async functions" +Cause: [2:19-2:24]: Await expression not allowed in formal parameter" `; exports[`snippet: #1 [acorn] format 1`] = ` @@ -99,10 +99,10 @@ exports[`snippet: #1 [flow] format 1`] = ` `; exports[`snippet: #1 [meriyah] format 1`] = ` -"Await expression not allowed in formal parameter (1:22) +"Await expression not allowed in formal parameter (1:21) > 1 | async (x = await 2) => {}; - | ^ -Cause: [1:22]: Await expression not allowed in formal parameter" + | ^^ +Cause: [1:20-1:22]: Await expression not allowed in formal parameter" `; exports[`snippet: #2 [acorn] format 1`] = ` @@ -136,7 +136,7 @@ exports[`snippet: #2 [meriyah] format 1`] = ` "Unexpected token: '!' (1:25) > 1 | f = async (a) => await a! ** 6; | ^ -Cause: [1:25]: Unexpected token: '!'" +Cause: [1:24-1:25]: Unexpected token: '!'" `; exports[`snippet: #3 [acorn] format 1`] = ` @@ -170,7 +170,7 @@ exports[`snippet: #3 [meriyah] format 1`] = ` "Unexpected token: '!' (1:14) > 1 | f = (a) => +a! ** 6; | ^ -Cause: [1:14]: Unexpected token: '!'" +Cause: [1:13-1:14]: Unexpected token: '!'" `; exports[`snippet: #4 [acorn] format 1`] = ` @@ -204,7 +204,7 @@ exports[`snippet: #4 [meriyah] format 1`] = ` "Expected ')' (1:22) > 1 | async (a) => (await a!) ** 6; | ^ -Cause: [1:22]: Expected ')'" +Cause: [1:21-1:22]: Expected ')'" `; exports[`snippet: #5 [acorn] format 1`] = ` @@ -235,10 +235,10 @@ exports[`snippet: #5 [flow] format 1`] = ` `; exports[`snippet: #5 [meriyah] format 1`] = ` -"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:7) +"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:6) > 1 | (-+5 ** 6); - | ^ -Cause: [1:7]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses" + | ^^ +Cause: [1:5-1:7]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses" `; exports[`snippet: #6 [acorn] format 1`] = ` @@ -269,10 +269,10 @@ exports[`snippet: #6 [flow] format 1`] = ` `; exports[`snippet: #6 [meriyah] format 1`] = ` -"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:26) +"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:25) > 1 | f = async () => await 5 ** 6; - | ^ -Cause: [1:26]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses" + | ^^ +Cause: [1:24-1:26]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses" `; exports[`snippet: #7 [acorn] format 1`] = ` @@ -303,10 +303,10 @@ exports[`snippet: #7 [flow] format 1`] = ` `; exports[`snippet: #7 [meriyah] format 1`] = ` -"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:27) +"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:26) > 1 | f = async () => await -5 ** 6; - | ^ -Cause: [1:27]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses" + | ^^ +Cause: [1:25-1:27]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses" `; exports[`snippet: #8 [acorn] format 1`] = ` @@ -340,5 +340,5 @@ exports[`snippet: #8 [meriyah] format 1`] = ` "Invalid shorthand property initializer (1:21) > 1 | async({ foo33 = 1 }); | ^ -Cause: [1:21]: Invalid shorthand property initializer" +Cause: [1:20-1:21]: Invalid shorthand property initializer" `; diff --git a/tests/format/misc/errors/js/for-of/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/for-of/__snapshots__/format.test.js.snap index e161c2585..edcd74c7f 100644 --- a/tests/format/misc/errors/js/for-of/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/for-of/__snapshots__/format.test.js.snap @@ -79,7 +79,7 @@ exports[`snippet: #0 [meriyah] format 1`] = ` "Identifier "let" disallowed as left-hand side expression in strict mode (1:9) > 1 | for (let.foo of []); | ^ -Cause: [1:9]: Identifier "let" disallowed as left-hand side expression in strict mode" +Cause: [1:8-1:9]: Identifier "let" disallowed as left-hand side expression in strict mode" `; exports[`snippet: #0 [typescript] format 1`] = ` @@ -127,7 +127,7 @@ exports[`snippet: #1 [meriyah] format 1`] = ` "Identifier "let" disallowed as left-hand side expression in strict mode (1:9) > 1 | for (let().bar of []); | ^ -Cause: [1:9]: Identifier "let" disallowed as left-hand side expression in strict mode" +Cause: [1:8-1:9]: Identifier "let" disallowed as left-hand side expression in strict mode" `; exports[`snippet: #1 [typescript] format 1`] = ` @@ -172,10 +172,10 @@ exports[`snippet: #2 [flow] format 1`] = ` `; exports[`snippet: #2 [meriyah] format 1`] = ` -"Identifier "let" disallowed as left-hand side expression in strict mode (1:10) +"Identifier "let" disallowed as left-hand side expression in strict mode (1:9) > 1 | for (let\`\`.bar of []); - | ^ -Cause: [1:10]: Identifier "let" disallowed as left-hand side expression in strict mode" + | ^^ +Cause: [1:8-1:10]: Identifier "let" disallowed as left-hand side expression in strict mode" `; exports[`snippet: #2 [typescript] format 1`] = ` diff --git a/tests/format/misc/errors/js/import/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/import/__snapshots__/format.test.js.snap index 630e22cce..3d9711e51 100644 --- a/tests/format/misc/errors/js/import/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/import/__snapshots__/format.test.js.snap @@ -31,7 +31,7 @@ exports[`snippet: #0 [meriyah] format 1`] = ` "Unexpected token: ')' (1:8) > 1 | import(); | ^ -Cause: [1:8]: Unexpected token: ')'" +Cause: [1:7-1:8]: Unexpected token: ')'" `; exports[`snippet: #0 [typescript] format 1`] = ` @@ -72,7 +72,7 @@ exports[`snippet: #1 [meriyah] format 1`] = ` "Unexpected token: ')' (1:21) > 1 | import(/* comment */); | ^ -Cause: [1:21]: Unexpected token: ')'" +Cause: [1:20-1:21]: Unexpected token: ')'" `; exports[`snippet: #1 [typescript] format 1`] = ` @@ -113,7 +113,7 @@ exports[`snippet: #2 [meriyah] format 1`] = ` "Cannot use new with import(...) (1:11) > 1 | new import('./a.mjs'); | ^ -Cause: [1:11]: Cannot use new with import(...)" +Cause: [1:10-1:11]: Cannot use new with import(...)" `; exports[`snippet: #2 [typescript] format 1`] = ` @@ -154,7 +154,7 @@ exports[`snippet: #3 [meriyah] format 1`] = ` "Cannot use new with import(...) (1:11) > 1 | new import(); | ^ -Cause: [1:11]: Cannot use new with import(...)" +Cause: [1:10-1:11]: Cannot use new with import(...)" `; exports[`snippet: #3 [typescript] format 1`] = ` diff --git a/tests/format/misc/errors/js/known-source-type/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/known-source-type/__snapshots__/format.test.js.snap index cbc3b998a..cbe475ecd 100644 --- a/tests/format/misc/errors/js/known-source-type/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/known-source-type/__snapshots__/format.test.js.snap @@ -15,10 +15,10 @@ Cause: 'import' and 'export' may appear only with 'sourceType: module'" `; exports[`snippet: #0 [meriyah] format 1`] = ` -"The import keyword can only be used with the module goal (1:12) +"The import keyword can only be used with the module goal (1:8) > 1 | import "foo" - | ^ -Cause: [1:12]: The import keyword can only be used with the module goal" + | ^^^^^ +Cause: [1:7-1:12]: The import keyword can only be used with the module goal" `; exports[`snippet: #1 [acorn] format 1`] = ` @@ -39,7 +39,7 @@ exports[`snippet: #1 [meriyah] format 1`] = ` "Strict mode code may not include a with statement (1:5) > 1 | with(foo) {} | ^ -Cause: [1:5]: Strict mode code may not include a with statement" +Cause: [1:4-1:5]: Strict mode code may not include a with statement" `; exports[`snippet: #2 [acorn] format 1`] = ` @@ -57,8 +57,8 @@ Cause: Deleting local variable in strict mode" `; exports[`snippet: #2 [meriyah] format 1`] = ` -"Calling delete on expression not allowed in strict mode (1:10) +"Calling delete on expression not allowed in strict mode (1:8) > 1 | delete foo - | ^ -Cause: [1:10]: Calling delete on expression not allowed in strict mode" + | ^^^ +Cause: [1:7-1:10]: Calling delete on expression not allowed in strict mode" `; diff --git a/tests/format/misc/errors/js/literal/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/literal/__snapshots__/format.test.js.snap index 46deec8e9..0f1dedd19 100644 --- a/tests/format/misc/errors/js/literal/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/literal/__snapshots__/format.test.js.snap @@ -25,9 +25,9 @@ Cause: Invalid number" `; exports[`invalid-exponent.js [meriyah] format 1`] = ` -"Non-number found after exponent indicator (1:5) +"Non-number found after exponent indicator (1:1) > 1 | 12.3e - | ^ + | ^^^^^ 2 | -Cause: [1:5]: Non-number found after exponent indicator" +Cause: [1:0-1:5]: Non-number found after exponent indicator" `; diff --git a/tests/format/misc/errors/js/object/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/object/__snapshots__/format.test.js.snap index 036d52b49..c02501ff4 100644 --- a/tests/format/misc/errors/js/object/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/object/__snapshots__/format.test.js.snap @@ -37,7 +37,7 @@ exports[`getter-generator.js [meriyah] format 1`] = ` | ^ 3 | }); 4 | -Cause: [2:9]: A getter cannot be a generator" +Cause: [2:8-2:9]: A getter cannot be a generator" `; exports[`getter-with-parameter.js [acorn] format 1`] = ` @@ -69,7 +69,7 @@ exports[`getter-with-parameter.js [meriyah] format 1`] = ` > 1 | ({ get x(a){} }); | ^ 2 | -Cause: [1:10]: Getter functions must have exactly no arguments" +Cause: [1:9-1:10]: Getter functions must have exactly no arguments" `; exports[`setter-generator.js [acorn] format 1`] = ` @@ -109,7 +109,7 @@ exports[`setter-generator.js [meriyah] format 1`] = ` | ^ 3 | }); 4 | -Cause: [2:9]: A setter cannot be a generator" +Cause: [2:8-2:9]: A setter cannot be a generator" `; exports[`setter-without-parameter.js [acorn] format 1`] = ` @@ -141,5 +141,5 @@ exports[`setter-without-parameter.js [meriyah] format 1`] = ` > 1 | ({ set x(){} }); | ^ 2 | -Cause: [1:10]: Setter functions must have exactly one argument" +Cause: [1:9-1:10]: Setter functions must have exactly one argument" `; diff --git a/tests/format/misc/errors/js/optional-chaining/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/optional-chaining/__snapshots__/format.test.js.snap index 09b0911dd..b5925071d 100644 --- a/tests/format/misc/errors/js/optional-chaining/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/optional-chaining/__snapshots__/format.test.js.snap @@ -22,10 +22,10 @@ Cause: Optional chaining cannot appear in the callee of new expressions" `; exports[`snippet: #0 [meriyah] format 1`] = ` -"Invalid optional chain from new expression (1:22) +"Invalid optional chain from new expression (1:21) > 1 | const baz3 = new obj?.foo?.bar?.baz(); // baz instance - | ^ -Cause: [1:22]: Invalid optional chain from new expression" + | ^^ +Cause: [1:20-1:22]: Invalid optional chain from new expression" `; exports[`snippet: #1 [acorn] format 1`] = ` @@ -50,10 +50,10 @@ Cause: Optional chaining cannot appear in the callee of new expressions" `; exports[`snippet: #1 [meriyah] format 1`] = ` -"Invalid optional chain from new expression (1:23) +"Invalid optional chain from new expression (1:22) > 1 | const safe5 = new obj?.qux?.baz(); // undefined - | ^ -Cause: [1:23]: Invalid optional chain from new expression" + | ^^ +Cause: [1:21-1:23]: Invalid optional chain from new expression" `; exports[`snippet: #2 [acorn] format 1`] = ` @@ -78,10 +78,10 @@ Cause: Optional chaining cannot appear in the callee of new expressions" `; exports[`snippet: #2 [meriyah] format 1`] = ` -"Invalid optional chain from new expression (1:23) +"Invalid optional chain from new expression (1:22) > 1 | const safe6 = new obj?.foo.bar.qux?.(); // undefined - | ^ -Cause: [1:23]: Invalid optional chain from new expression" + | ^^ +Cause: [1:21-1:23]: Invalid optional chain from new expression" `; exports[`snippet: #3 [acorn] format 1`] = ` @@ -106,10 +106,10 @@ Cause: Optional chaining cannot appear in the callee of new expressions" `; exports[`snippet: #3 [meriyah] format 1`] = ` -"Invalid optional chain from new expression (1:27) +"Invalid optional chain from new expression (1:26) > 1 | const willThrow = new obj?.foo.bar.qux(); // Error: not a constructor - | ^ -Cause: [1:27]: Invalid optional chain from new expression" + | ^^ +Cause: [1:25-1:27]: Invalid optional chain from new expression" `; exports[`snippet: #4 [acorn] format 1`] = ` @@ -140,12 +140,12 @@ Cause: Optional chaining cannot appear in the callee of new expressions" `; exports[`snippet: #4 [meriyah] format 1`] = ` -"Invalid optional chain from new expression (4:10) +"Invalid optional chain from new expression (4:9) 2 | class Test { 3 | } > 4 | new Test?.(); // test instance - | ^ -Cause: [4:10]: Invalid optional chain from new expression" + | ^^ +Cause: [4:8-4:10]: Invalid optional chain from new expression" `; exports[`snippet: #5 [acorn] format 1`] = ` @@ -170,8 +170,8 @@ Cause: Optional chaining cannot appear in the callee of new expressions" `; exports[`snippet: #5 [meriyah] format 1`] = ` -"Invalid optional chain from new expression (1:12) +"Invalid optional chain from new expression (1:11) > 1 | new exists?.(); // undefined - | ^ -Cause: [1:12]: Invalid optional chain from new expression" + | ^^ +Cause: [1:10-1:12]: Invalid optional chain from new expression" `; diff --git a/tests/format/misc/errors/js/record/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/record/__snapshots__/format.test.js.snap index 6e8729525..884cbce19 100644 --- a/tests/format/misc/errors/js/record/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/record/__snapshots__/format.test.js.snap @@ -25,7 +25,7 @@ exports[`snippet: #0 [meriyah] format 1`] = ` "'#' not followed by identifier (1:1) > 1 | #{a() {}} | ^ -Cause: [1:1]: '#' not followed by identifier" +Cause: [1:0-1:1]: '#' not followed by identifier" `; exports[`snippet: #1 [acorn] format 1`] = ` @@ -53,7 +53,7 @@ exports[`snippet: #1 [meriyah] format 1`] = ` "'#' not followed by identifier (1:1) > 1 | #{async b() {}} | ^ -Cause: [1:1]: '#' not followed by identifier" +Cause: [1:0-1:1]: '#' not followed by identifier" `; exports[`snippet: #2 [acorn] format 1`] = ` @@ -81,7 +81,7 @@ exports[`snippet: #2 [meriyah] format 1`] = ` "'#' not followed by identifier (1:1) > 1 | #{get c() {}} | ^ -Cause: [1:1]: '#' not followed by identifier" +Cause: [1:0-1:1]: '#' not followed by identifier" `; exports[`snippet: #3 [acorn] format 1`] = ` @@ -109,7 +109,7 @@ exports[`snippet: #3 [meriyah] format 1`] = ` "'#' not followed by identifier (1:1) > 1 | #{set d(_) {}} | ^ -Cause: [1:1]: '#' not followed by identifier" +Cause: [1:0-1:1]: '#' not followed by identifier" `; exports[`snippet: #4 [acorn] format 1`] = ` @@ -137,5 +137,5 @@ exports[`snippet: #4 [meriyah] format 1`] = ` "'#' not followed by identifier (1:1) > 1 | #{*e() {}} | ^ -Cause: [1:1]: '#' not followed by identifier" +Cause: [1:0-1:1]: '#' not followed by identifier" `; diff --git a/tests/format/misc/errors/js/regex-v-u-flags/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/regex-v-u-flags/__snapshots__/format.test.js.snap index a45b9f54e..1c3147b1a 100644 --- a/tests/format/misc/errors/js/regex-v-u-flags/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/regex-v-u-flags/__snapshots__/format.test.js.snap @@ -25,11 +25,11 @@ Cause: Invalid regular expression flag" `; exports[`invalid-flags.js [meriyah] format 1`] = ` -"Unexpected regular expression flag (1:5) +"Duplicate regular expression flag 'uv' (1:1) > 1 | /a/ugv; - | ^ + | ^^^^^ 2 | -Cause: [1:5]: Unexpected regular expression flag" +Cause: [1:0-1:5]: Duplicate regular expression flag 'uv'" `; exports[`invalid-flags2.js [acorn] format 1`] = ` @@ -57,9 +57,9 @@ Cause: Invalid regular expression flag" `; exports[`invalid-flags2.js [meriyah] format 1`] = ` -"Unexpected regular expression flag (1:3) +"Duplicate regular expression flag 'vu' (1:1) > 1 | /a/vu; - | ^ + | ^^^^ 2 | -Cause: [1:3]: Unexpected regular expression flag" +Cause: [1:0-1:4]: Duplicate regular expression flag 'vu'" `; diff --git a/tests/format/misc/errors/js/reserved-word/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/reserved-word/__snapshots__/format.test.js.snap index e7984e4f8..4f892bc0f 100644 --- a/tests/format/misc/errors/js/reserved-word/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/reserved-word/__snapshots__/format.test.js.snap @@ -8,10 +8,10 @@ Cause: The keyword 'interface' is reserved" `; exports[`snippet: #0 [meriyah] format 1`] = ` -"Unexpected strict mode reserved word (1:15) +"Unexpected strict mode reserved word (1:7) > 1 | class interface {} - | ^ -Cause: [1:15]: Unexpected strict mode reserved word" + | ^^^^^^^^^ +Cause: [1:6-1:15]: Unexpected strict mode reserved word" `; exports[`snippet: #1 [espree] format 1`] = ` @@ -22,8 +22,8 @@ Cause: The keyword 'interface' is reserved" `; exports[`snippet: #1 [meriyah] format 1`] = ` -"Unexpected strict mode reserved word (1:16) +"Unexpected strict mode reserved word (1:8) > 1 | import interface from "foo"; - | ^ -Cause: [1:16]: Unexpected strict mode reserved word" + | ^^^^^^^^^ +Cause: [1:7-1:16]: Unexpected strict mode reserved word" `; diff --git a/tests/format/misc/errors/js/variable-declarator/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/variable-declarator/__snapshots__/format.test.js.snap index 7f08e6174..37ddf0057 100644 --- a/tests/format/misc/errors/js/variable-declarator/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/variable-declarator/__snapshots__/format.test.js.snap @@ -29,5 +29,5 @@ exports[`invalid-const.js [meriyah] format 1`] = ` > 1 | const foo; | ^ 2 | -Cause: [1:10]: Missing initializer in const declaration" +Cause: [1:9-1:10]: Missing initializer in const declaration" `; diff --git a/tests/unit/doc-printer.js b/tests/unit/doc-printer.js index 17ef63010..055d5a658 100644 --- a/tests/unit/doc-printer.js +++ b/tests/unit/doc-printer.js @@ -46,7 +46,7 @@ test("`printDocToString` should not manipulate docs", () => { describe("`printDocToString` has linear time complexity at most to print fill()", () => { const baseSize = 3_000; - const relativeMargin = 0.3; + const relativeMargin = 0.4; const baseTime = time(makeFill(baseSize)); test.each([10_000, 20_000, 40_000])("numWords=%d", (numWords) => { const doc = makeFill(numWords); diff --git a/yarn.lock b/yarn.lock index b978123a1..c3cbf3086 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6489,10 +6489,10 @@ __metadata: languageName: node linkType: hard -"meriyah@npm:5.0.0": - version: 5.0.0 - resolution: "meriyah@npm:5.0.0" - checksum: 10/d89d06acbb5fd6d74b2ac2dc3359ca3e276128905ab60604c27db98bf4b316c9408b31b5f316dc12b363f0a8c1215b8f31c7b53aefecf59c8f6588ed2d85189f +"meriyah@npm:6.0.1": + version: 6.0.1 + resolution: "meriyah@npm:6.0.1" + checksum: 10/33263d03d35cddcd8bfdc43a563e131de837b4ca1a55133403d3706508b50fca4b3fc317aad383e74b3988efdb14c5b6be60fd5f5b5748efae842c9ececf1908 languageName: node linkType: hard @@ -7418,7 +7418,7 @@ __metadata: lines-and-columns: "npm:2.0.4" linguist-languages: "npm:7.27.0" magic-string: "npm:0.30.11" - meriyah: "npm:5.0.0" + meriyah: "npm:6.0.1" micromatch: "npm:4.0.8" minimist: "npm:1.2.8" n-readlines: "npm:1.0.1"