We’re going to start throwing lint errors for unused function arguments.
This matches our existing behaviour of throwing errors for unused variables
within functions. Specifically we will be setting the arguments option
for eslint’s
no-unused-vars rule to after-used
<https://eslint.org/docs/latest/rules/no-unused-vars#args-after-used>.

Unused arguments can be simply leftover after previous refactoring or can
be a sign of bugs where a function is expected to do something with the
argument and doesn’t. Either is a problem as it makes the function
signature misleading.

This lint error won’t be automatically fixable. Automatically fixing is
problematic during development since if you have your IDE configured to
auto-fix whenever saving it removes arguments from functions you are in the
middle of writing. Removing the argument is not always the correct solution
either, it is better for the developer to choose the best solution.

However we will be automatically fixing the over 9,000 existing occurrences
in the tree before turning the rule on. While it is possible we may miss
real bugs by doing this, those bugs are already present and it is simply
not feasible to turn this rule on otherwise.

What we cannot do is warn about or fix callers that are passing too many
arguments to functions. That would require more advanced JavaScript tooling
than we have available in Mozilla code currently.
This work will be tracked in bug 1864896
<https://bugzilla.mozilla.org/show_bug.cgi?id=1864896>.

-- 
You received this message because you are subscribed to the Google Groups 
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CAPMxTNrS%2BnhxhGuR7sxm6-_Ve_ofS%3D1GZvp_fmPGY3K7u6wcWQ%40mail.gmail.com.

Reply via email to