Closed Bug 1801092 Opened 1 year ago Closed 1 year ago

Add an ESLint rule to disallow single-argument use of Cu.reportError

Categories

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

Tracking

(firefox109 fixed)

RESOLVED FIXED
Tracking Status
firefox109 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

As part of moving away from Cu.reportError, the first step is to disallow the single-argument form.

As there's quite a few instances and various test failures that result, we'll roll this out as a warning for existing failures, and an error for other code where we have no failures.

We can then work on making it an error everywhere over time.

Disallowing multiple arguments will come in a future bug/patch.

This enforces the bulk of the cases for Cu.reportError. A follow-up will extend this to the
two argument form.

These are normally hidden due to bug 1578682, but get highlighted when doing an outgoing push and will currently
cause pushing via lando to fail.

Backed out for causing newtab failures.

Push with failures

Failure log

Backout link

[task 2022-11-29T22:11:58.001Z] TEST START | karma
[task 2022-11-29T22:12:39.243Z] webpack was not included as a framework in karma configuration, setting this automatically...
[task 2022-11-29T22:12:39.254Z] TEST-UNEXPECTED-FAIL karma | activity-stream:ASRouter:valid preview endpoint should report an error if url protocol is not https: function(msg, ...args) {
[task 2022-11-29T22:12:39.254Z]   origConsoleError.apply(console, [msg, ...args]);
[task 2022-11-29T22:12:39.254Z] 
[task 2022-11-29T22:12:39.254Z]   if (
[task 2022-11-29T22:12:39.254Z]     /(Invalid prop|Failed prop type|Check the render method|React Intl)/.test(
[task 2022-11-29T22:12:39.254Z]       msg
[task 2022-11-29T22:12:39.254Z]     )
[task 2022-11-29T22:12:39.254Z]   ) {
[task 2022-11-29T22:12:39.254Z]     throw new Error(msg);
[task 2022-11-29T22:12:39.254Z]   }
[task 2022-11-29T22:12:39.254Z] } is not stubbed
[task 2022-11-29T22:12:39.254Z] fail@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:174:25
[task 2022-11-29T22:12:39.254Z] [2]</createAssertObject/verifyIsStub/<@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:91:28
[task 2022-11-29T22:12:39.254Z] verifyIsStub@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:78:16
[task 2022-11-29T22:12:39.254Z] [2]</createAssertObject/mirrorPropAsAssertion/assert[name]@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:132:25
[task 2022-11-29T22:12:39.254Z] @http://localhost:9876/absolute/tmp/_karma_webpack_280695/commons.js?8a9ba531703779713dd47b6daf3eaee777dfd061:111794:14
[task 2022-11-29T22:12:39.254Z] 
[task 2022-11-29T22:12:39.254Z] TEST-UNEXPECTED-FAIL karma | activity-stream:ASRouterPreferences:#_transformPersonalizedCfrScores should report JSON.parse errors: expected reportError to be called once but was called 0 times
[task 2022-11-29T22:12:39.254Z] fail@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:174:25
[task 2022-11-29T22:12:39.254Z] failAssertion@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:120:20
[task 2022-11-29T22:12:39.254Z] [2]</createAssertObject/mirrorPropAsAssertion/assert[name]@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:149:30
[task 2022-11-29T22:12:39.254Z] @http://localhost:9876/absolute/tmp/_karma_webpack_280695/commons.js?8a9ba531703779713dd47b6daf3eaee777dfd061:119421:14
[task 2022-11-29T22:12:39.254Z] 
[task 2022-11-29T22:12:39.254Z] TEST-UNEXPECTED-FAIL karma | activity-stream:CFRPageActions:PageAction:#getStrings should report an error when no attributes are present but subAttribute is requested: expected reportError to be called once but was called 0 times
[task 2022-11-29T22:12:39.255Z] fail@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:174:25
[task 2022-11-29T22:12:39.255Z] failAssertion@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:120:20
[task 2022-11-29T22:12:39.255Z] [2]</createAssertObject/mirrorPropAsAssertion/assert[name]@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:149:30
[task 2022-11-29T22:12:39.255Z] @http://localhost:9876/absolute/tmp/_karma_webpack_280695/commons.js?8a9ba531703779713dd47b6daf3eaee777dfd061:121231:16
[task 2022-11-29T22:12:39.255Z] 
[task 2022-11-29T22:12:39.255Z] TEST-UNEXPECTED-FAIL karma | activity-stream:ActivityStreamMessageChannel:portID validation should log errors for an invalid portID: expected 0 to equal 3
[task 2022-11-29T22:12:39.255Z] AssertionError@http://localhost:9876/base/node_modules/chai/chai.js?f1fcb2c183aa6b15ddf3d41bc841c13888ffe3ad:9574:13
[task 2022-11-29T22:12:39.255Z] [3]</module.exports/Assertion.prototype.assert@http://localhost:9876/base/node_modules/chai/chai.js?f1fcb2c183aa6b15ddf3d41bc841c13888ffe3ad:250:13
[task 2022-11-29T22:12:39.255Z] [6]</module.exports/assert.equal@http://localhost:9876/base/node_modules/chai/chai.js?f1fcb2c183aa6b15ddf3d41bc841c13888ffe3ad:4365:10
[task 2022-11-29T22:12:39.255Z] @http://localhost:9876/absolute/tmp/_karma_webpack_280695/commons.js?8a9ba531703779713dd47b6daf3eaee777dfd061:147607:14
[task 2022-11-29T22:12:39.255Z] 
[task 2022-11-29T22:12:39.255Z] TEST-UNEXPECTED-FAIL karma | activity-stream:ActivityStreamMessageChannel:Message handling:#onMessage should report an error if the msg.data is missing: expected reportError to be called once but was called 0 times
[task 2022-11-29T22:12:39.255Z] fail@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:174:25
[task 2022-11-29T22:12:39.255Z] failAssertion@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:120:20
[task 2022-11-29T22:12:39.255Z] [2]</createAssertObject/mirrorPropAsAssertion/assert[name]@http://localhost:9876/base/node_modules/sinon/pkg/sinon.js?f837a180811d6d8392aef37bdfa2287bf7ce2414:149:30
[task 2022-11-29T22:12:39.255Z] @http://localhost:9876/absolute/tmp/_karma_webpack_280695/commons.js?8a9ba531703779713dd47b6daf3eaee777dfd061:147874:16
[task 2022-11-29T22:12:39.255Z] 
<...>
Flags: needinfo?(standard8)
See Also: → 1803229

Unfortunately Lando jumped in there and changed those instances because I'd left newtab as warning. I've filed bug 1803229 as Lando should not be changing non-formatting things.

Flags: needinfo?(standard8)
Pushed by imoraru@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/7323c7444941
Exclude .eslintrc.js files from the rejected-words linter. r=linter-reviewers,ahal
https://hg.mozilla.org/mozilla-central/rev/9df9c279c28d
Add an ESLint rule to disllow use of Cu.reportError with a single argument. r=Gijs,cmkm
Blocks: 1806720
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: