Skip to content

Commit

Permalink
stream: add trailing commas in stream source files
Browse files Browse the repository at this point in the history
PR-URL: #46686
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
  • Loading branch information
aduh95 authored and MylesBorins committed Feb 20, 2023
1 parent 6ad01fd commit 6b64a94
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 62 deletions.
1 change: 1 addition & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ overrides:
- ./internal/readme.md
- ./internal/repl/history.js
- ./internal/source_map/prepare_stack_trace.js
- ./internal/streams/*.js
- ./internal/structured_clone.js
- ./internal/test/*.js
- ./internal/test_runner/**/*.js
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/buffer_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ module.exports = class BufferList {
// Only inspect one level.
depth: 0,
// It should not recurse.
customInspect: false
customInspect: false,
});
}
};
4 changes: 2 additions & 2 deletions lib/internal/streams/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
kDestroyed,
isDestroyed,
isFinished,
isServerRequest
isServerRequest,
} = require('internal/streams/utils');

const kDestroy = Symbol('kDestroy');
Expand Down Expand Up @@ -334,5 +334,5 @@ module.exports = {
destroyer,
destroy,
undestroy,
errorOrDestroy
errorOrDestroy,
};
4 changes: 2 additions & 2 deletions lib/internal/streams/duplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ ObjectDefineProperties(Duplex.prototype, {
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
}
}
},
},
});

let webStreamsAdapters;
Expand Down
12 changes: 6 additions & 6 deletions lib/internal/streams/duplexify.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {
const { AbortController } = require('internal/abort_controller');

const {
FunctionPrototypeCall
FunctionPrototypeCall,
} = primordials;

// This is needed for pre node 17.
Expand Down Expand Up @@ -91,7 +91,7 @@ module.exports = function duplexify(body, name) {
objectMode: true,
write,
final,
destroy
destroy,
});
}

Expand Down Expand Up @@ -127,7 +127,7 @@ module.exports = function duplexify(body, name) {
}
});
},
destroy
destroy,
});
}

Expand All @@ -143,7 +143,7 @@ module.exports = function duplexify(body, name) {
return from(Duplexify, body, {
// TODO (ronag): highWaterMark?
objectMode: true,
writable: false
writable: false,
});
}

Expand Down Expand Up @@ -192,7 +192,7 @@ module.exports = function duplexify(body, name) {
return d = new Duplexify({
objectMode: true,
writable: false,
read() {}
read() {},
});
}

Expand Down Expand Up @@ -236,7 +236,7 @@ function fromAsyncGen(fn) {
destroy(err, cb) {
ac.abort();
cb(err);
}
},
};
}

Expand Down
4 changes: 2 additions & 2 deletions lib/internal/streams/end-of-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
} = require('internal/errors');
const {
ERR_INVALID_ARG_TYPE,
ERR_STREAM_PREMATURE_CLOSE
ERR_STREAM_PREMATURE_CLOSE,
} = codes;
const {
kEmptyObject,
Expand All @@ -19,7 +19,7 @@ const {
validateAbortSignal,
validateFunction,
validateObject,
validateBoolean
validateBoolean,
} = require('internal/validators');

const { Promise, PromisePrototypeThen } = primordials;
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/streams/from.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { Buffer } = require('buffer');

const {
ERR_INVALID_ARG_TYPE,
ERR_STREAM_NULL_VALUES
ERR_STREAM_NULL_VALUES,
} = require('internal/errors').codes;

function from(Readable, iterable, opts) {
Expand All @@ -21,7 +21,7 @@ function from(Readable, iterable, opts) {
read() {
this.push(iterable);
this.push(null);
}
},
});
}

Expand Down
10 changes: 5 additions & 5 deletions lib/internal/streams/lazy_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const {
const stream = require('stream');

const {
getDefaultEncoding
getDefaultEncoding,
} = require('internal/crypto/util');

module.exports = LazyTransform;
Expand Down Expand Up @@ -43,7 +43,7 @@ function makeSetter(name) {
value: val,
enumerable: true,
configurable: true,
writable: true
writable: true,
});
};
}
Expand All @@ -54,13 +54,13 @@ ObjectDefineProperties(LazyTransform.prototype, {
get: makeGetter('_readableState'),
set: makeSetter('_readableState'),
configurable: true,
enumerable: true
enumerable: true,
},
_writableState: {
__proto__: null,
get: makeGetter('_writableState'),
set: makeSetter('_writableState'),
configurable: true,
enumerable: true
}
enumerable: true,
},
});
6 changes: 3 additions & 3 deletions lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const {

const {
validateFunction,
validateAbortSignal
validateAbortSignal,
} = require('internal/validators');

const {
Expand Down Expand Up @@ -60,7 +60,7 @@ function destroyer(stream, reading, writing) {
finished = true;
destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe'));
},
cleanup
cleanup,
};
}

Expand Down Expand Up @@ -314,7 +314,7 @@ function pipelineImpl(streams, callback, opts) {
// composed through `.pipe(stream)`.

const pt = new PassThrough({
objectMode: true
objectMode: true,
});

// Handle Promises/A+ spec, `then` could be a getter that throws on
Expand Down
40 changes: 20 additions & 20 deletions lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {
Promise,
SafeSet,
SymbolAsyncIterator,
Symbol
Symbol,
} = primordials;

module.exports = Readable;
Expand All @@ -54,7 +54,7 @@ const BufferList = require('internal/streams/buffer_list');
const destroyImpl = require('internal/streams/destroy');
const {
getHighWaterMark,
getDefaultHighWaterMark
getDefaultHighWaterMark,
} = require('internal/streams/state');

const {
Expand All @@ -65,7 +65,7 @@ const {
ERR_OUT_OF_RANGE,
ERR_STREAM_PUSH_AFTER_EOF,
ERR_STREAM_UNSHIFT_AFTER_END_EVENT,
}
},
} = require('internal/errors');
const { validateObject } = require('internal/validators');

Expand Down Expand Up @@ -1166,15 +1166,15 @@ ObjectDefineProperties(Readable.prototype, {
if (this._readableState) {
this._readableState.readable = !!val;
}
}
},
},

readableDidRead: {
__proto__: null,
enumerable: false,
get: function() {
return this._readableState.dataEmitted;
}
},
},

readableAborted: {
Expand All @@ -1186,23 +1186,23 @@ ObjectDefineProperties(Readable.prototype, {
(this._readableState.destroyed || this._readableState.errored) &&
!this._readableState.endEmitted
);
}
},
},

readableHighWaterMark: {
__proto__: null,
enumerable: false,
get: function() {
return this._readableState.highWaterMark;
}
},
},

readableBuffer: {
__proto__: null,
enumerable: false,
get: function() {
return this._readableState && this._readableState.buffer;
}
},
},

readableFlowing: {
Expand All @@ -1215,46 +1215,46 @@ ObjectDefineProperties(Readable.prototype, {
if (this._readableState) {
this._readableState.flowing = state;
}
}
},
},

readableLength: {
__proto__: null,
enumerable: false,
get() {
return this._readableState.length;
}
},
},

readableObjectMode: {
__proto__: null,
enumerable: false,
get() {
return this._readableState ? this._readableState.objectMode : false;
}
},
},

readableEncoding: {
__proto__: null,
enumerable: false,
get() {
return this._readableState ? this._readableState.encoding : null;
}
},
},

errored: {
__proto__: null,
enumerable: false,
get() {
return this._readableState ? this._readableState.errored : null;
}
},
},

closed: {
__proto__: null,
get() {
return this._readableState ? this._readableState.closed : false;
}
},
},

destroyed: {
Expand All @@ -1273,15 +1273,15 @@ ObjectDefineProperties(Readable.prototype, {
// Backward compatibility, the user is explicitly
// managing destroyed.
this._readableState.destroyed = value;
}
},
},

readableEnded: {
__proto__: null,
enumerable: false,
get() {
return this._readableState ? this._readableState.endEmitted : false;
}
},
},

});
Expand All @@ -1292,7 +1292,7 @@ ObjectDefineProperties(ReadableState.prototype, {
__proto__: null,
get() {
return this.pipes.length;
}
},
},

// Legacy property for `paused`.
Expand All @@ -1303,8 +1303,8 @@ ObjectDefineProperties(ReadableState.prototype, {
},
set(value) {
this[kPaused] = !!value;
}
}
},
},
});

// Exposed for testing purposes only.
Expand Down Expand Up @@ -1418,6 +1418,6 @@ Readable.wrap = function(src, options) {
destroy(err, callback) {
destroyImpl.destroyer(src, err);
callback(err);
}
},
}).wrap(src);
};
2 changes: 1 addition & 1 deletion lib/internal/streams/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ function getHighWaterMark(state, options, duplexKey, isDuplex) {

module.exports = {
getHighWaterMark,
getDefaultHighWaterMark
getDefaultHighWaterMark,
};
4 changes: 2 additions & 2 deletions lib/internal/streams/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const {

module.exports = Transform;
const {
ERR_METHOD_NOT_IMPLEMENTED
ERR_METHOD_NOT_IMPLEMENTED,
} = require('internal/errors').codes;
const Duplex = require('internal/streams/duplex');
const { getHighWaterMark } = require('internal/streams/state');
Expand Down Expand Up @@ -99,7 +99,7 @@ function Transform(options) {
// a "bug" where we check needDrain before calling _write and not after.
// Refs: https://github.com/nodejs/node/pull/32887
// Refs: https://github.com/nodejs/node/pull/35941
writableHighWaterMark: options.writableHighWaterMark || 0
writableHighWaterMark: options.writableHighWaterMark || 0,
};
}

Expand Down
Loading

0 comments on commit 6b64a94

Please sign in to comment.