babel / notes

♬ Notes from the @Babel Team (discuss in PRs)
https://github.com/babel/notes#meetings
122 stars 16 forks source link

Jan 08 meeting #109

Closed nicolo-ribaudo closed 4 years ago

nicolo-ribaudo commented 4 years ago

@babel/babel feel free to add items to the agenda!

Thom1729 commented 4 years ago

The babel-sublime issue is a bit on the long side, so here's a summary.

Who am I?

In my day job, I do full-stack web application development, and I write developer tools on the side. I'm the primary maintainer (and majority author) of the official Sublime Text JavaScript syntax definition, and I wrote and maintain the JS Custom package, which lets you selectively enable, disable, and configure JavaScript highlighting extensions such as JSX, Flow types, and custom template literals.

What's the issue?

The babel-sublime package is by far the most popular syntax highlighter for JSX in Sublime Text, with over half a million installations. Countless developers use it on a daily basis. However, babel-sublime has not been significantly updated in several years. In that time, Sublime Text has gotten a brand-new, faster, and more powerful syntax highlighting engine. The official JavaScript syntax definition has been almost totally rewritten and now offers much more accurate, detailed, and up-to-date highlighting of vanilla JavaScript than babel-sublime. However, because the official syntax does not support JSX (or other popular-but-nonstandard features), there is still an important role for babel-sublime.

What do I propose?

Publish a new version of babel-sublime with a new syntax definition. The syntax definition will be generated by JS Custom to support the same features as babel-sublime. When JS Custom is updated, babel-sublime will be updated with a re-generated syntax definition. The benefits of this approach are:

Why not improve the existing babel-sublime syntax definition?

The existing babel-sublime definition is very far out of date, based on an old TextMate syntax definition. Rewriting the official JavaScript syntax definition took months of effort. In addition, due to the complexity of the JavaScript syntax, fixing the known bugs required a radical restructuring of the syntax definition. Accomplishing such an overhaul without major user disruption was only possible because the existing syntax had a large test suite, which babel-sublime lacks.

Bringing the existing babel-sublime definition up to the standards of the official JavaScript syntax would require, in effect, a complete rewrite. But between the official syntax and JS Custom, that rewrite has already been done.

Why not use JS Custom directly?

JS Custom is a complex tool whose primary focus is customizability. On the other hand, babel-sublime is plug-and-play. Users who want to customize their highlighting in detail can install JS Custom, but the many, many users who are happy with the scope of babel-sublime can keep using it.

What is the migration path?

From a code perspective:

  1. Create a next branch.
  2. Configure and compile a JS Custom syntax. Copy the syntax and appropriate tests to the next branch.
  3. Publish a pre-release build from the next branch and make a public announcement.
  4. When we're confident in the new branch, publish a stable build.

From an administrative perspective, there are a couple of major alternatives:

Other considerations

JS Custom: https://github.com/Thom1729/Sublime-JS-Custom Edits by @JLHwung : added JS Custom project link for information.