From 1f85ea979ccef3c52ec4ca3263306e527b625498 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 3 Dec 2018 17:15:45 +0100 Subject: 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: https://github.com/nodejs/node/pull/24808 Reviewed-By: Sam Ruby Reviewed-By: Trivikram Kamat Reviewed-By: Ujjwal Sharma Reviewed-By: Sakthipriyan Vairamani --- doc/api/async_hooks.md | 6 +++--- doc/api/crypto.md | 2 +- doc/api/domain.md | 2 +- doc/api/errors.md | 4 ++-- doc/api/events.md | 4 ++-- doc/api/fs.md | 2 +- doc/api/modules.md | 2 +- doc/api/process.md | 2 +- doc/api/stream.md | 2 +- doc/api/util.md | 2 +- doc/api/worker_threads.md | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) (limited to 'doc') diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 6894851ba1..b0a0c7e23c 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -61,12 +61,12 @@ asyncHook.disable(); // resource referenced by "asyncId" may not have been populated. function init(asyncId, type, triggerAsyncId, resource) { } -// before is called just before the resource's callback is called. It can be +// Before is called just before the resource's callback is called. It can be // called 0-N times for handles (e.g. TCPWrap), and will be called exactly 1 // time for requests (e.g. FSReqCallback). function before(asyncId) { } -// after is called just after the resource's callback has finished. +// After is called just after the resource's callback has finished. function after(asyncId) { } // destroy is called when an AsyncWrap instance is destroyed. @@ -159,7 +159,7 @@ const fs = require('fs'); const util = require('util'); function debug(...args) { - // use a function like this one when debugging inside an AsyncHooks callback + // Use a function like this one when debugging inside an AsyncHooks callback fs.writeFileSync('log.out', `${util.format(...args)}\n`, { flag: 'a' }); } ``` diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 3e1de25f75..736ac360c9 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -772,7 +772,7 @@ const uncompressedKey = ECDH.convertKey(compressedKey, 'hex', 'uncompressed'); -// the converted key and the uncompressed public key should be the same +// The converted key and the uncompressed public key should be the same console.log(uncompressedKey === ecdh.getPublicKey('hex')); ``` diff --git a/doc/api/domain.md b/doc/api/domain.md index eec763600e..3a1027f07b 100644 --- a/doc/api/domain.md +++ b/doc/api/domain.md @@ -143,7 +143,7 @@ if (cluster.isMaster) { // a new worker. cluster.worker.disconnect(); - // try to send an error to the request that triggered the problem + // Try to send an error to the request that triggered the problem res.statusCode = 500; res.setHeader('content-type', 'text/plain'); res.end('Oops, there was a problem!\n'); diff --git a/doc/api/errors.md b/doc/api/errors.md index 6c255d0710..f0c118fd59 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -371,7 +371,7 @@ range, or outside the set of options for a given function parameter. ```js require('net').connect(-1); -// throws "RangeError: "port" option should be >= 0 and < 65536: -1" +// Throws "RangeError: "port" option should be >= 0 and < 65536: -1" ``` Node.js will generate and throw `RangeError` instances *immediately* as a form @@ -388,7 +388,7 @@ will do so. ```js doesNotExist; -// throws ReferenceError, doesNotExist is not a variable in this program. +// Throws ReferenceError, doesNotExist is not a variable in this program. ``` Unless an application is dynamically generating and running code, diff --git a/doc/api/events.md b/doc/api/events.md index aafdbcf735..4fcaeb3211 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -638,14 +638,14 @@ emitter.once('log', () => console.log('log once')); const listeners = emitter.rawListeners('log'); const logFnWrapper = listeners[0]; -// logs "log once" to the console and does not unbind the `once` event +// Logs "log once" to the console and does not unbind the `once` event logFnWrapper.listener(); // logs "log once" to the console and removes the listener logFnWrapper(); emitter.on('log', () => console.log('log persistently')); -// will return a new Array with a single function bound by `.on()` above +// Will return a new Array with a single function bound by `.on()` above const newListeners = emitter.rawListeners('log'); // logs "log persistently" twice diff --git a/doc/api/fs.md b/doc/api/fs.md index 7ce8262a3e..1ab47d1760 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1926,7 +1926,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 10 bytes, whereas the actual size is 7 bytes +// Truncate the file to 10 bytes, whereas the actual size is 7 bytes fs.ftruncate(fd, 10, (err) => { assert.ifError(err); console.log(fs.readFileSync('temp.txt')); diff --git a/doc/api/modules.md b/doc/api/modules.md index 28a13fb36d..5292d23897 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -49,7 +49,7 @@ console.log(`The area of mySquare is ${mySquare.area()}`); The `square` module is defined in `square.js`: ```js -// assigning to exports will not modify module, must use module.exports +// Assigning to exports will not modify module, must use module.exports module.exports = class Square { constructor(width) { this.width = width; diff --git a/doc/api/process.md b/doc/api/process.md index 64d93a8760..818bb6ed4a 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -286,7 +286,7 @@ The listener function is called with the following arguments: ```js process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection at:', p, 'reason:', reason); - // application specific logging, throwing an error, or other logic here + // Application specific logging, throwing an error, or other logic here }); somePromise.then((res) => { diff --git a/doc/api/stream.md b/doc/api/stream.md index 5441cb0372..c1f23adae5 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -131,7 +131,7 @@ const server = http.createServer((req, res) => { body += chunk; }); - // the 'end' event indicates that the entire body has been received + // The 'end' event indicates that the entire body has been received req.on('end', () => { try { const data = JSON.parse(body); diff --git a/doc/api/util.md b/doc/api/util.md index 49e3f32289..8c21bef9ae 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -159,7 +159,7 @@ const util = require('util'); const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001'); const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001'); fn1(); // emits a deprecation warning with code DEP0001 -fn2(); // does not emit a deprecation warning because it has the same code +fn2(); // Does not emit a deprecation warning because it has the same code ``` If either the `--no-deprecation` or `--no-warnings` command line flags are diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 0fc133376d..bc9f18402f 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -109,7 +109,7 @@ const { MessageChannel } = require('worker_threads'); const { port1, port2 } = new MessageChannel(); port1.on('message', (message) => console.log('received', message)); port2.postMessage({ foo: 'bar' }); -// prints: received { foo: 'bar' } from the `port1.on('message')` listener +// Prints: received { foo: 'bar' } from the `port1.on('message')` listener ``` ## Class: MessagePort -- cgit v1.2.3