Skip to content

Commit 9b4e480

Browse files
simonsmithgiuseppeg
authored andcommitted
Disable postcss-bem-linter when lint is set to false (#68)
Fixes #67
1 parent 5adc521 commit 9b4e480

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### 3.0.1 (November XX, 2016)
44

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

lib/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ function lintFile(css, options, filename) {
156156
var processor = postcss();
157157

158158
if (options.lint) {
159-
processor.use(stylelint(options.stylelint || stylelintConfigSuit));
159+
processor
160+
.use(stylelint(options.stylelint || stylelintConfigSuit))
161+
.use(bemLinter(options['postcss-bem-linter']));
160162
}
161163

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

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

171172
if (isPromise(css)) {

test/linting.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,16 @@ describe('stylelint', function() {
7979
).to.be.rejectedWith(Error, 'postcss-reporter: warnings or errors were found');
8080
});
8181
});
82+
83+
describe('disabling linting', function() {
84+
it('should not run stylelint or postcss-bem-linter', function() {
85+
return expect(
86+
suitcss('/** @define Foo */\n\n.foo {color: red;}', {
87+
lint: false,
88+
'postcss-reporter': {
89+
throwError: true
90+
}
91+
})
92+
).to.be.fulfilled;
93+
});
94+
});

0 commit comments

Comments
 (0)