refactor: rename FreshContext.req to FreshContext.request#2593
refactor: rename FreshContext.req to FreshContext.request#2593timreichen wants to merge 45 commits intodenoland:mainfrom
FreshContext.req to FreshContext.request#2593Conversation
|
@marvinhagemeister Ready for review. |
marvinhagemeister
left a comment
There was a problem hiding this comment.
At Deno here we prefer ctx.req for brevity reasons. Merging this would make my coworkers unhappy. Instead of removing it entirely, you could add a getter to alias ctx.request -> ctx.req.
Are you sure? It seems there are lot of upvotes which agree with the change (#2363 (comment) |
|
@timreichen I don't find Because let's be real, this PR is only nitpicking and personal preference. Deep down it's not important what the name of the variable is as long as it's somewhat clear. I use Hono a lot, it's Apart from you apparently. |
I don't find But this is not about personal preference, it is about consistency and alignment with web apis. What I find would be a personal preference however is to sacrifice consistency over the convenience of saving a few chars. |
|
@marvinhagemeister I think we should resolve this issue soon. I worked a lot on deno @std for the last two years helping to make the mods consistent among each other and follow web api syntax and conventions. So this issue seems like a no-brainer to me. Is there any chance it can be adopted? |
|
Apart from the consistency concerns, I think "req" instead of "request" is also bad because:
In many of the points above, I speak from personal experience. On several occasions, I’ve had to remind work colleagues, non-technical product owners, or even my own tired 3am brain what "req", "res", "opt", "dep", "acc", etc. mean at some line deep in a codebase. And that is where you lose actual time. In our newer codebases, I introduced the aforementioned eslint plugin and code reviews are now 20% more fun (a made up stat, but I hope you get my point). |
|
@marvinhagemeister I added the alias with a deprecation note. I think that way a slow adoption can happen during the alpha releases and before 1.0 is released. WDYT? |
justinmchase
left a comment
There was a problem hiding this comment.
Yes please, also response should be on the context not returned from the next function.
Was this discussed somewhere? I think this might be better in a separate issue/PR. |
|
@marvinhagemeister Would it be possible to reevaluate this PR? I hope I don't have to rebase it any longer:) |
|
😭 |
This PR renamesFreshContext.reqproperty toFreshContext.requestThis PR adds
FreshContext.requestproperty as an alias toFreshContext.req. See #2363 (comment)