Skip to content
Merged
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
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var PluginError = require('plugin-error');
var through = require('through2');
var csslint = require('csslint').CSSLint;
var RcLoader = require('rcloader');
Expand All @@ -16,7 +16,7 @@ var cssLintPlugin = function(options) {
var rcLoader = new RcLoader('.csslintrc', options, { loader: 'async' });
return through.obj(function(file, enc, cb) {
if (file.isNull()) return cb(null, file); // pass along
if (file.isStream()) return cb(new gutil.PluginError('gulp-csslint: Streaming not supported'), file);
if (file.isStream()) return cb(new PluginError('gulp-csslint: Streaming not supported'), file);

var ruleset = {};
// Build a list of all available rules
Expand Down Expand Up @@ -139,7 +139,7 @@ cssLintPlugin.failFormatter = function() {
return cb(null, file);
}

return cb(new gutil.PluginError('gulp-csslint', 'CSSLint failed for ' + file.relative), file);
return cb(new PluginError('gulp-csslint', 'CSSLint failed for ' + file.relative), file);
});
};

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
],
"dependencies": {
"csslint": "^1.0.2",
"gulp-util": "^3.0.7",
"fancy-log": "^1.3.2",
"plugin-error": "^1.0.1",
"rcloader": "^0.2.1",
"through2": "^2.0.1"
"through2": "^2.0.1",
"vinyl": "^2.1.0"
},
"devDependencies": {
"coveralls": "^2.11.12",
Expand Down
11 changes: 6 additions & 5 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
var cssLintPlugin = require('../');
var cssLint = require('csslint').CSSLint;
var should = require('should');
var gutil = require('gulp-util');
var fancyLog = require('fancy-log');
var Vinyl = require('vinyl');
var fs = require('fs');
var path = require('path');
var sinon = require('sinon');

var getFile = function(filePath) {
filePath = 'test/' + filePath;
return new gutil.File({
return new Vinyl({
path: filePath,
cwd: 'test/',
base: path.dirname(filePath),
Expand Down Expand Up @@ -408,7 +409,7 @@ describe('gulp-csslint', function() {
}
});

sinon.stub(gutil, 'log');
sinon.stub(fancyLog, 'info');

formatterStream.on('data', function() {
++a;
Expand All @@ -423,9 +424,9 @@ describe('gulp-csslint', function() {
formatterStream.once('end', function() {
fs.writeFile('test-output.xml', output, function() {
a.should.equal(1);
sinon.assert.notCalled(gutil.log);
sinon.assert.notCalled(fancyLog.info);

gutil.log.restore();
fancyLog.info.restore();

fs.readFile('test-output.xml', function(err, content) {
(err === null).should.be.true;
Expand Down
Loading