diff --git a/doc/.eslintrc.yaml b/doc/.eslintrc.yaml index 52e5b7eef91d9c..5b7ea75de5ce4a 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 2cdc160cb99d3d..c2a55a97d33eca 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 ed0f2882e9f4f3..839bdadf76e1ec 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. + ```js const util = require('util');