Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: add trailing commas in stream source files #46686

Merged
merged 1 commit into from Feb 18, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/.eslintrc.yaml
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
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
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
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
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
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
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
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
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
42 changes: 21 additions & 21 deletions lib/internal/streams/readable.js
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,8 +65,8 @@ const {
ERR_OUT_OF_RANGE,
ERR_STREAM_PUSH_AFTER_EOF,
ERR_STREAM_UNSHIFT_AFTER_END_EVENT,
ERR_UNKNOWN_ENCODING
}
ERR_UNKNOWN_ENCODING,
},
} = require('internal/errors');
const { validateObject } = require('internal/validators');

Expand Down Expand Up @@ -1174,15 +1174,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 @@ -1194,23 +1194,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 @@ -1223,46 +1223,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 @@ -1281,15 +1281,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 @@ -1300,7 +1300,7 @@ ObjectDefineProperties(ReadableState.prototype, {
__proto__: null,
get() {
return this.pipes.length;
}
},
},

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

// Exposed for testing purposes only.
Expand Down Expand Up @@ -1426,6 +1426,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
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
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