-
-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
acceptedbugSomething isn't workingSomething isn't workingrepro:yesIssues with a reproducible exampleIssues with a reproducible example
Description
Environment
ESLint version: 9.36.0
@eslint/json version: 0.13.2
Node version:
npm version:
Operating System:
Which language are you using?
jsonc
What did you do?
import { JSONLanguage, JSONSourceCode } from "@eslint/json";
const file = { body: "{\r/* CR */\r}" };
const language = new JSONLanguage({
mode: "jsonc"
});
const parseResult = language.parse(file);
const sourceCode = new JSONSourceCode({
text: file.body,
ast: parseResult.ast,
});
console.log(sourceCode.lines);
What did you expect to happen?
JSONSourceCode.lines
returns the correct array of lines.getLocFromIndex
andgetIndexFromLoc
return correct line/column positions.
What actually happened?
Lines containing CR were not split, causing incorrect line/column calculations.
Link to Minimal Reproducible Example
n/a
Participation
- I am willing to submit a pull request for this issue.
Additional comments
According to the JSON specification (RFC 8259, Section 2), the allowed whitespace characters are:
- Space ( , U+0020)
- Horizontal tab (\t, U+0009)
- Line feed (\n, U+000A)
- Carriage return (\r, U+000D)
No response
Metadata
Metadata
Assignees
Labels
acceptedbugSomething isn't workingSomething isn't workingrepro:yesIssues with a reproducible exampleIssues with a reproducible example
Type
Projects
Status
Ready to Implement