Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix the lint
  • Loading branch information
jamesdaniels committed Nov 26, 2025
commit 9964bc2df23712afa5e2a313ae52c9104f55fd1c
15 changes: 15 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ module.exports = [
"newlines-between": "never"
},
],
'@angular-eslint/prefer-inject': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'import/named': 'off',
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"@typescript-eslint/prefer-promise-reject-errors": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/ban-ts-comment": "warn",
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test:all": "npm run test:node-esm && npm run test:chrome-headless && npm run test:typings && npm run test:build",
"build": "rimraf dist && tspc -p tsconfig.build.json && node --trace-warnings ./tools/build.js && npm pack ./dist/packages-dist",
"buildd": "tsc -p tsconfig.build.json && node --trace-warnings ./tools/build.js && npm pack ./dist/packages-dist",
"build:jasmine": "npx tsc -p tsconfig.jasmine.json --module es2015 && cp ./dist/out-tsc/jasmine/tools/jasmine.js ./dist/out-tsc/jasmine/tools/jasmine.mjs && npx tsc -p tsconfig.jasmine.json && cp ./dist/packages-dist/schematics/versions.json ./dist/out-tsc/jasmine/schematics",
"build:jasmine": "npx tsc -p tsconfig.jasmine.json --module es2015 && cp ./dist/out-tsc/jasmine/tools/jasmine.js ./dist/out-tsc/jasmine/tools/jasmine.mjs && npx tsc -p tsconfig.jasmine.json && cp ./dist/packages-dist/schematics/versions.json ./dist/out-tsc/jasmine/src/schematics",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1"
},
"husky": {
Expand Down
1 change: 0 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export function firebaseAppFactory(fn: (injector: Injector) => IFirebaseApp) {
]
})
export class FirebaseAppModule {
// eslint-disable-next-line @typescript-eslint/ban-types
constructor(@Inject(PLATFORM_ID) platformId: object) {
registerVersion('angularfire', VERSION.full, 'core');
registerVersion('angularfire', VERSION.full, 'app');
Expand Down
2 changes: 1 addition & 1 deletion src/compat/analytics/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class AngularFireAnalytics {
@Optional() @Inject(APP_NAME) providedAppName: string | null,
@Optional() @Inject(DEBUG_MODE) debugModeEnabled: boolean | null,
@Optional() @Inject(CONFIG) providedConfig: Config | null,
// eslint-disable-next-line @typescript-eslint/ban-types

@Inject(PLATFORM_ID) platformId: object,
zone: NgZone,
schedulers: ɵAngularFireSchedulers,
Expand Down
2 changes: 1 addition & 1 deletion src/compat/analytics/user-tracking.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class UserTrackingService implements OnDestroy {
// TODO a user properties injector
constructor(
analytics: AngularFireAnalytics,
// eslint-disable-next-line @typescript-eslint/ban-types

@Inject(PLATFORM_ID) platformId: object,
auth: AngularFireAuth,
zone: NgZone,
Expand Down
4 changes: 0 additions & 4 deletions src/compat/angularfire2.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { CompilerFactory, DoBootstrap, NgModule, PlatformRef } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { ɵZoneScheduler } from '@angular/fire';
import { AngularFireModule, FirebaseApp } from '@angular/fire/compat';
import { BrowserModule } from '@angular/platform-browser';
import { TestScheduler } from 'rxjs/testing';
import { COMMON_CONFIG } from '../../src/test-config';
import { rando } from '../../src/utils';

describe('angularfire', () => {
let app: FirebaseApp;
let defaultPlatform: PlatformRef;
let appName: string;

beforeEach(() => {
Expand All @@ -21,7 +18,6 @@ describe('angularfire', () => {
});

app = TestBed.inject(FirebaseApp);
defaultPlatform = TestBed.inject(PlatformRef);
});

describe('ZoneScheduler', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/compat/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class AngularFireAuth {
constructor(
@Inject(FIREBASE_OPTIONS) options: FirebaseOptions,
@Optional() @Inject(FIREBASE_APP_NAME) name: string|null|undefined,
// eslint-disable-next-line @typescript-eslint/ban-types

@Inject(PLATFORM_ID) platformId: object,
zone: NgZone,
schedulers: ɵAngularFireSchedulers,
Expand Down
2 changes: 1 addition & 1 deletion src/compat/database/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class AngularFireDatabase {
@Inject(FIREBASE_OPTIONS) options: FirebaseOptions,
@Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,
@Optional() @Inject(URL) databaseURL: string | null,
// eslint-disable-next-line @typescript-eslint/ban-types

@Inject(PLATFORM_ID) platformId: object,
zone: NgZone,
public schedulers: ɵAngularFireSchedulers,
Expand Down
2 changes: 1 addition & 1 deletion src/compat/database/list/create-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function createListReference<T= any>(query: DatabaseQuery, afDatabase: An
const snapshotChanges$ = snapshotChanges<T>(query, events, outsideAngularScheduler);
return snapshotChanges$.pipe(
map(actions => actions.map(a => {
if (options && options.idField) {
if (options?.idField) {
return {
...a.payload.val() as T,
...{
Expand Down
11 changes: 5 additions & 6 deletions src/compat/firebase.app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function ɵfirebaseAppFactory(options: FirebaseOptions, zone: NgZone, nam
const config = typeof nameOrConfig === 'object' && nameOrConfig || {};
config.name = config.name || name;
// Added any due to some inconsistency between @firebase/app and firebase types
const existingApp = firebase.apps.filter(app => app && app.name === config.name)[0];
const existingApp = firebase.apps.find(app => app && app.name === config.name);
// We support FirebaseConfig, initializeApp's public type only accepts string; need to cast as any
// Could be solved with https://github.com/firebase/firebase-js-sdk/pull/1206
const app = (existingApp || zone.runOutsideAngular(() => firebase.initializeApp(options, config as any)));
Expand All @@ -24,11 +24,11 @@ export function ɵfirebaseAppFactory(options: FirebaseOptions, zone: NgZone, nam
const hmr = !!(module as any).hot;
log('error', `${app.name} Firebase App already initialized with different options${hmr ? ', you may need to reload as Firebase is not HMR aware.' : '.'}`);
}
} catch (e) { /* empty */ }
} catch (_) { /* empty */ }
return new FirebaseApp(app);
}

const log = (level: 'log'|'error'|'info'|'warn', ...args: any) => {
const log = (level: 'log' | 'error' | 'info' | 'warn', ...args: any) => {
if (isDevMode() && typeof console !== 'undefined') {
// eslint-disable-next-line no-console
console[level](...args);
Expand All @@ -53,13 +53,12 @@ export class AngularFireModule {
return {
ngModule: AngularFireModule,
providers: [
{provide: FIREBASE_OPTIONS, useValue: options},
{provide: FIREBASE_APP_NAME, useValue: nameOrConfig}
{ provide: FIREBASE_OPTIONS, useValue: options },
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }
]
};
}

// eslint-disable-next-line @typescript-eslint/ban-types
constructor(@Inject(PLATFORM_ID) platformId: object) {
firebase.registerVersion('angularfire', VERSION.full, 'core');
firebase.registerVersion('angularfire', VERSION.full, 'app-compat');
Expand Down
10 changes: 5 additions & 5 deletions src/compat/firestore/collection-group/collection-group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ describe('AngularFirestoreCollectionGroup', () => {
// length but the updated item is now modified
if (count === 2) {
expect(data.length).toEqual(ITEMS);
const change = data.filter(x => x.payload.doc.id === names[0])[0];
const change = data.find(x => x.payload.doc.id === names[0]);
expect(change.type).toEqual('modified');
sub.unsubscribe();
done();
Expand Down Expand Up @@ -216,14 +216,14 @@ describe('AngularFirestoreCollectionGroup', () => {
// the first time should all be 'added'
if (count === 1) {
// make an update
firstIndex = data.filter(d => d.payload.doc.id === names[0])[0].payload.newIndex;
firstIndex = data.find(d => d.payload.doc.id === names[0]).payload.newIndex;
ref.doc(names[0]).update({ price: 2 });
}
// on the second round, make sure the array is still the same
// length but the updated item is now modified
if (count === 2) {
expect(data.length).toEqual(ITEMS);
const change = data.filter(x => x.payload.doc.id === names[0])[0];
const change = data.find(x => x.payload.doc.id === names[0]);
expect(change.type).toEqual('modified');
expect(change.payload.oldIndex).toEqual(firstIndex);
sub.unsubscribe();
Expand All @@ -241,7 +241,7 @@ describe('AngularFirestoreCollectionGroup', () => {

const sub = TestBed.runInInjectionContext(() => stocks.snapshotChanges(['modified'])).pipe(skip(1)).subscribe(data => {
sub.unsubscribe();
const change = data.filter(x => x.payload.doc.id === names[0])[0];
const change = data.find(x => x.payload.doc.id === names[0]);
expect(data.length).toEqual(1);
expect(change.payload.doc.data().price).toEqual(2);
expect(change.type).toEqual('modified');
Expand All @@ -262,7 +262,7 @@ describe('AngularFirestoreCollectionGroup', () => {

const sub = TestBed.runInInjectionContext(() => stocks.snapshotChanges(['added'])).pipe(skip(1)).subscribe(data => {
sub.unsubscribe();
const change = data.filter(x => x.payload.doc.id === nextId)[0];
const change = data.find(x => x.payload.doc.id === nextId);
expect(data.length).toEqual(ITEMS + 1);
expect(change.payload.doc.data().price).toEqual(2);
expect(change.type).toEqual('added');
Expand Down
10 changes: 5 additions & 5 deletions src/compat/firestore/collection/collection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe('AngularFirestoreCollection', () => {
// length but the updated item is now modified
if (count === 2) {
expect(data.length).toEqual(ITEMS);
const change = data.filter(x => x.payload.doc.id === firstName)[0];
const change = data.find(x => x.payload.doc.id === firstName);
expect(change.type).toEqual('modified');
sub.unsubscribe();
done();
Expand Down Expand Up @@ -219,14 +219,14 @@ describe('AngularFirestoreCollection', () => {
// the first time should all be 'added'
if (count === 1) {
// make an update
firstIndex = data.filter(d => d.payload.doc.id === names[0])[0].payload.newIndex;
firstIndex = data.find(d => d.payload.doc.id === names[0]).payload.newIndex;
stocks.doc(names[0]).update({ price: 2 });
}
// on the second round, make sure the array is still the same
// length but the updated item is now modified
if (count === 2) {
expect(data.length).toEqual(ITEMS);
const change = data.filter(x => x.payload.doc.id === names[0])[0];
const change = data.find(x => x.payload.doc.id === names[0]);
expect(change.type).toEqual('modified');
expect(change.payload.oldIndex).toEqual(firstIndex);
sub.unsubscribe();
Expand All @@ -244,7 +244,7 @@ describe('AngularFirestoreCollection', () => {

const sub = TestBed.runInInjectionContext(() => stocks.snapshotChanges(['modified'])).pipe(skip(1)).subscribe(data => {
sub.unsubscribe();
const change = data.filter(x => x.payload.doc.id === names[0])[0];
const change = data.find(x => x.payload.doc.id === names[0]);
expect(data.length).toEqual(1);
expect(change.payload.doc.data().price).toEqual(2);
expect(change.type).toEqual('modified');
Expand All @@ -264,7 +264,7 @@ describe('AngularFirestoreCollection', () => {

const sub = TestBed.runInInjectionContext(() => stocks.snapshotChanges(['added'])).pipe(skip(1)).subscribe(data => {
sub.unsubscribe();
const change = data.filter(x => x.payload.doc.id === nextId)[0];
const change = data.find(x => x.payload.doc.id === nextId);
expect(data.length).toEqual(ITEMS + 1);
expect(change.payload.doc.data().price).toEqual(2);
expect(change.type).toEqual('added');
Expand Down
2 changes: 1 addition & 1 deletion src/compat/firestore/firestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class AngularFirestore {
@Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,
@Optional() @Inject(ENABLE_PERSISTENCE) shouldEnablePersistence: boolean | null,
@Optional() @Inject(SETTINGS) settings: Settings | null,
// eslint-disable-next-line @typescript-eslint/ban-types

@Inject(PLATFORM_ID) platformId: object,
zone: NgZone,
public schedulers: ɵAngularFireSchedulers,
Expand Down
2 changes: 1 addition & 1 deletion src/compat/messaging/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class AngularFireMessaging {
constructor(
@Inject(FIREBASE_OPTIONS) options: FirebaseOptions,
@Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,
// eslint-disable-next-line @typescript-eslint/ban-types

@Inject(PLATFORM_ID) platformId: object,
zone: NgZone,
schedulers: ɵAngularFireSchedulers,
Expand Down
4 changes: 2 additions & 2 deletions src/compat/performance/performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class AngularFirePerformance {
@Optional() @Inject(INSTRUMENTATION_ENABLED) instrumentationEnabled: boolean | null,
@Optional() @Inject(DATA_COLLECTION_ENABLED) dataCollectionEnabled: boolean | null,
private zone: NgZone,
// eslint-disable-next-line @typescript-eslint/ban-types

@Inject(PLATFORM_ID) platformId: object
) {

Expand Down Expand Up @@ -107,7 +107,7 @@ export const traceWhile = <T = any>(
}
},
() => undefined,
() => options && options.orComplete && traceSubscription && traceSubscription.unsubscribe()
() => options?.orComplete && traceSubscription?.unsubscribe()
)
).subscribe(subscriber);
});
Expand Down
4 changes: 1 addition & 3 deletions src/compat/remote-config/remote-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EnvironmentInjector, Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID, inject } from '@angular/core';
import { EnvironmentInjector, Inject, Injectable, InjectionToken, NgZone, Optional, inject } from '@angular/core';
import { pendingUntilEvent } from '@angular/core/rxjs-interop';
import { ɵAngularFireSchedulers } from '@angular/fire';
import { ɵPromiseProxy, ɵapplyMixins, ɵlazySDKProxy } from '@angular/fire/compat';
Expand Down Expand Up @@ -130,8 +130,6 @@ export class AngularFireRemoteConfig {
@Optional() @Inject(DEFAULTS) defaultConfig: ConfigTemplate | null,
private zone: NgZone,
schedulers: ɵAngularFireSchedulers,
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/ban-types
@Inject(PLATFORM_ID) platformId: object
) {
const remoteConfig$ = of(undefined).pipe(
observeOn(schedulers.outsideAngular),
Expand Down
2 changes: 1 addition & 1 deletion src/compat/storage/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class AngularFireStorage {
@Inject(FIREBASE_OPTIONS) options: FirebaseOptions,
@Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,
@Optional() @Inject(BUCKET) storageBucket: string | null,
// eslint-disable-next-line @typescript-eslint/ban-types

@Inject(PLATFORM_ID) platformId: object,
zone: NgZone,
schedulers: ɵAngularFireSchedulers,
Expand Down
14 changes: 7 additions & 7 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"author": "angular,firebase",
"license": "MIT",
"peerDependencies": {
"@angular/common": "21.0.0-next.7",
"@angular/core": "21.0.0-next.7",
"@angular/platform-browser": "21.0.0-next.7",
"@angular/platform-browser-dynamic": "21.0.0-next.7",
"@angular/platform-server": "^21.0.0-next.7",
"@angular/common": "^21.0.0",
"@angular/core": "^21.0.0",
"@angular/platform-browser": "^21.0.0",
"@angular/platform-browser-dynamic": "^21.0.0",
"@angular/platform-server": "^21.0.0",
"rxjs": "~7.8.0",
"firebase-tools": "^14.0.0"
},
Expand All @@ -38,8 +38,8 @@
"dependencies": {
"firebase": "^12.4.0",
"rxfire": "^6.1.0",
"@angular-devkit/schematics": "21.0.0-next.7",
"@schematics/angular": "21.0.0-next.7",
"@angular-devkit/schematics": "^21.0.0",
"@schematics/angular": "^21.0.0",
"tslib": "^2.3.0"
},
"ng-update": {
Expand Down
4 changes: 2 additions & 2 deletions src/performance/performance.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const PROVIDED_PERFORMANCE_INSTANCES = new InjectionToken<Performance[]>(
export function defaultPerformanceInstanceFactory(
provided: FirebasePerformance[]|undefined,
defaultApp: FirebaseApp,
// eslint-disable-next-line @typescript-eslint/ban-types

platform: object
) {
if (!isPlatformBrowser(platform)) { return null; }
Expand All @@ -29,7 +29,7 @@ export function defaultPerformanceInstanceFactory(
}

export function performanceInstanceFactory(fn: (injector: Injector) => FirebasePerformance) {
// eslint-disable-next-line @typescript-eslint/ban-types

return (zone: NgZone, platform: object, injector: Injector) => {
if (!isPlatformBrowser(platform)) { return null; }
const performance = zone.runOutsideAngular(() => fn(injector));
Expand Down
2 changes: 1 addition & 1 deletion src/schematics/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const addDependencies = (
context.logger.warn(`⚠️ The ${depName} devDependency specified in your package.json (${existingVersion}) does not fulfill AngularFire's dependency (${dep.version})`);
// TODO offer to fix
}
} catch (e) {
} catch (_) {
if (existingVersion !== dep.version) {
context.logger.warn(`⚠️ The ${depName} devDependency specified in your package.json (${existingVersion}) does not fulfill AngularFire's dependency (${dep.version})`);
// TODO offer to fix
Expand Down
6 changes: 3 additions & 3 deletions src/schematics/deploy/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export const deployToFunction = async (
join(newStaticOut, 'index.html'),
join(newStaticOut, 'index.original.html')
);
} catch (e) { /* empty */ }
} catch (_) { /* empty */ }
}

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Expand Down Expand Up @@ -346,7 +346,7 @@ export const deployToCloudRun = async (
join(newStaticOut, 'index.html'),
join(newStaticOut, 'index.original.html')
);
} catch (e) { /* empty */ }
} catch (_) { /* empty */ }
}

if (options.preview) {
Expand Down Expand Up @@ -453,7 +453,7 @@ or the new Firebase App Hosting product https://firebase.google.com/docs/app-hos
project: firebaseProject,
projectRoot: context.workspaceRoot,
});
} catch (e) {
} catch (_) {
throw new Error(`Cannot select firebase project '${firebaseProject}'`);
}

Expand Down
4 changes: 2 additions & 2 deletions src/schematics/firebaseTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export const getFirebaseTools = () => globalThis.firebaseTools ?
process.env.FIREBASE_CLI_EXPERIMENTS ||= 'webframeworks';
try {
resolve(require('firebase-tools'));
} catch (e) {
} catch (_) {
try {
const root = execSync('npm root --location=global').toString().trim();
resolve(require(`${root}/firebase-tools`));
} catch (e) {
} catch (_) {
const spinner = ora({
text: `Installing firebase-tools...`,
// Workaround for https://github.com/sindresorhus/ora/issues/136.
Expand Down
Loading
Loading