From e458e56862e14752e29a1a72d7c607d91cc8deea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinung=20R=C3=B8saker?= Date: Mon, 31 Mar 2014 13:56:57 +0200 Subject: [PATCH] Remove cruft log + fix boolean check for selectors --- lib/index.js | 2 -- lib/rule/validate/css.js | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/index.js b/lib/index.js index f6d766d..d41014b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -77,8 +77,6 @@ internals.resolveIncludes = function(options){ // todo: dependencies relative to same path? ./ options.validate.forEach(readDependencies); options.preprocess.forEach(readDependencies); - - console.log('options.preprocess', options.preprocess); }; internals.run = function (options, callback) { if (!callback){ diff --git a/lib/rule/validate/css.js b/lib/rule/validate/css.js index c153f3a..ef5266a 100644 --- a/lib/rule/validate/css.js +++ b/lib/rule/validate/css.js @@ -26,9 +26,11 @@ internals.declartionVialoation = function (declarations) { var RE_VALID_FIRST_SELECTOR = /^[#|\.]{1}/; internals.hasSelectorViolation = function (rule) { - return rule && rule.selectors + return !!( + rule && rule.selectors && rule.selectors.length > 0 && !rule.selectors[0].match(RE_VALID_FIRST_SELECTOR) && - internals.declartionVialoation(rule.declarations); + internals.declartionVialoation(rule.declarations) + ); }; internals.reportErrorOnStyleContent = function (config, report) { @@ -50,6 +52,8 @@ internals.reportErrorOnStyleContent = function (config, report) { return; } var method = config.strictRules ? 'error' : 'warn'; + console.log('internals.hasSelectorViolation(rule)', internals.hasSelectorViolation(rule)); + console.log(rule); report[method]('Styling from style-tag without class or ID prefix found: \"' + rule.selectors.join(', ') + '\"', { 'code': internals.getCode(rule)