atom-tasks icon indicating copy to clipboard operation
atom-tasks copied to clipboard

How do you feel about converting this to ES6?

Open anaisbetts opened this issue 8 years ago • 3 comments

A lot of Atom is moving to ES6 and I have a few ideas on stuff to contribute, but I vastly prefer working in ES6 to CoffeeScript because the linter catches so much more stuff. I'll be glad to do the boring conversion and submit a PR if you're interested.

anaisbetts avatar Apr 30 '16 21:04 anaisbetts

Certainly not opposed! Might be a pretty big undertaking, but if you submit a PR, i'll definitely take a look :)

irrationalistic avatar May 03 '16 18:05 irrationalistic

The toughest part of this is the heavy use of the ? operator, of which there's no direct equivalent in es6.

I ran decaffeinate, which is a great tool to convert to es6 (repo, info), but the code is kind of ugly, as it adds these "guard" statements all over the place:

Coffee

  destroy: ->
    @activeItemSub.dispose()
    @changeSub?.dispose()
    @tokenizeSub?.dispose()

JS

  destroy() {
    this.activeItemSub.dispose();
    __guard__(this.changeSub, x => x.dispose());
    return __guard__(this.tokenizeSub, x1 => x1.dispose());
  }

function __guard__(value, transform) {
  return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined;
}

I'm not super-familiar with atom plugin development, so I don't know how many of these existential operators are important to keep. However, if we could remove some of those, it'd be really easy to convert over!

blimmer avatar Jan 22 '17 00:01 blimmer

I imagine with a solid block of time I could knock this out pretty quickly. Might be good to rewrite some of the logic anyways. Just gotta find that solid block of time ;)

I've also been thinking about rewriting the plugin to use a custom text editor view, which would take a lot more work but support a lot of the customization folks have been asking for. I'd really love to explore that further too!

irrationalistic avatar Jan 28 '17 05:01 irrationalistic