-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Convert elements to use ES6 modules (import/export) #6776
Conversation
src/elements/index.js
Outdated
import Point from './element.point'; | ||
import Rectangle from './element.rectangle'; | ||
|
||
export { |
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 used a non default export here since I think that will allow something like
import { Arc } from 'elements';
I started with the elements since I think the diff is minimal for now. The helpers require a lot more changes since we'd want to move toward exporting individual functions rather than exporting one large object. |
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.
Great!
Just some wondering about style we should be using.
@@ -184,4 +184,4 @@ class Line extends Element { | |||
|
|||
Line.prototype._type = 'line'; | |||
|
|||
module.exports = Line; | |||
export default Line; |
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.
Should we use the
export default class Line extends ...
style instead?
Thinking about style consistency when we get to helpers:
export function helper1() {};
export function helper2() {};
vs
function helper1() {}
function helper2() {}
export {
helper1
helper2
}
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 started playing with the helpers files. Personally I preferred the first style but I'm not opposed to the 2nd if that's what everyone else prefers
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 prefer brevity
Not sure why 1 test is failing. It says that it failed to create the chart, but I don't know why. Will debug later today |
Not sure what |
6f3c976
to
aeb9ccf
Compare
Yeah, I moved to a default export and it worked. Tests are still failing until #6780 is merged |
I closed and reopened the PR to kick off Travis again. The tests are passing now |
Converts the element files (src/elements/*) to use import/export.