Centralize handling of newlines in error detail/context to always replace (consecutive) newlines with a single space.

This commit is contained in:
David Anson 2025-05-04 23:18:51 -07:00
parent db967fd387
commit cdfa934d8d
5 changed files with 21 additions and 45 deletions

View file

@ -310,7 +310,7 @@ module.exports.addErrorDetailIf = addErrorDetailIf;
*/
function addErrorContext(
onError, lineNumber, context, start, end, range, fixInfo) {
context = ellipsify(context.replace(newLineRe, "\n"), start, end);
context = ellipsify(context, start, end);
addError(onError, lineNumber, undefined, context, range, fixInfo);
}
module.exports.addErrorContext = addErrorContext;