Skip to content

Commit e140d41

Browse files
BridgeARBethGriggs
authored andcommitted
tools: capitalize sentences
This adds the `capitalized-comments` eslint rule to verify that actual sentences use capital letters as starting letters. It ignores special words and all lines below 62 characters. PR-URL: #24808 Reviewed-By: Sam Ruby <rubys@intertwingly.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent ad6104d commit e140d41

File tree

156 files changed

+774
-244
lines changed

Some content is hidden

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

156 files changed

+774
-244
lines changed

.eslintrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ module.exports = {
5858
'arrow-spacing': ['error', { before: true, after: true }],
5959
'block-spacing': 'error',
6060
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
61+
'capitalized-comments': ['error', 'always', {
62+
line: {
63+
// Ignore all lines that have less characters than 62 and all lines that
64+
// start with something that looks like a variable name or code.
65+
ignorePattern: '^.{0,62}$|^ [a-z]+ ?[0-9A-Z_.(/=:-]',
66+
ignoreInlineComments: true,
67+
ignoreConsecutiveComments: true
68+
},
69+
block: {
70+
ignorePattern: '.*'
71+
}
72+
}],
6173
'comma-dangle': ['error', 'only-multiline'],
6274
'comma-spacing': 'error',
6375
'comma-style': 'error',

benchmark/_cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function CLI(usage, settings) {
4949
this.optional[currentOptional] = true;
5050
mode = 'both';
5151
} else {
52-
// expect the next value to be option related (either -- or the value)
52+
// Expect the next value to be option related (either -- or the value)
5353
mode = 'option';
5454
}
5555
} else if (mode === 'option') {

benchmark/child_process/child-process-exec-stdout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function childProcessExecStdout({ dur, len }) {
3131
try {
3232
execSync(`taskkill /f /t /pid ${child.pid}`);
3333
} catch {
34-
// this is a best effort kill. stderr is piped to parent for tracing.
34+
// This is a best effort kill. stderr is piped to parent for tracing.
3535
}
3636
} else {
3737
child.kill();

benchmark/common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Benchmark.prototype._run = function() {
146146
(function recursive(queueIndex) {
147147
const config = self.queue[queueIndex];
148148

149-
// set NODE_RUN_BENCHMARK_FN to indicate that the child shouldn't construct
149+
// Set NODE_RUN_BENCHMARK_FN to indicate that the child shouldn't construct
150150
// a configuration queue, but just execute the benchmark function.
151151
const childEnv = Object.assign({}, process.env);
152152
childEnv.NODE_RUN_BENCHMARK_FN = '';
@@ -187,7 +187,7 @@ Benchmark.prototype.start = function() {
187187
};
188188

189189
Benchmark.prototype.end = function(operations) {
190-
// get elapsed time now and do error checking later for accuracy.
190+
// Get elapsed time now and do error checking later for accuracy.
191191
const elapsed = process.hrtime(this._time);
192192

193193
if (!this._started) {

benchmark/crypto/cipher-stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function main({ api, cipher, type, len, writes }) {
5858

5959
const fn = api === 'stream' ? streamWrite : legacyWrite;
6060

61-
// write data as fast as possible to alice, and have bob decrypt.
61+
// Write data as fast as possible to alice, and have bob decrypt.
6262
// use old API for comparison to v0.8
6363
bench.start();
6464
fn(alice_cipher, bob_cipher, message, encoding, writes);

benchmark/dgram/array-vs-concat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// test UDP send throughput with the multi buffer API against Buffer.concat
1+
// Test UDP send throughput with the multi buffer API against Buffer.concat
22
'use strict';
33

44
const common = require('../common.js');

benchmark/dgram/offset-length.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// test UDP send/recv throughput with the "old" offset/length API
1+
// Test UDP send/recv throughput with the "old" offset/length API
22
'use strict';
33

44
const common = require('../common.js');

benchmark/napi/function_call/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
const assert = require('assert');
88
const common = require('../../common.js');
99

10-
// this fails when we try to open with a different version of node,
10+
// This fails when we try to open with a different version of node,
1111
// which is quite common for benchmarks. so in that case, just
1212
// abort quietly.
1313

benchmark/net/net-wrap-js-stream-passthrough.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// test the speed of .pipe() with JSStream wrapping for PassThrough streams
1+
// Test the speed of .pipe() with JSStream wrapping for PassThrough streams
22
'use strict';
33

44
const common = require('../common.js');

doc/api/async_hooks.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ asyncHook.disable();
6161
// resource referenced by "asyncId" may not have been populated.
6262
function init(asyncId, type, triggerAsyncId, resource) { }
6363

64-
// before is called just before the resource's callback is called. It can be
64+
// Before is called just before the resource's callback is called. It can be
6565
// called 0-N times for handles (e.g. TCPWrap), and will be called exactly 1
6666
// time for requests (e.g. FSReqCallback).
6767
function before(asyncId) { }
6868

69-
// after is called just after the resource's callback has finished.
69+
// After is called just after the resource's callback has finished.
7070
function after(asyncId) { }
7171

7272
// destroy is called when an AsyncWrap instance is destroyed.
@@ -159,7 +159,7 @@ const fs = require('fs');
159159
const util = require('util');
160160

161161
function debug(...args) {
162-
// use a function like this one when debugging inside an AsyncHooks callback
162+
// Use a function like this one when debugging inside an AsyncHooks callback
163163
fs.writeFileSync('log.out', `${util.format(...args)}\n`, { flag: 'a' });
164164
}
165165
```

0 commit comments

Comments
 (0)