From 63a451ee56e32e1622359c9c0a7df076774476e9 Mon Sep 17 00:00:00 2001 From: Dan Purdy Date: Thu, 1 Oct 2015 01:31:43 +0100 Subject: [PATCH] :bug: Fix mixin before declaration issues Add check for declaration node content type Fixes #227 Fixes #230 --- lib/rules/mixins-before-declarations.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/rules/mixins-before-declarations.js b/lib/rules/mixins-before-declarations.js index 285b93e7..0e4ee5bb 100644 --- a/lib/rules/mixins-before-declarations.js +++ b/lib/rules/mixins-before-declarations.js @@ -18,13 +18,22 @@ module.exports = { var depth = 0, declarationCount = [depth]; - parent.traverse( function (item) { + parent.forEach( function (item) { if (item.type === 'ruleset') { depth++; declarationCount[depth] = 0; } else if (item.type === 'declaration') { - declarationCount[depth]++; + if (item.first().is('property')) { + + var prop = item.first(); + + if(prop.first().is('ident')) { + + declarationCount[depth]++; + + } + } } else if (item.type === 'include') { item.forEach('simpleSelector', function (name) {