Skip to content

Commit 3d53b98

Browse files
artyomtrityakJaKXz
authored andcommitted
feat: use the default configuration if none is specified (#33)
* It should work without configuration, just use default one * It should warn user if .stylelintrc file does not exit * Add warnings check
1 parent edf880b commit 3d53b98

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var formatter = require('stylelint/dist/formatters/stringFormatter').default;
1010
var runCompilation = require('./lib/run-compilation');
1111

1212
function apply(options, compiler) {
13+
options = options || {};
1314
var context = options.context || compiler.context;
1415

1516
options = assign({

test/fixtures/test9/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require(getPath('./../../../node_modules/file-loader/index') + '!./test.scss');
2+
3+
console.log('test9');

test/fixtures/test9/test.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
display: block;
3+
}

test/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,20 @@ describe('stylelint-webpack-plugin', function () {
9090
expect(stats.compilation.warnings).to.have.length(1);
9191
});
9292
});
93+
94+
it('works without StyleLintPlugin configuration but posts warnign .stylelintrc file not found', function () {
95+
var config = {
96+
context: './test/fixtures/test9',
97+
entry: './index',
98+
plugins: [
99+
new StyleLintPlugin()
100+
]
101+
};
102+
103+
return pack(assign({}, baseConfig, config))
104+
.then(function (stats) {
105+
expect(stats.compilation.errors).to.have.length(0);
106+
expect(stats.compilation.warnings).to.have.length(0);
107+
});
108+
});
93109
});

0 commit comments

Comments
 (0)