Skip to content

Commit

Permalink
feat: use the default configuration if none is specified (#33)
Browse files Browse the repository at this point in the history
* It should work without configuration, just use default one

* It should warn user if .stylelintrc file does not exit

* Add warnings check
  • Loading branch information
artyomtrityak authored and JaKXz committed Sep 30, 2016
1 parent edf880b commit 3d53b98
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var formatter = require('stylelint/dist/formatters/stringFormatter').default;
var runCompilation = require('./lib/run-compilation');

function apply(options, compiler) {
options = options || {};
var context = options.context || compiler.context;

options = assign({
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/test9/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require(getPath('./../../../node_modules/file-loader/index') + '!./test.scss');

console.log('test9');
3 changes: 3 additions & 0 deletions test/fixtures/test9/test.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
display: block;
}
16 changes: 16 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,20 @@ describe('stylelint-webpack-plugin', function () {
expect(stats.compilation.warnings).to.have.length(1);
});
});

it('works without StyleLintPlugin configuration but posts warnign .stylelintrc file not found', function () {
var config = {
context: './test/fixtures/test9',
entry: './index',
plugins: [
new StyleLintPlugin()
]
};

return pack(assign({}, baseConfig, config))
.then(function (stats) {
expect(stats.compilation.errors).to.have.length(0);
expect(stats.compilation.warnings).to.have.length(0);
});
});
});

0 comments on commit 3d53b98

Please sign in to comment.