Skip to content

Commit 159294d

Browse files
vsemozhetbytjasnell
authored andcommitted
doc: use prefer-rest-params eslint rule in docs
Do not promote using of `arguments`. One fragment is left as is because of history nature: it uses a real deprecated code from libs. Refs: http://eslint.org/docs/rules/prefer-rest-params Refs: https://github.com/nodejs/node/blob/99da8e8e02a874a0a044889f863c45700509d02c/lib/util.js#L1002-L1006 PR-URL: #13389 Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent 44c8ea3 commit 159294d

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

doc/.eslintrc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ rules:
1212
# add new ECMAScript features gradually
1313
no-var: 2
1414
prefer-const: 2
15+
prefer-rest-params: 2

doc/api/async_hooks.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ not invoke AsyncHooks recursively because it is synchronous.
119119
const fs = require('fs');
120120
const util = require('util');
121121

122-
function debug() {
122+
function debug(...args) {
123123
// use a function like this one when debugging inside an AsyncHooks callback
124-
fs.writeSync(1, util.format.apply(null, arguments));
124+
fs.writeSync(1, `${util.format(...args)}\n`);
125125
}
126126
```
127127

doc/api/util.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ added: v0.8.0
5555
The `util.deprecate()` method wraps the given `function` or class in such a way that
5656
it is marked as deprecated.
5757

58+
<!-- eslint-disable prefer-rest-params -->
5859
```js
5960
const util = require('util');
6061

0 commit comments

Comments
 (0)