summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/lib/rules/no-caller.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/lib/rules/no-caller.js')
-rw-r--r--tools/node_modules/eslint/lib/rules/no-caller.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/node_modules/eslint/lib/rules/no-caller.js b/tools/node_modules/eslint/lib/rules/no-caller.js
new file mode 100644
index 0000000000..55a37b7d86
--- /dev/null
+++ b/tools/node_modules/eslint/lib/rules/no-caller.js
@@ -0,0 +1,39 @@
+/**
+ * @fileoverview Rule to flag use of arguments.callee and arguments.caller.
+ * @author Nicholas C. Zakas
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+ meta: {
+ docs: {
+ description: "disallow the use of `arguments.caller` or `arguments.callee`",
+ category: "Best Practices",
+ recommended: false
+ },
+
+ schema: []
+ },
+
+ create(context) {
+
+ return {
+
+ MemberExpression(node) {
+ const objectName = node.object.name,
+ propertyName = node.property.name;
+
+ if (objectName === "arguments" && !node.computed && propertyName && propertyName.match(/^calle[er]$/)) {
+ context.report({ node, message: "Avoid arguments.{{property}}.", data: { property: propertyName } });
+ }
+
+ }
+ };
+
+ }
+};