From b4ebef096763e9b271d873413d2f1b21c3f48e7b Mon Sep 17 00:00:00 2001 From: Sam Richard Date: Sat, 29 Aug 2015 17:24:44 -0400 Subject: [PATCH] :bug: Resolve issue with indentation and parens Resolves #46 --- lib/rules/indentation.js | 4 +++- tests/sass/indentation.scss | 4 ++++ tests/scratch.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/rules/indentation.js b/lib/rules/indentation.js index afff1989..12fe9b99 100644 --- a/lib/rules/indentation.js +++ b/lib/rules/indentation.js @@ -67,7 +67,9 @@ module.exports = { } } - if (n.is('block') || n.is('atrulers') || n.is('parentheses')) { + + + if (n.is('block') || n.is('atrulers') || (n.is('parentheses') && !node.is('atruleb'))) { level++; } diff --git a/tests/sass/indentation.scss b/tests/sass/indentation.scss index efe44114..29a01624 100644 --- a/tests/sass/indentation.scss +++ b/tests/sass/indentation.scss @@ -20,6 +20,10 @@ content: 'bar'; .qux { content: 'bar'; } + + @if (1 == 1) { + content: 'foo'; + } } @mixin bar { diff --git a/tests/scratch.js b/tests/scratch.js index 2e0f173a..49ca6c08 100644 --- a/tests/scratch.js +++ b/tests/scratch.js @@ -15,7 +15,7 @@ var lint = require('../index'), // detects = lint.lintFiles('**/*.s+(a|c)ss'); -detects = lint.lintFiles('sass/quotes.scss'); +detects = lint.lintFiles('sass/indentation.scss'); console.log(lint.format(detects));