Skip to content

Commit 478c1a5

Browse files
committed
fix more lint
1 parent a0dc008 commit 478c1a5

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

config/.eslintrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ module.exports = {
146146
'String': "Use 'string' instead.",
147147
'Number': "Use 'number' instead.",
148148
'Boolean': "Use 'boolean' instead.",
149-
'Function': 'Avoid the Function type, as it provides little safety'
149+
'Function': `Avoid the Function type, as it provides little safety for the following reasons:
150+
It provides no type safety when calling the value, which means it's easy to provide the wrong arguments.
151+
It accepts class declarations, which will fail when called, as they are called without the new keyword.`
150152
},
151153
'extendDefaults': false
152154
}

packages/database/src/core/util/util.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ export function each(obj: object, fn: (k: string, v: unknown) => void) {
428428
export const bindCallback = function (
429429
callback: (a: unknown) => void,
430430
context?: object | null
431-
): Function {
431+
): (a: unknown) => void {
432432
return context ? callback.bind(context) : callback;
433433
};
434434

@@ -609,6 +609,7 @@ export const exceptionGuard = function (fn: () => void) {
609609
* @param {...*} varArgs Arbitrary args to be passed to opt_onComplete
610610
*/
611611
export const callUserCallback = function (
612+
// eslint-disable-next-line @typescript-eslint/ban-types
612613
callback?: Function | null,
613614
...varArgs: unknown[]
614615
) {
@@ -665,7 +666,7 @@ export const exportPropGetter = function (
665666
* @return {number|Object} The setTimeout() return value.
666667
*/
667668
export const setTimeoutNonBlocking = function (
668-
fn: Function,
669+
fn: () => void,
669670
time: number
670671
): number | object {
671672
const timeout: number | object = setTimeout(fn, time);

packages/database/test/helpers/EventAccumulator.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class EventAccumulator {
3737
reject;
3838
private onResetFxn;
3939
private onEventFxn;
40+
// eslint-disable-next-line @typescript-eslint/ban-types
4041
constructor(public condition: Function) {
4142
this.promise = new Promise((resolve, reject) => {
4243
this.resolve = resolve;
@@ -52,6 +53,7 @@ export class EventAccumulator {
5253
this.resolve(this.eventData);
5354
}
5455
}
56+
// eslint-disable-next-line @typescript-eslint/ban-types
5557
reset(condition?: Function) {
5658
this.eventData = [];
5759
this.promise = new Promise((resolve, reject) => {
@@ -65,9 +67,11 @@ export class EventAccumulator {
6567
this.condition = condition;
6668
}
6769
}
70+
// eslint-disable-next-line @typescript-eslint/ban-types
6871
onEvent(cb: Function) {
6972
this.onEventFxn = cb;
7073
}
74+
// eslint-disable-next-line @typescript-eslint/ban-types
7175
onReset(cb: Function) {
7276
this.onResetFxn = cb;
7377
}

packages/firestore/test/util/equality_matcher.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface Equatable<T> {
3232
*/
3333
export interface CustomMatcher<T> {
3434
equalsFn: (left: T, right: T) => boolean;
35+
// eslint-disable-next-line @typescript-eslint/ban-types
3536
forType: Function;
3637
}
3738

0 commit comments

Comments
 (0)