use current-line mode for csslint allow override (#977)

This commit is contained in:
tophf 2020-06-25 19:08:04 +03:00 committed by GitHub
parent 574f11b552
commit 4e146d0e54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -229,30 +229,33 @@ var CSSLint = (() => {
// Example 1: // Example 1:
/* csslint ignore:start */ /* csslint ignore:start */
// the chunk of code where errors won't be reported /*
// the chunk's start is hardwired to the line of the opening comment the chunk of code where errors won't be reported
// the chunk's end is hardwired to the line of the closing comment the chunk's start is hardwired to the line of the opening comment
/* csslint ignore:end */ the chunk's end is hardwired to the line of the closing comment
*/
/* csslint ignore:end */
// Example 2: // Example 2:
// allow rule violations on the current line:
/* csslint allow:rulename1,rulename2,... */ // foo: bar; /* csslint allow:rulename1,rulename2,... */
// allows to break the specified rules on the next single line of code /* csslint allow:rulename1,rulename2,... */ // foo: bar;
// Example 3: // Example 3:
/* csslint rulename1 */ /* csslint rulename1 */
/* csslint rulename2:N */ /* csslint rulename2:N */
/* csslint rulename3:N, rulename4:N */ /* csslint rulename3:N, rulename4:N */
// entire code is affected; /* entire code is affected;
// comments futher down the code extend/override previous comments of this kind * comments futher down the code extend/override previous comments of this kind
// values for N: * values for N (without the backquotes):
// "2" or "true" means "error" `2` or `true` means "error"
// "1" or nothing means "warning" - note in this case ":" can also be omitted `1` or omitted means "warning" (when omitting, the colon can be omitted too)
// "0" or "false" means "ignore" `0` or `false` means "ignore"
// (the quotes are added here for convenience, don't put them in the actual comments) */
function applyEmbeddedOverrides(text, ruleset, allow, ignore) { function applyEmbeddedOverrides(text, ruleset, allow, ignore) {
let ignoreStart = null; let ignoreStart = null;
@ -282,7 +285,7 @@ var CSSLint = (() => {
allowRuleset[allowRule.trim()] = true; allowRuleset[allowRule.trim()] = true;
num++; num++;
}); });
if (num) allow[lineno + 1] = allowRuleset; if (num) allow[lineno] = allowRuleset;
break; break;
} }