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

tools: capitalize more comments #26483

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ module.exports = {
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'capitalized-comments': ['error', 'always', {
line: {
// Ignore all lines that have less characters than 40 and all lines that
// Ignore all lines that have less characters than 30 and all lines that
// start with something that looks like a variable name or code.
ignorePattern: '^.{0,40}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]|^ std',
ignorePattern: '^.{0,30}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]|^ std',
ignoreInlineComments: true,
ignoreConsecutiveComments: true,
},
Expand Down
2 changes: 1 addition & 1 deletion benchmark/_cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function CLI(usage, settings) {
// item arguments
this.items.push(arg);

// the next value must be an item
// The next value must be an item
mode = 'item';
} else {
// Bad case, abort
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/net-c2s-cork.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// test the speed of .pipe() with sockets
// Test the speed of .pipe() with sockets
'use strict';

const common = require('../common.js');
Expand Down Expand Up @@ -78,7 +78,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
return true;
};

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/net-c2s.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// test the speed of .pipe() with sockets
// Test the speed of .pipe() with sockets
'use strict';

const common = require('../common.js');
Expand Down Expand Up @@ -72,7 +72,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
return true;
};

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/net-pipe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// test the speed of .pipe() with sockets
// Test the speed of .pipe() with sockets
'use strict';

const common = require('../common.js');
Expand Down Expand Up @@ -75,7 +75,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
return true;
};

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/net-s2c.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// test the speed of .pipe() with sockets
// Test the speed of .pipe() with sockets
'use strict';

const common = require('../common.js');
Expand Down Expand Up @@ -73,7 +73,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
return true;
};

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
2 changes: 1 addition & 1 deletion benchmark/net/net-wrap-js-stream-passthrough.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
return true;
};

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/tcp-raw-s2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
const common = require('../common.js');
const util = require('util');

// if there are dur=N and len=N args, then
// If there are dur=N and len=N args, then
// run the function with those settings.
// if not, then queue up a bunch of child processes.
// If not, then queue up a bunch of child processes.
const bench = common.createBenchmark(main, {
len: [102400, 1024 * 1024 * 16],
type: ['utf', 'asc', 'buf'],
Expand Down
2 changes: 1 addition & 1 deletion benchmark/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (format === 'csv') {
for (const key of Object.keys(data.conf)) {
conf += ` ${key}=${JSON.stringify(data.conf[key])}`;
}
// delete first space of the configuration
// Delete first space of the configuration
conf = conf.slice(1);
if (format === 'csv') {
// Escape quotes (") for correct csv formatting
Expand Down
6 changes: 3 additions & 3 deletions benchmark/timers/immediate.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function depth1(N) {
}
}

// concurrent setImmediate, 0 arguments
// Concurrent setImmediate, 0 arguments
function breadth(N) {
var n = 0;
bench.start();
Expand All @@ -71,7 +71,7 @@ function breadth(N) {
}
}

// concurrent setImmediate, 1 argument
// Concurrent setImmediate, 1 argument
function breadth1(N) {
var n = 0;
bench.start();
Expand All @@ -85,7 +85,7 @@ function breadth1(N) {
}
}

// concurrent setImmediate, 4 arguments
// Concurrent setImmediate, 4 arguments
function breadth4(N) {
N /= 2;
var n = 0;
Expand Down
2 changes: 1 addition & 1 deletion doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ if (cluster.isMaster) {
res.writeHead(200);
res.end('hello world\n');

// notify master about the request
// Notify master about the request
process.send({ cmd: 'notifyRequest' });
}).listen(8000);
}
Expand Down
4 changes: 2 additions & 2 deletions doc/api/dgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ server.on('listening', () => {
});

server.bind(41234);
// server listening 0.0.0.0:41234
// Prints: server listening 0.0.0.0:41234
```

## Class: dgram.Socket
Expand Down Expand Up @@ -172,7 +172,7 @@ server.on('listening', () => {
});

server.bind(41234);
// server listening 0.0.0.0:41234
// Prints: server listening 0.0.0.0:41234
```

### socket.bind(options[, callback])
Expand Down
2 changes: 1 addition & 1 deletion doc/api/domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ d.on('error', (er) => {
});
d.run(() => {
process.nextTick(() => {
setTimeout(() => { // simulating some various async stuff
setTimeout(() => { // Simulating some various async stuff
fs.open('non-existent file', 'r', (er, fd) => {
if (er) throw er;
// proceed...
Expand Down
6 changes: 3 additions & 3 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const fs = require('fs');

try {
fs.readFile('/some/file/that/does-not-exist', (err, data) => {
// mistaken assumption: throwing here...
// Mistaken assumption: throwing here...
if (err) {
throw err;
}
Expand Down Expand Up @@ -217,7 +217,7 @@ a string representing the location in the code at which
```js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // similar to `new Error().stack`
myObject.stack; // Similar to `new Error().stack`
```

The first line of the trace will be prefixed with
Expand Down Expand Up @@ -316,7 +316,7 @@ will not be present in the stack traces:
const cheetahify = require('./native-binding.node');

function makeFaster() {
// cheetahify *synchronously* calls speedy.
// `cheetahify()` *synchronously* calls speedy.
cheetahify(function speedy() {
throw new Error('oh no!');
});
Expand Down
6 changes: 3 additions & 3 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,7 @@ console.log(fs.readFileSync('temp.txt', 'utf8'));
// get the file descriptor of the file to be truncated
const fd = fs.openSync('temp.txt', 'r+');

// truncate the file to first four bytes
// Truncate the file to first four bytes
fs.ftruncate(fd, 4, (err) => {
assert.ifError(err);
console.log(fs.readFileSync('temp.txt', 'utf8'));
Expand Down Expand Up @@ -3912,7 +3912,7 @@ async function doTruncate() {
await filehandle.truncate(4);
} finally {
if (filehandle) {
// close the file if it is opened.
// Close the file if it is opened.
await filehandle.close();
}
}
Expand All @@ -3939,7 +3939,7 @@ async function doTruncate() {
await filehandle.truncate(10);
} finally {
if (filehandle) {
// close the file if it is opened.
// Close the file if it is opened.
await filehandle.close();
}
}
Expand Down
10 changes: 5 additions & 5 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ proxy.on('connect', (req, cltSocket, head) => {
// now that proxy is running
proxy.listen(1337, '127.0.0.1', () => {

// make a request to a tunneling proxy
// Make a request to a tunneling proxy
const options = {
port: 1337,
host: '127.0.0.1',
Expand All @@ -387,7 +387,7 @@ proxy.listen(1337, '127.0.0.1', () => {
req.on('connect', (res, socket, head) => {
console.log('got connected!');

// make a request over an HTTP tunnel
// Make a request over an HTTP tunnel
socket.write('GET / HTTP/1.1\r\n' +
'Host: www.google.com:80\r\n' +
'Connection: close\r\n' +
Expand Down Expand Up @@ -1313,7 +1313,7 @@ with any headers passed to [`response.writeHead()`][], with the headers passed
to [`response.writeHead()`][] given precedence.

```js
// returns content-type = text/plain
// Returns content-type = text/plain
const server = http.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.setHeader('X-Foo', 'bar');
Expand Down Expand Up @@ -1506,7 +1506,7 @@ desired with potential future retrieval and modification, use
[`response.setHeader()`][] instead.

```js
// returns content-type = text/plain
// Returns content-type = text/plain
const server = http.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.setHeader('X-Foo', 'bar');
Expand Down Expand Up @@ -1918,7 +1918,7 @@ http.get('http://nodejs.org/dist/index.json', (res) => {
}
if (error) {
console.error(error.message);
// consume response data to free up memory
// Consume response data to free up memory
res.resume();
return;
}
Expand Down
4 changes: 2 additions & 2 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -3138,7 +3138,7 @@ with any headers passed to [`response.writeHead()`][], with the headers passed
to [`response.writeHead()`][] given precedence.

```js
// returns content-type = text/plain
// Returns content-type = text/plain
const server = http2.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.setHeader('X-Foo', 'bar');
Expand Down Expand Up @@ -3332,7 +3332,7 @@ with any headers passed to [`response.writeHead()`][], with the headers passed
to [`response.writeHead()`][] given precedence.

```js
// returns content-type = text/plain
// Returns content-type = text/plain
const server = http2.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.setHeader('X-Foo', 'bar');
Expand Down
2 changes: 1 addition & 1 deletion doc/api/inspector.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ session.post('Profiler.enable', () => {

// some time later...
session.post('Profiler.stop', (err, { profile }) => {
// write profile to disk, upload, etc.
// Write profile to disk, upload, etc.
if (!err) {
fs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile));
}
Expand Down
2 changes: 1 addition & 1 deletion doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ added: v10.12.0
const { createRequireFromPath } = require('module');
const requireUtil = createRequireFromPath('../src/utils');

// require `../src/utils/some-tool`
// Require `../src/utils/some-tool`
requireUtil('./some-tool');
```

Expand Down
2 changes: 1 addition & 1 deletion doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const server = net.createServer((socket) => {
throw err;
});

// grab an arbitrary unused port.
// Grab an arbitrary unused port.
server.listen(() => {
console.log('opened server on', server.address());
});
Expand Down
4 changes: 2 additions & 2 deletions doc/api/perf_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ const {
} = require('perf_hooks');

const obs = new PerformanceObserver((list, observer) => {
// Called three times synchronously. list contains one item
// Called three times synchronously. `list` contains one item.
});
obs.observe({ entryTypes: ['mark'] });

Expand All @@ -346,7 +346,7 @@ const {
} = require('perf_hooks');

const obs = new PerformanceObserver((list, observer) => {
// called once. list contains three items
// Called once. `list` contains three items.
});
obs.observe({ entryTypes: ['mark'], buffered: true });

Expand Down
2 changes: 1 addition & 1 deletion doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ setTimeout(() => {
// [ 1, 552 ]

console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
// benchmark took 1000000552 nanoseconds
// Benchmark took 1000000552 nanoseconds
}, 1000);
```

Expand Down
2 changes: 1 addition & 1 deletion doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ For instance: `[[substr1, substr2, ...], originalsubstring]`.
function completer(line) {
const completions = '.help .error .exit .quit .q'.split(' ');
const hits = completions.filter((c) => c.startsWith(line));
// show all completions if none found
// Show all completions if none found
return [hits.length ? hits : completions, line];
}
```
Expand Down
10 changes: 5 additions & 5 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ function writeOneMillionTimes(writer, data, encoding, callback) {
// last time!
writer.write(data, encoding, callback);
} else {
// see if we should continue, or wait
// don't pass the callback, because we're not done yet.
// See if we should continue, or wait.
// Don't pass the callback, because we're not done yet.
ok = writer.write(data, encoding);
}
} while (i > 0 && ok);
Expand Down Expand Up @@ -418,7 +418,7 @@ const fs = require('fs');
const file = fs.createWriteStream('example.txt');
file.write('hello, ');
file.end('world!');
// writing more now is not allowed!
// Writing more now is not allowed!
```

##### writable.setDefaultEncoding(encoding)
Expand Down Expand Up @@ -819,7 +819,7 @@ cause some amount of data to be read into an internal buffer.
```javascript
const readable = getReadableStreamSomehow();
readable.on('readable', function() {
// there is some data to read now
// There is some data to read now
let data;

while (data = this.read()) {
Expand Down Expand Up @@ -2431,7 +2431,7 @@ net.createServer((socket) => {
socket.end('The message was received but was not processed.\n');
});

// start the flow of data, discarding it.
// Start the flow of data, discarding it.
socket.resume();
}).listen(1337);
```
Expand Down
Loading