This change has now (finally!) landed. Thanks to everyone who was involved
in a fairly epic amount of reviews.

Just to add, we chose to turn on errors for unused function arguments,
unless the argument is prefixed with `_`, so if it makes sense to keep an
argument for describing a functions signature then that is the preferred
way to do it rather than disabling the rule entirely.

On Wed, 29 Nov 2023 at 11:15, Dave Townsend <dtowns...@mozilla.com> wrote:

> 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 
"dev-platform@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dev-platform+unsubscr...@mozilla.org.
To view this discussion on the web visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CAPMxTNqotW_KwDZ1TL%3DNZ1iSgsHCbG_WzrUvs09Lmm_1KPwXxg%40mail.gmail.com.

Reply via email to