Skip to content

Commit f0c4b42

Browse files
demurgossindresorhus
authored andcommitted
Drop dependency on deprecated gulp-util (#121)
Closes #120
1 parent f7471e8 commit f0c4b42

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
var path = require('path');
3-
var gutil = require('gulp-util');
3+
var PluginError = require('plugin-error');
44
var through = require('through2');
55
var tildify = require('tildify');
66
var Checker = require('jscs');
@@ -41,7 +41,7 @@ module.exports = function (opts) {
4141
}
4242

4343
if (file.isStream()) {
44-
cb(new gutil.PluginError('gulp-jscs', 'Streaming not supported'));
44+
cb(new PluginError('gulp-jscs', 'Streaming not supported'));
4545
return;
4646
}
4747

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@
3434
"checker"
3535
],
3636
"dependencies": {
37-
"gulp-util": "^3.0.4",
3837
"jscs": "^3.0.4",
38+
"plugin-error": "^0.1.2",
3939
"through2": "^2.0.0",
4040
"tildify": "^1.0.0"
4141
},
4242
"devDependencies": {
4343
"mocha": "*",
4444
"stream-assert": "^2.0.2",
4545
"temp-write": "^2.1.0",
46+
"vinyl": "^2.1.0",
4647
"xo": "*"
4748
}
4849
}

reporters/fail.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
var PluginError = require('gulp-util').PluginError;
2+
var PluginError = require('plugin-error');
33
var through = require('through2');
44

55
module.exports = function (failImmediately) {

reporters/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
var PluginError = require('gulp-util').PluginError;
2+
var PluginError = require('plugin-error');
33
var through = require('through2');
44
var loadReporter = require('./load-reporter');
55
var failReporter = require('./fail');

test.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict';
33
var path = require('path');
44
var assert = require('assert');
5-
var gutil = require('gulp-util');
5+
var Vinyl = require('vinyl');
66
var streamAssert = require('stream-assert');
77
var tempWrite = require('temp-write');
88
var jscs = require('./');
@@ -38,13 +38,13 @@ it('should check code style of JS files', function (cb) {
3838
}))
3939
.pipe(streamAssert.end(cb));
4040

41-
stream.write(new gutil.File({
41+
stream.write(new Vinyl({
4242
base: __dirname,
4343
path: path.join(__dirname, 'fixture.js'),
4444
contents: new Buffer('var x = 1,y = 2;')
4545
}));
4646

47-
stream.write(new gutil.File({
47+
stream.write(new Vinyl({
4848
base: __dirname,
4949
path: path.join(__dirname, 'fixture2.js'),
5050
contents: new Buffer('var x = { a: 1 };')
@@ -65,7 +65,7 @@ it('should check code style of JS files using a preset', function (cb) {
6565
}))
6666
.pipe(streamAssert.end(cb));
6767

68-
stream.write(new gutil.File({
68+
stream.write(new Vinyl({
6969
base: __dirname,
7070
path: path.join(__dirname, 'fixture.js'),
7171
contents: new Buffer('var x = 1,y = 2;')
@@ -81,7 +81,7 @@ it('should pass valid files', function (cb) {
8181
assert(false, err);
8282
}).on('end', cb).resume();
8383

84-
stream.write(new gutil.File({
84+
stream.write(new Vinyl({
8585
path: path.join(__dirname, 'fixture.js'),
8686
contents: new Buffer('var x = 1; var y = 2;')
8787
}));
@@ -96,7 +96,7 @@ it('should respect "excludeFiles" from config', function (cb) {
9696
assert(false, err);
9797
}).on('end', cb).resume();
9898

99-
stream.write(new gutil.File({
99+
stream.write(new Vinyl({
100100
base: __dirname,
101101
path: path.join(__dirname, 'excluded.js'),
102102
contents: new Buffer('var x = { a: 1 };')
@@ -118,7 +118,7 @@ it('should accept configPath options', function (cb) {
118118
}))
119119
.pipe(streamAssert.end(cb));
120120

121-
stream.write(new gutil.File({
121+
stream.write(new Vinyl({
122122
base: __dirname,
123123
path: path.join(__dirname, 'fixture.js'),
124124
contents: new Buffer('import x from \'x\'; var x = 1, y = 2;')
@@ -138,7 +138,7 @@ it('should accept the fix option', function (cb) {
138138

139139
stream.on('end', cb);
140140

141-
stream.write(new gutil.File({
141+
stream.write(new Vinyl({
142142
base: __dirname,
143143
path: path.join(__dirname, 'fixture.js'),
144144
contents: new Buffer('var x = { a: 1, b: 2 }')
@@ -169,13 +169,13 @@ it('should run autofix over as many errors as possible', function (done) {
169169
}))
170170
.pipe(streamAssert.end(done));
171171

172-
stream.write(new gutil.File({
172+
stream.write(new Vinyl({
173173
base: __dirname,
174174
path: path.join(__dirname, 'fixture.js'),
175175
contents: new Buffer(invalidJS)
176176
}));
177177

178-
stream.write(new gutil.File({
178+
stream.write(new Vinyl({
179179
base: __dirname,
180180
path: path.join(__dirname, 'fixture2.js'),
181181
contents: new Buffer(invalidJS)
@@ -201,7 +201,7 @@ describe('Reporter', function () {
201201
cb();
202202
}).resume();
203203

204-
stream.write(new gutil.File({
204+
stream.write(new Vinyl({
205205
base: __dirname,
206206
path: path.join(__dirname, 'fixture.js'),
207207
contents: new Buffer('var x = 1,y = 2;')
@@ -220,7 +220,7 @@ describe('Reporter', function () {
220220
cb();
221221
}).resume();
222222

223-
stream.write(new gutil.File({
223+
stream.write(new Vinyl({
224224
base: __dirname,
225225
path: path.join(__dirname, 'fixture.js'),
226226
contents: new Buffer('var x = 1,y = 2;')
@@ -239,7 +239,7 @@ describe('Reporter', function () {
239239

240240
stream.pipe(jscs.reporter(reporterFn)).resume();
241241

242-
stream.write(new gutil.File({
242+
stream.write(new Vinyl({
243243
base: __dirname,
244244
path: path.join(__dirname, 'fixture.js'),
245245
contents: new Buffer('var x = 1,y = 2;')
@@ -276,13 +276,13 @@ describe('Reporter', function () {
276276
cb();
277277
}));
278278

279-
stream.write(new gutil.File({
279+
stream.write(new Vinyl({
280280
base: __dirname,
281281
path: path.join(__dirname, 'fixture.js'),
282282
contents: new Buffer('var x = 1,y = 2;')
283283
}));
284284

285-
stream.write(new gutil.File({
285+
stream.write(new Vinyl({
286286
base: __dirname,
287287
path: path.join(__dirname, 'passing.js'),
288288
contents: new Buffer('var x = 1; var y = 2;')
@@ -305,13 +305,13 @@ describe('Reporter', function () {
305305
}))
306306
.pipe(streamAssert.end());
307307

308-
stream.write(new gutil.File({
308+
stream.write(new Vinyl({
309309
base: __dirname,
310310
path: path.join(__dirname, 'fixture.js'),
311311
contents: new Buffer('var x = 1,y = 2;')
312312
}));
313313

314-
stream.write(new gutil.File({
314+
stream.write(new Vinyl({
315315
base: __dirname,
316316
path: path.join(__dirname, 'passing.js'),
317317
contents: new Buffer('var x = 1; var y = 2;')

0 commit comments

Comments
 (0)