Skip to content
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

[META] Use ES6 constructs, idioms in metrics-graphics #811

Open
wlach opened this issue Feb 13, 2018 · 3 comments
Open

[META] Use ES6 constructs, idioms in metrics-graphics #811

wlach opened this issue Feb 13, 2018 · 3 comments

Comments

@wlach
Copy link
Collaborator

wlach commented Feb 13, 2018

Now that we're using babel to transpile, we should start using some ES6 idioms. It might be a good idea to use an automated-converter like lebab to automate this process.

For now we should try to do this in a backwards-compatible way. i.e. none of the public interfaces provided by metricsgraphics should change at all.

@lobax and some students might be interested in taking these on.

RickardBjorklund pushed a commit to DD2480-G9/metrics-graphics that referenced this issue Feb 15, 2018
RickardBjorklund pushed a commit to DD2480-G9/metrics-graphics that referenced this issue Feb 18, 2018
RickardBjorklund pushed a commit to DD2480-G9/metrics-graphics that referenced this issue Feb 18, 2018
RickardBjorklund pushed a commit to DD2480-G9/metrics-graphics that referenced this issue Feb 18, 2018
RickardBjorklund pushed a commit to DD2480-G9/metrics-graphics that referenced this issue Feb 18, 2018
RickardBjorklund pushed a commit to DD2480-G9/metrics-graphics that referenced this issue Feb 18, 2018
wlach pushed a commit to wlach/metrics-graphics that referenced this issue Feb 20, 2018
wlach pushed a commit to wlach/metrics-graphics that referenced this issue Feb 20, 2018
wlach pushed a commit to wlach/metrics-graphics that referenced this issue Feb 20, 2018
wlach pushed a commit to wlach/metrics-graphics that referenced this issue Feb 20, 2018
wlach pushed a commit to wlach/metrics-graphics that referenced this issue Feb 20, 2018
@lobax
Copy link
Contributor

lobax commented Feb 21, 2018

A little wrap up of what we did and what is left to do:

All files under charts except table.js have been refactored to use ES6 with lebab. There are currently no unit tests for table.js, which is why we didn't refactor it. Maybe a few should be added before further refactoring is preformed?

The files under charts could also further be refactored to use ES6 Classes.

thomaschampagne pushed a commit to thomaschampagne/metrics-graphics that referenced this issue Mar 7, 2018
thomaschampagne pushed a commit to thomaschampagne/metrics-graphics that referenced this issue Mar 7, 2018
thomaschampagne pushed a commit to thomaschampagne/metrics-graphics that referenced this issue Mar 7, 2018
thomaschampagne pushed a commit to thomaschampagne/metrics-graphics that referenced this issue Mar 7, 2018
thomaschampagne pushed a commit to thomaschampagne/metrics-graphics that referenced this issue Mar 7, 2018
wlach added a commit to wlach/metrics-graphics that referenced this issue Mar 12, 2018
@hamilton hamilton changed the title Use ES6 constructs, idioms in metrics-graphics [META] Use ES6 constructs, idioms in metrics-graphics Mar 12, 2018
@garygreen
Copy link

garygreen commented Mar 14, 2018

Once this is done, is it worth changing the main in package.json to point to the main entry point for MG? Reason being, there is pretty decent support for ES6 now in all major browsers and it would allow Webpack / Rollup users to allow their bundler to bundle MG to create smaller and faster builds, targeting whatever browser they wish to support. See https://philipwalton.com/articles/deploying-es2015-code-in-production-today/ for more info. Google's autotrack is pushing this too see googleanalytics/autotrack#137 for more info.

Also, it would be great if you could include only the charts you use:

import 'metric-graphics/charts/line';

Or tree shaking:

import { lineCharts, mg } from 'metric-graphics';

So any other charts / modules not used by metric graphics will be removed (at least by Webpack, and Rollup I believe)

Now to cut down the size of the d3 dependency.... but that's another topic 😄

@edmorley
Copy link

Once this is done, is it worth changing the main in package.json to point to the main entry point for MG?

There's a safer intermediate step: leave main pointing at an ES5 version, and use module for the ES2015 version. Webpack et al know to prioritise the module reference over main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants