Skip to content

Commit

Permalink
Bug 1869678 - Use more idiomatic code patterns for better type infere…
Browse files Browse the repository at this point in the history
…nce r=robwu

These fall under 5 main categories:

 1) Declare and/or initialize all class fiels in the constructor.
    (general good practise)

 2) Use real getters and redefineGetter instead of defineLazyGetter.
    (also keeps related code closer together)

 3) When subclassing, don't override class fields with getters (or vice versa).
    microsoft/TypeScript#33509

 4) Declare and assign object literals at the same time, not separatelly.
    (don't use `let foo;` at the top of the file, use `var foo = {`)

 5) Don't re-use local variables unnecesarily with different types.
    (general good practise, local variables are "free")

Differential Revision: https://phabricator.services.mozilla.com/D196386

UltraBlame original commit: 8e768446e17cc306729e3b0f705b0285c69321cf
  • Loading branch information
marco-c committed Jan 1, 2024
1 parent bb08a84 commit 826c4ec
Show file tree
Hide file tree
Showing 20 changed files with 1,923 additions and 1,415 deletions.
16 changes: 16 additions & 0 deletions toolkit/components/extensions/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,25 @@ before
define
"
:
[
"
error
"
{
allowNamedExports
:
true
classes
:
true
functions
:
false
variables
:
false
}
]
"
block
-
Expand Down
11 changes: 7 additions & 4 deletions toolkit/components/extensions/ConduitsParent.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3114,7 +3114,8 @@ this
)
;
}
sender
let
remote
=
Hub
.
Expand All @@ -3128,10 +3129,10 @@ sender
if
(
!
sender
remote
|
|
sender
remote
.
actor
!
Expand Down Expand Up @@ -3173,7 +3174,7 @@ Hub
.
recvConduitClosed
(
sender
remote
)
;
}
Expand Down Expand Up @@ -3224,6 +3225,8 @@ actor
this
query
sender
:
remote
}
)
;
Expand Down
Loading

0 comments on commit 826c4ec

Please sign in to comment.