Closed Bug 1246594 Opened 4 years ago Closed 5 months ago

Enable no-throw-literal eslint rule in the entire tree

Categories

(Firefox :: General, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 68
Tracking Status
firefox47 --- wontfix
firefox68 --- fixed

People

(Reporter: Gijs, Assigned: Kwan)

References

Details

Attachments

(1 file)

Because `throw "Foo"` isn't as good as `throw new Error("Foo")`

eslint has a builtin rule for this:

http://eslint.org/docs/rules/no-throw-literal

It seems to already be enabled for toolkit/components/extensions and devtools. I think we should enable it everywhere.
Depends on: 1250254

I have this done locally, modulo a couple test errors https://treeherder.mozilla.org/#/jobs?repo=try&revision=b3dfb79d3e8722b1e5cc8297ebef3eaf4b59cbe9

Also have a new rule to forbid and autofix throw Cr.NS_ERROR;, since no-throw-literals can't detect that's just an int.

Assignee: nobody → moz-ian
Status: NEW → ASSIGNED
See Also: → 1536556

Green try:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=724b6b5b589c944a265509a5254511ca29117a5

Sheriffs, this patch may have some dependent patches on Lando when you get to this, but they'll be attached to other bugs so they won't need landing, only this one at the bottom of the stack
https://lando.services.mozilla.com/D24088/

Keywords: checkin-needed

Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/13e9a230eb25
Enable ESLint rule no-throw-literal by default. r=Standard8

Keywords: checkin-needed
Blocks: 1536648
Blocks: 1536653
See Also: → 1536659
Blocks: 1536659
See Also: 1536659
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 68
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/470f4c1ed97e
Port bug 1246594 - Enable ESLint rule no-throw-literal by default; rs=bustage-fix DONTBUILD
Blocks: 1537776
Blocks: 1538764
Blocks: 1538766
Blocks: 1539176
Blocks: 1539177
Blocks: 1541024
Blocks: 1541025
Blocks: 1544284
Blocks: 1544285
Blocks: 1544286
You need to log in before you can comment on or make changes to this bug.