-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Don't add parameters after functions #97
Comments
I don't see why the API has to change. Just not put the function inline. |
I disagree about that being ideal. I find that API quite weird. There are now two ways to do the same thing. |
Any API that allows unreadable code is not good for me, similarly to why functions should not have 5 parameters. Inline functions are nice but they grow and people don't move them out. Should I open an issue on unicorn? 😃 |
👍 |
have you seen fetch 🙈 fetch('flowers.jpg', {method: 'POST'}) const myRequest = new Request("flowers.jpg", {method: 'POST'});
fetch(myRequest)
I mean, that's pretty common, but I don’t think anyone would prefer |
Maybe we can change signature to
? options can't be a function anyway. |
That sounds almost good but I think |
memoize({
- cb() {
- // .... indention level 2
- },
- cache: new ManyKeysMap,
}) memoize(() => {
+ // .... indention level 1
}) |
They do when you tell them. :p |
Sounds like a linter job, but that rule is complex and I think it's not in the recommended config, so it's easier to just avoid bad patterns at the root |
Lots of things are not diff friendly, like Prettier, and yet… they're worth it. |
While this reads fine:
This is bad practice:
This could be enforced by a linter, since APIs like
addEventListener(string, cb, options)
exist natively, but ideallymemoize
andp-memoize
should accept a single parameter:It complicates types a bit but it requires the much cleaner:
Personal note: I went through this recently in webext-storage-cache, changing
(fn, opts) => {}
to(fnOrOpts) => {}
The text was updated successfully, but these errors were encountered: