Closed Bug 1766228 Opened 3 years ago Closed 3 years ago

Add an ESLint rule to ensure that member property accesses of Services are valid

Categories

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

Tracking

(firefox103 fixed)

RESOLVED FIXED
103 Branch
Tracking Status
firefox103 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(5 files)

I believe we occasionally have issues where code is broken because of incorrect use of Services. member property accesses.

We also have several existing in-tree at the moment.

As our ESLint plugin already knows about what services are available on Services, it is reasonably simple to add a rule to check that these are correct. Whilst it is not really the responsibility of ESLint, it is the best tool that we have at the moment.

This makes the tests consistent with the rest of the code, and avoids errors from the new ESLint valid-services rule.

Depends on D149389

This makes the tests consistent with the rest of the code, and avoids errors from the new ESLint valid-services rule.

Depends on D149390

Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2c7ef1ad380a Add some more interface types to components that are included in services. r=kmag https://hg.mozilla.org/integration/autoland/rev/76a32127865d Replace manual Services.cookiemgr definition with Services.cookies in netwerk cookies tests. r=necko-reviewers,kershaw https://hg.mozilla.org/integration/autoland/rev/cbba28151712 Replace manual definition of Services.cookiesvc with Services.cookies. r=necko-reviewers,kershaw https://hg.mozilla.org/integration/autoland/rev/01642c97e7a5 Add nsICookieService as an acceptable interface for Services.cookies. r=kmag https://hg.mozilla.org/integration/autoland/rev/5ff1634cfe18 Add an ESLint rule to ensure that member property accesses of Services are valid. r=Gijs

Backed out for causing lint failures on test_restrequest.js

Backout link

Push with failures

Failure log

Failure line(s): TEST-UNEXPECTED-ERROR | /builds/worker/checkouts/gecko/services/common/tests/unit/test_restrequest.js:851:3 | 'Services' is not defined. (no-undef)

There are also some xpcshell failures caused by this push as seen here . Failure log xpcshell

Flags: needinfo?(standard8)

Ah, this conflicted with bug 1773609 which landed a few hours before this. I'll fix.

Flags: needinfo?(standard8)
Regressions: 1774623
No longer regressions: 1774623
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6e8dfdb7a82d Add some more interface types to components that are included in services. r=kmag https://hg.mozilla.org/integration/autoland/rev/4ba8be002536 Replace manual Services.cookiemgr definition with Services.cookies in netwerk cookies tests. r=necko-reviewers,kershaw https://hg.mozilla.org/integration/autoland/rev/3240fa10558b Replace manual definition of Services.cookiesvc with Services.cookies. r=necko-reviewers,kershaw https://hg.mozilla.org/integration/autoland/rev/91253ef3da4f Add nsICookieService as an acceptable interface for Services.cookies. r=kmag https://hg.mozilla.org/integration/autoland/rev/29d19ae2936c Add an ESLint rule to ensure that member property accesses of Services are valid. r=Gijs
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: