summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/rules/max-params.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/lib/rules/max-params.js')
-rw-r--r--tools/eslint/lib/rules/max-params.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/eslint/lib/rules/max-params.js b/tools/eslint/lib/rules/max-params.js
index bbf087092e..85838adacc 100644
--- a/tools/eslint/lib/rules/max-params.js
+++ b/tools/eslint/lib/rules/max-params.js
@@ -6,6 +6,14 @@
"use strict";
//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const lodash = require("lodash");
+
+const astUtils = require("../ast-utils");
+
+//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
@@ -66,10 +74,15 @@ module.exports = {
*/
function checkFunction(node) {
if (node.params.length > numParams) {
- context.report({ node, message: "This function has too many parameters ({{count}}). Maximum allowed is {{max}}.", data: {
- count: node.params.length,
- max: numParams
- } });
+ context.report({
+ node,
+ message: "{{name}} has too many parameters ({{count}}). Maximum allowed is {{max}}.",
+ data: {
+ name: lodash.upperFirst(astUtils.getFunctionNameWithKind(node)),
+ count: node.params.length,
+ max: numParams
+ }
+ });
}
}