diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-06-02 12:20:47 +0300 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-06-05 14:27:57 +0300 |
commit | ce8bce497c788a8d4788ff5da7d48cd98228e917 (patch) | |
tree | 11e53d5a7e326f5932a4f79258815f5f2d111dc7 | |
parent | 3d9e7bb1d467765c0dc391798d8f954c98be095e (diff) | |
download | android-node-v8-ce8bce497c788a8d4788ff5da7d48cd98228e917.tar.gz android-node-v8-ce8bce497c788a8d4788ff5da7d48cd98228e917.tar.bz2 android-node-v8-ce8bce497c788a8d4788ff5da7d48cd98228e917.zip |
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: https://github.com/nodejs/node/pull/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>
-rw-r--r-- | doc/.eslintrc.yaml | 1 | ||||
-rw-r--r-- | doc/api/async_hooks.md | 4 | ||||
-rw-r--r-- | doc/api/util.md | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/doc/.eslintrc.yaml b/doc/.eslintrc.yaml index 52e5b7eef9..5b7ea75de5 100644 --- a/doc/.eslintrc.yaml +++ b/doc/.eslintrc.yaml @@ -12,3 +12,4 @@ rules: # add new ECMAScript features gradually no-var: 2 prefer-const: 2 + prefer-rest-params: 2 diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 2cdc160cb9..c2a55a97d3 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -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`); } ``` diff --git a/doc/api/util.md b/doc/api/util.md index ed0f2882e9..839bdadf76 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -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'); |