diff --git a/edit/lint-codemirror-helper.js b/edit/lint-codemirror-helper.js index 7b43a0d3..835be8db 100644 --- a/edit/lint-codemirror-helper.js +++ b/edit/lint-codemirror-helper.js @@ -15,9 +15,9 @@ severity, }).filter(Boolean), - stylelint: ({results}) => - !results[0] && [] || - results[0].warnings.map(({line, column: ch, text, severity}) => ({ + stylelint({results}, cm) { + 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 @@ -26,12 +26,18 @@ .replace(/\s*\([^(]+\)$/, ''), // strip the rule, rule: text.replace(/^.*?\s*\(([^(]+)\)$/, '$1'), severity, - })), + })); + return cm.doc.mode.name !== 'stylus' ? + output : + output.filter(({message}) => + !message.includes('"@css"') || !message.includes('(at-rule-no-unknown)')); + }, }; - function invokeHelper(code) { + function invokeHelper(code, options, cm) { const config = linterConfig.getCurrent(); + const cook = cookResults[linterConfig.getName()]; return linterConfig.invokeWorker({code, config}) - .then(cookResults[linterConfig.getName()]); + .then(data => cook(data, cm)); } })();