CSSLint: code cosmetics

This commit is contained in:
tophf 2019-02-13 08:25:53 +03:00
parent 99a7fedfb7
commit 113547b917

View File

@ -259,18 +259,15 @@ var CSSLint = (() => {
let ignoreEnd = null; let ignoreEnd = null;
let lineno = 0; let lineno = 0;
let eol = -1; let eol = -1;
let m = RX_EMBEDDED.exec(text); let m;
if (!m) return;
const nextLine = () => { while ((m = RX_EMBEDDED.exec(text))) {
eol = text.indexOf('\n', eol + 1);
if (eol < 0) eol = text.length;
lineno++;
};
do {
// account for the lines between the previous and current match // account for the lines between the previous and current match
while (eol <= m.index) nextLine(); while (eol <= m.index) {
eol = text.indexOf('\n', eol + 1);
if (eol < 0) eol = text.length;
lineno++;
}
const ovr = m[1].toLowerCase(); const ovr = m[1].toLowerCase();
const cmd = ovr.split(':', 1)[0]; const cmd = ovr.split(':', 1)[0];
@ -314,10 +311,10 @@ var CSSLint = (() => {
ruleset[property.trim()] = mapped === undefined ? 1 : mapped; ruleset[property.trim()] = mapped === undefined ? 1 : mapped;
}); });
} }
} while ((m = RX_EMBEDDED.exec(text))); }
// Close remaining ignore block, if any // Close remaining ignore block, if any
if (ignoreStart !== null) { if (ignoreStart) {
ignore.push([ignoreStart, lineno]); ignore.push([ignoreStart, lineno]);
} }
} }