Skip to content

Commit

Permalink
Reduce some eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Veeck committed Apr 30, 2019
1 parent 9495a95 commit e2a37ac
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ module.exports = function(editor, jsbeautifyOptions, deepmergeOptions) {

// stream is not supported
if (file.isStream()) {
this.emit('error', new PluginError('gulp-json-editor', 'Streaming is not supported'));
this.emit('error',
new PluginError('gulp-json-editor', 'Streaming is not supported'));
return callback();
}

Expand Down
3 changes: 2 additions & 1 deletion test/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ it('should raise error when missing option', function(done) {


it('should raise error when invalid type of option', function(done) {
should(function() {json(1);}).throw('"editor" option must be a function or object');
should(function() {json(1);})
.throw('"editor" option must be a function or object');
done();
});

Expand Down
16 changes: 12 additions & 4 deletions test/option.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ it('should pass-through second argument to js-beautify', function(done) {
version: '2.0.0',
description: 'this is test',
array: [
'1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890',
'1234567890', '1234567890', '1234567890', '1234567890',
'1234567890', '1234567890', '1234567890', '1234567890',
],
nested: {
version: '2.0.1',
Expand Down Expand Up @@ -52,7 +53,8 @@ it('should keep indentation', function(done) {
version: '2.0.0',
description: 'this is test',
array: [
'1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890',
'1234567890', '1234567890', '1234567890', '1234567890',
'1234567890', '1234567890', '1234567890', '1234567890',
],
nested: {
version: '2.0.1',
Expand Down Expand Up @@ -94,7 +96,8 @@ it('should bypass beautification when property is set', function(done) {
version: '2.0.0',
description: 'this is test',
array: [
'1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890',
'1234567890', '1234567890', '1234567890', '1234567890',
'1234567890', '1234567890', '1234567890', '1234567890',
],
nested: {
version: '2.0.1',
Expand All @@ -106,7 +109,12 @@ it('should bypass beautification when property is set', function(done) {
}));

stream.on('data', function(file) {
var expected = '{"name":"test object","version":"2.0.0","nested":{"name":"nested object","version":"2.0.1","description":"this is test for nested"},"authors":["tom"],"description":"this is test","array":["1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"]}';
var expected = '{"name":"test object","version":"2.0.0",' +
'"nested":{"name":"nested object","version":"2.0.1",' +
'"description":"this is test for nested"},"authors":["tom"],' +
'"description":"this is test",' +
'"array":["1234567890","1234567890","1234567890","1234567890",' +
'"1234567890","1234567890","1234567890","1234567890"]}';
file.contents.toString().should.eql(expected);
done();
});
Expand Down

0 comments on commit e2a37ac

Please sign in to comment.