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

lib: add trailing commas to more internal files #46811

Merged
merged 1 commit into from
Feb 26, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,8 @@ globals:
primordials: false
overrides:
- files:
- ./*/promises.js
- ./_stream_*.js
- ./_tls_common.js
- ./assert/*.js
- ./*/*.js
- ./_*.js
- ./child_process.js
- ./cluster.js
- ./console.js
Expand All @@ -290,7 +288,7 @@ overrides:
- ./internal/js_stream_socket.js
- ./internal/mime.js
- ./internal/modules/*.js
- ./internal/per_context/messageport.js
- ./internal/per_context/*.js
- ./internal/perf/*.js
- ./internal/policy/*.js
- ./internal/priority_queue.js
Expand All @@ -299,7 +297,7 @@ overrides:
- ./internal/readme.md
- ./internal/repl.js
- ./internal/repl/*.js
- ./internal/source_map/prepare_stack_trace.js
- ./internal/source_map/*.js
- ./internal/streams/*.js
- ./internal/structured_clone.js
- ./internal/test/*.js
Expand All @@ -312,15 +310,12 @@ overrides:
- ./internal/webidl.js
- ./internal/webstreams/*.js
- ./module.js
- ./path/*.js
- ./process.js
- ./punycode.js
- ./repl.js
- ./stream/*.js
- ./sys.js
- ./test.js
- ./tls.js
- ./url.js
- ./util/*.js
rules:
comma-dangle: [error, always-multiline]
4 changes: 2 additions & 2 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
__proto__: null,
host: options,
port,
localAddress
localAddress,
};
}

Expand Down Expand Up @@ -551,5 +551,5 @@ function asyncResetHandle(socket) {

module.exports = {
Agent,
globalAgent: new Agent({ keepAlive: true, scheduling: 'lifo', timeout: 5000 })
globalAgent: new Agent({ keepAlive: true, scheduling: 'lifo', timeout: 5000 }),
};
8 changes: 4 additions & 4 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const {
const {
kUniqueHeaders,
parseUniqueHeadersOption,
OutgoingMessage
OutgoingMessage,
} = require('_http_outgoing');
const Agent = require('_http_agent');
const { Buffer } = require('buffer');
Expand All @@ -78,7 +78,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_HTTP_TOKEN,
ERR_INVALID_PROTOCOL,
ERR_UNESCAPED_CHARACTERS
ERR_UNESCAPED_CHARACTERS,
} = codes;
const {
validateInteger,
Expand Down Expand Up @@ -644,7 +644,7 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
httpVersionMajor: res.httpVersionMajor,
httpVersionMinor: res.httpVersionMinor,
headers: res.headers,
rawHeaders: res.rawHeaders
rawHeaders: res.rawHeaders,
});

return 1; // Skip body but don't treat as Upgrade.
Expand Down Expand Up @@ -970,5 +970,5 @@ ClientRequest.prototype.clearTimeout = function clearTimeout(cb) {
};

module.exports = {
ClientRequest
ClientRequest,
};
2 changes: 1 addition & 1 deletion lib/_http_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const incoming = require('_http_incoming');
const {
IncomingMessage,
readStart,
readStop
readStop,
} = incoming;

const kIncomingMessage = Symbol('IncomingMessage');
Expand Down
16 changes: 8 additions & 8 deletions lib/_http_incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const {
StringPrototypeCharCodeAt,
StringPrototypeSlice,
StringPrototypeToLowerCase,
Symbol
Symbol,
} = primordials;

const { Readable, finished } = require('stream');
Expand Down Expand Up @@ -55,7 +55,7 @@ function IncomingMessage(socket) {

if (socket) {
streamOptions = {
highWaterMark: socket.readableHighWaterMark
highWaterMark: socket.readableHighWaterMark,
};
}

Expand Down Expand Up @@ -104,7 +104,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'connection', {
},
set: function(val) {
this.socket = val;
}
},
});

ObjectDefineProperty(IncomingMessage.prototype, 'headers', {
Expand All @@ -124,7 +124,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'headers', {
},
set: function(val) {
this[kHeaders] = val;
}
},
});

ObjectDefineProperty(IncomingMessage.prototype, 'headersDistinct', {
Expand All @@ -144,7 +144,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'headersDistinct', {
},
set: function(val) {
this[kHeadersDistinct] = val;
}
},
});

ObjectDefineProperty(IncomingMessage.prototype, 'trailers', {
Expand All @@ -164,7 +164,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'trailers', {
},
set: function(val) {
this[kTrailers] = val;
}
},
});

ObjectDefineProperty(IncomingMessage.prototype, 'trailersDistinct', {
Expand All @@ -184,7 +184,7 @@ ObjectDefineProperty(IncomingMessage.prototype, 'trailersDistinct', {
},
set: function(val) {
this[kTrailersDistinct] = val;
}
},
});

IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
Expand Down Expand Up @@ -452,5 +452,5 @@ function onError(self, error, cb) {
module.exports = {
IncomingMessage,
readStart,
readStop
readStop,
};
34 changes: 17 additions & 17 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const {
} = require('_http_common');
const {
defaultTriggerAsyncIdScope,
symbols: { async_id_symbol }
symbols: { async_id_symbol },
} = require('internal/async_hooks');
const {
codes: {
Expand All @@ -69,9 +69,9 @@ const {
ERR_STREAM_ALREADY_FINISHED,
ERR_STREAM_WRITE_AFTER_END,
ERR_STREAM_NULL_VALUES,
ERR_STREAM_DESTROYED
ERR_STREAM_DESTROYED,
},
hideStackFrames
hideStackFrames,
} = require('internal/errors');
const { validateString } = require('internal/validators');
const { isUint8Array } = require('internal/util/types');
Expand Down Expand Up @@ -176,36 +176,36 @@ ObjectDefineProperty(OutgoingMessage.prototype, 'writableFinished', {
this.outputSize === 0 &&
(!this.socket || this.socket.writableLength === 0)
);
}
},
});

ObjectDefineProperty(OutgoingMessage.prototype, 'writableObjectMode', {
__proto__: null,
get() {
return false;
}
},
});

ObjectDefineProperty(OutgoingMessage.prototype, 'writableLength', {
__proto__: null,
get() {
return this.outputSize + (this.socket ? this.socket.writableLength : 0);
}
},
});

ObjectDefineProperty(OutgoingMessage.prototype, 'writableHighWaterMark', {
__proto__: null,
get() {
return this.socket ? this.socket.writableHighWaterMark : HIGH_WATER_MARK;
}
},
});

ObjectDefineProperty(OutgoingMessage.prototype, 'writableCorked', {
__proto__: null,
get() {
const corked = this.socket ? this.socket.writableCorked : 0;
return corked + this[kCorked];
}
},
});

ObjectDefineProperty(OutgoingMessage.prototype, '_headers', {
Expand All @@ -226,7 +226,7 @@ ObjectDefineProperty(OutgoingMessage.prototype, '_headers', {
headers[StringPrototypeToLowerCase(name)] = [name, val[name]];
}
}
}, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066')
}, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066'),
});

ObjectDefineProperty(OutgoingMessage.prototype, 'connection', {
Expand All @@ -236,7 +236,7 @@ ObjectDefineProperty(OutgoingMessage.prototype, 'connection', {
},
set: function(val) {
this.socket = val;
}
},
});

ObjectDefineProperty(OutgoingMessage.prototype, '_headerNames', {
Expand Down Expand Up @@ -271,7 +271,7 @@ ObjectDefineProperty(OutgoingMessage.prototype, '_headerNames', {
header[0] = val[keys[i]];
}
}
}, 'OutgoingMessage.prototype._headerNames is deprecated', 'DEP0066')
}, 'OutgoingMessage.prototype._headerNames is deprecated', 'DEP0066'),
});


Expand Down Expand Up @@ -367,7 +367,7 @@ OutgoingMessage.prototype._send = function _send(data, encoding, callback, byteL
this.outputData.unshift({
data: header,
encoding: 'latin1',
callback: null
callback: null,
});
this.outputSize += header.length;
this._onPendingData(header.length);
Expand Down Expand Up @@ -418,7 +418,7 @@ function _storeHeader(firstLine, headers) {
date: false,
expect: false,
trailer: false,
header: firstLine
header: firstLine,
};

if (headers) {
Expand Down Expand Up @@ -810,19 +810,19 @@ ObjectDefineProperty(OutgoingMessage.prototype, 'headersSent', {
__proto__: null,
configurable: true,
enumerable: true,
get: function() { return !!this._header; }
get: function() { return !!this._header; },
});

ObjectDefineProperty(OutgoingMessage.prototype, 'writableEnded', {
__proto__: null,
get: function() { return this.finished; }
get: function() { return this.finished; },
});

ObjectDefineProperty(OutgoingMessage.prototype, 'writableNeedDrain', {
__proto__: null,
get: function() {
return !this.destroyed && !this.finished && this[kNeedDrain];
}
},
});

const crlf_buf = Buffer.from('\r\n');
Expand Down Expand Up @@ -1175,5 +1175,5 @@ module.exports = {
parseUniqueHeadersOption,
validateHeaderName,
validateHeaderValue,
OutgoingMessage
OutgoingMessage,
};
20 changes: 10 additions & 10 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const { ConnectionsList } = internalBinding('http_parser');
const {
kUniqueHeaders,
parseUniqueHeadersOption,
OutgoingMessage
OutgoingMessage,
} = require('_http_outgoing');
const {
kOutHeaders,
Expand All @@ -63,20 +63,20 @@ const {
} = require('internal/http');
const {
defaultTriggerAsyncIdScope,
getOrSetAsyncId
getOrSetAsyncId,
} = require('internal/async_hooks');
const { IncomingMessage } = require('_http_incoming');
const {
connResetException,
codes
codes,
} = require('internal/errors');
const {
ERR_HTTP_REQUEST_TIMEOUT,
ERR_HTTP_HEADERS_SENT,
ERR_HTTP_INVALID_STATUS_CODE,
ERR_HTTP_SOCKET_ENCODING,
ERR_INVALID_ARG_VALUE,
ERR_INVALID_CHAR
ERR_INVALID_CHAR,
} = codes;
const {
kEmptyObject,
Expand All @@ -85,7 +85,7 @@ const {
validateInteger,
validateBoolean,
validateLinkHeaderValue,
validateObject
validateObject,
} = require('internal/validators');
const Buffer = require('buffer').Buffer;
const { setInterval, clearInterval } = require('timers');
Expand Down Expand Up @@ -169,7 +169,7 @@ const STATUS_CODES = {
508: 'Loop Detected', // RFC 5842 7.2
509: 'Bandwidth Limit Exceeded',
510: 'Not Extended', // RFC 2774 7
511: 'Network Authentication Required' // RFC 6585 6
511: 'Network Authentication Required', // RFC 6585 6
};

const kOnExecute = HTTPParser.kOnExecute | 0;
Expand Down Expand Up @@ -663,7 +663,7 @@ function connectionListenerInternal(server, socket) {
// sent to the client.
outgoingData: 0,
requestsCount: 0,
keepAliveTimeoutSet: false
keepAliveTimeoutSet: false,
};
state.onData = socketOnData.bind(undefined,
server, socket, parser, state);
Expand Down Expand Up @@ -922,7 +922,7 @@ function resOnFinish(req, res, socket, state, server) {
request: req,
response: res,
socket,
server
server,
});
}

Expand Down Expand Up @@ -1014,7 +1014,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) {
request: req,
response: res,
socket,
server
server,
});
}

Expand Down Expand Up @@ -1157,5 +1157,5 @@ module.exports = {
setupConnectionsTracking,
storeHTTPOptions,
_connectionListener: connectionListener,
kServerResponse
kServerResponse,
};
Loading