Skip to content

Commit

Permalink
Disable postcss-bem-linter when lint is set to false (#68)
Browse files Browse the repository at this point in the history
Fixes #67
  • Loading branch information
simonsmith authored and giuseppeg committed Dec 1, 2016
1 parent 5adc521 commit 9b4e480
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### 3.0.1 (November XX, 2016)

* Fix: Setting `lint` to false also disables `postcss-bem-linter`
* Allow config file to be arbitrarily named
* Fix: `undefined` cli flags don't override config

Expand Down
5 changes: 3 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ function lintFile(css, options, filename) {
var processor = postcss();

if (options.lint) {
processor.use(stylelint(options.stylelint || stylelintConfigSuit));
processor
.use(stylelint(options.stylelint || stylelintConfigSuit))
.use(bemLinter(options['postcss-bem-linter']));
}

// Merge filename alongside any other `postcss` options
Expand All @@ -165,7 +167,6 @@ function lintFile(css, options, filename) {
});

processor
.use(bemLinter(options['postcss-bem-linter']))
.use(reporter(options['postcss-reporter']));

if (isPromise(css)) {
Expand Down
13 changes: 13 additions & 0 deletions test/linting.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@ describe('stylelint', function() {
).to.be.rejectedWith(Error, 'postcss-reporter: warnings or errors were found');
});
});

describe('disabling linting', function() {
it('should not run stylelint or postcss-bem-linter', function() {
return expect(
suitcss('/** @define Foo */\n\n.foo {color: red;}', {
lint: false,
'postcss-reporter': {
throwError: true
}
})
).to.be.fulfilled;
});
});

0 comments on commit 9b4e480

Please sign in to comment.