Fix bundled @babel/code-frame for test (#19340)
This commit is contained in:
1 parent
2680e80adb
commit
21a8c81940
8 files changed
+48
-57
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import indexToPosition from "index-to-position";
|
||||
import { codeFrameColumns } from "../../../vendors/babel-code-frame-for-test.js";
|
||||
|
||||
const codeFrameColumnsOptions = {
|
||||
linesAbove: Number.POSITIVE_INFINITY,
|
||||
linesBelow: Number.POSITIVE_INFINITY,
|
||||
@@ -8,11 +9,7 @@ const codeFrameColumnsOptions = {
|
||||
const locationForRange = (text, range) => {
|
||||
const [start, end] = [...range]
|
||||
.sort((indexA, indexB) => indexA - indexB)
|
||||
.map((index) => indexToPosition(text, index, { oneBased: true }));
|
||||
|
||||
if (start.line !== end.line) {
|
||||
end.column -= 1;
|
||||
}
|
||||
.map((index) => indexToPosition(text, index, { oneBasedLine: true }));
|
||||
|
||||
return { start, end };
|
||||
};
|
||||
|
||||
@@ -519,7 +519,7 @@ exports[`range-3.js format 1`] = `
|
||||
> 3 | thisWillBeFormatted (2 ,3, )
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
> 4 |
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^
|
||||
> 5 | thisWontBeFormatted (2, 90 ,)
|
||||
| ^
|
||||
6 |
|
||||
@@ -625,7 +625,7 @@ exports[`range-8.js format 1`] = `
|
||||
> 3 | thisWillBeFormatted (2 ,3, )<|>
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
> 4 |
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^
|
||||
> 5 | thisWontBeFormatted (2, 90 ,)
|
||||
| ^
|
||||
6 |
|
||||
|
||||
@@ -237,7 +237,7 @@ exports[`range.js format 1`] = `
|
||||
> 2 | };
|
||||
| ^^
|
||||
> 3 |
|
||||
| ^^
|
||||
| ^
|
||||
> 4 | foo(module { export let foo = "foo"; })
|
||||
| ^^
|
||||
5 |
|
||||
|
||||
@@ -604,9 +604,9 @@ exports[`multiple-statements.js format 1`] = `
|
||||
> 7 | );
|
||||
| ^^
|
||||
> 8 |
|
||||
| ^^
|
||||
| ^
|
||||
> 9 | call(
|
||||
| ^^
|
||||
| ^^^^^
|
||||
> 10 | 1, 2,3
|
||||
| ^^^^^
|
||||
11 | );
|
||||
@@ -646,17 +646,17 @@ exports[`multiple-statements2.js format 1`] = `
|
||||
> 5 | call(
|
||||
| ^^^^^
|
||||
> 6 | 1, 2,3
|
||||
| ^^^^^
|
||||
| ^^^^^^^^
|
||||
> 7 | );
|
||||
| ^^^^^
|
||||
| ^^
|
||||
> 8 |
|
||||
| ^^^^^
|
||||
| ^
|
||||
> 9 | call(
|
||||
| ^^^^^
|
||||
> 10 | 1, 2,3
|
||||
| ^^^^^
|
||||
| ^^^^^^^^
|
||||
> 11 | );
|
||||
| ^^^^^
|
||||
| ^^
|
||||
> 12 |
|
||||
| ^
|
||||
13 | call(
|
||||
@@ -691,7 +691,7 @@ exports[`nested.js format 1`] = `
|
||||
> 2 | if (condition) {
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
> 3 | body
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^
|
||||
> 4 | }
|
||||
| ^^^
|
||||
5 | }
|
||||
@@ -821,9 +821,9 @@ exports[`object-expression2.js format 1`] = `
|
||||
> 6 | {
|
||||
| ^^^^^
|
||||
> 7 | a: 1,
|
||||
| ^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
> 8 | b:2
|
||||
| ^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
> 9 | },
|
||||
| ^^^^^^
|
||||
10 | ]
|
||||
@@ -890,7 +890,7 @@ exports[`range-end.js format 1`] = `
|
||||
> 7 | call(
|
||||
| ^^^^^
|
||||
> 8 | 1, 2,3
|
||||
| ^^^^^
|
||||
| ^^^^^^^^
|
||||
> 9 | );
|
||||
| ^^
|
||||
: =====================================output=====================================
|
||||
@@ -916,7 +916,7 @@ exports[`range-start.js format 1`] = `
|
||||
> 2 | 1, 2,3
|
||||
| ^^^^^^^^
|
||||
> 3 | );
|
||||
| ^^^^^^^^
|
||||
| ^^
|
||||
> 4 |
|
||||
| ^
|
||||
5 |
|
||||
|
||||
@@ -15,7 +15,7 @@ exports[`cross-array.json format 1`] = `
|
||||
> 5 | 8
|
||||
| ^
|
||||
> 6 | ],
|
||||
| ^
|
||||
| ^^
|
||||
> 7 | b: [1, 2, 3, 4],
|
||||
| ^^^^^^^^^^^^^
|
||||
8 | c: [1, 2]
|
||||
|
||||
@@ -35,11 +35,11 @@ exports[`issue-4926.ts format 1`] = `
|
||||
> 5 | for (let attr in this) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
> 6 | if (this[attr] !== keyevent[attr]) return false
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
> 7 | }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
> 8 | return true
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
> 9 | }
|
||||
| ^^^^^
|
||||
10 | }
|
||||
|
||||
Reference in new issue
Block a user