Skip to content

Commit 078f83a

Browse files
authored
Enable noUnusedLocals in TS compiler options (#672)
* Enable noUnusedLocals in TS compiler options * [AUTOMATED]: Prettier Code Styling
1 parent 3327845 commit 078f83a

File tree

8 files changed

+11
-31
lines changed

8 files changed

+11
-31
lines changed

packages/messaging/src/controllers/controller-interface.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515
*/
1616

1717
import { FirebaseApp } from '@firebase/app-types';
18-
import {
19-
createSubscribe,
20-
ErrorFactory,
21-
NextFn,
22-
Observer,
23-
PartialObserver
24-
} from '@firebase/util';
18+
import { ErrorFactory, NextFn, PartialObserver } from '@firebase/util';
2519
import { isArrayBufferEqual } from '../helpers/is-array-buffer-equal';
2620
import { TokenDetails } from '../interfaces/token-details';
2721
import { ERROR_CODES, ERROR_MAP } from '../models/errors';

packages/messaging/src/controllers/sw-controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { FirebaseApp } from '@firebase/app-types';
18+
1819
import { ERROR_CODES } from '../models/errors';
1920
import { DEFAULT_PUBLIC_VAPID_KEY } from '../models/fcm-details';
2021
import * as WorkerPageMessage from '../models/worker-page-message';
@@ -123,7 +124,7 @@ export class SWController extends ControllerInterface {
123124
}
124125

125126
try {
126-
const subscription = await registration.pushManager.getSubscription();
127+
await registration.pushManager.getSubscription();
127128
// TODO: Check if it's still valid. If not, then update token.
128129
} catch (err) {
129130
// The best thing we can do is log this to the terminal so
@@ -185,7 +186,6 @@ export class SWController extends ControllerInterface {
185186
}
186187

187188
// Delete notification data from payload before sending to the page.
188-
const notificationData = msgPayload['notification'];
189189
delete msgPayload['notification'];
190190

191191
const internalMsg = WorkerPageMessage.createNewMsg(

packages/messaging/src/controllers/window-controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ import {
2424
Subscribe,
2525
Unsubscribe
2626
} from '@firebase/util';
27+
2728
import { base64ToArrayBuffer } from '../helpers/base64-to-array-buffer';
2829
import { DEFAULT_SW_PATH, DEFAULT_SW_SCOPE } from '../models/default-sw';
2930
import { ERROR_CODES } from '../models/errors';
3031
import { DEFAULT_PUBLIC_VAPID_KEY } from '../models/fcm-details';
3132
import * as WorkerPageMessage from '../models/worker-page-message';
3233
import { ControllerInterface } from './controller-interface';
3334

34-
declare const firebase: any;
35-
3635
export class WindowController extends ControllerInterface
3736
implements FirebaseMessaging {
3837
private registrationToUse_: ServiceWorkerRegistration | null = null;
@@ -42,6 +41,7 @@ export class WindowController extends ControllerInterface
4241
private readonly onMessage_: Subscribe<{}> = createSubscribe(observer => {
4342
this.messageObserver_ = observer;
4443
});
44+
// @ts-ignore: Unused variable error, this is not implemented yet.
4545
private tokenRefreshObserver_: Observer<{}, Error> | null = null;
4646
private readonly onTokenRefresh_: Subscribe<{}> = createSubscribe(
4747
observer => {

packages/messaging/src/models/db-interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { ErrorFactory } from '@firebase/util';
1818

19-
import { ERROR_CODES, ERROR_MAP } from './errors';
19+
import { ERROR_MAP } from './errors';
2020

2121
export abstract class DBInterface {
2222
private dbPromise: Promise<IDBDatabase> | null = null;

packages/messaging/src/models/iid-model.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { base64, ErrorFactory } from '@firebase/util';
17+
import { ErrorFactory } from '@firebase/util';
1818

1919
import { arrayBufferToBase64 } from '../helpers/array-buffer-to-base64';
20-
import { TokenDetails } from '../interfaces/token-details';
2120
import { ERROR_CODES, ERROR_MAP } from './errors';
2221
import { DEFAULT_PUBLIC_VAPID_KEY, ENDPOINT } from './fcm-details';
2322

packages/messaging/src/models/token-details-model.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,3 @@ export class TokenDetailsModel extends DBInterface {
245245
return details;
246246
}
247247
}
248-
249-
/** Promisifies an IDBRequest. Resolves with the IDBRequest's result. */
250-
function promisify<ReturnType>(request: IDBRequest): Promise<ReturnType> {
251-
return new Promise<ReturnType>((resolve, reject) => {
252-
request.onsuccess = () => {
253-
resolve(request.result);
254-
};
255-
request.onerror = () => {
256-
reject(request.error);
257-
};
258-
});
259-
}

packages/messaging/test/controller-get-token.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
*/
1616
import { assert, expect } from 'chai';
1717
import * as sinon from 'sinon';
18-
import {
19-
ControllerInterface,
20-
TOKEN_EXPIRATION_MILLIS
21-
} from '../src/controllers/controller-interface';
18+
19+
import { ControllerInterface } from '../src/controllers/controller-interface';
2220
import { SWController } from '../src/controllers/sw-controller';
2321
import { WindowController } from '../src/controllers/window-controller';
2422
import { base64ToArrayBuffer } from '../src/helpers/base64-to-array-buffer';

packages/messaging/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"extends": "../../config/tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "dist",
5-
"strict": true
5+
"strict": true,
6+
"noUnusedLocals": true
67
},
78
"exclude": [
89
"dist/**/*"

0 commit comments

Comments
 (0)