Skip to content

Commit 2540581

Browse files
committed
tools: add 'spaced-comment' into eslint rules
PR-URL: #19596 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent f89f798 commit 2540581

Some content is hidden

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

59 files changed

+169
-193
lines changed

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ module.exports = {
224224
'space-in-parens': ['error', 'never'],
225225
'space-infix-ops': 'error',
226226
'space-unary-ops': 'error',
227+
'spaced-comment': ['error', 'always', {
228+
'block': { 'balanced': true },
229+
'exceptions': ['-']
230+
}],
227231
'strict': ['error', 'global'],
228232
'symbol-description': 'error',
229233
'template-curly-spacing': 'error',

benchmark/buffers/buffer-swap.js

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

55
const bench = common.createBenchmark(main, {
66
aligned: ['true', 'false'],
7-
method: ['swap16', 'swap32', 'swap64'/*, 'htons', 'htonl', 'htonll'*/],
7+
method: ['swap16', 'swap32', 'swap64'/* , 'htons', 'htonl', 'htonll' */],
88
len: [8, 64, 128, 256, 512, 768, 1024, 1536, 2056, 4096, 8192],
99
n: [5e7]
1010
});

doc/api/assert.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ assert.equal(1, '1');
456456
assert.equal(1, 2);
457457
// AssertionError: 1 == 2
458458
assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
459-
//AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
459+
// AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
460460
```
461461

462462
If the values are not equal, an `AssertionError` is thrown with a `message`

doc/api/child_process.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ directly by the shell and special characters (vary based on
166166
need to be dealt with accordingly:
167167
```js
168168
exec('"/path/to/test file/test.sh" arg1 arg2');
169-
//Double quotes are used so that the space in the path is not interpreted as
170-
//multiple arguments
169+
// Double quotes are used so that the space in the path is not interpreted as
170+
// multiple arguments
171171

172172
exec('echo "The \\$HOME variable is $HOME"');
173-
//The $HOME variable is escaped in the first instance, but not in the second
173+
// The $HOME variable is escaped in the first instance, but not in the second
174174
```
175175

176176
**Never pass unsanitized user input to this function. Any input containing shell

doc/api/http2.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ settings do not take effect until the `'localSettings'` event is emitted.
203203
session.settings({ enablePush: false });
204204

205205
session.on('localSettings', (settings) => {
206-
/** use the new settings **/
206+
/* Use the new settings */
207207
});
208208
```
209209

@@ -218,7 +218,7 @@ of the remote settings.
218218

219219
```js
220220
session.on('remoteSettings', (settings) => {
221-
/** use the new settings **/
221+
/* Use the new settings */
222222
});
223223
```
224224

@@ -280,7 +280,7 @@ activity on the `Http2Session` after the configured number of milliseconds.
280280

281281
```js
282282
session.setTimeout(2000);
283-
session.on('timeout', () => { /** .. **/ });
283+
session.on('timeout', () => { /* .. */ });
284284
```
285285

286286
#### http2session.alpnProtocol
@@ -706,8 +706,8 @@ const {
706706
const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
707707
req.on('response', (headers) => {
708708
console.log(headers[HTTP2_HEADER_STATUS]);
709-
req.on('data', (chunk) => { /** .. **/ });
710-
req.on('end', () => { /** .. **/ });
709+
req.on('data', (chunk) => { /* .. */ });
710+
req.on('end', () => { /* .. */ });
711711
});
712712
```
713713

@@ -1928,7 +1928,7 @@ Returns a `ClientHttp2Session` instance.
19281928
const http2 = require('http2');
19291929
const client = http2.connect('https://localhost:1234');
19301930

1931-
/** use the client **/
1931+
/* Use the client */
19321932

19331933
client.close();
19341934
```

doc/api/net.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ in the [`net.createServer()`][] section:
914914
```js
915915
const net = require('net');
916916
const client = net.createConnection({ port: 8124 }, () => {
917-
//'connect' listener
917+
// 'connect' listener
918918
console.log('connected to server!');
919919
client.write('world!\r\n');
920920
});

lib/_http_agent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ Agent.prototype.getName = function getName(options) {
134134
return name;
135135
};
136136

137-
Agent.prototype.addRequest = function addRequest(req, options, port/*legacy*/,
138-
localAddress/*legacy*/) {
137+
Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
138+
localAddress/* legacy */) {
139139
// Legacy API: addRequest(req, host, port, localAddress)
140140
if (typeof options === 'string') {
141141
options = {

lib/_http_client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function ClientRequest(options, cb) {
194194
var posColon = hostHeader.indexOf(':');
195195
if (posColon !== -1 &&
196196
hostHeader.indexOf(':', posColon + 1) !== -1 &&
197-
hostHeader.charCodeAt(0) !== 91/*'['*/) {
197+
hostHeader.charCodeAt(0) !== 91/* '[' */) {
198198
hostHeader = `[${hostHeader}]`;
199199
}
200200

lib/_http_common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
237237
* Verifies that the given val is a valid HTTP token
238238
* per the rules defined in RFC 7230
239239
* See https://tools.ietf.org/html/rfc7230#section-3.2.6
240-
**/
240+
*/
241241
function checkIsHttpToken(val) {
242242
return tokenRegExp.test(val);
243243
}
@@ -248,7 +248,7 @@ const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
248248
* field-value = *( field-content / obs-fold )
249249
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
250250
* field-vchar = VCHAR / obs-text
251-
**/
251+
*/
252252
function checkInvalidHeaderChar(val) {
253253
return headerCharRegex.test(val);
254254
}

lib/buffer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const doFlaggedDeprecation =
170170
* runtime deprecation would introduce too much breakage at this time. It's not
171171
* likely that the Buffer constructors would ever actually be removed.
172172
* Deprecation Code: DEP0005
173-
**/
173+
*/
174174
function Buffer(arg, encodingOrOffset, length) {
175175
doFlaggedDeprecation();
176176
// Common case.
@@ -196,7 +196,7 @@ Object.defineProperty(Buffer, Symbol.species, {
196196
* Buffer.from(array)
197197
* Buffer.from(buffer)
198198
* Buffer.from(arrayBuffer[, byteOffset[, length]])
199-
**/
199+
*/
200200
Buffer.from = function from(value, encodingOrOffset, length) {
201201
if (typeof value === 'string')
202202
return fromString(value, encodingOrOffset);
@@ -260,7 +260,7 @@ function assertSize(size) {
260260
/**
261261
* Creates a new filled Buffer instance.
262262
* alloc(size[, fill[, encoding]])
263-
**/
263+
*/
264264
Buffer.alloc = function alloc(size, fill, encoding) {
265265
assertSize(size);
266266
if (fill !== undefined && size > 0) {
@@ -272,7 +272,7 @@ Buffer.alloc = function alloc(size, fill, encoding) {
272272
/**
273273
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer
274274
* instance. If `--zero-fill-buffers` is set, will zero-fill the buffer.
275-
**/
275+
*/
276276
Buffer.allocUnsafe = function allocUnsafe(size) {
277277
assertSize(size);
278278
return allocate(size);
@@ -282,7 +282,7 @@ Buffer.allocUnsafe = function allocUnsafe(size) {
282282
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled
283283
* Buffer instance that is not allocated off the pre-initialized pool.
284284
* If `--zero-fill-buffers` is set, will zero-fill the buffer.
285-
**/
285+
*/
286286
Buffer.allocUnsafeSlow = function allocUnsafeSlow(size) {
287287
assertSize(size);
288288
return createUnsafeBuffer(size);

0 commit comments

Comments
 (0)