Bug 1826514: Add eslint rule to disallow 'arguments' in self-hosted code. r=jandem

Use a custom rule instead of the built-in "prefer-rest-params" [1] rule, so we
can adjust the error message to mention `ArgumentsLength()` and `GetArgument()`.

[1] https://eslint.org/docs/latest/rules/prefer-rest-params

Differential Revision: https://phabricator.services.mozilla.com/D174727
This commit is contained in:
André Bargull 2023-04-05 11:25:20 +00:00
Родитель 3c87541fa8
Коммит 1af28ee6dc
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -107,6 +107,11 @@ module.exports = {
message:
"TO_PROPERTY_KEY macro must be called with a simple identifier",
},
{
selector: "Identifier[name='arguments']",
message:
"'arguments' is disallowed, use ArgumentsLength(), GetArgument(n), or rest-parameters",
},
],
},