report invalid selector in :not() as a warning

to prevent failures when updating usercss styles that have to override [currently] invalid :not() selectors used by the site

see #356
This commit is contained in:
tophf 2018-03-03 17:28:29 +03:00
parent 808ad0f059
commit 5acf815b79
4 changed files with 16 additions and 2 deletions

View File

@ -10,6 +10,7 @@ window.linterConfig.defaults.csslint = {
'duplicate-properties': 1, 'duplicate-properties': 1,
'empty-rules': 1, 'empty-rules': 1,
'errors': 1, 'errors': 1,
'warnings': 1,
'known-properties': 1, 'known-properties': 1,
// Default disabled // Default disabled

View File

@ -59,7 +59,7 @@ var linterConfig = {
// always use default syntax because we don't expose it in config UI // always use default syntax because we don't expose it in config UI
config.syntax = this.defaults.stylelint.syntax; config.syntax = this.defaults.stylelint.syntax;
} }
return config; return Object.assign({}, this.defaults[linter] || {}, config);
} else { } else {
return deepCopy(this.defaults[linter] || {}); return deepCopy(this.defaults[linter] || {});
} }

View File

@ -857,6 +857,19 @@ CSSLint.addRule({
}, },
}); });
CSSLint.addRule({
id: 'warnings',
name: 'Parsing warnings',
desc: 'This rule looks for parser warnings.',
browsers: 'All',
init(parser, reporter) {
parser.addListener('warning', ({message, line, col}) => {
reporter.report(message, line, col, this);
});
},
});
CSSLint.addRule({ CSSLint.addRule({
id: 'fallback-colors', id: 'fallback-colors',
name: 'Require fallback colors', name: 'Require fallback colors',

View File

@ -4627,7 +4627,7 @@ self.parserlib = (() => {
parts[0].modifiers.length + (parts[0].elementName ? 1 : 0) > 1 || parts[0].modifiers.length + (parts[0].elementName ? 1 : 0) > 1 ||
/^:not\b/i.test(parts[0])) { /^:not\b/i.test(parts[0])) {
this.fire({ this.fire({
type: 'error', type: 'warning',
message: `Simple selector expected, but found '${arg.join(', ')}'`, message: `Simple selector expected, but found '${arg.join(', ')}'`,
}, arg[0]); }, arg[0]);
} }