summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.yaml8
-rw-r--r--tools/eslint-rules/timer-arguments.js25
2 files changed, 7 insertions, 26 deletions
diff --git a/.eslintrc.yaml b/.eslintrc.yaml
index 4ad11a1ffd..f4809c0fc9 100644
--- a/.eslintrc.yaml
+++ b/.eslintrc.yaml
@@ -101,6 +101,13 @@ rules:
new-parens: 2
no-mixed-spaces-and-tabs: 2
no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}]
+ no-restricted-syntax: [2, {
+ selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]",
+ message: "setTimeout() must be invoked with at least two arguments."
+ }, {
+ selector: "CallExpression[callee.name='setInterval'][arguments.length<2]",
+ message: "setInterval() must be invoked with at least 2 arguments"
+ }]
no-tabs: 2
no-trailing-spaces: 2
one-var-declaration-per-line: 2
@@ -135,7 +142,6 @@ rules:
assert-fail-single-argument: 2
assert-throws-arguments: [2, { requireTwo: false }]
new-with-error: [2, Error, RangeError, TypeError, SyntaxError, ReferenceError]
- timer-arguments: 2
no-unescaped-regexp-dot: 2
# Global scoped method and vars
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`);
- }
- }
- };
-};