Skip to content

Commit 2516e9c

Browse files
BridgeARMylesBorins
authored andcommitted
doc,lib,test: capitalize comment sentences
This activates the eslint capitalize comment rule for comments above 50 characters. PR-URL: #24996 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 4513516 commit 2516e9c

File tree

201 files changed

+348
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+348
-348
lines changed

.eslintrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ module.exports = {
6060
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
6161
'capitalized-comments': ['error', 'always', {
6262
line: {
63-
// Ignore all lines that have less characters than 62 and all lines that
63+
// Ignore all lines that have less characters than 50 and all lines that
6464
// start with something that looks like a variable name or code.
65-
ignorePattern: '^.{0,62}$|^ [a-z]+ ?[0-9A-Z_.(/=:-]',
65+
ignorePattern: '^.{0,50}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]',
6666
ignoreInlineComments: true,
6767
ignoreConsecutiveComments: true
6868
},

benchmark/_benchmark_progress.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class BenchmarkProgress {
4040
this.completedConfig = 0;
4141
// Total number of configurations for the current file
4242
this.scheduledConfig = 0;
43-
this.interval = 0; // result of setInterval for updating the elapsed time
43+
this.interval; // Updates the elapsed time.
4444
}
4545

4646
startQueue(index) {

benchmark/napi/function_args/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// show the difference between calling a V8 binding C++ function
1+
// Show the difference between calling a V8 binding C++ function
22
// relative to a comparable N-API C++ function,
33
// in various types/numbers of arguments.
44
// Reports n of calls per second.

benchmark/napi/function_call/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// show the difference between calling a short js function
1+
// Show the difference between calling a short js function
22
// relative to a comparable C++ function.
33
// Reports n of calls per second.
44
// Note that JS speed goes up, while cxx speed stays about the same.

benchmark/net/net-pipe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function main({ dur, len, type }) {
4848
socket.pipe(writer);
4949

5050
setTimeout(function() {
51-
// multiply by 2 since we're sending it first one way
51+
// Multiply by 2 since we're sending it first one way
5252
// then then back again.
5353
const bytes = writer.received * 2;
5454
const gbits = (bytes * 8) / (1024 * 1024 * 1024);

benchmark/net/tcp-raw-c2s.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ function main({ dur, len, type }) {
4747
}, dur * 1000);
4848

4949
clientHandle.onread = function(buffer) {
50-
// we're not expecting to ever get an EOF from the client.
51-
// just lots of data forever.
50+
// We're not expecting to ever get an EOF from the client.
51+
// Just lots of data forever.
5252
if (!buffer)
5353
fail('read');
5454

55-
// don't slice the buffer. the point of this is to isolate, not
55+
// Don't slice the buffer. The point of this is to isolate, not
5656
// simulate real traffic.
5757
bytes += buffer.byteLength;
5858
};

benchmark/net/tcp-raw-pipe.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ function main({ dur, len, type }) {
4444
fail(err, 'connect');
4545

4646
clientHandle.onread = function(buffer) {
47-
// we're not expecting to ever get an EOF from the client.
48-
// just lots of data forever.
47+
// We're not expecting to ever get an EOF from the client.
48+
// Just lots of data forever.
4949
if (!buffer)
5050
fail('read');
5151

@@ -105,7 +105,7 @@ function main({ dur, len, type }) {
105105
clientHandle.readStart();
106106

107107
setTimeout(function() {
108-
// multiply by 2 since we're sending it first one way
108+
// Multiply by 2 since we're sending it first one way
109109
// then then back again.
110110
bench.end(2 * (bytes * 8) / (1024 * 1024 * 1024));
111111
process.exit(0);

benchmark/net/tcp-raw-s2c.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ function main({ dur, len, type }) {
110110
connectReq.oncomplete = function() {
111111
var bytes = 0;
112112
clientHandle.onread = function(buffer) {
113-
// we're not expecting to ever get an EOF from the client.
114-
// just lots of data forever.
113+
// We're not expecting to ever get an EOF from the client.
114+
// Just lots of data forever.
115115
if (!buffer)
116116
fail('read');
117117

118-
// don't slice the buffer. the point of this is to isolate, not
118+
// Don't slice the buffer. The point of this is to isolate, not
119119
// simulate real traffic.
120120
bytes += buffer.byteLength;
121121
};

benchmark/tls/tls-connect.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function makeConnection() {
5959

6060
function done() {
6161
running = false;
62-
// it's only an established connection if they both saw it.
62+
// It's only an established connection if they both saw it.
6363
// because we destroy the server somewhat abruptly, these
6464
// don't always match. Generally, serverConn will be
6565
// the smaller number, but take the min just to be sure.

doc/api/async_hooks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function before(asyncId) { }
6969
// After is called just after the resource's callback has finished.
7070
function after(asyncId) { }
7171

72-
// destroy is called when an AsyncWrap instance is destroyed.
72+
// Destroy is called when an AsyncWrap instance is destroyed.
7373
function destroy(asyncId) { }
7474

7575
// promiseResolve is called only for promise resources, when the

doc/api/cluster.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ if (cluster.isMaster) {
322322

323323
process.on('message', (msg) => {
324324
if (msg === 'shutdown') {
325-
// initiate graceful close of any connections to server
325+
// Initiate graceful close of any connections to server
326326
}
327327
});
328328
}

doc/api/domain.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ const serverDomain = domain.create();
248248
serverDomain.run(() => {
249249
// server is created in the scope of serverDomain
250250
http.createServer((req, res) => {
251-
// req and res are also created in the scope of serverDomain
251+
// Req and res are also created in the scope of serverDomain
252252
// however, we'd prefer to have a separate domain for each request.
253253
// create it first thing, and add req and res to it.
254254
const reqd = domain.create();
@@ -316,7 +316,7 @@ const d = domain.create();
316316

317317
function readSomeFile(filename, cb) {
318318
fs.readFile(filename, 'utf8', d.bind((er, data) => {
319-
// if this throws, it will also be passed to the domain
319+
// If this throws, it will also be passed to the domain
320320
return cb(er, data ? JSON.parse(data) : null);
321321
}));
322322
}

doc/api/esm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ export async function dynamicInstantiate(url) {
242242
return {
243243
exports: ['customExportName'],
244244
execute: (exports) => {
245-
// get and set functions provided for pre-allocated export names
245+
// Get and set functions provided for pre-allocated export names
246246
exports.customExportName.set('value');
247247
}
248248
};

doc/api/events.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ const logFnWrapper = listeners[0];
641641
// Logs "log once" to the console and does not unbind the `once` event
642642
logFnWrapper.listener();
643643

644-
// logs "log once" to the console and removes the listener
644+
// Logs "log once" to the console and removes the listener
645645
logFnWrapper();
646646

647647
emitter.on('log', () => console.log('log persistently'));

doc/api/path.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
299299
// Returns: '/foo/bar/baz/asdf'
300300

301301
path.join('foo', {}, 'bar');
302-
// throws 'TypeError: Path must be a string. Received {}'
302+
// Throws 'TypeError: Path must be a string. Received {}'
303303
```
304304

305305
A [`TypeError`][] is thrown if any of the path segments is not a string.
@@ -495,7 +495,7 @@ path.resolve('/foo/bar', '/tmp/file/');
495495
// Returns: '/tmp/file'
496496

497497
path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif');
498-
// if the current working directory is /home/myself/node,
498+
// If the current working directory is /home/myself/node,
499499
// this returns '/home/myself/node/wwwroot/static_files/gif/image.gif'
500500
```
501501

doc/api/perf_hooks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ const {
331331
} = require('perf_hooks');
332332

333333
const obs = new PerformanceObserver((list, observer) => {
334-
// called three times synchronously. list contains one item
334+
// Called three times synchronously. list contains one item
335335
});
336336
obs.observe({ entryTypes: ['mark'] });
337337

doc/api/stream.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ that implements an HTTP server:
118118
const http = require('http');
119119

120120
const server = http.createServer((req, res) => {
121-
// req is an http.IncomingMessage, which is a Readable Stream
122-
// res is an http.ServerResponse, which is a Writable Stream
121+
// `req` is an http.IncomingMessage, which is a Readable Stream
122+
// `res` is an http.ServerResponse, which is a Writable Stream
123123

124124
let body = '';
125125
// Get the data as utf8 strings.
@@ -1195,7 +1195,7 @@ function parseHeader(stream, callback) {
11951195
stream.removeListener('readable', onReadable);
11961196
if (buf.length)
11971197
stream.unshift(buf);
1198-
// now the body of the message can be read from the stream.
1198+
// Now the body of the message can be read from the stream.
11991199
callback(null, header, stream);
12001200
} else {
12011201
// still reading the header.
@@ -1930,19 +1930,19 @@ pause/resume mechanism, and a data callback, the low-level source can be wrapped
19301930
by the custom `Readable` instance:
19311931

19321932
```js
1933-
// source is an object with readStop() and readStart() methods,
1933+
// `_source` is an object with readStop() and readStart() methods,
19341934
// and an `ondata` member that gets called when it has data, and
19351935
// an `onend` member that gets called when the data is over.
19361936

19371937
class SourceWrapper extends Readable {
19381938
constructor(options) {
19391939
super(options);
19401940

1941-
this._source = getLowlevelSourceObject();
1941+
this._source = getLowLevelSourceObject();
19421942

19431943
// Every time there's data, push it into the internal buffer.
19441944
this._source.ondata = (chunk) => {
1945-
// if push() returns false, then stop reading from source
1945+
// If push() returns false, then stop reading from source
19461946
if (!this.push(chunk))
19471947
this._source.readStop();
19481948
};
@@ -2391,7 +2391,7 @@ For example, consider the following code:
23912391
// WARNING! BROKEN!
23922392
net.createServer((socket) => {
23932393

2394-
// we add an 'end' listener, but never consume the data
2394+
// We add an 'end' listener, but never consume the data
23952395
socket.on('end', () => {
23962396
// It will never get here.
23972397
socket.end('The message was received but was not processed.\n');

doc/api/tracing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ t2.enable();
133133
// Prints 'node,node.perf,v8'
134134
console.log(trace_events.getEnabledCategories());
135135

136-
t2.disable(); // will only disable emission of the 'node.perf' category
136+
t2.disable(); // Will only disable emission of the 'node.perf' category
137137

138138
// Prints 'node,v8'
139139
console.log(trace_events.getEnabledCategories());

doc/api/vm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const sandbox = { x: 2 };
3333
vm.createContext(sandbox); // Contextify the sandbox.
3434

3535
const code = 'x += 40; var y = 17;';
36-
// x and y are global variables in the sandboxed environment.
36+
// `x` and `y` are global variables in the sandboxed environment.
3737
// Initially, x has the value 2 because that is the value of sandbox.x.
3838
vm.runInContext(code, sandbox);
3939

doc/api/zlib.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ request.on('response', (response) => {
8181
const output = fs.createWriteStream('example.com_index.html');
8282

8383
switch (response.headers['content-encoding']) {
84-
// or, just use zlib.createUnzip() to handle both cases
84+
// Or, just use zlib.createUnzip() to handle both cases
8585
case 'gzip':
8686
response.pipe(zlib.createGunzip()).pipe(output);
8787
break;

doc/guides/writing-and-running-benchmarks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ const options = {
397397
flags: ['--zero-fill-buffers']
398398
};
399399

400-
// main and configs are required, options is optional.
400+
// `main` and `configs` are required, `options` is optional.
401401
const bench = common.createBenchmark(main, configs, options);
402402

403403
// Note that any code outside main will be run twice,

lib/_http_client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
556556
req.res = res;
557557
res.req = req;
558558

559-
// add our listener first, so that we guarantee socket cleanup
559+
// Add our listener first, so that we guarantee socket cleanup
560560
res.on('end', responseOnEnd);
561561
req.on('prefinish', requestOnPrefinish);
562562
var handled = req.emit('response', res);

lib/_http_common.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ function parserOnHeadersComplete(versionMajor, versionMinor, headers, method,
116116
function parserOnBody(b, start, len) {
117117
const stream = this.incoming;
118118

119-
// if the stream has already been removed, then drop it.
119+
// If the stream has already been removed, then drop it.
120120
if (stream === null)
121121
return;
122122

123-
// pretend this was the result of a stream._read call.
123+
// Pretend this was the result of a stream._read call.
124124
if (len > 0 && !stream._dumped) {
125125
var slice = b.slice(start, start + len);
126126
var ret = stream.push(slice);

lib/_http_incoming.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function IncomingMessage(socket) {
6868
this.client = socket;
6969

7070
this._consuming = false;
71-
// flag for when we decide that this message cannot possibly be
71+
// Flag for when we decide that this message cannot possibly be
7272
// read by the user, so there's no point continuing to handle it.
7373
this._dumped = false;
7474
}

lib/_http_server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ function resOnFinish(req, res, socket, state, server) {
570570

571571
state.incoming.shift();
572572

573-
// if the user never called req.read(), and didn't pipe() or
573+
// If the user never called req.read(), and didn't pipe() or
574574
// .resume() or .on('data'), then we call req._dump() so that the
575575
// bytes will be pulled off the wire.
576576
if (!req._consuming && !req._readableState.resumeScheduled)

lib/_stream_duplex.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function Duplex(options) {
6767
}
6868

6969
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
70-
// making it explicit this property is not enumerable
70+
// Making it explicit this property is not enumerable
7171
// because otherwise some prototype manipulation in
7272
// userland will fail
7373
enumerable: false,
@@ -77,7 +77,7 @@ Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
7777
});
7878

7979
Object.defineProperty(Duplex.prototype, 'writableBuffer', {
80-
// making it explicit this property is not enumerable
80+
// Making it explicit this property is not enumerable
8181
// because otherwise some prototype manipulation in
8282
// userland will fail
8383
enumerable: false,
@@ -87,7 +87,7 @@ Object.defineProperty(Duplex.prototype, 'writableBuffer', {
8787
});
8888

8989
Object.defineProperty(Duplex.prototype, 'writableLength', {
90-
// making it explicit this property is not enumerable
90+
// Making it explicit this property is not enumerable
9191
// because otherwise some prototype manipulation in
9292
// userland will fail
9393
enumerable: false,
@@ -112,7 +112,7 @@ function onEndNT(self) {
112112
}
113113

114114
Object.defineProperty(Duplex.prototype, 'destroyed', {
115-
// making it explicit this property is not enumerable
115+
// Making it explicit this property is not enumerable
116116
// because otherwise some prototype manipulation in
117117
// userland will fail
118118
enumerable: false,

0 commit comments

Comments
 (0)