-
Notifications
You must be signed in to change notification settings - Fork 333
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
Migrate JavaScript to ES2015 classes #3771
Conversation
d106d0c
to
be2c55d
Compare
Had a few TypeScript checks fail because our tests access Assume we're alright doing what we do elsewhere and ignoring known violations? // @ts-expect-error Parameter 'count' not a number
expect(i18n.getPluralSuffix('test', 'nonsense')).toBe('other') Note: Ideally we should update our tests to access only public methods, perhaps making getters/setters for things like |
69fedde
to
a44fccd
Compare
Had to make a manual Heroku review app: Automatic one is still stuck from Heroku downtime yesterday |
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.
A couple of minor things but otherwise looks good – exciting stuff! We are truly living in the future 2017.
// Code goes here | ||
} | ||
``` | ||
|
||
Assign methods to the prototype object. Do not overwrite the prototype with a new object as this makes inheritance impossible. | ||
Add methods to the class. Do not overwrite the prototype with a new object as this makes inheritance impossible. |
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 we can delete this bit as it's no longer relevant?
Add methods to the class. Do not overwrite the prototype with a new object as this makes inheritance impossible. | |
Add methods to the class. |
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.
Left it in as a technicality (still possible I guess?) but also glad to remove!
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.
Removed it ✅
|
||
/** @deprecated Will be made private in v5.0 */ | ||
this.$module = $module | ||
export class Details { |
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.
Worth noting that this file is being deleted in #3766 – could remove the changes relating to this file to avoid potential unnecessary conflicts, unless that makes ESLint unhappy?
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'm happy to fix conflicts 🤷♂️
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 try and merge the other PR first
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.
As fallback styling for Details in older browsers is still in progress let's switch and merge this first
We prefer named exports over default exports to avoid compatibility issues with transpiler "synthetic default" as discussed in: #2829 See our [coding standards for JavaScript](/docs/contributing/coding-standards/js.md)
This hides them from the generated JSDoc output too
Ideally we should update our tests to access only public methods, perhaps making getters/setters for things like `getCountMessage()` instead?
This is a “just in case” commit where early ES2015 class implementations would return `undefined` in a subclass constructor (extended component) rather than the subclass instance Might only affect Safari 9 See: #2987 (comment)
a44fccd
to
f16f23d
Compare
Now we've added
<script type="module">
we can use ES2015 (or ES6) classes for components in #3506Make sure you view Files changed with "Hide whitespace" ticked as class methods are mostly only indented