Skip to content

Commit 87534d6

Browse files
TrottMylesBorins
authored andcommittedMay 2, 2017
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: #12504 Reviewed-By: Myles Borins <myles.borins@gmail.com>
1 parent 736a736 commit 87534d6

File tree

2 files changed

+7
-26
lines changed

2 files changed

+7
-26
lines changed
 

‎.eslintrc.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ rules:
100100
new-parens: 2
101101
no-mixed-spaces-and-tabs: 2
102102
no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}]
103+
no-restricted-syntax: [2, {
104+
selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]",
105+
message: "setTimeout() must be invoked with at least two arguments."
106+
}, {
107+
selector: "CallExpression[callee.name='setInterval'][arguments.length<2]",
108+
message: "setInterval() must be invoked with at least 2 arguments"
109+
}]
103110
no-tabs: 2
104111
no-trailing-spaces: 2
105112
operator-linebreak: [2, after, {overrides: {'?': ignore, ':': ignore}}]
@@ -132,7 +139,6 @@ rules:
132139
assert-fail-single-argument: 2
133140
assert-throws-arguments: [2, { requireTwo: false }]
134141
new-with-error: [2, Error, RangeError, TypeError, SyntaxError, ReferenceError]
135-
timer-arguments: 2
136142

137143
# Global scoped method and vars
138144
globals:

‎tools/eslint-rules/timer-arguments.js

-25
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.