sdefresne / gerrit-monitor

Source for Gerrit Monitor Chrome extension
Apache License 2.0
21 stars 16 forks source link

RFC: Update code to use ES6 modules and classes #13

Closed davidgreenaway closed 5 years ago

davidgreenaway commented 5 years ago

These CLs update the Gerrit Monitor code to use ES6 modules and classes, replacing boilerplate such as:

(function(namespace) {
  if (namespace.foo)
    return;
  var foo = {};
  namespace.foo = badge;
  // Define a function.
  foo.myFunction = function(...) { ... };
})(this);

with just:

export function myFunction(...) { ... };

Similarly, ES5-style class definitions are replaced with more direct class based syntax.

ES6 support for classes and modules have been supported since Chrome 61 (September 2017), so should be safe to use directly.

Patches should have no behavioural differences. These diffs are best viewed by fetching them a running git show -w on the result to see actual content changes.

It may be worth me changing the author of these CLs to something like formatting-changes to avoid git blame pointing to me for every line (though git blame -w can see through the changes better). Let me know, and I'll adjust.

sdefresne commented 5 years ago

Thank you for the modernization of the code.

I do not think there is need to change the author (as git blame -w reports the correct author). I'll merge the pull request.