Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ module.exports = function gulpStylelint(options) {
file.contents = Buffer.from(lintResult.output);
}

file.stylelint = lintResult;

done(null, file);

return lintResult;
Expand Down
17 changes: 17 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const gulp = require('gulp');
const gulpSourcemaps = require('gulp-sourcemaps');
const path = require('path');
const test = require('tape');
const { Transform } = require('stream');

const gulpStylelint = require('../src/index');

Expand Down Expand Up @@ -53,6 +54,22 @@ test('should emit an error when linter complains', t => {
.on('error', () => t.pass('error has been emitted correctly'));
});

test('should pass linter result down to stream', t => {
t.plan(1);
gulp
.src(fixtures('basic.css'))
.pipe(gulpStylelint({config: {rules: {
'color-hex-case': 'lower'
}}}))
.pipe(new Transform({
objectMode: true,
transform: (file, enc, cb) => {
t.equal(file.stylelint.errored, false, 'has no errors');
cb(null, file);
}
}));
});

test('should ignore file', t => {
t.plan(1);
gulp
Expand Down