-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Comments
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. |
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. |
This will be a long transition. In particular, replacing the linter will be a giant pain. Checklist for ES6 conversion:
|
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
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
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
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
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
Some style rules are temporarily overridden until we can get in compliance. Issue #1157 Change-Id: Ie27be6ec6632b7786a1f9ebc32911ba9dcd42599
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
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
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
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
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
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
Some style rules are temporarily overridden until we can get in compliance. Issue #1157 Change-Id: Ie27be6ec6632b7786a1f9ebc32911ba9dcd42599
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
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. |
Until google/closure-compiler#893 is resolved, we can't use ES6 syntax in our externs. |
ES6 is now possible in externs! If it doesn't work right away, we may need a compiler update. |
Issue shaka-project#1157. Change-Id: I49092237b7fe7f98a22087b0ecf41f65005dbc61
Issue shaka-project#1157 Change-Id: Iab9c4be5d98494bf644f45cc0b4a5c235b31e80e
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
Issue shaka-project#1157 Change-Id: I6869b66665a44408d678a810255096076e93bea5
Issue shaka-project#1157 Change-Id: Ie330cd870ccf14dc3f56987b2787970b46b1ac89
Issue shaka-project#1157 Change-Id: Ib81d198e46bc57745f60af328d1160064e253ba3
Issue shaka-project#1157 Change-Id: I2deb52052d08b823e5ff53ecba69b424aad78c89
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
Issue shaka-project#1157 Change-Id: Ia90f6f2d9ce1659586db5d10903074bb9f141595
Issue shaka-project#1157 Change-Id: I034cb3b6b947f24f828e221612f46366ec6d660d
Issue shaka-project#1157 Change-Id: I027a1177fcd098f458b2cc3c3d92f93b43d26447
Issue shaka-project#1157 Change-Id: I007f5dd43f297ca108cbb2caa7a9118527722350
Issue shaka-project#1157 Change-Id: I30e39927c70d61f29d45698507b6ba809b33e2f3
Issue shaka-project#1157 Change-Id: Iee2c8daede491e832bc2fd790a6d6b15fb019619
Issue shaka-project#1157 Change-Id: I55a732a76d89217b677c375d4000fef2947018ae
Issue shaka-project#1157 Change-Id: I6d72a7cb5c8b1e4cb783d53a5465b8e4bb1b7063
Issue shaka-project#1157 Change-Id: I82213c9a20e7aa6e506732dc0295a61d2a67b1ec
Issue shaka-project#1157 Change-Id: I11bae98bcfff812589f69f38d446e655776eadc8
Issue shaka-project#1157 Change-Id: I7997921809076fa5e36653f51af32ee11b50ab88
Issue shaka-project#1157 Change-Id: Ia25a6cae84575f003980e9694b2769f2976e1342
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
Issue shaka-project#1157 Change-Id: Iec39608591931afde22f3d7d7904e0dadc8ffd78
Issue shaka-project#1157 Change-Id: I47f537bca5106b4ffca5db3182c8a268d2f3d24a
Issue shaka-project#1157 Change-Id: I06994fa294401a008c1c2097683c3621eed438cf
Issue shaka-project#1157 Change-Id: Ib8ddecc7106fea8c24c10cfac406c4709a3f275b
Issue shaka-project#1157 Change-Id: Id9757ac39c37a149630c87bceacb11cdd2144f04
What do you guys think of refactoring the code from ES5 to ES6?
The text was updated successfully, but these errors were encountered: