Skip to content

Commit 20410ac

Browse files
committed
fix: sort program.comments by range[0] after appending Glimmer comments
ESLint's SourceCode.tokensAndComments merge and createIndexMap both assume comments are sorted by range[0]; appending Glimmer comments after the TS-parser comments breaks that invariant when a JS block comment sits between templates, producing wrong results from getTokenBefore/getTokenAfter on template comments.
1 parent ef48542 commit 20410ac

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/parser/gjs-gts-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export function parseForESLint(code, options) {
232232
range: c.range,
233233
loc: c.loc,
234234
})),
235-
];
235+
].sort((a, b) => a.range[0] - b.range[0]);
236236
}
237237
}
238238

0 commit comments

Comments
 (0)