Page MenuHomePhabricator

enable modern JavaScript (ES2016+) for PageTriage (via transpiling/Babel)
Closed, DeclinedPublic

Description

enable modern JavaScript (ES2016+) for PageTriage (via transpiling/Babel)

Pros

  • use modern features like async/await, which
    • increases the # of developers that can work on the code, since we can make everything synchronous really easy, and that programming style is straightforward
    • increases reliability by eliminating several types of nasty promise bugs
    • increases code readability
  • makes it easy to convert to TypeScript later

Cons

  • step debugging is harder. developers need to learn how to use sourcemaps
  • build process is more complicated, need to set up Babel and automatic transpiling

I think @TheDJ mentioned this idea originally, and @Chlod also discussed it with us a bit.

I'd be in favor of exploring this idea more. I was hesitant at first, but as difficult-to-debug Promise bugs keep cropping up, I am changing my mind. I think a refactor of complicated, Promise-heavy files files (such as mark.js, delete.js, and tags.js) to classes + async/await would be a good strategy to get rid of these Promise bugs and improve code health.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

If we're considering switching to TypeScript (which means we'll be performing a near-full codebase refactor anyway), we're essentially crawling our way to a frontend rewrite, and we might as well formally kick off T208256. So there's a bit of a crossroads here: enable transpilation and use new code features for us to rewrite easier later, or we just bite the bullet and focus all resources on a Vue rewrite. Either way, we will need transpilation to some extent, but having to reconfigure from whatever we do here to a Vue setup (at some point in the future) would just create extra work.

I'd be cautious about introducing a build step or TypeScript without first-class support for it in our ecosystem (T199004). One reason that this extension has been difficult to maintain is that its libraries (i.e. backbone + underscore) and setup is different from most other Wikimedia deployed extensions. Keeping things mainstream would be a safer route for maintainability. To that end, I agree that T208256 makes sense, though as I said in that task, I also think it makes sense to use Codex wherever possible, again for the purposes of standardization (in code + UX) and using what is the current best practice.

Novem_Linguae renamed this task from enable modern JavaScript for PageTriage (via transpiling/Babel) to enable modern JavaScript (ES2016+) for PageTriage (via transpiling/Babel).Dec 11 2022, 11:10 AM
Novem_Linguae closed this task as Declined.
Novem_Linguae updated the task description. (Show Details)

Good point. Vue it is then. I'll close this in favor of the other ticket.