fix(core): fix broken lines and columns import (#14394)
This commit is contained in:
parent
c3e904db80
commit
a70eec8e40
@ -1,6 +1,6 @@
|
|||||||
import { parse, printParseErrorCode, stripComments } from 'jsonc-parser';
|
import { parse, printParseErrorCode, stripComments } from 'jsonc-parser';
|
||||||
import type { ParseError, ParseOptions } from 'jsonc-parser';
|
import type { ParseError, ParseOptions } from 'jsonc-parser';
|
||||||
import LinesAndColumn from 'lines-and-columns';
|
import { LinesAndColumns } from 'lines-and-columns';
|
||||||
|
|
||||||
export { stripComments as stripJsonComments };
|
export { stripComments as stripJsonComments };
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ function formatParseError(
|
|||||||
numContextLine: number
|
numContextLine: number
|
||||||
) {
|
) {
|
||||||
const { error, offset, length } = parseError;
|
const { error, offset, length } = parseError;
|
||||||
const { line, column } = new LinesAndColumn(input).locationForIndex(offset);
|
const { line, column } = new LinesAndColumns(input).locationForIndex(offset);
|
||||||
|
|
||||||
const errorLines = [
|
const errorLines = [
|
||||||
`${printParseErrorCode(error)} in JSON at ${line + 1}:${column + 1}`,
|
`${printParseErrorCode(error)} in JSON at ${line + 1}:${column + 1}`,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user