hide lint errors for LESS vars

This commit is contained in:
tophf 2022-08-27 21:08:56 +03:00
parent 5379f62c90
commit c5667b0352

View File

@ -149,7 +149,8 @@
/* We hide nonfatal "//" warnings since we lint with sugarss without applying @preprocessor. /* We hide nonfatal "//" warnings since we lint with sugarss without applying @preprocessor.
* We can't easily pre-remove "//" comments which may be inside strings, comments, url(), etc. * We can't easily pre-remove "//" comments which may be inside strings, comments, url(), etc.
* And even if we did, it'd be wrong to hide potential bugs in stylus-lang like #1460 */ * And even if we did, it'd be wrong to hide potential bugs in stylus-lang like #1460 */
const slashCommentAllowed = mode === 'stylus' || mode === 'text/x-less'; const isLess = mode === 'text/x-less';
const slashCommentAllowed = isLess || mode === 'stylus';
const res = []; const res = [];
for (const m of messages) { for (const m of messages) {
if (/deprecation|invalidOption/.test(m.stylelintType)) { if (/deprecation|invalidOption/.test(m.stylelintType)) {
@ -160,7 +161,7 @@
if (slashCommentAllowed && ( if (slashCommentAllowed && (
rule === 'no-invalid-double-slash-comments' || rule === 'no-invalid-double-slash-comments' ||
rule === 'property-no-unknown' && msg.includes('"//"') rule === 'property-no-unknown' && msg.includes('"//"')
)) { ) || isLess && /^unknown at-rule "@[-\w]+:"/.test(msg) /* LESS variables */) {
continue; continue;
} }
res.push({ res.push({