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: update capitalized-comments eslint rule #26849

Closed
wants to merge 6 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 30 and all lines that
// Ignore all lines that have less characters than 20 and all lines that
// start with something that looks like a variable name or code.
ignorePattern: '^.{0,30}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]|^ std',
ignorePattern: '.{0,20}$|[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 @@ -16,7 +16,7 @@ function CLI(usage, settings) {
if (!(this instanceof CLI)) return new CLI(usage, settings);

if (process.argv.length < 3) {
this.abort(usage); // abort will exit the process
this.abort(usage); // Abort will exit the process
}

this.usage = usage;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Benchmark.prototype.end = function(operations) {
if (elapsed[0] === 0 && elapsed[1] === 0) {
if (!process.env.NODEJS_BENCHMARK_ZERO_ALLOWED)
throw new Error('insufficient clock precision for short benchmark');
// avoid dividing by zero
// Avoid dividing by zero
elapsed[1] = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion benchmark/crypto/hash-stream-creation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// throughput benchmark
// Throughput benchmark
// creates a single hasher, then pushes a bunch of data through it
'use strict';
const common = require('../common.js');
Expand Down
2 changes: 1 addition & 1 deletion benchmark/crypto/hash-stream-throughput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// throughput benchmark
// Throughput benchmark
// creates a single hasher, then pushes a bunch of data through it
'use strict';
const common = require('../common.js');
Expand Down
2 changes: 1 addition & 1 deletion benchmark/fixtures/simple-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const storedUnicode = Object.create(null);

const useDomains = process.env.NODE_USE_DOMAINS;

// set up one global domain.
// Set up one global domain.
if (useDomains) {
var domain = require('domain');
const gdom = domain.create();
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const PORT = common.PORT;
const cluster = require('cluster');
if (cluster.isMaster) {
var bench = common.createBenchmark(main, {
// unicode confuses ab on os x.
// Unicode confuses ab on os x.
type: ['bytes', 'buffer'],
len: [4, 1024, 102400],
c: [50, 500]
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/incoming_headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const common = require('../common.js');
const http = require('http');

const bench = common.createBenchmark(main, {
// unicode confuses ab on os x.
// Unicode confuses ab on os x.
c: [50, 500],
n: [0, 5, 20]
});
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const common = require('../common.js');

const bench = common.createBenchmark(main, {
// unicode confuses ab on os x.
// Unicode confuses ab on os x.
type: ['bytes', 'buffer'],
len: [4, 1024, 102400],
chunks: [1, 4],
Expand Down
2 changes: 1 addition & 1 deletion benchmark/net/net-c2s-cork.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function main({ dur, len, type }) {

const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const server = net.createServer((socket) => {
socket.pipe(writer);
});
Expand Down
2 changes: 1 addition & 1 deletion benchmark/net/net-c2s.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function main({ dur, len, type }) {
const reader = new Reader();
const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const server = net.createServer((socket) => {
socket.pipe(writer);
});
Expand Down
2 changes: 1 addition & 1 deletion benchmark/net/net-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function main({ dur, len, type }) {
const reader = new Reader();
const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const server = net.createServer((socket) => {
socket.pipe(socket);
});
Expand Down
2 changes: 1 addition & 1 deletion benchmark/net/net-s2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function main({ dur, len, type }) {
const reader = new Reader();
const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const server = net.createServer((socket) => {
reader.pipe(socket);
});
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 @@ -38,7 +38,7 @@ function main({ dur, len, type }) {
const reader = new Reader();
const writer = new Writer();

// the actual benchmark.
// The actual benchmark.
const fakeSocket = new JSStreamWrap(new PassThrough());
bench.start();
reader.pipe(fakeSocket);
Expand Down
6 changes: 3 additions & 3 deletions benchmark/url/legacy-vs-whatwg-url-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, {

function useLegacy(data) {
const len = data.length;
var result = url.parse(data[0]); // avoid dead code elimination
var result = url.parse(data[0]); // Avoid dead code elimination
bench.start();
for (var i = 0; i < len; ++i) {
result = url.parse(data[i]);
Expand All @@ -24,7 +24,7 @@ function useLegacy(data) {

function useWHATWGWithBase(data) {
const len = data.length;
var result = new URL(data[0][0], data[0][1]); // avoid dead code elimination
var result = new URL(data[0][0], data[0][1]); // Avoid dead code elimination
bench.start();
for (var i = 0; i < len; ++i) {
const item = data[i];
Expand All @@ -36,7 +36,7 @@ function useWHATWGWithBase(data) {

function useWHATWGWithoutBase(data) {
const len = data.length;
var result = new URL(data[0]); // avoid dead code elimination
var result = new URL(data[0]); // Avoid dead code elimination
bench.start();
for (var i = 0; i < len; ++i) {
result = new URL(data[i]);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/url/url-searchparams-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const common = require('../common.js');
const URLSearchParams = require('url').URLSearchParams;

const inputs = {
wpt: 'wpt', // to work around tests
wpt: 'wpt', // To work around tests
empty: '',
sorted: 'a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z',
almostsorted: 'a&b&c&d&e&f&g&i&h&j&k&l&m&n&o&p&q&r&s&t&u&w&v&x&y&z',
Expand Down
2 changes: 1 addition & 1 deletion doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ if (cluster.isMaster) {
} else if (cluster.isWorker) {
const net = require('net');
const server = net.createServer((socket) => {
// connections never end
// Connections never end
});

server.listen(8000);
Expand Down
4 changes: 2 additions & 2 deletions doc/api/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ error output. If `stderr` is not provided, `stdout` is used for `stderr`.
```js
const output = fs.createWriteStream('./stdout.log');
const errorOutput = fs.createWriteStream('./stderr.log');
// custom simple logger
// Custom simple logger
const logger = new Console({ stdout: output, stderr: errorOutput });
// use it like console
const count = 5;
logger.log('count: %d', count);
// in stdout.log: count 5
// In stdout.log: count 5
```

The global `console` is a special `Console` whose output is sent to
Expand Down
12 changes: 5 additions & 7 deletions doc/api/domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ if (cluster.isMaster) {
// But don't keep the process open just for that!
killtimer.unref();

// stop taking new requests.
// Stop taking new requests.
server.close();

// Let the master know we're dead. This will trigger a
Expand Down Expand Up @@ -316,14 +316,13 @@ const d = domain.create();

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

d.on('error', (er) => {
// an error occurred somewhere.
// if we throw it now, it will crash the program
// An error occurred somewhere. If we throw it now, it will crash the program
// with the normal line number and stack message.
});
```
Expand Down Expand Up @@ -377,7 +376,7 @@ function readSomeFile(filename, cb) {
// callback since it is assumed to be the 'Error' argument
// and thus intercepted by the domain.

// if this throws, it will also be passed to the domain
// If this throws, it will also be passed to the domain
// so the error-handling logic can be moved to the 'error'
// event on the domain instead of being repeated throughout
// the program.
Expand All @@ -386,8 +385,7 @@ function readSomeFile(filename, cb) {
}

d.on('error', (er) => {
// an error occurred somewhere.
// if we throw it now, it will crash the program
// An error occurred somewhere. If we throw it now, it will crash the program
// with the normal line number and stack message.
});
```
Expand Down
4 changes: 2 additions & 2 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ program.
try {
require('vm').runInThisContext('binary ! isNotOk');
} catch (err) {
// err will be a SyntaxError
// 'err' will be a SyntaxError.
}
```

Expand All @@ -422,7 +422,7 @@ string would be considered a `TypeError`.

```js
require('url').parse(() => { });
// throws TypeError, since it expected a string
// Throws TypeError, since it expected a string.
```

Node.js will generate and throw `TypeError` instances *immediately* as a form
Expand Down
2 changes: 1 addition & 1 deletion doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');

// logs "log persistently" twice
// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
```
Expand Down
16 changes: 8 additions & 8 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ const proxy = http.createServer((req, res) => {
res.end('okay');
});
proxy.on('connect', (req, cltSocket, head) => {
// connect to an origin server
// Connect to an origin server
const srvUrl = url.parse(`http://${req.url}`);
const srvSocket = net.connect(srvUrl.port, srvUrl.hostname, () => {
cltSocket.write('HTTP/1.1 200 Connection Established\r\n' +
Expand All @@ -370,7 +370,7 @@ proxy.on('connect', (req, cltSocket, head) => {
});
});

// now that proxy is running
// Now that proxy is running
proxy.listen(1337, '127.0.0.1', () => {

// Make a request to a tunneling proxy
Expand Down Expand Up @@ -504,7 +504,7 @@ srv.on('upgrade', (req, socket, head) => {
socket.pipe(socket); // echo back
});

// now that server is running
// Now that server is running
srv.listen(1337, '127.0.0.1', () => {

// make a request
Expand Down Expand Up @@ -626,11 +626,11 @@ request.setHeader('content-type', 'text/html');
request.setHeader('Content-Length', Buffer.byteLength(body));
request.setHeader('Cookie', ['type=ninja', 'language=javascript']);
const contentType = request.getHeader('Content-Type');
// contentType is 'text/html'
// 'contentType' is 'text/html'
const contentLength = request.getHeader('Content-Length');
// contentLength is of type number
// 'contentLength' is of type number
const cookie = request.getHeader('Cookie');
// cookie is of type string[]
// 'cookie' is of type string[]
```

### request.maxHeadersCount
Expand Down Expand Up @@ -745,7 +745,7 @@ req.once('response', (res) => {
const ip = req.socket.localAddress;
const port = req.socket.localPort;
console.log(`Your IP address is ${ip} and your source port is ${port}.`);
// consume response object
// Consume response object
});
```

Expand Down Expand Up @@ -2065,7 +2065,7 @@ req.on('error', (e) => {
console.error(`problem with request: ${e.message}`);
});

// write data to request body
// Write data to request body
req.write(postData);
req.end();
```
Expand Down
2 changes: 1 addition & 1 deletion doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2432,7 +2432,7 @@ const client = http2.connect('http://localhost');

client.on('stream', (pushedStream, requestHeaders) => {
pushedStream.on('push', (responseHeaders) => {
// process response headers
// Process response headers
});
pushedStream.on('data', (chunk) => { /* handle pushed data */ });
});
Expand Down
4 changes: 2 additions & 2 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ process.on('unhandledRejection', (reason, p) => {
});

somePromise.then((res) => {
return reportToUser(JSON.pasre(res)); // note the typo (`pasre`)
}); // no `.catch()` or `.then()`
return reportToUser(JSON.pasre(res)); // Note the typo (`pasre`)
}); // No `.catch()` or `.then()`
```

The following will also trigger the `'unhandledRejection'` event to be
Expand Down
2 changes: 1 addition & 1 deletion doc/api/querystring.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
// Returns 'foo=bar&baz=qux&baz=quux&corge='

querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
// returns 'foo:bar;baz:qux'
// Returns 'foo:bar;baz:qux'
```

By default, characters requiring percent-encoding within the query string will
Expand Down
6 changes: 3 additions & 3 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ pass.unpipe(writable);
// readableFlowing is now false

pass.on('data', (chunk) => { console.log(chunk.toString()); });
pass.write('ok'); // will not emit 'data'
pass.write('ok'); // Will not emit 'data'
pass.resume(); // Must be called to make stream emit 'data'
```

Expand Down Expand Up @@ -1206,7 +1206,7 @@ function parseHeader(stream, callback) {
while (null !== (chunk = stream.read())) {
const str = decoder.write(chunk);
if (str.match(/\n\n/)) {
// found the header boundary
// Found the header boundary
const split = str.split(/\n\n/);
header += split.shift();
const remaining = split.join('\n\n');
Expand All @@ -1219,7 +1219,7 @@ function parseHeader(stream, callback) {
// Now the body of the message can be read from the stream.
callback(null, header, stream);
} else {
// still reading the header.
// Still reading the header.
header += str;
}
}
Expand Down
2 changes: 1 addition & 1 deletion doc/api/timers.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ setImmediatePromise('foobar').then((value) => {
// This is executed after all I/O callbacks.
});

// or with async function
// Or with async function
async function timerExample() {
console.log('Before I/O callbacks');
await setImmediatePromise();
Expand Down
2 changes: 1 addition & 1 deletion doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ option properties directly is also supported.
const util = require('util');
const arr = Array(101).fill(0);

console.log(arr); // logs the truncated array
console.log(arr); // Logs the truncated array
util.inspect.defaultOptions.maxArrayLength = null;
console.log(arr); // logs the full array
```
Expand Down
2 changes: 1 addition & 1 deletion doc/api/zlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ See [Memory Usage Tuning][] for more information on the speed/memory/compression
tradeoffs involved in `zlib` usage.

```js
// client request example
// Client request example
const zlib = require('zlib');
const http = require('http');
const fs = require('fs');
Expand Down
Loading