noArgumentsCallerOrCallee (JavaScript)
Language JavaScript (and super languages)
Summary
Section titled “Summary”- Rule available since:
v2.6.0 - Diagnostic Category:
lint/nursery/noArgumentsCallerOrCallee - This rule doesn’t have a fix.
- The default severity of this rule is warning.
- Sources:
- Same as
no-caller
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noArgumentsCallerOrCallee": "error" } } }}Description
Section titled “Description”Disallow the use of arguments.caller and arguments.callee.
These deprecated properties prevent JavaScript optimizations and are forbidden in strict mode. Refer to a function by name for recursion, and pass the caller explicitly if you need to access it.
This rule checks dot access, including optional chaining.
It also reports these properties on local variables named arguments.
Computed access such as arguments["callee"] is not checked.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”function factorial(n) { return n <= 1 ? 1 : n * arguments.callee(n - 1);}code-block.js:2:29 lint/nursery/noArgumentsCallerOrCallee ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Do not use arguments.callee.
1 │ function factorial(n) {
> 2 │ return n <= 1 ? 1 : n * arguments.callee(n - 1);
│ ^^^^^^^^^^^^^^^^
3 │ }
4 │
ℹ These deprecated properties are forbidden in strict mode and prevent JavaScript optimizations.
ℹ Refer to the function by name for recursion, and pass the caller explicitly if you need to access it.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
function getCaller() { return arguments.caller;}code-block.js:2:12 lint/nursery/noArgumentsCallerOrCallee ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Do not use arguments.caller.
1 │ function getCaller() {
> 2 │ return arguments.caller;
│ ^^^^^^^^^^^^^^^^
3 │ }
4 │
ℹ These deprecated properties are forbidden in strict mode and prevent JavaScript optimizations.
ℹ Refer to the function by name for recursion, and pass the caller explicitly if you need to access it.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1);}See Also
Section titled “See Also”- To disallow the use of
argumentsentirely, seenoArguments.
Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.