muting CSSLint's unicode-range warning, muting CSSLint hsl color code warning

This commit is contained in:
Jeremy Schomery 2017-03-03 14:54:02 +03:30
parent 1f8c46e9cf
commit 55fd654713
2 changed files with 20 additions and 3 deletions

View File

@ -19,7 +19,7 @@ CodeMirror.registerHelper("lint", "css", function(text) {
var found = []; var found = [];
if (!window.CSSLint) return found; if (!window.CSSLint) return found;
// STYLISH: hack start /* STYLISH: hack start (part 1) */
var rules = CSSLint.getRules(); var rules = CSSLint.getRules();
var allowedRules = ["display-property-grouping", "duplicate-properties", "empty-rules", "errors", "known-properties"]; var allowedRules = ["display-property-grouping", "duplicate-properties", "empty-rules", "errors", "known-properties"];
CSSLint.clearRules(); CSSLint.clearRules();
@ -28,11 +28,28 @@ CodeMirror.registerHelper("lint", "css", function(text) {
CSSLint.addRule(rule); CSSLint.addRule(rule);
} }
}); });
// STYLISH: hack end /* STYLISH: hack end */
var results = CSSLint.verify(text), messages = results.messages, message = null; var results = CSSLint.verify(text), messages = results.messages, message = null;
for ( var i = 0; i < messages.length; i++) { for ( var i = 0; i < messages.length; i++) {
message = messages[i]; message = messages[i];
/* STYLISH: hack start (part 2) */
if (message.type === 'warning') {
// @font-face {font-family: 'Ampersand'; unicode-range: U+26;}
if (message.message.indexOf('unicode-range') !== -1) {
continue;
}
else if ( // color: hsl(210, 100%, 2.2%);
message.message.startsWith('Expected (<color>) but found \'hsl') &&
/hsl\((\d+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\)/.test(message.message)
) {
continue;
}
//
}
/* STYLISH: hack end */
var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col; var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col;
found.push({ found.push({
from: CodeMirror.Pos(startLine, startCol), from: CodeMirror.Pos(startLine, startCol),

View File

@ -1,6 +1,6 @@
{ {
"name": "Stylus", "name": "Stylus",
"version": "1.0.2", "version": "1.0.3",
"description": "__MSG_description__", "description": "__MSG_description__",
"homepage_url": "https://github.com/schomery/stylish-chrome", "homepage_url": "https://github.com/schomery/stylish-chrome",
"manifest_version": 2, "manifest_version": 2,