suppress stylelint warning for stylus-lang's @css block

fixes #459
This commit is contained in:
tophf 2018-08-06 15:10:42 +03:00
parent 5f623f2f0e
commit f6a90ad166

View File

@ -15,9 +15,9 @@
severity, severity,
}).filter(Boolean), }).filter(Boolean),
stylelint: ({results}) => stylelint({results}, cm) {
!results[0] && [] || if (!results[0]) return [];
results[0].warnings.map(({line, column: ch, text, severity}) => ({ const output = results[0].warnings.map(({line, column: ch, text, severity}) => ({
from: {line: line - 1, ch: ch - 1}, from: {line: line - 1, ch: ch - 1},
to: {line: line - 1, ch}, to: {line: line - 1, ch},
message: text message: text
@ -26,12 +26,18 @@
.replace(/\s*\([^(]+\)$/, ''), // strip the rule, .replace(/\s*\([^(]+\)$/, ''), // strip the rule,
rule: text.replace(/^.*?\s*\(([^(]+)\)$/, '$1'), rule: text.replace(/^.*?\s*\(([^(]+)\)$/, '$1'),
severity, 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 config = linterConfig.getCurrent();
const cook = cookResults[linterConfig.getName()];
return linterConfig.invokeWorker({code, config}) return linterConfig.invokeWorker({code, config})
.then(cookResults[linterConfig.getName()]); .then(data => cook(data, cm));
} }
})(); })();