Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECMAScript 6? #1157

Closed
ghost opened this issue Nov 28, 2017 · 6 comments
Closed

ECMAScript 6? #1157

ghost opened this issue Nov 28, 2017 · 6 comments
Labels
status: archived Archived and locked; will not be updated type: code health A code health issue
Milestone

Comments

@ghost
Copy link

ghost commented Nov 28, 2017

What do you guys think of refactoring the code from ES5 to ES6?

@ghost ghost changed the title ES ECMAScript 6? Nov 28, 2017
@theodab
Copy link
Contributor

theodab commented Nov 28, 2017

At the moment we still support IE 11, and IE 11 does not support ES6 and (presumably) never will.

Maybe at some point in the future we will stop supporting IE 11 and upgrade everything to ES6. Perhaps if, once the Shaka Player survey has ended, we find that not many people care about IE 11 support? I can't make any promises, of course.

@theodab theodab added the type: enhancement New feature or request label Nov 28, 2017
@joeyparrish
Copy link
Member

We could move to ES6 without dropping IE11 support, by changing the way we develop. Uncompiled mode is the issue. In uncompiled mode, ES6 code won't run on IE11. If we are compiling ES6 down to ES5, we can still develop in ES6 and run compiled ES5 on IE11.

@joeyparrish joeyparrish added this to the Backlog milestone Nov 28, 2017
@joeyparrish joeyparrish self-assigned this Jan 3, 2018
@joeyparrish
Copy link
Member

joeyparrish commented Jan 4, 2018

This will be a long transition. In particular, replacing the linter will be a giant pain.

Checklist for ES6 conversion:

  • Use Babel to serve ES5 in unit tests, so we can still test uncompiled code on IE11
  • Disallow uncompiled build in the demo app on IE11
  • Allow ES6 input in the compiler settings
  • Replace the long-deprecated gjslint with modern JS linters that understand ES6
    • Refine linter settings and convert code to pass
    • Reimplement property doc enforcement for typedefs (in jsdoc fork? as eslint plugin?)
  • Start converting library code to ES6 syntax
  • Polyfill some ES6 methods and lift some of the bans in build/conformance.textproto

shaka-bot pushed a commit that referenced this issue Jan 5, 2018
Once we start moving to ES6, uncompiled mode stops working on non-ES6
browsers (IE11 is the only one we test on).  We can disable uncompiled
mode in the demo, but we still want our tests to be uncompiled.  With
uncompiled library & tests, we can test units that are not exported
and even access private members that would otherwise be renamed.

For production/demo, Babel plays no role.  The Closure Compiler will
take in ES6 and spit out ES3 syntax (even older than ES5, so we can
at least run & fail a support check).

Babel will be used by Karma to preprocess all test and library code
before serving it from Karma.  This will allow us to use ES6 in both
the library and the tests, and still run uncompiled tests and test the
uncompiled library on ES5 browsers such as IE 11.

Issue #1157

Change-Id: Idd185d0e231d16b6df52babda777111e85890012
shaka-bot pushed a commit that referenced this issue Jan 5, 2018
As we convert Shaka Player to ES6, we will lose the ability to run the
demo app in uncompiled mode on older browsers, such as IE 11.

This detects ES6 syntax support and disables the link to uncompiled
mode in the demo app.  It also prevents the loader from choosing
uncompiled mode by default in these older browsers.

Issue #1157

Change-Id: I13e3a80669daaabd38a056f5242ee713f3d014cc
shaka-bot pushed a commit that referenced this issue Jan 5, 2018
Note that until we replace gjslint, the linter will still not accept
ES6 syntax.  So we cannot yet merge any commits which use ES6.

But this should allow us to start experimenting with ES6 locally by
bypassing the old linter.

Issue #1157

Change-Id: Ic0902f57a34f61b0a7831c3e019425cee6e0308f
shaka-bot pushed a commit that referenced this issue Jan 16, 2018
The eslint configuration is derived from analyzing the style of our
sources as they are now, plus a few tweaks.

In particular, we have disabled checks for undefined variables and use
of console, both of which the compiler handle with greater precision.
The compiler already knows what is defined in the environment through
our externs, and has specific exceptions for the use of console (demo,
tests).

We have also disabled a few checks that we should use, but will
require many changes to the code: no-unused-vars, no-redeclare,
and comma-dangle.

This commit also fixes several types of eslint errors that were easy:
  - no-useless-escape (unneccessary escape characters in Regexp)
  - no-constant-condition (using true/false/0/1/etc in if/while)
  - no-fallthrough (caught an actual bug in one EME polyfill)
  - no-irregular-whitespace (we had a UTF-8 nbsp in externs)
  - no-cond-assign (using an assignment inside a conditional)

To satisfy stricter provide/require checks in the Closure Compiler
Linter, we will no longer use provide/require at all in tests.  We
will still use provide in test utilities (test/test/util/) since it
sets up the namespace for us.  But we will not use require there
because there is no deps management for test code.

Issue #1157

Change-Id: Icc44f51feeb568ea7d3980e693e92e560d897afd
shaka-bot pushed a commit that referenced this issue Jan 17, 2018
This digests and organizes many of the automatic settings in eslint,
and changes several of them to be more strict.  This also fixes the
following errors:
  - array-callback-return
  - no-catch-shadow
  - no-multi-spaces
  - no-new
  - no-throw-literal
  - no-useless-call
  - no-useless-concat
  - no-useless-return

Several checks have been organized into a group of checks we should
use, but need more time to implement and fix.  Some other checks have
been delegated to the Closure compiler, which can more precisely
whitelist exceptions.

Issue #1157

Change-Id: I8fe4966959e08050f8159e6a1fee161e7d71177e
shaka-bot pushed a commit that referenced this issue Jan 18, 2018
Some style rules are temporarily overridden until we can get in
compliance.

Issue #1157

Change-Id: Ie27be6ec6632b7786a1f9ebc32911ba9dcd42599
shaka-bot pushed a commit that referenced this issue Jan 18, 2018
Git checks out files with native newlines, which is making eslint angry.

Issue #1157
Issue #1228

Change-Id: If83adca5c206581c5fe1883a07c4d5c84a326663
shaka-bot pushed a commit that referenced this issue Jan 18, 2018
This avoids line-length limits on Windows in the node module's
pass-through shell script.

The long list of files, combined with a node module's bin file,
tripped the Windows command-line length limit of 8k.  The transition
to eslint, therefore, broke the Windows build.

Issue #1157
Closes #1228

Change-Id: Ie57624efbbbfb4a27035e82ab12e788d18652ae3
joeyparrish added a commit that referenced this issue Jan 19, 2018
Once we start moving to ES6, uncompiled mode stops working on non-ES6
browsers (IE11 is the only one we test on).  We can disable uncompiled
mode in the demo, but we still want our tests to be uncompiled.  With
uncompiled library & tests, we can test units that are not exported
and even access private members that would otherwise be renamed.

For production/demo, Babel plays no role.  The Closure Compiler will
take in ES6 and spit out ES3 syntax (even older than ES5, so we can
at least run & fail a support check).

Babel will be used by Karma to preprocess all test and library code
before serving it from Karma.  This will allow us to use ES6 in both
the library and the tests, and still run uncompiled tests and test the
uncompiled library on ES5 browsers such as IE 11.

Issue #1157

Change-Id: Idd185d0e231d16b6df52babda777111e85890012
joeyparrish added a commit that referenced this issue Jan 19, 2018
As we convert Shaka Player to ES6, we will lose the ability to run the
demo app in uncompiled mode on older browsers, such as IE 11.

This detects ES6 syntax support and disables the link to uncompiled
mode in the demo app.  It also prevents the loader from choosing
uncompiled mode by default in these older browsers.

Issue #1157

Change-Id: I13e3a80669daaabd38a056f5242ee713f3d014cc
joeyparrish added a commit that referenced this issue Jan 19, 2018
Note that until we replace gjslint, the linter will still not accept
ES6 syntax.  So we cannot yet merge any commits which use ES6.

But this should allow us to start experimenting with ES6 locally by
bypassing the old linter.

Issue #1157

Change-Id: Ic0902f57a34f61b0a7831c3e019425cee6e0308f
joeyparrish added a commit that referenced this issue Jan 19, 2018
The eslint configuration is derived from analyzing the style of our
sources as they are now, plus a few tweaks.

In particular, we have disabled checks for undefined variables and use
of console, both of which the compiler handle with greater precision.
The compiler already knows what is defined in the environment through
our externs, and has specific exceptions for the use of console (demo,
tests).

We have also disabled a few checks that we should use, but will
require many changes to the code: no-unused-vars, no-redeclare,
and comma-dangle.

This commit also fixes several types of eslint errors that were easy:
  - no-useless-escape (unneccessary escape characters in Regexp)
  - no-constant-condition (using true/false/0/1/etc in if/while)
  - no-fallthrough (caught an actual bug in one EME polyfill)
  - no-irregular-whitespace (we had a UTF-8 nbsp in externs)
  - no-cond-assign (using an assignment inside a conditional)

To satisfy stricter provide/require checks in the Closure Compiler
Linter, we will no longer use provide/require at all in tests.  We
will still use provide in test utilities (test/test/util/) since it
sets up the namespace for us.  But we will not use require there
because there is no deps management for test code.

Issue #1157

Change-Id: Icc44f51feeb568ea7d3980e693e92e560d897afd
joeyparrish added a commit that referenced this issue Jan 19, 2018
This digests and organizes many of the automatic settings in eslint,
and changes several of them to be more strict.  This also fixes the
following errors:
  - array-callback-return
  - no-catch-shadow
  - no-multi-spaces
  - no-new
  - no-throw-literal
  - no-useless-call
  - no-useless-concat
  - no-useless-return

Several checks have been organized into a group of checks we should
use, but need more time to implement and fix.  Some other checks have
been delegated to the Closure compiler, which can more precisely
whitelist exceptions.

Issue #1157

Change-Id: I8fe4966959e08050f8159e6a1fee161e7d71177e
joeyparrish added a commit that referenced this issue Jan 19, 2018
Some style rules are temporarily overridden until we can get in
compliance.

Issue #1157

Change-Id: Ie27be6ec6632b7786a1f9ebc32911ba9dcd42599
joeyparrish added a commit that referenced this issue Jan 19, 2018
Git checks out files with native newlines, which is making eslint angry.

Issue #1157
Issue #1228

Change-Id: If83adca5c206581c5fe1883a07c4d5c84a326663
joeyparrish added a commit that referenced this issue Jan 19, 2018
This avoids line-length limits on Windows in the node module's
pass-through shell script.

The long list of files, combined with a node module's bin file,
tripped the Windows command-line length limit of 8k.  The transition
to eslint, therefore, broke the Windows build.

Issue #1157
Closes #1228

Change-Id: Ie57624efbbbfb4a27035e82ab12e788d18652ae3
@joeyparrish
Copy link
Member

ES6 work and linter changes cherry-picked to v2.3.1 to make it easier to cherry-pick bug fixes from after these ES6 changes.

@joeyparrish
Copy link
Member

Until google/closure-compiler#893 is resolved, we can't use ES6 syntax in our externs.

@joeyparrish
Copy link
Member

ES6 is now possible in externs! If it doesn't work right away, we may need a compiler update.

AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157.

Change-Id: I49092237b7fe7f98a22087b0ecf41f65005dbc61
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: Iab9c4be5d98494bf644f45cc0b4a5c235b31e80e
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
This changes how the spies are created.  This should still allow using
them as their base classes but still access the spies as a spy (i.e.
using their "calls" property).

Issue shaka-project#1157

Change-Id: I36840bcc8f4491eedbe90019047228bc65a048a2
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I6869b66665a44408d678a810255096076e93bea5
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: Ie330cd870ccf14dc3f56987b2787970b46b1ac89
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: Ib81d198e46bc57745f60af328d1160064e253ba3
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I2deb52052d08b823e5ff53ecba69b424aad78c89
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
CastProxy needs to be converted at the same time so that it can properly
adapt to the changes to Player's structure.
This only converts those classes to be ES6 classes, and does not make any
other ES6 conversions to them. That will be a follow-up CL.

Issue shaka-project#1157

Change-Id: I0e0f2ce9a62639060a645969a9cc2ae6d0a400cd
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: Ia90f6f2d9ce1659586db5d10903074bb9f141595
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I034cb3b6b947f24f828e221612f46366ec6d660d
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I027a1177fcd098f458b2cc3c3d92f93b43d26447
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I007f5dd43f297ca108cbb2caa7a9118527722350
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I30e39927c70d61f29d45698507b6ba809b33e2f3
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: Iee2c8daede491e832bc2fd790a6d6b15fb019619
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I55a732a76d89217b677c375d4000fef2947018ae
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I6d72a7cb5c8b1e4cb783d53a5465b8e4bb1b7063
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I82213c9a20e7aa6e506732dc0295a61d2a67b1ec
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I11bae98bcfff812589f69f38d446e655776eadc8
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I7997921809076fa5e36653f51af32ee11b50ab88
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: Ia25a6cae84575f003980e9694b2769f2976e1342
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
This also removes the unused SimpleIDB type and removes the duplicate
code in Utils that appears in Waiter.

Issue shaka-project#1157

Change-Id: Ib3cfc16212b9d169b360825a25a084c5ebd7b80f
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: Iec39608591931afde22f3d7d7904e0dadc8ffd78
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I47f537bca5106b4ffca5db3182c8a268d2f3d24a
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: I06994fa294401a008c1c2097683c3621eed438cf
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: Ib8ddecc7106fea8c24c10cfac406c4709a3f275b
AnteWall pushed a commit to AnteWall/shaka-player that referenced this issue Jul 17, 2019
Issue shaka-project#1157

Change-Id: Id9757ac39c37a149630c87bceacb11cdd2144f04
@shaka-project shaka-project locked and limited conversation to collaborators Oct 11, 2019
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: code health A code health issue
Projects
None yet
Development

No branches or pull requests

4 participants