Closed Bug 1392119 Opened 7 years ago Closed 7 years ago

Enable the ESLint no-caller rule across mozilla-central

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement)

3 Branch
enhancement
Not set
normal

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: standard8, Assigned: dbugs, Mentored)

Details

(Whiteboard: [lang=js])

Attachments

(1 file)

We currently have no-caller enabled for a few directories, but we should expand it to the whole of the repository.

There's background on our eslint setups here:

https://developer.mozilla.org/docs/ESLint

Also, details of the rule: http://eslint.org/docs/rules/no-caller

Here's some approximate steps:

- Add a no-caller (error) line in recommended.js.
- Remove the no-caller related lines in the existing .eslintrc.js configs (apart from devtools/):

https://dxr.mozilla.org/mozilla-central/search?q=no-caller&redirect=false

- Run eslint to find the issues to fix:

./mach lint -l eslint

- Fix the failures (note: the ESLint rules page gives hints as to what needs changing)
- Create a commit and push it to mozreview:

http://mozilla-version-control-tools.readthedocs.io/en/latest/mozreview.html
Comment on attachment 8900260 [details]
Bug 1392119 - Enable the ESLint no-caller rule across mozilla-central

https://reviewboard.mozilla.org/r/171652/#review176884

Almost there, just a few things to address.

::: browser/base/content/test/general/browser_bug432599.js:87
(Diff revision 1)
>  var removeElement = document.getElementById("editBookmarkPanelRemoveButton");
>  
>  function checkBookmarksPanel(invoker, phase) {
>    let onPopupShown = function(aEvent) {
>      if (aEvent.originalTarget == popupElement) {
> -      popupElement.removeEventListener("popupshown", arguments.callee);
> +      popupElement.removeEventListener("popupshown", checkBookmarksPanel);

This needs a function name inserting around line 85, e.g. popupShownListener

::: browser/base/content/test/general/browser_printpreview.js:57
(Diff revision 1)
>    executeSoon(function() {
>      if (gInPrintPreviewMode) {
>        executeSoon(aCallback);
>        return;
>      }
> -    executeSoon(arguments.callee);
> +    executeSoon(openPrintPreview);

Same as before.

::: browser/base/content/test/general/browser_printpreview.js:72
(Diff revision 1)
>      }
>      if (++count == 1000) {
>        // The test might fail.
>        PrintUtils.exitPrintPreview();
>      }
> -    executeSoon(arguments.callee);
> +    executeSoon(checkPrintPreviewClosed);

Same as before.

::: toolkit/content/widgets/toolbar.xml:140
(Diff revision 1)
>            if (document.readyState == "complete") {
>              this._init();
>            } else {
>              // Need to wait until XUL overlays are loaded. See bug 554279.
>              let self = this;
> -            document.addEventListener("readystatechange", function(event) {
> +            document.addEventListener("readystatechange", function listerner(event) {

nit: spelling

::: toolkit/content/widgets/toolbar.xml:143
(Diff revision 1)
>              // Need to wait until XUL overlays are loaded. See bug 554279.
>              let self = this;
> -            document.addEventListener("readystatechange", function(event) {
> +            document.addEventListener("readystatechange", function listerner(event) {
>                if (document.readyState != "complete")
>                  return;
> -              document.removeEventListener("readystatechange", arguments.callee);
> +              document.removeEventListener("readystatechange", listerner);

nit: spelling
Attachment #8900260 - Flags: review?(standard8)
Comment on attachment 8900260 [details]
Bug 1392119 - Enable the ESLint no-caller rule across mozilla-central

https://reviewboard.mozilla.org/r/171652/#review177544

Looks good, as long as try is green. r=Standard8
Attachment #8900260 - Flags: review?(standard8) → review+
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c36031a6431b
Enable the ESLint no-caller rule across mozilla-central r=standard8
https://hg.mozilla.org/mozilla-central/rev/c36031a6431b
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: