Convert JavaScript files to ECMAScript modules
Background / User story
In #936 (closed) we moved a background script module out of the adblockpluschrome directory. Since adblockplusui's background script modules use require()
instead of import
, those ECMAScript module imports had to be converted.
However, there's no more reason for using require()
for those background script modules anymore, as it was just a simple and backwards-compatible way to reference files in adblockpluschrome, which is now part of adblockplusui (see #884 (closed)). Therefore we should instead convert existing background script (as well as other JavaScript modules) to ECMAScript modules.
That way we won't need to convert other adblockpluschrome modules (see #934 (closed), #935 (closed)) and could more easily stop using browserify, as soon as all supported browsers support ECMAScript modules natively.
What to change
- Design: N/A
- Research: N/A
- Spec: N/A
- Legal: N/A
-
Development:
- For JavaScript files in js/ and lib/ directories:
- Remove
"use strict";
statement. - Replace
require()
function calls withimport
statements. - Replace
module.exports
assignments withexport
statements.
- Remove
- Update ESLint configuration to treat files in js/
and lib/directories as ECMAScript modules.
- For JavaScript files in js/ and lib/ directories:
the lib
directory was originally in this ticket. due to unforseen complexity, it now has it's own ticket
Further information
Related adblockpluscore issue: eyeo/adblockplus/abc/adblockpluscore#373 (moved)
Hints for testers
Nothing new, everything should simply work as it did before
Hints for translators
N/A