From 7262ac697c5b671f36890a176c8bef71ebe1ee3e Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 14 Mar 2021 08:46:30 -0500 Subject: [PATCH] fix: skip checking for the valid range if it is a line-ending issue --- src/helpers.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index e236e9db..d074478a 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -297,12 +297,19 @@ export async function processESLintMessages(messages, textEditor, showRule) { ret.url = rules.getRuleUrl(ruleId) } + // HACK for https://github.com/AtomLinter/linter-eslint/issues/1249 + let fixLineEnding = false + if (ruleId === 'prettier/prettier' && (message === 'Delete `␍`')) { + fixLineEnding = true + } + let range try { if (eslintFullRange) { - const buffer = textEditor.getBuffer() - throwIfInvalidPoint(buffer, msgLine, msgCol) - throwIfInvalidPoint(buffer, msgEndLine, msgEndCol) + if (!fixLineEnding) { + throwIfInvalidPoint(textBuffer, msgLine, msgCol) + throwIfInvalidPoint(textBuffer, msgEndLine, msgEndCol) + } range = [[msgLine, msgCol], [msgEndLine, msgEndCol]] } else { range = generateRange(textEditor, msgLine, msgCol)