Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2775,27 +2775,6 @@
"count": 1
}
},
"packages/polling-controller/src/BlockTrackerPollingController.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 5
},
"@typescript-eslint/naming-convention": {
"count": 1
}
},
"packages/polling-controller/src/StaticIntervalPollingController.test.ts": {
"id-denylist": {
"count": 1
}
},
"packages/polling-controller/src/StaticIntervalPollingController.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 7
},
"@typescript-eslint/naming-convention": {
"count": 1
}
},
"packages/profile-sync-controller/src/controllers/authentication/AuthenticationController.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export type BlockTrackerPollingInput = {
* @param Base - The base class to mix onto.
* @returns The composed class.
*/
// This is a function that's used as class, and the return type is inferred from
// the class defined inside the function scope, so this can't be easily typed.
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention
function BlockTrackerPollingControllerMixin<
TBase extends Constructor,
PollingInput extends BlockTrackerPollingInput,
Expand All @@ -40,7 +43,7 @@ function BlockTrackerPollingControllerMixin<
networkClientId: NetworkClientId,
): NetworkClient | undefined;

_startPolling(input: PollingInput) {
_startPolling(input: PollingInput): void {
const key = getKey(input);

if (this.#activeListeners[key]) {
Expand All @@ -61,7 +64,7 @@ function BlockTrackerPollingControllerMixin<
}
}

_stopPollingByPollingTokenSetId(key: PollingTokenSetId) {
_stopPollingByPollingTokenSetId(key: PollingTokenSetId): void {
const { networkClientId } = JSON.parse(key);
const networkClient = this._getNetworkClientById(
networkClientId as NetworkClientId,
Expand All @@ -86,10 +89,16 @@ class Empty {}

export const BlockTrackerPollingControllerOnly = <
PollingInput extends BlockTrackerPollingInput,
// The return type is inferred from the class defined inside the function
// scope, so this can't be easily typed.
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
>() => BlockTrackerPollingControllerMixin<typeof Empty, PollingInput>(Empty);

export const BlockTrackerPollingController = <
PollingInput extends BlockTrackerPollingInput,
// The return type is inferred from the class defined inside the function
// scope, so this can't be easily typed.
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
>() =>
BlockTrackerPollingControllerMixin<typeof BaseController, PollingInput>(
BaseController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ChildBlockTrackerPollingController extends StaticIntervalPollingController
any
> {
executePollPromises: {
reject: (err: unknown) => void;
reject: (error: unknown) => void;
resolve: () => void;
}[] = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import type {
* @param Base - The base class to mix onto.
* @returns The composed class.
*/
// This is a function that's used as class, and the return type is inferred from
// the class defined inside the function scope, so this can't be easily typed.
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention
function StaticIntervalPollingControllerMixin<
TBase extends Constructor,
PollingInput extends Json,
Expand All @@ -30,15 +33,15 @@ function StaticIntervalPollingControllerMixin<

#intervalLength: number | undefined = 1000;

setIntervalLength(intervalLength: number) {
setIntervalLength(intervalLength: number): void {
this.#intervalLength = intervalLength;
}

getIntervalLength() {
getIntervalLength(): number | undefined {
return this.#intervalLength;
}

_startPolling(input: PollingInput) {
_startPolling(input: PollingInput): void {
if (!this.#intervalLength) {
throw new Error('intervalLength must be defined and greater than 0');
}
Expand All @@ -65,7 +68,7 @@ function StaticIntervalPollingControllerMixin<
));
}

_stopPollingByPollingTokenSetId(key: PollingTokenSetId) {
_stopPollingByPollingTokenSetId(key: PollingTokenSetId): void {
const intervalId = this.#intervalIds[key];
if (intervalId) {
clearTimeout(intervalId);
Expand All @@ -81,8 +84,14 @@ class Empty {}

export const StaticIntervalPollingControllerOnly = <
PollingInput extends Json,
// The return type is inferred from the class defined inside the function
// scope, so this can't be easily typed.
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
>() => StaticIntervalPollingControllerMixin<typeof Empty, PollingInput>(Empty);

// The return type is inferred from the class defined inside the function
// scope, so this can't be easily typed.
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const StaticIntervalPollingController = <PollingInput extends Json>() =>
StaticIntervalPollingControllerMixin<typeof BaseController, PollingInput>(
BaseController,
Expand Down
Loading