-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Refactoring] convert hosting/*.js to typescript code #1903
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
Conversation
| import * as _ from "lodash"; | ||
|
|
||
| function _filterOnly(configs, onlyString) { | ||
| type HostingConfig = { site: string; target: string }; |
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.
Any reason to use a type here but use an interface for TemplateServerResponse?
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.
it's no reason.
it seems more better to interface.
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.
please prefer interfaces to types. Maybe that's something I could enforce with the linter in the future...
|
@iida-hayato thanks for doing this! I left some small comments, hopefully @bkendall can do a review as well. |
|
There seems to be a better name for the added types.
But i have no idea . 🤔 |
bkendall
left a comment
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.
Alright, you prompted me to write up a script that should help identify easy bits to clean up while rewriting this code. If you would do the following, it would be appreciated:
- Make sure your local
masterbranch is up to date and sync this branch with it. - Run
npm run lint:changed-files- it should print 28 "problems" (which are lint warnings) that should be addressed. Most of it will be fairly trivial, but worth addressing.
One of the tricker warnings to get rid of in some of the files will be @typescript-eslint/no-explicit-any, especially when it comes to req, res, and next. If you get stuck, silence that warning by adding a comment to the end of the line: // eslint-disable-line @typescript-eslint/no-explicit-any (if the formatter complains, you can use // eslint-disable-next-line @typescript-eslint/no-explicit-any above it instead).
src/hosting/implicitInit.ts
Outdated
| /** | ||
| * generate template server responce | ||
| * @param options | ||
| * @return {Promise<{js: string, json: string}>} |
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.
Specifying return types in a typescript file is redundant. Please just include a brief written description of what is returned. e.g.:
| * @return {Promise<{js: string, json: string}>} | |
| * @return the initialization configuration. |
| import * as _ from "lodash"; | ||
|
|
||
| function _filterOnly(configs, onlyString) { | ||
| type HostingConfig = { site: string; target: string }; |
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.
please prefer interfaces to types. Maybe that's something I could enforce with the linter in the future...
| module.exports = function(options) { | ||
| /** | ||
| * @param options | ||
| * @return {any[] | HostingConfig[]} |
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.
lint --fix adds this return type? I will dig into that as it shouldn't in TS...
|
Generated JSDocs seems useless, so I erased and rewrite JSDoc comments. |
|
FYI - I've still got this on my radar, but dedicating the time to make sure I can go through it is a little tricky. I'm hoping to get back to you today or tomorrow. Thanks for the PR and your patience. |
|
All right. If this still difficult to merge, you can close it. or, Is there any other code that preferentially converts to typescript? |
|
Thanks for keeping on top of this. I've been horrible at actually getting back to you on this and I apologize for that - things have been rather busy for me as of late as other things have taken priority. I appreciate the PR and promise I haven't lost track of it! |
|
Because base's hosting.js has been changed, |
|
I've been super super busy, so I haven't gotten time to sit down on this, but I was going to manually resolve the conflicts and merge this. If you can manage to resolve the conflicts yourself in the next few days, I will promise to re-review by the end of the week. Otherwise, it may be next week when I get a chance to wrap this up. |
|
(seriously, thank you for your patience and I'm sorry I've been slooww) |
|
🎶 I'm horrible, it's true 🎶 (to the tune of You're Beautiful) I'm looking at this right now! |
Uh oh!
There was an error while loading. Please reload this page.