From 11ce144efb225a1ff3e678fcb918cd4c14f064b4 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 9 Oct 2020 19:40:11 +0300 Subject: [PATCH] remove the redundant stylus-lang warning filter --- edit/linter-engines.js | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/edit/linter-engines.js b/edit/linter-engines.js index 7f7717b8..3b3ca7a1 100644 --- a/edit/linter-engines.js +++ b/edit/linter-engines.js @@ -20,29 +20,19 @@ } }); - function stylelint(text, config, mode) { + function stylelint(text, config) { return editorWorker.stylelint(text, config) - .then(({results}) => { - if (!results[0]) { - return []; - } - const output = results[0].warnings.map(({line, column: ch, text, severity}) => - ({ - from: {line: line - 1, ch: ch - 1}, - to: {line: line - 1, ch}, - message: text - .replace('Unexpected ', '') - .replace(/^./, firstLetter => firstLetter.toUpperCase()) - .replace(/\s*\([^(]+\)$/, ''), // strip the rule, - rule: text.replace(/^.*?\s*\(([^(]+)\)$/, '$1'), - severity, - }) - ); - return mode !== 'stylus' ? - output : - output.filter(({message}) => - !message.includes('"@css"') || !message.includes('(at-rule-no-unknown)')); - }); + .then(({results}) => !results[0] ? [] : + results[0].warnings.map(({line, column: ch, text, severity}) => ({ + from: {line: line - 1, ch: ch - 1}, + to: {line: line - 1, ch}, + message: text + .replace('Unexpected ', '') + .replace(/^./, firstLetter => firstLetter.toUpperCase()) + .replace(/\s*\([^(]+\)$/, ''), // strip the rule, + rule: text.replace(/^.*?\s*\(([^(]+)\)$/, '$1'), + severity, + }))); } function csslint(text, config) {