Coder Social home page Coder Social logo

Should we refactor for ES6? about vanilla-todo HOT 4 CLOSED

morris avatar morris commented on May 12, 2024
Should we refactor for ES6?

from vanilla-todo.

Comments (4)

perfectsquircle avatar perfectsquircle commented on May 12, 2024 4

I took a crack at it because I haven't played with native modules much and I was curious.

Here is the diff set: main...perfectsquircle:feature/es6

I started by running Lebab to take care of the boilerplate changes.

lebab --replace public/scripts --transform \
arrow,\
arrow-return,\
obj-method,\
obj-shorthand,\
for-of,\
for-each,\
let,\
template
# destruct-param <-- interesting changes, but broke some things

Then I converted everything on the global VT object into modules. It was actually very easy because everything was already scoped nicely.

My takeaway: it's interesting to note the differences, but maybe it should exist only as a fork for comparison sake? The original art is interesting because of the hard constraints.

In the readme you state

considerable duplication (most of which may be mitigated by ES6)

I'm curious what ideas you had for this.

from vanilla-todo.

sperretcraft avatar sperretcraft commented on May 12, 2024 2

Would love to see a version with ES6 ! And why not with Typescript (I read your comment on HN saying you'd use it if build steps were allowed)
I think your work would be even more interesting if closer to real uses of Vanilla in 2020 (with a lot of builder framework available and Typescript broadly used).

Great work anyway. Would love to see more.

P.S. I'm not fluent enough in JS to help you going forward >.<

from vanilla-todo.

morris avatar morris commented on May 12, 2024

Thanks for your effort @perfectsquircle - looking good although missing some steps (convert HTML string arrays to template literals, simplify one-line functions e.g. () => { call(); } to () => call()).

I remember not being super happy with the wording

albeit verbose and with considerable duplication (most of which may be mitigated by ES6)

and I should change it; ES6 does reduce verbosity, and therefore the duplication may hurt less, but it's structurally the same duplication. That can only be solved through helpers (as far as I can tell).

In any case I agree with you, I think it made sense to hit "rock-bottom" at least once with ES5. I'm inclined to keep it as it is and let an ES6 version be a fork or a branch just for reference. I'll keep this discussion open for a while and see if there's more demand. If you want to progress on your ES6 fork, feel free, would be interesting to see exactly how much simpler it gets :) thanks again!

from vanilla-todo.

morris avatar morris commented on May 12, 2024

1.5 years later... done :)

from vanilla-todo.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.