Enable eslint no-undef for services/

RESOLVED FIXED

Status

defect
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: standard8, Assigned: standard8)

Tracking

unspecified
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox54 fixed)

Details

Attachments

(3 attachments, 1 obsolete attachment)

Assignee

Description

2 years ago
As part of enabling no-undef in bug 1311312, it is fairly simple to enable it for services/, so I'd like to do that as a first step towards getting no-undef enabled in the tree.
Assignee

Updated

2 years ago
Assignee: nobody → standard8
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)

Comment 4

2 years ago
mozreview-review
Comment on attachment 8829997 [details]
Bug 1333044 - Prepare services/ for enabling no-undef eslint rule.

https://reviewboard.mozilla.org/r/106940/#review108060
Attachment #8829997 - Flags: review?(jaws) → review+

Comment 5

2 years ago
mozreview-review
Comment on attachment 8829998 [details]
Bug 1333044 - Fix no-shadow issues in services/.

https://reviewboard.mozilla.org/r/106942/#review108088

::: services/fxaccounts/tests/xpcshell/test_accounts.js:528
(Diff revision 1)
>    user.verified = true;
>  
>    fxa.setSignedInUser(user).then(() => {
> -    fxa.getSignedInUser().then((user) => {
> +    fxa.getSignedInUser().then((user2) => {
>        // Before getKeys, we have no keys
>        do_check_eq(!!user.kA, false);

hrm - this code looks odd, but I think all |user|s in this block should be |user2|?

::: services/fxaccounts/tests/xpcshell/test_profile_client.js:24
(Diff revision 1)
>      // Store the request uri so tests can inspect it
>      Request._requestUri = requestUri;
> +    Request.ifNoneMatchSet = false;
>      return {
> -      setHeader() {},
> +      setHeader(header, value) {
> +        if (header == "If-None-Match" && value == "bogusETag") {

thanks!

::: services/sync/tests/unit/test_bookmark_tracker.js:960
(Diff revision 1)
>      PlacesUtils.favicons.replaceFaviconDataFromDataURL(iconURI, iconURL, 0,
>        Services.scriptSecurityManager.getSystemPrincipal());
>  
>      await new Promise(resolve => {
>        PlacesUtils.favicons.setAndFetchFaviconForPage(pageURI, iconURI, true,
> -        PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, (iconURI, dataLen, data, mimeType) => {
> +        PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, (uri, dataLen, data, mimeType) => {

I don't understand this change or where |uri| comes from?
Attachment #8829998 - Flags: review?(markh) → review+

Comment 6

2 years ago
mozreview-review
Comment on attachment 8829999 [details]
Bug 1333044 - Enable no-undef eslint rule for services/.

https://reviewboard.mozilla.org/r/106944/#review108084

awesome, thanks Mark!

::: services/sync/tps/extensions/tps/resource/modules/bookmarks.jsm:937
(Diff revision 1)
>        return -1;
>      }
>      let expected_pos = -1;
>      if (this.props.before) {
> -      other_id = this.GetPlacesNodeId(this.props.folder_id,
> +      let other_id = this.GetPlacesNodeId(this.props.folder_id,
>                                        null,

we should probably indent these lines to match
Attachment #8829999 - Flags: review?(markh) → review+
Assignee

Comment 7

2 years ago
mozreview-review-reply
Comment on attachment 8829998 [details]
Bug 1333044 - Fix no-shadow issues in services/.

https://reviewboard.mozilla.org/r/106942/#review108088

> hrm - this code looks odd, but I think all |user|s in this block should be |user2|?

Yes, I missed that. Thanks for catching it.

> I don't understand this change or where |uri| comes from?

The last argument is a callback. iconURI is already declared in the upper scope, so this is just changing the argument name within the callback (no-shadow rule for eslint).
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)

Comment 11

2 years ago
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f8b29e24280b
Prepare services/ for enabling no-undef eslint rule. r=jaws
https://hg.mozilla.org/integration/autoland/rev/06a658a93aab
Fix no-shadow issues in services/. r=markh
https://hg.mozilla.org/integration/autoland/rev/9c6b98edac72
Enable no-undef eslint rule for services/. r=markh
Assignee

Comment 12

2 years ago
Posted patch Fix eslint failures (obsolete) — Splinter Review
Follow-up to fix the eslint failures.
Assignee

Updated

2 years ago
Attachment #8830276 - Attachment is patch: true

Comment 13

2 years ago
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d1f3d30546a1
"Enable eslint no-undef for services/" a=tomcat
sorry had to backout for test failures like https://treeherder.mozilla.org/logviewer.html#?job_id=71891487&repo=autoland
Flags: needinfo?(standard8)

Comment 15

2 years ago
Backout by cbook@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/788447f4f174
Backed out changeset d1f3d30546a1 
https://hg.mozilla.org/integration/autoland/rev/b01c14ac6688
Backed out changeset 9c6b98edac72 
https://hg.mozilla.org/integration/autoland/rev/a86db26c9700
Backed out changeset 06a658a93aab 
https://hg.mozilla.org/integration/autoland/rev/4346f9e1d390
Backed out changeset f8b29e24280b for perma failures in test_load_modules.js
Assignee

Comment 16

2 years ago
The tests fail on android as I was trying to include "resource://services-sync/constants.js" into services/crypto/modules/utils.js.

On Android, it appears that the sync part isn't shipped, and as a result, we then fail.

The reason we should use the constants.js file is that utils.js uses SYNC_KEY_DECODED_LENGTH.

https://dxr.mozilla.org/mozilla-central/rev/fbdfcecf0c774d2221f11aed5a504d5591c774e0/services/crypto/modules/utils.js#188

I think there's two options:

1) Move services/sync/modules/constants.js into common.
2) Change the check in utils.js to throw if dkLen isn't defined - as far as I can see, all the callers are defining dkLen.

Mark, any opinions on what we should do here?
Flags: needinfo?(standard8) → needinfo?(markh)
Comment hidden (mozreview-request)
Assignee

Updated

2 years ago
Attachment #8830276 - Attachment is obsolete: true
Assignee

Comment 18

2 years ago
Comment on attachment 8829999 [details]
Bug 1333044 - Enable no-undef eslint rule for services/.

Mark: this implements my option 2, as I think that's probably the best option.
Attachment #8829999 - Flags: review+ → review?(markh)

Comment 19

2 years ago
mozreview-review
Comment on attachment 8829999 [details]
Bug 1333044 - Enable no-undef eslint rule for services/.

https://reviewboard.mozilla.org/r/106944/#review109162

This looks great, thanks!
Attachment #8829999 - Flags: review?(markh) → review+
(In reply to Mark Banner (:standard8) from comment #16)
> I think there's two options:
> 
> 1) Move services/sync/modules/constants.js into common.
> 2) Change the check in utils.js to throw if dkLen isn't defined - as far as
> I can see, all the callers are defining dkLen.
> 
> Mark, any opinions on what we should do here?

SGTM!
Flags: needinfo?(markh)
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)

Comment 24

2 years ago
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/964e4881f2fe
Prepare services/ for enabling no-undef eslint rule. r=jaws
https://hg.mozilla.org/integration/autoland/rev/d0ba3b285285
Fix no-shadow issues in services/. r=markh
https://hg.mozilla.org/integration/autoland/rev/f3741ccc800b
Enable no-undef eslint rule for services/. r=markh
You need to log in before you can comment on or make changes to this bug.