Closed Bug 1812098 Opened 3 years ago Closed 3 years ago

Enable the builtinGlobals option for ESLint's no-shadow rule on .mjs files

Categories

(Developer Infrastructure :: Lint and Formatting, task, P3)

task

Tracking

(firefox113 fixed)

RESOLVED FIXED
Tracking Status
firefox113 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(3 external files)

In bug 1810567 we turned on the no-shadow rule for .mjs files. I feel that we should turn on the builtinGlobals option as well, as this will prevent us redeclaring global variables, and hopefully improve code clarity, and reduce possible unnecessary declarations.

Once we fix the obvious parts here, most of the errors are along these lines:

browser/components/firefoxview/tab-pickup-container.mjs
   67:9   error  'event' is already a global variable.   no-shadow (eslint)
   83:15  error  'event' is already a global variable.   no-shadow (eslint)
  119:17  error  'window' is already a global variable.  no-shadow (eslint)

browser/components/protections/content/lockwise-card.mjs
  12:15  error  'document' is already a global variable.  no-shadow (eslint)

browser/components/storybook/.storybook/preview.mjs
  23:27  error  'name' is already a global variable.  no-shadow (eslint)
  71:19  error  'name' is already a global variable.  no-shadow (eslint)

browser/components/storybook/stories/credential-management.stories.mjs
  16:21  error  'history' is already a global variable.  no-shadow (eslint)

browser/components/storybook/stories/panel-list.stories.mjs
  25:21  error  'open' is already a global variable.  no-shadow (eslint)

toolkit/content/aboutNetError.mjs
   227:7   error  'location' is already a global variable.  no-shadow (eslint)
   579:38  error  'parent' is already a global variable.    no-shadow (eslint)
   947:7   error  'location' is already a global variable.  no-shadow (eslint)
  1426:9   error  'parent' is already a global variable.    no-shadow (eslint)
  1447:7   error  'event' is already a global variable.     no-shadow (eslint)

These are all window.* items provided by the browser environment. event is the most frequently used.

.sys.mjs will be handled in a future dependency of bug 1575506.

Depends on D169463

Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ccbcb0fd7ae1 Fix ESLint raised issues with no-shadow of builtinGlobals in toolkit .mjs files. r=Gijs https://hg.mozilla.org/integration/autoland/rev/5fc0f774b623 Fix ESLint raised issues with no-shadow of builtinGlobals in browser .mjs files. r=Gijs,credential-management-reviewers,sgalich,fxview-reviewers,sclements https://hg.mozilla.org/integration/autoland/rev/bba6bea945da Enable the builtinGlobals option for ESLint no-shadow rule on .mjs files. r=Gijs
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: