Skip to content

Commit

Permalink
fix(firestore): linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
exaby73 committed Jul 14, 2023
1 parent c165a69 commit f22c38e
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 25 deletions.
4 changes: 2 additions & 2 deletions packages/firestore/e2e/DocumentSnapshot/isEqual.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
const COLLECTION = 'firestore';

describe('firestore.doc() -> snapshot.isEqual()', function () {
describe('v8 compatibility', () => {
describe('v8 compatibility', function () {
it('throws if other is not a DocumentSnapshot', async function () {
try {
const docRef = firebase.firestore().doc(`${COLLECTION}/baz`);
Expand Down Expand Up @@ -59,7 +59,7 @@ describe('firestore.doc() -> snapshot.isEqual()', function () {
});
});

describe('modular', () => {
describe('modular', function () {
it('throws if other is not a DocumentSnapshot', async function () {
const { getFirestore, doc, getDocs } = firestoreModular;
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/e2e/DocumentSnapshot/properties.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('firestore().doc() -> snapshot', function () {
return wipe();
});

describe('v8 compatibility', () => {
describe('v8 compatibility', function () {
it('.exists -> returns a boolean for exists', async function () {
const ref1 = firebase.firestore().doc(`${COLLECTION}/exists`);
const ref2 = firebase.firestore().doc(`${COLLECTION}/idonotexist`);
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('firestore().doc() -> snapshot', function () {
});
});

describe('modular', () => {
describe('modular', function () {
it('.exists -> returns a boolean for exists', async function () {
const { getFirestore, doc, setDoc, getDocs, deleteDoc } = firestoreModular;
const db = getFirestore(firebase.app());
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/e2e/Query/endAt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('firestore().collection().endAt()', function () {
return wipe();
});

describe('v8 compatibility', () => {
describe('v8 compatibility', function () {
it('throws if no argument provided', function () {
try {
firebase.firestore().collection(COLLECTION).endAt();
Expand Down Expand Up @@ -142,7 +142,7 @@ describe('firestore().collection().endAt()', function () {
});
});

describe('modular', () => {
describe('modular', function () {
it('throws if no argument provided', function () {
const { getFirestore, collection, endAt, query } = firestoreModular;
try {
Expand Down
5 changes: 2 additions & 3 deletions packages/firestore/e2e/Query/endBefore.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ describe('firestore().collection().endBefore()', function () {
});

it('ends before snapshot', async function () {
const { getFirestore, collection, doc, setDoc, query, orderBy, endBefore, getDocs } =
firestoreModular;
const { getFirestore, collection, doc, setDoc, query, endBefore, getDocs } = firestoreModular;
const colRef = collection(getFirestore(), `${COLLECTION}/endBefore/snapshot`);
const doc1 = doc(colRef, 'doc1');
const doc2 = doc(colRef, 'doc2');
Expand All @@ -269,7 +268,7 @@ describe('firestore().collection().endBefore()', function () {

const endBeforeSnapshot = await getDocs(doc2);

const qs = await getDocs(colRef.endBefore(endBeforeSnapshot));
const qs = await getDocs(query(colRef, endBefore(endBeforeSnapshot)));

qs.docs.length.should.eql(1);
qs.docs[0].id.should.eql('doc1');
Expand Down
7 changes: 3 additions & 4 deletions packages/firestore/e2e/Query/orderBy.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ describe('firestore().collection().orderBy()', function () {
});

it('orders by a value DESC', async function () {
const { getFirestore, collection, addDoc, getDocs, query, orderBy } = firestoreModular;
const { getFirestore, collection, addDoc, getDocs, query, orderBy, FieldPath } =
firestoreModular;
const colRef = collection(
getFirestore(),
// Firestore caches aggressively, even if you wipe the emulator, local documents are cached
Expand All @@ -244,9 +245,7 @@ describe('firestore().collection().orderBy()', function () {
await addDoc(colRef, { value: 3 });
await addDoc(colRef, { value: 2 });

const snapshot = await getDocs(
query(colRef.orderBy(new firebase.firestore.FieldPath('value'), 'desc')),
);
const snapshot = await getDocs(query(colRef, orderBy(new FieldPath('value'), 'desc')));
const expected = [3, 2, 1];

snapshot.forEach((docSnap, i) => {
Expand Down
12 changes: 6 additions & 6 deletions packages/firestore/e2e/Query/query.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ describe('FirestoreQuery/FirestoreQueryModifiers', function () {
const { getFirestore, collection, query, where, orderBy, limit, endAt } = firestoreModular;
try {
query(
collection(getFirestore(), COLLECTION)
.where('foo', '>', 'bar')
.orderBy('bar')
.orderBy('foo')
.limit(1)
.endAt(2),
collection(getFirestore(), COLLECTION),
where('foo', '>', 'bar'),
orderBy('bar'),
orderBy('foo'),
limit(1),
endAt(2),
);
return Promise.reject(new Error('Did not throw an Error.'));
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/e2e/WriteBatch/commit.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ describe('firestore.WriteBatch.commit()', function () {
});

it('should delete & commit', async function () {
const { getFirestore, writeBatch, doc, setDoc, getDocs, deleteDoc } = firestoreModular;
const { getFirestore, writeBatch, doc, setDoc, getDocs } = firestoreModular;
const db = getFirestore();
const lRef = doc(db, `${COLLECTION}/LON`);
const nycRef = doc(db, `${COLLECTION}/NYC`);
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/e2e/WriteBatch/set.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ describe('firestore.WriteBatch.set()', function () {
docRef,
{},
{
mergeFields: ['foo.bar', new firebase.firestore.FieldPath('foo', 'bar')],
mergeFields: ['foo.bar', new FieldPath('foo', 'bar')],
},
);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/lib/modular/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
* @typedef {import('@firebase/app').FirebaseApp} FirebaseApp
*/

import { firebase, FirebaseFirestoreTypes } from '../index';
import { LoadBundleTask, LogLevel } from './index';
import { firebase } from '../index';

/**
* @param {FirebaseApp?} app
Expand Down Expand Up @@ -157,6 +156,7 @@ export function waitForPendingWrites(firestore) {
// Calling getFirestore() after initializeFirestore() would return this new instance.
// Need to figure out how to handle this using the compat API.
export async function initializeFirestore(app, settings, databaseId) {
databaseId; // make eslint happy
const firestore = firebase.firestore(app);
await firestore.settings(settings);
return firestore;
Expand Down
2 changes: 0 additions & 2 deletions packages/firestore/lib/modular/snapshot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { isPartialObserver } from './utils/observer';

/**
* @typedef {import('../..').FirebaseFirestoreTypes.Query} Query
* @typedef {import('../..').FirebaseFirestoreTypes.DocumentReference} DocumentReference
Expand Down

0 comments on commit f22c38e

Please sign in to comment.