-
Notifications
You must be signed in to change notification settings - Fork 0
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
Chore/179551806/convert to ts #11
base: master
Are you sure you want to change the base?
Conversation
39ba59c
to
bf31a32
Compare
@ss-eggs could you please take a look at my review of goodeggs/goodeggs-validators#7 and start by making those same changes here? It looks like one of these PRs was copied from the other (instead of the guide: https://goodeggs.atlassian.net/wiki/spaces/ENG/pages/161841475/Porting+from+Flow+to+TypeScript), so there are a lot of the same issues. Thank you! |
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 see review on goodeggs/goodeggs-validators#7.
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.
Partial review: I reviewed everything except the actual source and tests! I'll review the rest a bit later.
@@ -2,3 +2,4 @@ | |||
.gitignore | |||
.travis.yml | |||
test/ | |||
lib/ |
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.
If we do this, we'll publish an unusable package that doesn't include the built code, which is the only useful thing to include!
"@goodeggs/tsconfig": "^1.0.0", | ||
"@types/accounting": "^0.4.2", | ||
"@types/jest": "^27.0.2", | ||
"@types/node": "^16.10.2", |
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.
You're testing on node 14 so maybe use 14 here?
"@types/node": "^16.10.2", | ||
"@types/sinon": "^10.0.4", | ||
"@types/underscore": "^1.11.3", | ||
"babel-jest": "^27.2.4", | ||
"chai": "^1.10.0", |
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.
remove? you switched to jest, so should be unused now
"chai": "^1.10.0", | ||
"jest": "^27.2.4", | ||
"mocha": "~1.x.x", |
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.
same here, remove?
"lint:fix": "yarn run lint:fix:es", | ||
"lint:fix:es": "getk run fix-es", | ||
"prepublishOnly": "yarn lint && yarn test && yarn run build", | ||
"test": "jest src/", |
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.
This isn't running linting or typechecking in CI.
"test": "jest src/", | |
"test": "yarn run lint && yarn run typecheck && yarn run test:unit", | |
"test:unit": "jest", |
types/format-location.d.ts
Outdated
@@ -0,0 +1,4 @@ | |||
declare module 'format-location' { | |||
function formatLocation(location: any, type: string): 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.
Consider taking 5 mins to write a correct type here. If it's too complicated, it's ok to leave this as is.
declare module 'inflect' { | ||
export function ordinalize(arg: string): 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.
Could you check if we actually need this? Maybe we can remove the function that uses this? I think it's worth taking at least 10 mins to check how we're using this (e.g. in garbanzo).
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.
Library was not created by me. I don't know if methods are being used or not in any of the apps. But I can do a search.. ticket does not specify to look if library or parts of it are being used
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.
humanDate (not used): https://github.com/search?q=org%3Agoodeggs+humanDate&type=code
humanDay (used): https://github.com/search?q=org%3Agoodeggs+humanDay&type=code
humanShortDay (used): https://github.com/search?q=org%3Agoodeggs+humanShortDay&type=code
Let me know what you want to do.
@@ -0,0 +1,3183 @@ | |||
Arguments: |
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 delete this file and add yarn-error.log
to .gitignore
@@ -0,0 +1,15 @@ | |||
declare module 'node-clock' { |
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.
😬
Since node-clock is deprecated, I would be eternally grateful if you could just refactor it away instead of adding this here. You can find hundreds of examples in this PR: https://github.com/goodeggs/garbanzo/pull/7945.
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.
@serhalp the whole package is dependent on this node-clock package functionality.
all formatting filters https://github.com/goodeggs/goodeggs-formatters/blob/chore/179551806/convert-to-TS/src/index.ts#L148 would have to be redone in order to use moment-timeline package to provide same exposed features.
Before I continue the work, I want a sign off from you and @risharma as this was not mentioned in the ticket.
"extends": "./tsconfig.json", | ||
"include": [ | ||
"src/**/*.ts", | ||
"types" |
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.
I think the correct way to do this is to remove this from here and add this instead:
"typeRoots": [
"./node_modules/@types",
"./types"
],
@serhalp thanks for giving a look. Ticket does not mention refactoring, so I tried not to touch code unless it is impossible add types to certain parts of code. If refactoring is included - I would refactor the whole library. For now, I will complete whatever was pointed out. In my personal opinion the whole library was written poorly. In the end, I am trying to follow what is mentioned in the ticket. |
Fix the `formats a date range of different dates` and `formats a date range of the same day` tests
Background
Completed efforts as part of Typescriptify story:
https://www.pivotaltracker.com/n/projects/2533706/stories/179551806
Changes