ESLint improvement: Reduced need for import-globals-from when using loadSubScript

29 visningar
Hoppa till det första olästa meddelandet

Mark Banner

oläst,
31 jan. 2023 03:21:102023-01-31
till dev-pl...@mozilla.org, firefox-dev list

I have just landed a change that helps ESLint to automatically detect globals for loadSubScript when importing test files.

Previously you may have had to write a line to tell ESLint to import the file, e.g.

/* import-globals-from ../../../gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js */

Services.scriptloader.loadSubScript(
  "chrome://mochitests/content/browser/gfx/layers/apz/test/mochitest/apz_test_utils.js",
  this
);

No more! Now you can simply call loadSubScript:

Services.scriptloader.loadSubScript(
  "chrome://mochitests/content/browser/gfx/layers/apz/test/mochitest/apz_test_utils.js",
  this
);


For urls starting with chrome://mochitests/content/browser/, our ESLint setup will now automatically find the source file and load the relevant global variables.

The patches I have just landed also clean up all (that I can find) the existing instances of import-globals-from that are now unnecessary.

Mark

Svara alla
Svara författaren
Vidarebefordra
0 nya meddelanden