1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | "use strict";
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | module.exports = function(context) {
|
14 |
|
15 | var config = context.options[0],
|
16 | allowInForAfterthought = false;
|
17 |
|
18 | if (typeof config === "object") {
|
19 | allowInForAfterthought = config.allowForLoopAfterthoughts === true;
|
20 | }
|
21 |
|
22 | return {
|
23 |
|
24 | "UpdateExpression": function(node) {
|
25 | if (allowInForAfterthought && node.parent.type === "ForStatement") {
|
26 | return;
|
27 | }
|
28 | context.report(node, "Unary operator '" + node.operator + "' used.");
|
29 | }
|
30 |
|
31 | };
|
32 |
|
33 | };
|
34 |
|
35 | module.exports.schema = [
|
36 | {
|
37 | "type": "object",
|
38 | "properties": {
|
39 | "allowForLoopAfterthoughts": {
|
40 | "type": "boolean"
|
41 | }
|
42 | },
|
43 | "additionalProperties": false
|
44 | }
|
45 | ];
|