1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | module.exports = function(context) {
|
11 |
|
12 | "use strict";
|
13 |
|
14 | var numParams = context.options[0] || 3;
|
15 |
|
16 | return {
|
17 |
|
18 | "FunctionDeclaration": function(node) {
|
19 | if (node.params.length > numParams) {
|
20 | context.report(node, "This function has too many parameters ({{count}}). Maximum allowed is {{max}}.", {
|
21 | count: node.params.length,
|
22 | max: numParams
|
23 | });
|
24 | }
|
25 | },
|
26 |
|
27 | "FunctionExpression": function(node) {
|
28 | if (node.params.length > numParams) {
|
29 | context.report(node, "This function has too many parameters ({{count}}). Maximum allowed is {{max}}.", {
|
30 | count: node.params.length,
|
31 | max: numParams
|
32 | });
|
33 | }
|
34 | }
|
35 | };
|
36 |
|
37 | };
|