On Wed, 29 Nov 2023 at 13:00, Marco Bonardo <[email protected]> wrote:
> Apart from the possibility of catching bugs, are there performance > advantages in doing this? > Not that I'm aware of. There will be a small reduction in the physical size of the files of course but probably nothing that really impacts anything. > I sometimes specify arguments even if they are not used, especially when > refactoring code and adding new arguments that avoid the consumer fetching > things in more exotic ways. Unless I update all consumers with the new > argument, people are used to the previous signature and may not notice the > change, then new exotic fetches are added. > It's surely something that the review process should catch, but it's not a > given. > Can you explain this further, I'm not sure I understand what you're saying. > In the bug Gijs suggested supporting a _ prefix to keep arguments, will > that be implemented? > We did not plan to, do you think we should? > Are the 9000 cases covering all the cases of unused arguments, before and > after used arguments? What will it replace unused arguments with, if they > are before used ones? > Those are all cases of unused arguments after any used arguments. Unused arguments before used arguments won't be touched. > On Wed, Nov 29, 2023 at 12:15 PM Dave Townsend <[email protected]> > 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 >> "[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/firefox-dev/CAPMxTNrS%2BnhxhGuR7sxm6-_Ve_ofS%3D1GZvp_fmPGY3K7u6wcWQ%40mail.gmail.com >> <https://groups.google.com/a/mozilla.org/d/msgid/firefox-dev/CAPMxTNrS%2BnhxhGuR7sxm6-_Ve_ofS%3D1GZvp_fmPGY3K7u6wcWQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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/firefox-dev/CAPDqYT2HO8rC7%3DyRXvqamc1RGndaxMrNRmcZJu%2B-_pkO%2Bek%2BbA%40mail.gmail.com > <https://groups.google.com/a/mozilla.org/d/msgid/firefox-dev/CAPDqYT2HO8rC7%3DyRXvqamc1RGndaxMrNRmcZJu%2B-_pkO%2Bek%2BbA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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/CAPMxTNoXv3QLvQ%3DBFmEpwV%3DSr%3DzS3CE72jRNAkEvy6f-yHLMBA%40mail.gmail.com.
