-
Notifications
You must be signed in to change notification settings - Fork 653
chore: add exported-function-args-maximum
Deno Style Guide linter plugin
#6561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: add exported-function-args-maximum
Deno Style Guide linter plugin
#6561
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6561 +/- ##
=======================================
Coverage 94.74% 94.75%
=======================================
Files 583 574 -9
Lines 46478 46516 +38
Branches 6523 6530 +7
=======================================
+ Hits 44036 44074 +38
Misses 2399 2399
Partials 43 43 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we should review all the instances where this rule is ignored. It's a bit of a shame that we ignore this rule in some parts of the codebase. It's a very reasonable rule and not adhering to it could pose a few little backwards compatibility challenges in the future.
@@ -29,6 +29,7 @@ import { AssertionError } from "./assertion_error.ts"; | |||
* default is one hundred thousandth of a percent of the expected value. | |||
* @param msg The optional message to include in the error. | |||
*/ | |||
// deno-lint-ignore deno-style-guide/exported-function-args-maximum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sidenote: bums me out a little that we don't follow this rule in @std/assert
😝
@@ -1,6 +1,7 @@ | |||
// Copyright 2018-2025 the Deno authors. MIT license. | |||
// This module is browser compatible. | |||
|
|||
// deno-lint-ignore deno-style-guide/exported-function-args-maximum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocker: we should have this function just accept an object.
A max of two arguments seems kind of arbitrary and I think we may find many instances where it doesn't make sense |
Note this rule only applies to the public APIs (though this lint rule checks more than that). Internal utilities don't need to follow this. The rule exists from the beginning of the project, and the maintainers keep checking the compliance to it (for example, see this discussion #4651 (comment) ). I think it's reasonable to keep this rule. |
Only the items below look like truly exceptions to this rule to me:
|
I don't think this rule should exclusively apply to the public API. The maintainer can benefit a little by having these symbols accept objects by having removing argument position as a pain point. The changes to do this are trivial too.
We still need to update the style guide. |
This rule is very uncommon and restrictive in my view. I guess many contributors would feel uncomfortable if this rule is enforced everywhere. (See @BlackAsLight's comment for example)
That exception is already covered by the 2nd paragraph of the 2nd point.
|
In this example here, https://github.com/denoland/std/blob/main/encoding/_common64.ts#L54-L60, I'd find it more painful to have to needlessly put it in an object than write it in a particular order. |
To be honest I think the rule is great especially for functions like the one you pointed out. I have no idea what the arguments mean without getting into the meat of the function. JSDocs are only required for public apis, so this rule actually helps to understand the internals too. |
I agree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, barring one nit.
Co-authored-by: Asher Gomez <[email protected]>
Towards #6551