J4 Issue ? ?
avatar dneukirchen
dneukirchen
11 Feb 2018

Why?

  • There are many improvements in es6 which makes it a lot easier to write javascript
  • The module system makes it easier to write javascript unit tests.
  • All modern js libraries and frameworks switched to es6 (angular, vue, react… and many more). We should at least try to keep up with the js world.
  • We already use es6 features in some parts of the project: i.e.: tests, media manager, custom elements.
  • Browser Support for es6 is good: https://kangax.github.io/compat-table/es6/ Essentially all browsers except IE11. To support IE11 we need to compile es6 code down to es5. This means there will be no change for the end user.

More information about es6: https://github.com/lukehoban/es6features

How?

  • Update the package.json and install dependencies needed to compile ES6 down to ES5. Add/Update scripts to compile es6 to es5: #19650
  • Adopt airbnb es6 javascript style guide as javascript coding standard: #19638
  • Fix code style errors in build scripts #19717
  • Rename all Javascript files to *.es6.js and compile them: https://github.com/joomla-projects/joomla-es6/issues
  • check all dependencies in package.json (are the versions up 2 date? Are they still required?)
  • Re/Organize joomla namespace
  • Refactor libraries, so that they are unit testable.
  • Drop javascript test dependencies: jasmine-jquery, requirejs, jasmine-ajax… and reduce the usage of fixture testing (prefer real unit tests, probably with a mocking lib like sinon).
  • Refactor the unit tests.
  • optional: implement module loading
  • Remove all minified scripts from repository. #19637
  • add .eslint.es5 and lint old es5 code. Personally i think we should focus on moving things to es6 and enforce cs during refactoring instead of spending time with this.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar dneukirchen dneukirchen - open - 11 Feb 2018
avatar joomla-cms-bot joomla-cms-bot - change - 11 Feb 2018
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Feb 2018
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Feb 2018
avatar dneukirchen dneukirchen - change - 11 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 11 Feb 2018
avatar dneukirchen dneukirchen - change - 11 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 11 Feb 2018
avatar dneukirchen dneukirchen - change - 11 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 11 Feb 2018
avatar dneukirchen dneukirchen - change - 11 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 11 Feb 2018
avatar C-Lodder
C-Lodder - comment - 11 Feb 2018

Update the package.json and install dependencies needed to compile ES6 down to ES5

We already do this (Babel) for custom elements, so I suppose you can check that off.

avatar dneukirchen
dneukirchen - comment - 11 Feb 2018

We already do this for custom elements, so I suppose you can check that off.

yes and no... i checked the build scripts. we can at least refactor them (and probably get rid of browserify and use only babel-core instead as we said that we do not want to depend on bundlers anymore?).

avatar dneukirchen dneukirchen - change - 11 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 11 Feb 2018
avatar dneukirchen dneukirchen - change - 11 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 11 Feb 2018
avatar dneukirchen dneukirchen - change - 11 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 11 Feb 2018
avatar dgt41
dgt41 - comment - 11 Feb 2018

Rename all Javascript files to *.es6.js and compile them. (OR: rename only the files that are rewritten in es6 to *.es6.js).

Let's do it the same way we're doing it in custom elements: .js is ES6, .es5.js is dead code...

avatar dneukirchen
dneukirchen - comment - 11 Feb 2018

Let's do it the same way we're doing it in custom elements: .js is ES6, .es5.js is dead code...

we can do that, personally i like the *.es6.js approach more, because it does not change anything for the end user (he can continue to use validation.js, which will be compiled es5).

avatar dneukirchen dneukirchen - change - 11 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 11 Feb 2018
avatar dneukirchen dneukirchen - change - 11 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 11 Feb 2018
avatar dgt41
dgt41 - comment - 11 Feb 2018

Hold on, is this (i mean the ES6 coded files) only for our eyes, only for devs?
If so we can do better, use the existing Joomla.webcomponents loader and let the client side decide what type of js will be fetched...

avatar dneukirchen
dneukirchen - comment - 11 Feb 2018

In a first step i want to improve the current js code and be able to write es6 javascript. So the new .es6.js files are mostly for devs atm.

If we find a way to lazy load es6 modules, i would love to go a step further, but thats not a trivial task in joomla context.

avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Feb 2018
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Feb 2018
Category JavaScript
avatar dneukirchen dneukirchen - change - 12 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 12 Feb 2018
avatar dneukirchen dneukirchen - change - 12 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 12 Feb 2018
avatar dneukirchen dneukirchen - change - 12 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 12 Feb 2018
avatar dneukirchen dneukirchen - change - 12 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 12 Feb 2018
avatar dneukirchen dneukirchen - change - 14 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 14 Feb 2018
avatar dneukirchen dneukirchen - change - 18 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 18 Feb 2018
avatar dneukirchen dneukirchen - change - 20 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 20 Feb 2018
avatar dneukirchen dneukirchen - change - 20 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 20 Feb 2018
avatar dneukirchen dneukirchen - change - 20 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 20 Feb 2018
avatar dneukirchen dneukirchen - change - 20 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 20 Feb 2018
avatar dneukirchen dneukirchen - change - 20 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 20 Feb 2018
avatar dneukirchen dneukirchen - change - 20 Feb 2018
The description was changed
avatar dneukirchen dneukirchen - edited - 20 Feb 2018
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J4 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar brianteeman
brianteeman - comment - 21 May 2018

is this meta list being kept upto date

avatar brianteeman
brianteeman - comment - 3 Aug 2018

Closed due to lack of response

avatar brianteeman brianteeman - change - 3 Aug 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-08-03 20:11:03
Closed_By brianteeman
avatar brianteeman brianteeman - close - 3 Aug 2018

Add a Comment

Login with GitHub to post a comment