-
-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
refactor: fix I18n class constructor jsdoc to resolve vscode type errors #3195
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c321e8d
refactor: fix I18n class constructor jsdoc to resolve vscode type errors
qwerty541 7b3c991
Merge remote-tracking branch 'upstream/master' into refactor_fix_i18n…
qwerty541 515a183
Merge remote-tracking branch 'upstream/master' into refactor_fix_i18n…
qwerty541 d10840c
Merge remote-tracking branch 'upstream/master' into refactor_fix_i18n…
qwerty541 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@qwerty541 I checked this change but could not find what rule this is fixing. Isn't the
locale
property required for the function to work?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.
@qwerty541 I now see that the default value is hidden inside the constructor. Maybe we can replace it with the following:
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.
Additionally, the
t
method could be improved: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.
@rickstaa This pull request resolves the following vscode type errors:
src/cards/repo-card.js on line 94
src/cards/stats-card.js on line 150
src/cards/top-languages-card.js on line 744
src/cards/wakatime-card.js on line 208
This occurs because
locale
is optional query parameter and can beundefined
and I18n class constructor jsdoc requires 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.
I like current variant of this methos more because it contains different error messages when locale and translation is missing.
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.
Moving the fallback into the object deconstruction looks good for me, but i have doubts about if it should be done inside this pull request or inside a new one, since this one about fixing jsdoc.
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.
Also thank you for following, i appreciate it, followed you back.
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.
Let's do this in a new PR.
Of course. I'm curious about your projects and contributions 🚀!
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.
Recently i tried to make change with moving the fallback into the object deconstruction. Looks like this does not suit us because when
locale
variable passed into constructor withundefined
value it override the default value bacauseundefined
is valid. Currently it will be handled by the following codethis.locale = locale || FALLBACK_LOCALE;
.Moving fallback can de done only the following way:
But i do not think that code will be better after this.
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 agree. Thanks for testing my improvement. I forgot about the fact that undefined is seen as a valid input! I think we can leave the old code 👍🏻.