remove the redundant stylus-lang warning filter

This commit is contained in:
tophf 2020-10-09 19:40:11 +03:00
parent 707cd6576f
commit 11ce144efb

View File

@ -20,14 +20,10 @@
} }
}); });
function stylelint(text, config, mode) { function stylelint(text, config) {
return editorWorker.stylelint(text, config) return editorWorker.stylelint(text, config)
.then(({results}) => { .then(({results}) => !results[0] ? [] :
if (!results[0]) { results[0].warnings.map(({line, column: ch, text, severity}) => ({
return [];
}
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
@ -36,13 +32,7 @@
.replace(/\s*\([^(]+\)$/, ''), // strip the rule, .replace(/\s*\([^(]+\)$/, ''), // strip the rule,
rule: text.replace(/^.*?\s*\(([^(]+)\)$/, '$1'), rule: text.replace(/^.*?\s*\(([^(]+)\)$/, '$1'),
severity, severity,
}) })));
);
return mode !== 'stylus' ?
output :
output.filter(({message}) =>
!message.includes('"@css"') || !message.includes('(at-rule-no-unknown)'));
});
} }
function csslint(text, config) { function csslint(text, config) {