1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | module.exports = function(context) {
|
11 |
|
12 | "use strict";
|
13 |
|
14 | return {
|
15 | "CallExpression": function(node) {
|
16 |
|
17 | if (node.callee.type === "Identifier") {
|
18 | var callee = node.callee.name;
|
19 |
|
20 | if (callee === "setTimeout" || callee === "setInterval") {
|
21 | var argument = node.arguments[0];
|
22 | if (argument && argument.type === "Literal" && typeof argument.value === "string") {
|
23 | context.report(node, "Implied eval. Consider passing a function instead of a string.");
|
24 | }
|
25 | }
|
26 | }
|
27 | }
|
28 | };
|
29 |
|
30 | };
|