Skip to content

Commit

Permalink
doc: use prefer-rest-params eslint rule in docs
Browse files Browse the repository at this point in the history
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 <daijiro.wachi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information
vsemozhetbyt authored and jasnell committed Jun 5, 2017
1 parent 44c8ea3 commit 159294d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ rules:
# add new ECMAScript features gradually
no-var: 2
prefer-const: 2
prefer-rest-params: 2
4 changes: 2 additions & 2 deletions doc/api/async_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ not invoke AsyncHooks recursively because it is synchronous.
const fs = require('fs');
const util = require('util');

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

Expand Down
1 change: 1 addition & 0 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ added: v0.8.0
The `util.deprecate()` method wraps the given `function` or class in such a way that
it is marked as deprecated.

<!-- eslint-disable prefer-rest-params -->
```js
const util = require('util');

Expand Down

0 comments on commit 159294d

Please sign in to comment.