diff options
author | Rich Trott <rtrott@gmail.com> | 2017-04-01 23:06:31 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-04-04 10:24:15 -0700 |
commit | f637703b8693d86b56edc4e6894eefde3e8fc0d4 (patch) | |
tree | 7d1e837ab7bcd60d34599829c701737462c6dd44 /tools | |
parent | 316665235c5a0f5b4aa4e74b6b23e862357635ab (diff) | |
download | android-node-v8-f637703b8693d86b56edc4e6894eefde3e8fc0d4.tar.gz android-node-v8-f637703b8693d86b56edc4e6894eefde3e8fc0d4.tar.bz2 android-node-v8-f637703b8693d86b56edc4e6894eefde3e8fc0d4.zip |
tools: replace custom ESLint timers rule
ESLint 3.19.0 allows the specification of selectors that represent
disallowed syntax. Replace our custom rule for timer arguments with a
pair of `no-restricted-syntax` option objects.
PR-URL: https://github.com/nodejs/node/pull/12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/eslint-rules/timer-arguments.js | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/tools/eslint-rules/timer-arguments.js b/tools/eslint-rules/timer-arguments.js deleted file mode 100644 index 4dd7816ff8..0000000000 --- a/tools/eslint-rules/timer-arguments.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @fileoverview Require at least two arguments when calling setTimeout() or - * setInterval(). - * @author Rich Trott - */ -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -function isTimer(name) { - return ['setTimeout', 'setInterval'].includes(name); -} - -module.exports = function(context) { - return { - 'CallExpression': function(node) { - const name = node.callee.name; - if (isTimer(name) && node.arguments.length < 2) { - context.report(node, `${name} must have at least 2 arguments`); - } - } - }; -}; |