diff --git a/RNFBFirestore.podspec b/RNFBFirestore.podspec index 3cc2d4354e..b3d100205e 100644 --- a/RNFBFirestore.podspec +++ b/RNFBFirestore.podspec @@ -19,5 +19,5 @@ Pod::Spec.new do |s| s.dependency 'Firebase/Core', '~> 6.5.0' s.dependency 'Firebase/Firestore', '~> 6.5.0' s.dependency 'RNFBApp' - s.static_framework = true + s.static_framework = false end diff --git a/android/build.gradle b/android/build.gradle index 747d0d173d..3f8c162fb8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.0' + classpath 'com.android.tools.build:gradle:3.4.2' } } @@ -15,7 +15,7 @@ plugins { project.ext { set('react-native', [ versions: [ - android : [ + android : [ minSdk : 16, targetSdk : 28, compileSdk: 28, @@ -24,12 +24,8 @@ project.ext { buildTools: "28.0.3" ], - googlePlayServices: [ - base: "16.1.0", - ], - - firebase : [ - firestore: "19.0.2" + firebase: [ + bom: "21.1.0", ], ], ]) @@ -61,8 +57,8 @@ repositories { dependencies { api project(':@react-native-firebase_app') - implementation "com.google.firebase:firebase-firestore:${ReactNative.ext.getVersion("firebase", "firestore")}" - implementation "com.google.android.gms:play-services-base:${ReactNative.ext.getVersion("googlePlayServices", "base")}" + implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}") + implementation "com.google.firebase:firebase-firestore" } ReactNative.shared.applyPackageVersion() diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index c877ea65b7..a10588d9dc 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/e2e/Blob.e2e.js b/e2e/Blob.e2e.js index 7b885f80e7..cce3b0510f 100644 --- a/e2e/Blob.e2e.js +++ b/e2e/Blob.e2e.js @@ -31,7 +31,7 @@ describe('firestore.Blob', () => { new firebase.firestore.Blob(); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`constructor is private`); + error.message.should.containEql('constructor is private'); return Promise.resolve(); } }); diff --git a/e2e/CollectionReference/add.e2e.js b/e2e/CollectionReference/add.e2e.js index f6326b2162..23c295603f 100644 --- a/e2e/CollectionReference/add.e2e.js +++ b/e2e/CollectionReference/add.e2e.js @@ -28,7 +28,7 @@ describe('firestore.collection().add()', () => { .add(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'data' must be an object`); + error.message.should.containEql("'data' must be an object"); return Promise.resolve(); } }); diff --git a/e2e/CollectionReference/doc.e2e.js b/e2e/CollectionReference/doc.e2e.js index b534cdfeaf..0a063bb3e3 100644 --- a/e2e/CollectionReference/doc.e2e.js +++ b/e2e/CollectionReference/doc.e2e.js @@ -28,7 +28,7 @@ describe('firestore.collection().doc()', () => { .doc('bar/baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentPath' must point to a document`); + error.message.should.containEql("'documentPath' must point to a document"); return Promise.resolve(); } }); diff --git a/e2e/DocumentReference/collection.e2e.js b/e2e/DocumentReference/collection.e2e.js index 3924ba289d..1d5b055515 100644 --- a/e2e/DocumentReference/collection.e2e.js +++ b/e2e/DocumentReference/collection.e2e.js @@ -24,7 +24,7 @@ describe('firestore.doc().collection()', () => { .collection(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'collectionPath' must be a string value`); + error.message.should.containEql("'collectionPath' must be a string value"); return Promise.resolve(); } }); @@ -37,7 +37,7 @@ describe('firestore.doc().collection()', () => { .collection(''); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'collectionPath' must be a non-empty string`); + error.message.should.containEql("'collectionPath' must be a non-empty string"); return Promise.resolve(); } }); @@ -50,7 +50,7 @@ describe('firestore.doc().collection()', () => { .collection('foo/bar'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'collectionPath' must point to a collection`); + error.message.should.containEql("'collectionPath' must point to a collection"); return Promise.resolve(); } }); diff --git a/e2e/DocumentReference/get.e2e.js b/e2e/DocumentReference/get.e2e.js index 77a96ef1fd..0c33170846 100644 --- a/e2e/DocumentReference/get.e2e.js +++ b/e2e/DocumentReference/get.e2e.js @@ -28,7 +28,7 @@ describe('firestore.doc().get()', () => { .get('foo'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options' must be an object is provided`); + error.message.should.containEql("'options' must be an object is provided"); return Promise.resolve(); } }); @@ -42,7 +42,7 @@ describe('firestore.doc().get()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `'options' GetOptions.source must be one of 'default', 'server' or 'cache'`, + "'options' GetOptions.source must be one of 'default', 'server' or 'cache'", ); return Promise.resolve(); } diff --git a/e2e/DocumentReference/isEqual.e2e.js b/e2e/DocumentReference/isEqual.e2e.js index 2bee1fb6ad..ab1b3e1c1f 100644 --- a/e2e/DocumentReference/isEqual.e2e.js +++ b/e2e/DocumentReference/isEqual.e2e.js @@ -24,7 +24,7 @@ describe('firestore.doc().isEqual()', () => { .isEqual(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'other' expected a DocumentReference instance`); + error.message.should.containEql("'other' expected a DocumentReference instance"); return Promise.resolve(); } }); diff --git a/e2e/DocumentReference/onSnapshot.e2e.js b/e2e/DocumentReference/onSnapshot.e2e.js index d717e691b9..73ed95c4ae 100644 --- a/e2e/DocumentReference/onSnapshot.e2e.js +++ b/e2e/DocumentReference/onSnapshot.e2e.js @@ -28,7 +28,7 @@ describe('firestore().doc().onSnapshot()', () => { .onSnapshot(); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`expected at least one argument`); + error.message.should.containEql('expected at least one argument'); return Promise.resolve(); } }); @@ -302,7 +302,7 @@ describe('firestore().doc().onSnapshot()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `'options' SnapshotOptions.includeMetadataChanges must be a boolean value`, + "'options' SnapshotOptions.includeMetadataChanges must be a boolean value", ); return Promise.resolve(); } @@ -318,7 +318,7 @@ describe('firestore().doc().onSnapshot()', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'observer.next' or 'onNext' expected a function`); + error.message.should.containEql("'observer.next' or 'onNext' expected a function"); return Promise.resolve(); } }); @@ -333,7 +333,7 @@ describe('firestore().doc().onSnapshot()', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'observer.error' or 'onError' expected a function`); + error.message.should.containEql("'observer.error' or 'onError' expected a function"); return Promise.resolve(); } }); diff --git a/e2e/DocumentReference/set.e2e.js b/e2e/DocumentReference/set.e2e.js index cd24db0353..d918e5108d 100644 --- a/e2e/DocumentReference/set.e2e.js +++ b/e2e/DocumentReference/set.e2e.js @@ -28,7 +28,7 @@ describe('firestore.doc().set()', () => { .set('foo'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'data' must be an object`); + error.message.should.containEql("'data' must be an object"); return Promise.resolve(); } }); @@ -41,7 +41,7 @@ describe('firestore.doc().set()', () => { .set({}, 'foo'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options' must be an object`); + error.message.should.containEql("'options' must be an object"); return Promise.resolve(); } }); @@ -60,7 +60,7 @@ describe('firestore.doc().set()', () => { ); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options' must not contain both 'merge' & 'mergeFields'`); + error.message.should.containEql("'options' must not contain both 'merge' & 'mergeFields'"); return Promise.resolve(); } }); @@ -78,7 +78,7 @@ describe('firestore.doc().set()', () => { ); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options.merge' must be a boolean value`); + error.message.should.containEql("'options.merge' must be a boolean value"); return Promise.resolve(); } }); @@ -96,7 +96,7 @@ describe('firestore.doc().set()', () => { ); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options.mergeFields' must be an array`); + error.message.should.containEql("'options.mergeFields' must be an array"); return Promise.resolve(); } }); @@ -115,7 +115,7 @@ describe('firestore.doc().set()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `'options.mergeFields' all fields must be of type string or FieldPath, but the value at index 3 was number`, + "'options.mergeFields' all fields must be of type string or FieldPath, but the value at index 3 was number", ); return Promise.resolve(); } diff --git a/e2e/DocumentReference/update.e2e.js b/e2e/DocumentReference/update.e2e.js index 54e4745a54..7a1ccc528b 100644 --- a/e2e/DocumentReference/update.e2e.js +++ b/e2e/DocumentReference/update.e2e.js @@ -29,7 +29,7 @@ describe('firestore.doc().update()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `expected at least 1 argument but was called with 0 arguments`, + 'expected at least 1 argument but was called with 0 arguments', ); return Promise.resolve(); } @@ -43,7 +43,7 @@ describe('firestore.doc().update()', () => { .update({}); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.code.should.containEql(`firestore/not-found`); + error.code.should.containEql('firestore/not-found'); return Promise.resolve(); } }); @@ -56,7 +56,7 @@ describe('firestore.doc().update()', () => { .update('foo', 'bar', 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`or equal numbers of key/value pairs`); + error.message.should.containEql('or equal numbers of key/value pairs'); return Promise.resolve(); } }); diff --git a/e2e/DocumentSnapshot/get.e2e.js b/e2e/DocumentSnapshot/get.e2e.js index b53d676c06..949176d958 100644 --- a/e2e/DocumentSnapshot/get.e2e.js +++ b/e2e/DocumentSnapshot/get.e2e.js @@ -28,7 +28,7 @@ describe('firestore().doc() -> snapshot.get()', () => { snapshot.get(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'fieldPath' expected type string or FieldPath`); + error.message.should.containEql("'fieldPath' expected type string or FieldPath"); return Promise.resolve(); } }); @@ -41,7 +41,7 @@ describe('firestore().doc() -> snapshot.get()', () => { snapshot.get(''); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'fieldPath' Invalid field path`); + error.message.should.containEql("'fieldPath' Invalid field path"); return Promise.resolve(); } }); @@ -54,7 +54,7 @@ describe('firestore().doc() -> snapshot.get()', () => { snapshot.get('.foo'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'fieldPath' Invalid field path`); + error.message.should.containEql("'fieldPath' Invalid field path"); return Promise.resolve(); } }); @@ -67,7 +67,7 @@ describe('firestore().doc() -> snapshot.get()', () => { snapshot.get('foo.'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'fieldPath' Invalid field path`); + error.message.should.containEql("'fieldPath' Invalid field path"); return Promise.resolve(); } }); @@ -80,7 +80,7 @@ describe('firestore().doc() -> snapshot.get()', () => { snapshot.get('foo..bar'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'fieldPath' Invalid field path`); + error.message.should.containEql("'fieldPath' Invalid field path"); return Promise.resolve(); } }); diff --git a/e2e/DocumentSnapshot/isEqual.e2e.js b/e2e/DocumentSnapshot/isEqual.e2e.js index 00b6eb9f56..e6f170ea49 100644 --- a/e2e/DocumentSnapshot/isEqual.e2e.js +++ b/e2e/DocumentSnapshot/isEqual.e2e.js @@ -24,7 +24,7 @@ describe('firestore.doc() -> snapshot.isEqual()', () => { docSnapshot.isEqual(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'other' expected a DocumentSnapshot instance`); + error.message.should.containEql("'other' expected a DocumentSnapshot instance"); return Promise.resolve(); } }); diff --git a/e2e/FieldPath.e2e.js b/e2e/FieldPath.e2e.js index 94954915dd..d2c5c9b2e7 100644 --- a/e2e/FieldPath.e2e.js +++ b/e2e/FieldPath.e2e.js @@ -21,7 +21,7 @@ describe('firestore.FieldPath', () => { new firebase.firestore.FieldPath(); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`cannot construct FieldPath with no segments`); + error.message.should.containEql('cannot construct FieldPath with no segments'); return Promise.resolve(); } }); @@ -31,7 +31,7 @@ describe('firestore.FieldPath', () => { new firebase.firestore.FieldPath('foo', ''); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`invalid segment at index`); + error.message.should.containEql('invalid segment at index'); return Promise.resolve(); } }); @@ -41,7 +41,7 @@ describe('firestore.FieldPath', () => { new firebase.firestore.FieldPath('foo', 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`invalid segment at index`); + error.message.should.containEql('invalid segment at index'); return Promise.resolve(); } }); @@ -55,7 +55,7 @@ describe('firestore.FieldPath', () => { .where('.foo', '<', 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Invalid field path`); + error.message.should.containEql('Invalid field path'); return Promise.resolve(); } }); @@ -69,7 +69,7 @@ describe('firestore.FieldPath', () => { .where('foo/bar', '<', 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Paths must not contain`); + error.message.should.containEql('Paths must not contain'); return Promise.resolve(); } }); @@ -100,7 +100,7 @@ describe('firestore.FieldPath', () => { path.isEqual({}); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'other' expected instance of FieldPath`); + error.message.should.containEql("'other' expected instance of FieldPath"); return Promise.resolve(); } }); diff --git a/e2e/FieldValue.e2e.js b/e2e/FieldValue.e2e.js index 7a715ed4c9..809f50922c 100644 --- a/e2e/FieldValue.e2e.js +++ b/e2e/FieldValue.e2e.js @@ -25,7 +25,7 @@ describe('firestore.FieldValue', () => { new firebase.firestore.FieldValue(); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`constructor is private`); + error.message.should.containEql('constructor is private'); return Promise.resolve(); } }); @@ -36,7 +36,7 @@ describe('firestore.FieldValue', () => { firebase.firestore.FieldValue.increment(1).isEqual(1); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'other' expected a FieldValue instance`); + error.message.should.containEql("'other' expected a FieldValue instance"); return Promise.resolve(); } }); @@ -71,7 +71,7 @@ describe('firestore.FieldValue', () => { firebase.firestore.FieldValue.increment('1'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'n' expected a number value`); + error.message.should.containEql("'n' expected a number value"); return Promise.resolve(); } }); @@ -136,7 +136,7 @@ describe('firestore.FieldValue', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `FieldValue instance cannot be used with other FieldValue methods`, + 'FieldValue instance cannot be used with other FieldValue methods', ); return Promise.resolve(); } @@ -147,7 +147,7 @@ describe('firestore.FieldValue', () => { firebase.firestore.FieldValue.arrayUnion([1]); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Nested arrays are not supported`); + error.message.should.containEql('Nested arrays are not supported'); return Promise.resolve(); } }); @@ -202,7 +202,7 @@ describe('firestore.FieldValue', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `FieldValue instance cannot be used with other FieldValue methods`, + 'FieldValue instance cannot be used with other FieldValue methods', ); return Promise.resolve(); } @@ -213,7 +213,7 @@ describe('firestore.FieldValue', () => { firebase.firestore.FieldValue.arrayRemove([1]); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Nested arrays are not supported`); + error.message.should.containEql('Nested arrays are not supported'); return Promise.resolve(); } }); diff --git a/e2e/FirestoreStatics.e2e.js b/e2e/FirestoreStatics.e2e.js index 861d3b296c..616f67dc10 100644 --- a/e2e/FirestoreStatics.e2e.js +++ b/e2e/FirestoreStatics.e2e.js @@ -22,7 +22,7 @@ describe('firestore.X', () => { firebase.firestore.setLogLevel('verbose'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'logLevel' expected one of 'debug', 'error' or 'silent'`); + error.message.should.containEql("'logLevel' expected one of 'debug', 'error' or 'silent'"); return Promise.resolve(); } }); diff --git a/e2e/GeoPoint.e2e.js b/e2e/GeoPoint.e2e.js index c907ed7d1b..52e179cfe4 100644 --- a/e2e/GeoPoint.e2e.js +++ b/e2e/GeoPoint.e2e.js @@ -25,7 +25,7 @@ describe('firestore.GeoPoint', () => { new firebase.firestore.GeoPoint(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`constructor expected latitude and longitude values`); + error.message.should.containEql('constructor expected latitude and longitude values'); return Promise.resolve(); } }); @@ -35,7 +35,7 @@ describe('firestore.GeoPoint', () => { new firebase.firestore.GeoPoint('123', 0); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'latitude' must be a number value`); + error.message.should.containEql("'latitude' must be a number value"); return Promise.resolve(); } }); @@ -45,7 +45,7 @@ describe('firestore.GeoPoint', () => { new firebase.firestore.GeoPoint(0, '123'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'longitude' must be a number value`); + error.message.should.containEql("'longitude' must be a number value"); return Promise.resolve(); } }); @@ -55,7 +55,7 @@ describe('firestore.GeoPoint', () => { new firebase.firestore.GeoPoint(-100, 0); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'longitude' must be a number between -90 and 90`); + error.message.should.containEql("'longitude' must be a number between -90 and 90"); return Promise.resolve(); } }); @@ -65,7 +65,7 @@ describe('firestore.GeoPoint', () => { new firebase.firestore.GeoPoint(0, 200); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'longitude' must be a number between -180 and 180`); + error.message.should.containEql("'longitude' must be a number between -180 and 180"); return Promise.resolve(); } }); @@ -87,7 +87,7 @@ describe('firestore.GeoPoint', () => { geo.isEqual(); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'other' expected an instance of GeoPoint`); + error.message.should.containEql("'other' expected an instance of GeoPoint"); return Promise.resolve(); } }); diff --git a/e2e/Query/endAt.e2e.js b/e2e/Query/endAt.e2e.js index d3a186de8a..381f8530c4 100644 --- a/e2e/Query/endAt.e2e.js +++ b/e2e/Query/endAt.e2e.js @@ -29,7 +29,7 @@ describe('firestore().collection().endAt()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `Expected a DocumentSnapshot or list of field values but got undefined`, + 'Expected a DocumentSnapshot or list of field values but got undefined', ); return Promise.resolve(); } @@ -44,7 +44,7 @@ describe('firestore().collection().endAt()', () => { .endAt('bar', 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`The number of arguments must be less than or equal`); + error.message.should.containEql('The number of arguments must be less than or equal'); return Promise.resolve(); } }); @@ -61,7 +61,7 @@ describe('firestore().collection().endAt()', () => { .endAt(doc, 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Expected DocumentSnapshot or list of field values`); + error.message.should.containEql('Expected DocumentSnapshot or list of field values'); return Promise.resolve(); } }); @@ -78,7 +78,7 @@ describe('firestore().collection().endAt()', () => { .endAt(doc); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Can't use a DocumentSnapshot that doesn't exist`); + error.message.should.containEql("Can't use a DocumentSnapshot that doesn't exist"); return Promise.resolve(); } }); @@ -97,7 +97,7 @@ describe('firestore().collection().endAt()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `You are trying to start or end a query using a document for which the field`, + 'You are trying to start or end a query using a document for which the field', ); return Promise.resolve(); } diff --git a/e2e/Query/endBefore.e2e.js b/e2e/Query/endBefore.e2e.js index e45cce35d3..d985d8c668 100644 --- a/e2e/Query/endBefore.e2e.js +++ b/e2e/Query/endBefore.e2e.js @@ -29,7 +29,7 @@ describe('firestore().collection().endBefore()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `Expected a DocumentSnapshot or list of field values but got undefined`, + 'Expected a DocumentSnapshot or list of field values but got undefined', ); return Promise.resolve(); } @@ -44,7 +44,7 @@ describe('firestore().collection().endBefore()', () => { .endBefore('bar', 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`The number of arguments must be less than or equal`); + error.message.should.containEql('The number of arguments must be less than or equal'); return Promise.resolve(); } }); @@ -61,7 +61,7 @@ describe('firestore().collection().endBefore()', () => { .endBefore(doc, 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Expected DocumentSnapshot or list of field values`); + error.message.should.containEql('Expected DocumentSnapshot or list of field values'); return Promise.resolve(); } }); @@ -78,7 +78,7 @@ describe('firestore().collection().endBefore()', () => { .endBefore(doc); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Can't use a DocumentSnapshot that doesn't exist`); + error.message.should.containEql("Can't use a DocumentSnapshot that doesn't exist"); return Promise.resolve(); } }); @@ -97,7 +97,7 @@ describe('firestore().collection().endBefore()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `You are trying to start or end a query using a document for which the field`, + 'You are trying to start or end a query using a document for which the field', ); return Promise.resolve(); } diff --git a/e2e/Query/get.e2e.js b/e2e/Query/get.e2e.js index 47c511fa33..f84f25ce5a 100644 --- a/e2e/Query/get.e2e.js +++ b/e2e/Query/get.e2e.js @@ -28,7 +28,7 @@ describe('firestore().collection().get()', () => { .get(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options' must be an object is provided`); + error.message.should.containEql("'options' must be an object is provided"); return Promise.resolve(); } }); @@ -44,7 +44,7 @@ describe('firestore().collection().get()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `'options' GetOptions.source must be one of 'default', 'server' or 'cache'`, + "'options' GetOptions.source must be one of 'default', 'server' or 'cache'", ); return Promise.resolve(); } diff --git a/e2e/Query/isEqual.e2e.js b/e2e/Query/isEqual.e2e.js index 0bf1d4cbe0..2f422930a9 100644 --- a/e2e/Query/isEqual.e2e.js +++ b/e2e/Query/isEqual.e2e.js @@ -24,7 +24,7 @@ describe('firestore().collection().isEqual()', () => { .isEqual(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'other' expected a Query instance`); + error.message.should.containEql("'other' expected a Query instance"); return Promise.resolve(); } }); diff --git a/e2e/Query/limit.e2e.js b/e2e/Query/limit.e2e.js index 58a14c80cb..83c38607e5 100644 --- a/e2e/Query/limit.e2e.js +++ b/e2e/Query/limit.e2e.js @@ -28,7 +28,7 @@ describe('firestore().collection().limit()', () => { .limit(-1); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'limit' must be a positive integer value`); + error.message.should.containEql("'limit' must be a positive integer value"); return Promise.resolve(); } }); diff --git a/e2e/Query/onSnapshot.e2e.js b/e2e/Query/onSnapshot.e2e.js index db5fd87a1e..f5ff2857f7 100644 --- a/e2e/Query/onSnapshot.e2e.js +++ b/e2e/Query/onSnapshot.e2e.js @@ -28,7 +28,7 @@ describe('firestore().collection().onSnapshot()', () => { .onSnapshot(); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`expected at least one argument`); + error.message.should.containEql('expected at least one argument'); return Promise.resolve(); } }); @@ -302,7 +302,7 @@ describe('firestore().collection().onSnapshot()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `'options' SnapshotOptions.includeMetadataChanges must be a boolean value`, + "'options' SnapshotOptions.includeMetadataChanges must be a boolean value", ); return Promise.resolve(); } @@ -318,7 +318,7 @@ describe('firestore().collection().onSnapshot()', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'observer.next' or 'onNext' expected a function`); + error.message.should.containEql("'observer.next' or 'onNext' expected a function"); return Promise.resolve(); } }); @@ -333,7 +333,7 @@ describe('firestore().collection().onSnapshot()', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'observer.error' or 'onError' expected a function`); + error.message.should.containEql("'observer.error' or 'onError' expected a function"); return Promise.resolve(); } }); diff --git a/e2e/Query/orderBy.e2e.js b/e2e/Query/orderBy.e2e.js index e7603227df..780aff529b 100644 --- a/e2e/Query/orderBy.e2e.js +++ b/e2e/Query/orderBy.e2e.js @@ -28,7 +28,7 @@ describe('firestore().collection().orderBy()', () => { .orderBy(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'fieldPath' must be a string or instance of FieldPath`); + error.message.should.containEql("'fieldPath' must be a string or instance of FieldPath"); return Promise.resolve(); } }); @@ -41,7 +41,7 @@ describe('firestore().collection().orderBy()', () => { .orderBy('.foo.bar'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'fieldPath' Invalid field path`); + error.message.should.containEql("'fieldPath' Invalid field path"); return Promise.resolve(); } }); @@ -54,7 +54,7 @@ describe('firestore().collection().orderBy()', () => { .orderBy('foo', 'up'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'directionStr' must be one of 'asc' or 'desc'`); + error.message.should.containEql("'directionStr' must be one of 'asc' or 'desc'"); return Promise.resolve(); } }); @@ -72,7 +72,7 @@ describe('firestore().collection().orderBy()', () => { .orderBy('foo'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`You must not call startAt() or startAfter()`); + error.message.should.containEql('You must not call startAt() or startAfter()'); return Promise.resolve(); } }); @@ -90,7 +90,7 @@ describe('firestore().collection().orderBy()', () => { .orderBy('foo'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`You must not call endAt() or endBefore()`); + error.message.should.containEql('You must not call endAt() or endBefore()'); return Promise.resolve(); } }); @@ -104,7 +104,7 @@ describe('firestore().collection().orderBy()', () => { .orderBy('bar'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`You have a where filter with an inequality`); + error.message.should.containEql('You have a where filter with an inequality'); return Promise.resolve(); } }); @@ -118,7 +118,7 @@ describe('firestore().collection().orderBy()', () => { .orderBy('foo.bar'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Order by clause cannot contain duplicate fields`); + error.message.should.containEql('Order by clause cannot contain duplicate fields'); return Promise.resolve(); } }); diff --git a/e2e/Query/startAfter.e2e.js b/e2e/Query/startAfter.e2e.js index f0f2864621..1218407707 100644 --- a/e2e/Query/startAfter.e2e.js +++ b/e2e/Query/startAfter.e2e.js @@ -29,7 +29,7 @@ describe('firestore().collection().startAfter()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `Expected a DocumentSnapshot or list of field values but got undefined`, + 'Expected a DocumentSnapshot or list of field values but got undefined', ); return Promise.resolve(); } @@ -44,7 +44,7 @@ describe('firestore().collection().startAfter()', () => { .startAfter('bar', 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`The number of arguments must be less than or equal`); + error.message.should.containEql('The number of arguments must be less than or equal'); return Promise.resolve(); } }); @@ -61,7 +61,7 @@ describe('firestore().collection().startAfter()', () => { .startAfter(doc, 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Expected DocumentSnapshot or list of field values`); + error.message.should.containEql('Expected DocumentSnapshot or list of field values'); return Promise.resolve(); } }); @@ -78,7 +78,7 @@ describe('firestore().collection().startAfter()', () => { .startAfter(doc); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Can't use a DocumentSnapshot that doesn't exist`); + error.message.should.containEql("Can't use a DocumentSnapshot that doesn't exist"); return Promise.resolve(); } }); @@ -97,7 +97,7 @@ describe('firestore().collection().startAfter()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `You are trying to start or end a query using a document for which the field`, + 'You are trying to start or end a query using a document for which the field', ); return Promise.resolve(); } diff --git a/e2e/Query/startAt.e2e.js b/e2e/Query/startAt.e2e.js index b7b312dbf9..5ee2a5ab2c 100644 --- a/e2e/Query/startAt.e2e.js +++ b/e2e/Query/startAt.e2e.js @@ -29,7 +29,7 @@ describe('firestore().collection().starAt()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `Expected a DocumentSnapshot or list of field values but got undefined`, + 'Expected a DocumentSnapshot or list of field values but got undefined', ); return Promise.resolve(); } @@ -44,7 +44,7 @@ describe('firestore().collection().starAt()', () => { .startAt('bar', 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`The number of arguments must be less than or equal`); + error.message.should.containEql('The number of arguments must be less than or equal'); return Promise.resolve(); } }); @@ -61,7 +61,7 @@ describe('firestore().collection().starAt()', () => { .startAt(doc, 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Expected DocumentSnapshot or list of field values`); + error.message.should.containEql('Expected DocumentSnapshot or list of field values'); return Promise.resolve(); } }); @@ -78,7 +78,7 @@ describe('firestore().collection().starAt()', () => { .startAt(doc); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Can't use a DocumentSnapshot that doesn't exist`); + error.message.should.containEql("Can't use a DocumentSnapshot that doesn't exist"); return Promise.resolve(); } }); @@ -97,7 +97,7 @@ describe('firestore().collection().starAt()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `You are trying to start or end a query using a document for which the field`, + 'You are trying to start or end a query using a document for which the field', ); return Promise.resolve(); } diff --git a/e2e/Query/where.e2e.js b/e2e/Query/where.e2e.js index 2f77282c0f..1dcac21059 100644 --- a/e2e/Query/where.e2e.js +++ b/e2e/Query/where.e2e.js @@ -28,7 +28,7 @@ describe('firestore().collection().where()', () => { .where(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'fieldPath' must be a string or instance of FieldPath`); + error.message.should.containEql("'fieldPath' must be a string or instance of FieldPath"); return Promise.resolve(); } }); @@ -41,7 +41,7 @@ describe('firestore().collection().where()', () => { .where('.foo.bar'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'fieldPath' Invalid field path`); + error.message.should.containEql("'fieldPath' Invalid field path"); return Promise.resolve(); } }); @@ -54,7 +54,7 @@ describe('firestore().collection().where()', () => { .where('foo.bar', '!'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'opStr' is invalid`); + error.message.should.containEql("'opStr' is invalid"); return Promise.resolve(); } }); @@ -68,7 +68,7 @@ describe('firestore().collection().where()', () => { .where('foo.bar', 'array-contains', 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Queries only support a single array-contains filter`); + error.message.should.containEql('Queries only support a single array-contains filter'); return Promise.resolve(); } }); @@ -81,7 +81,7 @@ describe('firestore().collection().where()', () => { .where('foo.bar', 'array-contains'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'value' argument expected`); + error.message.should.containEql("'value' argument expected"); return Promise.resolve(); } }); @@ -94,7 +94,7 @@ describe('firestore().collection().where()', () => { .where('foo.bar', 'array-contains', null); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`You can only perform equals comparisons on null`); + error.message.should.containEql('You can only perform equals comparisons on null'); return Promise.resolve(); } }); @@ -115,7 +115,7 @@ describe('firestore().collection().where()', () => { .where('bar', '>', 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`All where filters with an inequality`); + error.message.should.containEql('All where filters with an inequality'); return Promise.resolve(); } }); diff --git a/e2e/QuerySnapshot.e2e.js b/e2e/QuerySnapshot.e2e.js index 3825dfe241..7ee15427b5 100644 --- a/e2e/QuerySnapshot.e2e.js +++ b/e2e/QuerySnapshot.e2e.js @@ -90,7 +90,7 @@ describe('firestore.QuerySnapshot', () => { snapshot.docChanges(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options' expected an object`); + error.message.should.containEql("'options' expected an object"); return Promise.resolve(); } }); @@ -102,7 +102,7 @@ describe('firestore.QuerySnapshot', () => { snapshot.docChanges({ includeMetadataChanges: 123 }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options.includeMetadataChanges' expected a boolean`); + error.message.should.containEql("'options.includeMetadataChanges' expected a boolean"); return Promise.resolve(); } }); @@ -124,7 +124,7 @@ describe('firestore.QuerySnapshot', () => { snapshot.docChanges({ includeMetadataChanges: true }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`To include metadata changes with your document changes`); + error.message.should.containEql('To include metadata changes with your document changes'); return Promise.resolve(); } }); @@ -183,7 +183,7 @@ describe('firestore.QuerySnapshot', () => { snapshot.forEach(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'callback' expected a function`); + error.message.should.containEql("'callback' expected a function"); return Promise.resolve(); } }); @@ -226,7 +226,7 @@ describe('firestore.QuerySnapshot', () => { qs.isEqual(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'other' expected a QuerySnapshot instance`); + error.message.should.containEql("'other' expected a QuerySnapshot instance"); return Promise.resolve(); } }); diff --git a/e2e/SnapshotMetadata.e2e.js b/e2e/SnapshotMetadata.e2e.js index 111961fdf1..ad96a0d8db 100644 --- a/e2e/SnapshotMetadata.e2e.js +++ b/e2e/SnapshotMetadata.e2e.js @@ -48,7 +48,7 @@ describe('firestore.SnapshotMetadata', () => { snapshot.metadata.isEqual(); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'other' expected instance of SnapshotMetadata`); + error.message.should.containEql("'other' expected instance of SnapshotMetadata"); return Promise.resolve(); } }); diff --git a/e2e/Timestamp.e2e.js b/e2e/Timestamp.e2e.js index 143dad2d55..a00c92191a 100644 --- a/e2e/Timestamp.e2e.js +++ b/e2e/Timestamp.e2e.js @@ -21,7 +21,7 @@ describe('firestore.Timestamp', () => { new firebase.firestore.Timestamp('1234'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'seconds' expected a number value`); + error.message.should.containEql("'seconds' expected a number value"); return Promise.resolve(); } }); @@ -31,7 +31,7 @@ describe('firestore.Timestamp', () => { new firebase.firestore.Timestamp(123, '456'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'nanoseconds' expected a number value`); + error.message.should.containEql("'nanoseconds' expected a number value"); return Promise.resolve(); } }); @@ -41,7 +41,7 @@ describe('firestore.Timestamp', () => { new firebase.firestore.Timestamp(123, -1); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'nanoseconds' out of range`); + error.message.should.containEql("'nanoseconds' out of range"); return Promise.resolve(); } }); @@ -51,7 +51,7 @@ describe('firestore.Timestamp', () => { new firebase.firestore.Timestamp(123, 10000000000); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'nanoseconds' out of range`); + error.message.should.containEql("'nanoseconds' out of range"); return Promise.resolve(); } }); @@ -61,7 +61,7 @@ describe('firestore.Timestamp', () => { new firebase.firestore.Timestamp(-63135596800, 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'seconds' out of range`); + error.message.should.containEql("'seconds' out of range"); return Promise.resolve(); } }); @@ -71,7 +71,7 @@ describe('firestore.Timestamp', () => { new firebase.firestore.Timestamp(253402300800, 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'seconds' out of range`); + error.message.should.containEql("'seconds' out of range"); return Promise.resolve(); } }); @@ -93,7 +93,7 @@ describe('firestore.Timestamp', () => { ts.isEqual(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'other' expected an instance of Timestamp`); + error.message.should.containEql("'other' expected an instance of Timestamp"); return Promise.resolve(); } }); @@ -148,7 +148,7 @@ describe('firestore.Timestamp', () => { firebase.firestore.Timestamp.fromDate(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'date' expected a valid Date object`); + error.message.should.containEql("'date' expected a valid Date object"); return Promise.resolve(); } }); diff --git a/e2e/Transaction.e2e.js b/e2e/Transaction.e2e.js index 12fa66727b..a5419bbe57 100644 --- a/e2e/Transaction.e2e.js +++ b/e2e/Transaction.e2e.js @@ -21,7 +21,7 @@ describe('firestore.Transaction', () => { await firebase.firestore().runTransaction(() => 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'updateFunction' must return a Promise`); + error.message.should.containEql("'updateFunction' must return a Promise"); return Promise.resolve(); } }); @@ -81,7 +81,7 @@ describe('firestore.Transaction', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentRef' expected a DocumentReference`); + error.message.should.containEql("'documentRef' expected a DocumentReference"); return Promise.resolve(); } }); @@ -96,7 +96,7 @@ describe('firestore.Transaction', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `Every document read in a transaction must also be written`, + 'Every document read in a transaction must also be written', ); return Promise.resolve(); } @@ -125,7 +125,7 @@ describe('firestore.Transaction', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentRef' expected a DocumentReference`); + error.message.should.containEql("'documentRef' expected a DocumentReference"); return Promise.resolve(); } }); @@ -158,7 +158,7 @@ describe('firestore.Transaction', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentRef' expected a DocumentReference`); + error.message.should.containEql("'documentRef' expected a DocumentReference"); return Promise.resolve(); } }); @@ -172,7 +172,7 @@ describe('firestore.Transaction', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`it must be an object`); + error.message.should.containEql('it must be an object'); return Promise.resolve(); } }); @@ -222,7 +222,7 @@ describe('firestore.Transaction', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentRef' expected a DocumentReference`); + error.message.should.containEql("'documentRef' expected a DocumentReference"); return Promise.resolve(); } }); @@ -236,7 +236,7 @@ describe('firestore.Transaction', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'data' must be an object.`); + error.message.should.containEql("'data' must be an object."); return Promise.resolve(); } }); @@ -257,7 +257,7 @@ describe('firestore.Transaction', () => { }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options' must not contain both 'merge' & 'mergeFields'`); + error.message.should.containEql("'options' must not contain both 'merge' & 'mergeFields'"); return Promise.resolve(); } }); diff --git a/e2e/WriteBatch/delete.e2e.js b/e2e/WriteBatch/delete.e2e.js index e1dd7d404e..3e290251ca 100644 --- a/e2e/WriteBatch/delete.e2e.js +++ b/e2e/WriteBatch/delete.e2e.js @@ -24,7 +24,7 @@ describe('firestore.WriteBatch.delete()', () => { .delete(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentRef' expected instance of a DocumentReference`); + error.message.should.containEql("'documentRef' expected instance of a DocumentReference"); return Promise.resolve(); } }); @@ -40,7 +40,7 @@ describe('firestore.WriteBatch.delete()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `'documentRef' provided DocumentReference is from a different Firestore instance`, + "'documentRef' provided DocumentReference is from a different Firestore instance", ); return Promise.resolve(); } diff --git a/e2e/WriteBatch/set.e2e.js b/e2e/WriteBatch/set.e2e.js index 9022bf36e8..ea28488601 100644 --- a/e2e/WriteBatch/set.e2e.js +++ b/e2e/WriteBatch/set.e2e.js @@ -24,7 +24,7 @@ describe('firestore.WriteBatch.set()', () => { .set(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentRef' expected instance of a DocumentReference`); + error.message.should.containEql("'documentRef' expected instance of a DocumentReference"); return Promise.resolve(); } }); @@ -40,7 +40,7 @@ describe('firestore.WriteBatch.set()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `'documentRef' provided DocumentReference is from a different Firestore instance`, + "'documentRef' provided DocumentReference is from a different Firestore instance", ); return Promise.resolve(); } @@ -55,7 +55,7 @@ describe('firestore.WriteBatch.set()', () => { .set(docRef, 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'data' must be an object`); + error.message.should.containEql("'data' must be an object"); return Promise.resolve(); } }); @@ -69,7 +69,7 @@ describe('firestore.WriteBatch.set()', () => { .set(docRef, {}, 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options' must be an object`); + error.message.should.containEql("'options' must be an object"); return Promise.resolve(); } }); @@ -90,7 +90,7 @@ describe('firestore.WriteBatch.set()', () => { ); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options' must not contain both 'merge' & 'mergeFields'`); + error.message.should.containEql("'options' must not contain both 'merge' & 'mergeFields'"); return Promise.resolve(); } }); @@ -110,7 +110,7 @@ describe('firestore.WriteBatch.set()', () => { ); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options.merge' must be a boolean value`); + error.message.should.containEql("'options.merge' must be a boolean value"); return Promise.resolve(); } }); @@ -130,7 +130,7 @@ describe('firestore.WriteBatch.set()', () => { ); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options.mergeFields' must be an array`); + error.message.should.containEql("'options.mergeFields' must be an array"); return Promise.resolve(); } }); @@ -151,7 +151,7 @@ describe('firestore.WriteBatch.set()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `'options.mergeFields' all fields must be of type string or FieldPath`, + "'options.mergeFields' all fields must be of type string or FieldPath", ); return Promise.resolve(); } @@ -172,7 +172,7 @@ describe('firestore.WriteBatch.set()', () => { ); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'options.mergeFields' Invalid field path`); + error.message.should.containEql("'options.mergeFields' Invalid field path"); return Promise.resolve(); } }); diff --git a/e2e/WriteBatch/update.e2e.js b/e2e/WriteBatch/update.e2e.js index e8bdf9a144..afb8ab775d 100644 --- a/e2e/WriteBatch/update.e2e.js +++ b/e2e/WriteBatch/update.e2e.js @@ -24,7 +24,7 @@ describe('firestore.WriteBatch.update()', () => { .update(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentRef' expected instance of a DocumentReference`); + error.message.should.containEql("'documentRef' expected instance of a DocumentReference"); return Promise.resolve(); } }); @@ -40,7 +40,7 @@ describe('firestore.WriteBatch.update()', () => { return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { error.message.should.containEql( - `'documentRef' provided DocumentReference is from a different Firestore instance`, + "'documentRef' provided DocumentReference is from a different Firestore instance", ); return Promise.resolve(); } @@ -55,7 +55,7 @@ describe('firestore.WriteBatch.update()', () => { .update(docRef); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`Expected update object or list of key/value pairs`); + error.message.should.containEql('Expected update object or list of key/value pairs'); return Promise.resolve(); } }); @@ -69,7 +69,7 @@ describe('firestore.WriteBatch.update()', () => { .update(docRef, 123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`if using a single update argument, it must be an object`); + error.message.should.containEql('if using a single update argument, it must be an object'); return Promise.resolve(); } }); @@ -83,7 +83,7 @@ describe('firestore.WriteBatch.update()', () => { .update(docRef, 'foo', 'bar', 'baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`equal numbers of key/value pairs`); + error.message.should.containEql('equal numbers of key/value pairs'); return Promise.resolve(); } }); @@ -97,7 +97,7 @@ describe('firestore.WriteBatch.update()', () => { .update(docRef, 'foo', 'bar', 123, 'ben'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`argument at index 2 must be a string or FieldPath`); + error.message.should.containEql('argument at index 2 must be a string or FieldPath'); return Promise.resolve(); } }); diff --git a/e2e/firestore.e2e.js b/e2e/firestore.e2e.js index b1a7edf613..d718e6a946 100644 --- a/e2e/firestore.e2e.js +++ b/e2e/firestore.e2e.js @@ -57,7 +57,7 @@ describe('firestore()', () => { firebase.firestore().collection(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'collectionPath' must be a string value`); + error.message.should.containEql("'collectionPath' must be a string value"); return Promise.resolve(); } }); @@ -67,7 +67,7 @@ describe('firestore()', () => { firebase.firestore().collection(''); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'collectionPath' must be a non-empty string`); + error.message.should.containEql("'collectionPath' must be a non-empty string"); return Promise.resolve(); } }); @@ -77,7 +77,7 @@ describe('firestore()', () => { firebase.firestore().collection('foo/bar'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'collectionPath' must point to a collection`); + error.message.should.containEql("'collectionPath' must point to a collection"); return Promise.resolve(); } }); @@ -95,7 +95,7 @@ describe('firestore()', () => { firebase.firestore().doc(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentPath' must be a string value`); + error.message.should.containEql("'documentPath' must be a string value"); return Promise.resolve(); } }); @@ -105,7 +105,7 @@ describe('firestore()', () => { firebase.firestore().doc(''); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentPath' must be a non-empty string`); + error.message.should.containEql("'documentPath' must be a non-empty string"); return Promise.resolve(); } }); @@ -115,7 +115,7 @@ describe('firestore()', () => { firebase.firestore().doc('foo/bar/baz'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'documentPath' must point to a document`); + error.message.should.containEql("'documentPath' must point to a document"); return Promise.resolve(); } }); @@ -133,7 +133,7 @@ describe('firestore()', () => { firebase.firestore().collectionGroup(123); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'collectionId' must be a string value`); + error.message.should.containEql("'collectionId' must be a string value"); return Promise.resolve(); } }); @@ -143,7 +143,7 @@ describe('firestore()', () => { firebase.firestore().collectionGroup(''); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'collectionId' must be a non-empty string`); + error.message.should.containEql("'collectionId' must be a non-empty string"); return Promise.resolve(); } }); @@ -153,7 +153,7 @@ describe('firestore()', () => { firebase.firestore().collectionGroup('foo/bar'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'collectionId' must not contain '/'`); + error.message.should.containEql("'collectionId' must not contain '/'"); return Promise.resolve(); } }); @@ -205,7 +205,7 @@ describe('firestore()', () => { firebase.firestore().runTransaction('foo'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'updateFunction' must be a function`); + error.message.should.containEql("'updateFunction' must be a function"); return Promise.resolve(); } }); @@ -217,7 +217,7 @@ describe('firestore()', () => { firebase.firestore().settings('foo'); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'settings' must be an object`); + error.message.should.containEql("'settings' must be an object"); return Promise.resolve(); } }); @@ -227,7 +227,7 @@ describe('firestore()', () => { firebase.firestore().settings({ foo: 'bar' }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'settings.foo' is not a valid settings field`); + error.message.should.containEql("'settings.foo' is not a valid settings field"); return Promise.resolve(); } }); @@ -237,7 +237,7 @@ describe('firestore()', () => { firebase.firestore().settings({ cacheSizeBytes: 'foo' }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'settings.cacheSizeBytes' must be a number value`); + error.message.should.containEql("'settings.cacheSizeBytes' must be a number value"); return Promise.resolve(); } }); @@ -247,7 +247,7 @@ describe('firestore()', () => { firebase.firestore().settings({ cacheSizeBytes: 123 }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'settings.cacheSizeBytes' the minimum cache size`); + error.message.should.containEql("'settings.cacheSizeBytes' the minimum cache size"); return Promise.resolve(); } }); @@ -261,7 +261,7 @@ describe('firestore()', () => { firebase.firestore().settings({ host: 123 }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'settings.host' must be a string value`); + error.message.should.containEql("'settings.host' must be a string value"); return Promise.resolve(); } }); @@ -271,7 +271,7 @@ describe('firestore()', () => { firebase.firestore().settings({ host: '' }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'settings.host' must not be an empty string`); + error.message.should.containEql("'settings.host' must not be an empty string"); return Promise.resolve(); } }); @@ -281,7 +281,7 @@ describe('firestore()', () => { firebase.firestore().settings({ persistence: 'true' }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'settings.persistence' must be a boolean value`); + error.message.should.containEql("'settings.persistence' must be a boolean value"); return Promise.resolve(); } }); @@ -291,7 +291,7 @@ describe('firestore()', () => { firebase.firestore().settings({ ssl: 'true' }); return Promise.reject(new Error('Did not throw an Error.')); } catch (error) { - error.message.should.containEql(`'settings.ssl' must be a boolean value`); + error.message.should.containEql("'settings.ssl' must be a boolean value"); return Promise.resolve(); } }); diff --git a/e2e/helpers.js b/e2e/helpers.js index 5963c601d0..3c53ec8274 100644 --- a/e2e/helpers.js +++ b/e2e/helpers.js @@ -18,7 +18,11 @@ */ exports.wipe = async function wipe(collection = 'v6', debug = false) { - if (debug) console.time('wipe'); + if (debug) { + console.time('wipe'); + } await TestAdminApi.firestore().clearCollection(collection); - if (debug) console.timeEnd('wipe'); + if (debug) { + console.timeEnd('wipe'); + } }; diff --git a/ios/RNFBFirestore.podspec b/ios/RNFBFirestore.podspec index 2f3e6e4a8d..12411a0adc 100644 --- a/ios/RNFBFirestore.podspec +++ b/ios/RNFBFirestore.podspec @@ -19,5 +19,5 @@ Pod::Spec.new do |s| s.dependency 'Firebase/Core', '~> 6.5.0' s.dependency 'Firebase/Firestore', '~> 6.5.0' s.dependency 'RNFBApp' - s.static_framework = true + s.static_framework = false end diff --git a/lib/FirestoreCollectionReference.js b/lib/FirestoreCollectionReference.js index 8c18f0a54f..4a1a7c9286 100644 --- a/lib/FirestoreCollectionReference.js +++ b/lib/FirestoreCollectionReference.js @@ -33,7 +33,9 @@ export default class FirestoreCollectionReference extends FirestoreQuery { get parent() { const parent = this._collectionPath.parent(); - if (!parent) return null; + if (!parent) { + return null; + } return new FirestoreDocumentReference(this._firestore, parent); } @@ -43,7 +45,7 @@ export default class FirestoreCollectionReference extends FirestoreQuery { add(data) { if (!isObject(data)) { - throw new Error(`firebase.firestore().collection().add(*) 'data' must be an object.`); + throw new Error("firebase.firestore().collection().add(*) 'data' must be an object."); } const documentRef = this.doc(); @@ -56,7 +58,7 @@ export default class FirestoreCollectionReference extends FirestoreQuery { if (!path.isDocument) { throw new Error( - `firebase.firestore().collection().doc(*) 'documentPath' must point to a document.`, + "firebase.firestore().collection().doc(*) 'documentPath' must point to a document.", ); } diff --git a/lib/FirestoreDocumentReference.js b/lib/FirestoreDocumentReference.js index 22a33f78fe..f8de17e762 100644 --- a/lib/FirestoreDocumentReference.js +++ b/lib/FirestoreDocumentReference.js @@ -60,13 +60,13 @@ export default class FirestoreDocumentReference { collection(collectionPath) { if (!isString(collectionPath)) { throw new Error( - `firebase.firestore().doc().collection(*) 'collectionPath' must be a string value.`, + "firebase.firestore().doc().collection(*) 'collectionPath' must be a string value.", ); } if (collectionPath === '') { throw new Error( - `firebase.firestore().doc().collection(*) 'collectionPath' must be a non-empty string.`, + "firebase.firestore().doc().collection(*) 'collectionPath' must be a non-empty string.", ); } @@ -74,7 +74,7 @@ export default class FirestoreDocumentReference { if (!path.isCollection) { throw new Error( - `firebase.firestore().doc().collection(*) 'collectionPath' must point to a collection.`, + "firebase.firestore().doc().collection(*) 'collectionPath' must point to a collection.", ); } @@ -87,7 +87,7 @@ export default class FirestoreDocumentReference { get(options) { if (!isUndefined(options) && !isObject(options)) { - throw new Error(`firebase.firestore().doc().get(*) 'options' must be an object is provided.`); + throw new Error("firebase.firestore().doc().get(*) 'options' must be an object is provided."); } if ( @@ -98,7 +98,7 @@ export default class FirestoreDocumentReference { options.source !== 'cache' ) { throw new Error( - `firebase.firestore().doc().get(*) 'options' GetOptions.source must be one of 'default', 'server' or 'cache'.`, + "firebase.firestore().doc().get(*) 'options' GetOptions.source must be one of 'default', 'server' or 'cache'.", ); } @@ -110,7 +110,7 @@ export default class FirestoreDocumentReference { isEqual(other) { if (!(other instanceof FirestoreDocumentReference)) { throw new Error( - `firebase.firestore().doc().isEqual(*) 'other' expected a DocumentReference instance.`, + "firebase.firestore().doc().isEqual(*) 'other' expected a DocumentReference instance.", ); } @@ -122,8 +122,6 @@ export default class FirestoreDocumentReference { } onSnapshot(...args) { - /* eslint-disable prefer-destructuring */ - let snapshotListenOptions; let callback; let onNext; @@ -179,7 +177,7 @@ export default class FirestoreDocumentReference { set(data, options) { if (!isObject(data)) { - throw new Error(`firebase.firestore().doc().set(*) 'data' must be an object.`); + throw new Error("firebase.firestore().doc().set(*) 'data' must be an object."); } let setOptions; @@ -195,7 +193,7 @@ export default class FirestoreDocumentReference { update(...args) { if (args.length === 0) { throw new Error( - `firebase.firestore().doc().update(*) expected at least 1 argument but was called with 0 arguments.`, + 'firebase.firestore().doc().update(*) expected at least 1 argument but was called with 0 arguments.', ); } diff --git a/lib/FirestoreDocumentSnapshot.js b/lib/FirestoreDocumentSnapshot.js index 8a996f84fa..245ada2be5 100644 --- a/lib/FirestoreDocumentSnapshot.js +++ b/lib/FirestoreDocumentSnapshot.js @@ -80,7 +80,7 @@ export default class FirestoreDocumentSnapshot { if (!isString(fieldPath) && !(fieldPath instanceof FirestoreFieldPath)) { throw new Error( - `firebase.firestore() DocumentSnapshot.get(*) 'fieldPath' expected type string or FieldPath.`, + "firebase.firestore() DocumentSnapshot.get(*) 'fieldPath' expected type string or FieldPath.", ); } @@ -103,7 +103,7 @@ export default class FirestoreDocumentSnapshot { isEqual(other) { if (!(other instanceof FirestoreDocumentSnapshot)) { throw new Error( - `firebase.firestore() DocumentSnapshot.isEqual(*) 'other' expected a DocumentSnapshot instance.`, + "firebase.firestore() DocumentSnapshot.isEqual(*) 'other' expected a DocumentSnapshot instance.", ); } diff --git a/lib/FirestoreFieldPath.js b/lib/FirestoreFieldPath.js index 1d3a4260e6..c283ac2f9e 100644 --- a/lib/FirestoreFieldPath.js +++ b/lib/FirestoreFieldPath.js @@ -26,7 +26,7 @@ export default class FirestoreFieldPath { constructor(...segments) { if (segments.length === 0) { - throw new Error(`firebase.firestore.FieldPath cannot construct FieldPath with no segments.`); + throw new Error('firebase.firestore.FieldPath cannot construct FieldPath with no segments.'); } for (let i = 0; i < segments.length; i++) { @@ -44,7 +44,7 @@ export default class FirestoreFieldPath { isEqual(other) { if (!(other instanceof FirestoreFieldPath)) { throw new Error( - `firebase.firestore.FieldPath.isEqual(*) 'other' expected instance of FieldPath.`, + "firebase.firestore.FieldPath.isEqual(*) 'other' expected instance of FieldPath.", ); } @@ -61,7 +61,7 @@ export const DOCUMENT_ID = new FirestoreFieldPath('__name__'); export function fromDotSeparatedString(path) { if (path === '' || path.startsWith('.') || path.endsWith('.') || path.indexOf('..') > 0) { throw new Error( - `Invalid field path. Paths must not be empty, begin with '.', end with '.', or contain '..'.`, + "Invalid field path. Paths must not be empty, begin with '.', end with '.', or contain '..'.", ); } diff --git a/lib/FirestoreFieldValue.js b/lib/FirestoreFieldValue.js index c95c1448ac..fef7d21966 100644 --- a/lib/FirestoreFieldValue.js +++ b/lib/FirestoreFieldValue.js @@ -29,11 +29,11 @@ function validateArrayElements(elements) { const element = elements[i]; if (element instanceof FirestoreFieldValue) { - throw new Error(`FieldValue instance cannot be used with other FieldValue methods.`); + throw new Error('FieldValue instance cannot be used with other FieldValue methods.'); } if (isArray(element)) { - throw new Error(`Nested arrays are not supported`); + throw new Error('Nested arrays are not supported'); } } } @@ -56,7 +56,7 @@ export default class FirestoreFieldValue { static increment(n) { if (!isNumber(n)) { - throw new Error(`firebase.firestore.FieldValue.increment(*) 'n' expected a number value.`); + throw new Error("firebase.firestore.FieldValue.increment(*) 'n' expected a number value."); } return new FirestoreFieldValue(true, TypeFieldValueIncrement, n); @@ -97,7 +97,7 @@ export default class FirestoreFieldValue { isEqual(other) { if (!(other instanceof FirestoreFieldValue)) { throw new Error( - `firebase.firestore.FieldValue.isEqual(*) 'other' expected a FieldValue instance.`, + "firebase.firestore.FieldValue.isEqual(*) 'other' expected a FieldValue instance.", ); } diff --git a/lib/FirestoreGeoPoint.js b/lib/FirestoreGeoPoint.js index 2e854a7d29..eacaa74868 100644 --- a/lib/FirestoreGeoPoint.js +++ b/lib/FirestoreGeoPoint.js @@ -21,16 +21,16 @@ export default class FirestoreGeoPoint { constructor(latitude, longitude) { if (isUndefined(latitude) || isUndefined(longitude)) { throw new Error( - `firebase.firestore.GeoPoint constructor expected latitude and longitude values.`, + 'firebase.firestore.GeoPoint constructor expected latitude and longitude values.', ); } if (!isNumber(latitude)) { - throw new Error(`firebase.firestore.GeoPoint 'latitude' must be a number value.`); + throw new Error("firebase.firestore.GeoPoint 'latitude' must be a number value."); } if (!isNumber(longitude)) { - throw new Error(`firebase.firestore.GeoPoint 'longitude' must be a number value.`); + throw new Error("firebase.firestore.GeoPoint 'longitude' must be a number value."); } if (!isFinite(latitude) || latitude < -90 || latitude > 90) { @@ -60,7 +60,7 @@ export default class FirestoreGeoPoint { isEqual(other) { if (!(other instanceof FirestoreGeoPoint)) { throw new Error( - `firebase.firestore.GeoPoint.isEqual(*) 'other' expected an instance of GeoPoint.`, + "firebase.firestore.GeoPoint.isEqual(*) 'other' expected an instance of GeoPoint.", ); } diff --git a/lib/FirestoreQuery.js b/lib/FirestoreQuery.js index 5e32d6394f..574be6cf3c 100644 --- a/lib/FirestoreQuery.js +++ b/lib/FirestoreQuery.js @@ -122,7 +122,7 @@ export default class FirestoreQuery { get(options) { if (!isUndefined(options) && !isObject(options)) { throw new Error( - `firebase.firestore().collection().get(*) 'options' must be an object is provided.`, + "firebase.firestore().collection().get(*) 'options' must be an object is provided.", ); } @@ -134,7 +134,7 @@ export default class FirestoreQuery { options.source !== 'cache' ) { throw new Error( - `firebase.firestore().collection().get(*) 'options' GetOptions.source must be one of 'default', 'server' or 'cache'.`, + "firebase.firestore().collection().get(*) 'options' GetOptions.source must be one of 'default', 'server' or 'cache'.", ); } @@ -153,7 +153,7 @@ export default class FirestoreQuery { isEqual(other) { if (!(other instanceof FirestoreQuery)) { throw new Error( - `firebase.firestore().collection().isEqual(*) 'other' expected a Query instance.`, + "firebase.firestore().collection().isEqual(*) 'other' expected a Query instance.", ); } @@ -184,7 +184,7 @@ export default class FirestoreQuery { limit(limit) { if (this._modifiers.isValidLimit(limit)) { throw new Error( - `firebase.firestore().collection().limit(*) 'limit' must be a positive integer value.`, + "firebase.firestore().collection().limit(*) 'limit' must be a positive integer value.", ); } @@ -194,8 +194,6 @@ export default class FirestoreQuery { } onSnapshot(...args) { - /* eslint-disable prefer-destructuring */ - let snapshotListenOptions; let callback; let onNext; @@ -260,7 +258,7 @@ export default class FirestoreQuery { orderBy(fieldPath, directionStr) { if (!isString(fieldPath) && !(fieldPath instanceof FirestoreFieldPath)) { throw new Error( - `firebase.firestore().collection().orderBy(*) 'fieldPath' must be a string or instance of FieldPath.`, + "firebase.firestore().collection().orderBy(*) 'fieldPath' must be a string or instance of FieldPath.", ); } @@ -278,19 +276,19 @@ export default class FirestoreQuery { if (!isUndefined(directionStr) && !this._modifiers.isValidDirection(directionStr)) { throw new Error( - `firebase.firestore().collection().orderBy(_, *) 'directionStr' must be one of 'asc' or 'desc'.`, + "firebase.firestore().collection().orderBy(_, *) 'directionStr' must be one of 'asc' or 'desc'.", ); } if (this._modifiers.hasStart()) { throw new Error( - `firebase.firestore().collection().orderBy() Invalid query. You must not call startAt() or startAfter() before calling orderBy().`, + 'firebase.firestore().collection().orderBy() Invalid query. You must not call startAt() or startAfter() before calling orderBy().', ); } if (this._modifiers.hasEnd()) { throw new Error( - `firebase.firestore().collection().orderBy() Invalid query. You must not call endAt() or endBefore() before calling orderBy().`, + 'firebase.firestore().collection().orderBy() Invalid query. You must not call endAt() or endBefore() before calling orderBy().', ); } @@ -324,7 +322,7 @@ export default class FirestoreQuery { where(fieldPath, opStr, value) { if (!isString(fieldPath) && !(fieldPath instanceof FirestoreFieldPath)) { throw new Error( - `firebase.firestore().collection().where(*) 'fieldPath' must be a string or instance of FieldPath.`, + "firebase.firestore().collection().where(*) 'fieldPath' must be a string or instance of FieldPath.", ); } @@ -342,19 +340,19 @@ export default class FirestoreQuery { if (!this._modifiers.isValidOperator(opStr)) { throw new Error( - `firebase.firestore().collection().where(_, *) 'opStr' is invalid. Expected one of '==', '>', '>=', '<', '<=' or 'array-contains'.`, + "firebase.firestore().collection().where(_, *) 'opStr' is invalid. Expected one of '==', '>', '>=', '<', '<=' or 'array-contains'.", ); } if (isUndefined(value)) { throw new Error( - `firebase.firestore().collection().where(_, _, *) 'value' argument expected.`, + "firebase.firestore().collection().where(_, _, *) 'value' argument expected.", ); } if (isNull(value) && !this._modifiers.isEqualOperator(opStr)) { throw new Error( - `firebase.firestore().collection().where(_, _, *) 'value' is invalid. You can only perform equals comparisons on null`, + "firebase.firestore().collection().where(_, _, *) 'value' is invalid. You can only perform equals comparisons on null", ); } diff --git a/lib/FirestoreQueryModifiers.js b/lib/FirestoreQueryModifiers.js index 1a24b57279..9aaa3d250d 100644 --- a/lib/FirestoreQueryModifiers.js +++ b/lib/FirestoreQueryModifiers.js @@ -63,11 +63,21 @@ export default class FirestoreQueryModifiers { get options() { const options = {}; - if (this._limit) options.limit = this._limit; - if (this._startAt) options.startAt = this._startAt; - if (this._startAfter) options.startAfter = this._startAfter; - if (this._endAt) options.endAt = this._endAt; - if (this._endBefore) options.endBefore = this._endBefore; + if (this._limit) { + options.limit = this._limit; + } + if (this._startAt) { + options.startAt = this._startAt; + } + if (this._startAfter) { + options.startAfter = this._startAfter; + } + if (this._endAt) { + options.endAt = this._endAt; + } + if (this._endBefore) { + options.endBefore = this._endBefore; + } return options; } @@ -180,7 +190,7 @@ export default class FirestoreQueryModifiers { continue; } - throw new Error(`Invalid query. Queries only support a single array-contains filter.`); + throw new Error('Invalid query. Queries only support a single array-contains filter.'); } } @@ -209,7 +219,7 @@ export default class FirestoreQueryModifiers { const set = new Set(orders); if (set.size !== orders.length) { - throw new Error(`Invalid query. Order by clause cannot contain duplicate fields.`); + throw new Error('Invalid query. Order by clause cannot contain duplicate fields.'); } } diff --git a/lib/FirestoreQuerySnapshot.js b/lib/FirestoreQuerySnapshot.js index 202116483c..92b5d0f45b 100644 --- a/lib/FirestoreQuerySnapshot.js +++ b/lib/FirestoreQuerySnapshot.js @@ -53,7 +53,7 @@ export default class FirestoreQuerySnapshot { docChanges(options) { if (!isUndefined(options) && !isObject(options)) { throw new Error( - `firebase.firestore() QuerySnapshot.docChanges(*) 'options' expected an object.`, + "firebase.firestore() QuerySnapshot.docChanges(*) 'options' expected an object.", ); } @@ -62,7 +62,7 @@ export default class FirestoreQuerySnapshot { if (options) { if (!isBoolean(options.includeMetadataChanges)) { throw new Error( - `firebase.firestore() QuerySnapshot.docChanges(*) 'options.includeMetadataChanges' expected a boolean.`, + "firebase.firestore() QuerySnapshot.docChanges(*) 'options.includeMetadataChanges' expected a boolean.", ); } @@ -76,7 +76,7 @@ export default class FirestoreQuerySnapshot { if (includeMetaDataChanges && this._excludesMetadataChanges) { throw new Error( - `firebase.firestore() QuerySnapshot.docChanges() To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().`, + 'firebase.firestore() QuerySnapshot.docChanges() To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().', ); } @@ -93,7 +93,7 @@ export default class FirestoreQuerySnapshot { forEach(callback, thisArg) { if (!isFunction(callback)) { throw new Error( - `firebase.firestore() QuerySnapshot.forEach(*) 'callback' expected a function.`, + "firebase.firestore() QuerySnapshot.forEach(*) 'callback' expected a function.", ); } @@ -107,7 +107,7 @@ export default class FirestoreQuerySnapshot { isEqual(other) { if (!(other instanceof FirestoreQuerySnapshot)) { throw new Error( - `firebase.firestore() QuerySnapshot.isEqual(*) 'other' expected a QuerySnapshot instance.`, + "firebase.firestore() QuerySnapshot.isEqual(*) 'other' expected a QuerySnapshot instance.", ); } diff --git a/lib/FirestoreSnapshotMetadata.js b/lib/FirestoreSnapshotMetadata.js index 2097a33bf4..37c22eed2c 100644 --- a/lib/FirestoreSnapshotMetadata.js +++ b/lib/FirestoreSnapshotMetadata.js @@ -33,7 +33,7 @@ export default class FirestoreSnapshotMetadata { isEqual(other) { if (isUndefined(other) || !(other instanceof FirestoreSnapshotMetadata)) { throw new Error( - `firebase.firestore() SnapshotMetadata.isEqual(*) 'other' expected instance of SnapshotMetadata`, + "firebase.firestore() SnapshotMetadata.isEqual(*) 'other' expected instance of SnapshotMetadata", ); } diff --git a/lib/FirestoreStatics.js b/lib/FirestoreStatics.js index 71f857d166..be4dd58bb5 100644 --- a/lib/FirestoreStatics.js +++ b/lib/FirestoreStatics.js @@ -35,7 +35,7 @@ export default { setLogLevel(logLevel) { if (logLevel !== 'debug' && logLevel !== 'error' && logLevel !== 'silent') { throw new Error( - `firebase.firestore.setLogLevel(*) 'logLevel' expected one of 'debug', 'error' or 'silent'`, + "firebase.firestore.setLogLevel(*) 'logLevel' expected one of 'debug', 'error' or 'silent'", ); } diff --git a/lib/FirestoreTimestamp.js b/lib/FirestoreTimestamp.js index fbf81c40d8..ba9e880789 100644 --- a/lib/FirestoreTimestamp.js +++ b/lib/FirestoreTimestamp.js @@ -25,7 +25,7 @@ export default class FirestoreTimestamp { static fromDate(date) { if (!isDate(date)) { throw new Error( - `firebase.firestore.Timestamp.fromDate(*) 'date' expected a valid Date object.`, + "firebase.firestore.Timestamp.fromDate(*) 'date' expected a valid Date object.", ); } @@ -40,11 +40,11 @@ export default class FirestoreTimestamp { constructor(seconds, nanoseconds) { if (!isNumber(seconds)) { - throw new Error(`firebase.firestore.Timestamp 'seconds' expected a number value.`); + throw new Error("firebase.firestore.Timestamp 'seconds' expected a number value."); } if (!isNumber(nanoseconds)) { - throw new Error(`firebase.firestore.Timestamp 'nanoseconds' expected a number value.`); + throw new Error("firebase.firestore.Timestamp 'nanoseconds' expected a number value."); } if (nanoseconds < 0) { @@ -80,7 +80,7 @@ export default class FirestoreTimestamp { isEqual(other) { if (!(other instanceof FirestoreTimestamp)) { throw Error( - `firebase.firestore.Timestamp.isEqual(*) 'other' expected an instance of Timestamp.`, + "firebase.firestore.Timestamp.isEqual(*) 'other' expected an instance of Timestamp.", ); } diff --git a/lib/FirestoreTransaction.js b/lib/FirestoreTransaction.js index 34c5ff9e5e..c09c733049 100644 --- a/lib/FirestoreTransaction.js +++ b/lib/FirestoreTransaction.js @@ -45,7 +45,7 @@ export default class FirestoreTransaction { get(documentRef) { if (!(documentRef instanceof FirestoreDocumentReference)) { throw new Error( - `firebase.firestore().runTransaction() Transaction.get(*) 'documentRef' expected a DocumentReference.`, + "firebase.firestore().runTransaction() Transaction.get(*) 'documentRef' expected a DocumentReference.", ); } @@ -63,13 +63,13 @@ export default class FirestoreTransaction { set(documentRef, data, options) { if (!(documentRef instanceof FirestoreDocumentReference)) { throw new Error( - `firebase.firestore().runTransaction() Transaction.set(*) 'documentRef' expected a DocumentReference.`, + "firebase.firestore().runTransaction() Transaction.set(*) 'documentRef' expected a DocumentReference.", ); } if (!isObject(data)) { throw new Error( - `firebase.firestore().runTransaction() Transaction.set(_, *) 'data' must be an object..`, + "firebase.firestore().runTransaction() Transaction.set(_, *) 'data' must be an object..", ); } @@ -95,7 +95,7 @@ export default class FirestoreTransaction { update(documentRef, ...args) { if (!(documentRef instanceof FirestoreDocumentReference)) { throw new Error( - `firebase.firestore().runTransaction() Transaction.update(*) 'documentRef' expected a DocumentReference.`, + "firebase.firestore().runTransaction() Transaction.update(*) 'documentRef' expected a DocumentReference.", ); } @@ -120,7 +120,7 @@ export default class FirestoreTransaction { delete(documentRef) { if (!(documentRef instanceof FirestoreDocumentReference)) { throw new Error( - `firebase.firestore().runTransaction() Transaction.delete(*) 'documentRef' expected a DocumentReference.`, + "firebase.firestore().runTransaction() Transaction.delete(*) 'documentRef' expected a DocumentReference.", ); } diff --git a/lib/FirestoreTransactionHandler.js b/lib/FirestoreTransactionHandler.js index cb85adc73a..a5f9278169 100644 --- a/lib/FirestoreTransactionHandler.js +++ b/lib/FirestoreTransactionHandler.js @@ -38,7 +38,6 @@ export default class FirestoreTransactionHandler { } _onTransactionEvent(event) { - // eslint-disable-next-line default-case switch (event.body.type) { case 'update': this._handleUpdate(event); @@ -56,7 +55,9 @@ export default class FirestoreTransactionHandler { const { listenerId: id } = event; // abort if no longer exists js side - if (!this._pending[id]) return this._remove(id); + if (!this._pending[id]) { + return this._remove(id); + } const { meta, transaction } = this._pending[id]; const { updateFunction, reject } = meta; @@ -74,7 +75,7 @@ export default class FirestoreTransactionHandler { // validate user has returned a promise in their update function if (!possiblePromise || !possiblePromise.then) { throw new Error( - `firebase.firestore().runTransaction(*) 'updateFunction' must return a Promise.`, + "firebase.firestore().runTransaction(*) 'updateFunction' must return a Promise.", ); } diff --git a/lib/FirestoreWriteBatch.js b/lib/FirestoreWriteBatch.js index 753054f3c9..171a51c98f 100644 --- a/lib/FirestoreWriteBatch.js +++ b/lib/FirestoreWriteBatch.js @@ -39,7 +39,9 @@ export default class FirestoreWriteBatch { commit() { this._verifyNotCommitted('commit'); this._committed = true; - if (this._writes.length === 0) return Promise.resolve(); + if (this._writes.length === 0) { + return Promise.resolve(); + } return this._firestore.native.documentBatch(this._writes); } @@ -47,13 +49,13 @@ export default class FirestoreWriteBatch { this._verifyNotCommitted('delete'); if (!(documentRef instanceof FirestoreDocumentReference)) { throw new Error( - `firebase.firestore.batch().delete(*) 'documentRef' expected instance of a DocumentReference.`, + "firebase.firestore.batch().delete(*) 'documentRef' expected instance of a DocumentReference.", ); } if (documentRef.firestore.app !== this._firestore.app) { throw new Error( - `firebase.firestore.batch().delete(*) 'documentRef' provided DocumentReference is from a different Firestore instance.`, + "firebase.firestore.batch().delete(*) 'documentRef' provided DocumentReference is from a different Firestore instance.", ); } @@ -69,18 +71,18 @@ export default class FirestoreWriteBatch { this._verifyNotCommitted('set'); if (!(documentRef instanceof FirestoreDocumentReference)) { throw new Error( - `firebase.firestore.batch().set(*) 'documentRef' expected instance of a DocumentReference.`, + "firebase.firestore.batch().set(*) 'documentRef' expected instance of a DocumentReference.", ); } if (documentRef.firestore.app !== this._firestore.app) { throw new Error( - `firebase.firestore.batch().set(*) 'documentRef' provided DocumentReference is from a different Firestore instance.`, + "firebase.firestore.batch().set(*) 'documentRef' provided DocumentReference is from a different Firestore instance.", ); } if (!isObject(data)) { - throw new Error(`firebase.firestore.batch().set(_, *) 'data' must be an object.`); + throw new Error("firebase.firestore.batch().set(_, *) 'data' must be an object."); } let setOptions; @@ -104,19 +106,19 @@ export default class FirestoreWriteBatch { this._verifyNotCommitted('update'); if (!(documentRef instanceof FirestoreDocumentReference)) { throw new Error( - `firebase.firestore.batch().update(*) 'documentRef' expected instance of a DocumentReference.`, + "firebase.firestore.batch().update(*) 'documentRef' expected instance of a DocumentReference.", ); } if (documentRef.firestore.app !== this._firestore.app) { throw new Error( - `firebase.firestore.batch().update(*) 'documentRef' provided DocumentReference is from a different Firestore instance.`, + "firebase.firestore.batch().update(*) 'documentRef' provided DocumentReference is from a different Firestore instance.", ); } if (args.length === 0) { throw new Error( - `firebase.firestore.batch().update(_, *) Invalid arguments. Expected update object or list of key/value pairs.`, + 'firebase.firestore.batch().update(_, *) Invalid arguments. Expected update object or list of key/value pairs.', ); } diff --git a/lib/index.js b/lib/index.js index f8addee630..fdb39d5b59 100644 --- a/lib/index.js +++ b/lib/index.js @@ -83,13 +83,13 @@ class FirebaseFirestoreModule extends FirebaseModule { collection(collectionPath) { if (!isString(collectionPath)) { throw new Error( - `firebase.firestore().collection(*) 'collectionPath' must be a string value.`, + "firebase.firestore().collection(*) 'collectionPath' must be a string value.", ); } if (collectionPath === '') { throw new Error( - `firebase.firestore().collection(*) 'collectionPath' must be a non-empty string.`, + "firebase.firestore().collection(*) 'collectionPath' must be a non-empty string.", ); } @@ -97,7 +97,7 @@ class FirebaseFirestoreModule extends FirebaseModule { if (!path.isCollection) { throw new Error( - `firebase.firestore().collection(*) 'collectionPath' must point to a collection.`, + "firebase.firestore().collection(*) 'collectionPath' must point to a collection.", ); } @@ -107,19 +107,19 @@ class FirebaseFirestoreModule extends FirebaseModule { collectionGroup(collectionId) { if (!isString(collectionId)) { throw new Error( - `firebase.firestore().collectionGroup(*) 'collectionId' must be a string value.`, + "firebase.firestore().collectionGroup(*) 'collectionId' must be a string value.", ); } if (collectionId === '') { throw new Error( - `firebase.firestore().collectionGroup(*) 'collectionId' must be a non-empty string.`, + "firebase.firestore().collectionGroup(*) 'collectionId' must be a non-empty string.", ); } if (collectionId.indexOf('/') >= 0) { throw new Error( - `firebase.firestore().collectionGroup(*) 'collectionId' must not contain '/'.`, + "firebase.firestore().collectionGroup(*) 'collectionId' must not contain '/'.", ); } @@ -136,17 +136,17 @@ class FirebaseFirestoreModule extends FirebaseModule { doc(documentPath) { if (!isString(documentPath)) { - throw new Error(`firebase.firestore().doc(*) 'documentPath' must be a string value.`); + throw new Error("firebase.firestore().doc(*) 'documentPath' must be a string value."); } if (documentPath === '') { - throw new Error(`firebase.firestore().doc(*) 'documentPath' must be a non-empty string.`); + throw new Error("firebase.firestore().doc(*) 'documentPath' must be a non-empty string."); } const path = this._referencePath.child(documentPath); if (!path.isDocument) { - throw new Error(`firebase.firestore().doc(*) 'documentPath' must point to a document.`); + throw new Error("firebase.firestore().doc(*) 'documentPath' must point to a document."); } return new FirestoreDocumentReference(this, path); @@ -159,7 +159,7 @@ class FirebaseFirestoreModule extends FirebaseModule { runTransaction(updateFunction) { if (!isFunction(updateFunction)) { throw new Error( - `firebase.firestore().runTransaction(*) 'updateFunction' must be a function.`, + "firebase.firestore().runTransaction(*) 'updateFunction' must be a function.", ); } @@ -168,7 +168,7 @@ class FirebaseFirestoreModule extends FirebaseModule { settings(settings) { if (!isObject(settings)) { - throw new Error(`firebase.firestore().settings(*) 'settings' must be an object.`); + throw new Error("firebase.firestore().settings(*) 'settings' must be an object."); } const keys = Object.keys(settings); @@ -187,7 +187,7 @@ class FirebaseFirestoreModule extends FirebaseModule { if (!isUndefined(settings.cacheSizeBytes)) { if (!isNumber(settings.cacheSizeBytes)) { throw new Error( - `firebase.firestore().settings(*) 'settings.cacheSizeBytes' must be a number value.`, + "firebase.firestore().settings(*) 'settings.cacheSizeBytes' must be a number value.", ); } @@ -196,31 +196,31 @@ class FirebaseFirestoreModule extends FirebaseModule { settings.cacheSizeBytes < 1048576 // 1MB ) { throw new Error( - `firebase.firestore().settings(*) 'settings.cacheSizeBytes' the minimum cache size is 1048576 bytes (1MB).`, + "firebase.firestore().settings(*) 'settings.cacheSizeBytes' the minimum cache size is 1048576 bytes (1MB).", ); } } if (!isUndefined(settings.host)) { if (!isString(settings.host)) { - throw new Error(`firebase.firestore().settings(*) 'settings.host' must be a string value.`); + throw new Error("firebase.firestore().settings(*) 'settings.host' must be a string value."); } if (settings.host === '') { throw new Error( - `firebase.firestore().settings(*) 'settings.host' must not be an empty string.`, + "firebase.firestore().settings(*) 'settings.host' must not be an empty string.", ); } } if (!isUndefined(settings.persistence) && !isBoolean(settings.persistence)) { throw new Error( - `firebase.firestore().settings(*) 'settings.persistence' must be a boolean value.`, + "firebase.firestore().settings(*) 'settings.persistence' must be a boolean value.", ); } if (!isUndefined(settings.ssl) && !isBoolean(settings.ssl)) { - throw new Error(`firebase.firestore().settings(*) 'settings.ssl' must be a boolean value.`); + throw new Error("firebase.firestore().settings(*) 'settings.ssl' must be a boolean value."); } return this.native.settings(settings); diff --git a/lib/utils/index.js b/lib/utils/index.js index 20f5e32ef8..f078bbcdc6 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -44,12 +44,12 @@ export function parseUpdateArgs(args) { let data = {}; if (args.length === 1) { if (!isObject(args[0])) { - throw new Error(`if using a single update argument, it must be an object.`); + throw new Error('if using a single update argument, it must be an object.'); } [data] = args; } else if (args.length % 2 === 1) { throw new Error( - `the update arguments must be either a single object argument, or equal numbers of key/value pairs.`, + 'the update arguments must be either a single object argument, or equal numbers of key/value pairs.', ); } else { for (let i = 0; i < args.length; i += 2) { @@ -74,19 +74,21 @@ export function parseUpdateArgs(args) { export function parseSetOptions(options) { const out = {}; - if (isUndefined(options)) return out; + if (isUndefined(options)) { + return out; + } if (!isObject(options)) { - throw new Error(`'options' must be an object.`); + throw new Error("'options' must be an object."); } if (hasOwnProperty(options, 'merge') && hasOwnProperty(options, 'mergeFields')) { - throw new Error(`'options' must not contain both 'merge' & 'mergeFields'.`); + throw new Error("'options' must not contain both 'merge' & 'mergeFields'."); } if (!isUndefined(options.merge)) { if (!isBoolean(options.merge)) { - throw new Error(`'options.merge' must be a boolean value.`); + throw new Error("'options.merge' must be a boolean value."); } out.merge = true; @@ -94,7 +96,7 @@ export function parseSetOptions(options) { if (!isUndefined(options.mergeFields)) { if (!isArray(options.mergeFields)) { - throw new Error(`'options.mergeFields' must be an array.`); + throw new Error("'options.mergeFields' must be an array."); } out.mergeFields = []; @@ -159,10 +161,8 @@ export function mergeFieldPathData(data, segments, value) { } export function parseSnapshotArgs(args) { - /* eslint-disable prefer-destructuring */ - if (args.length === 0) { - throw new Error(`expected at least one argument.`); + throw new Error('expected at least one argument.'); } // Ignore onComplete as its never used @@ -194,8 +194,12 @@ export function parseSnapshotArgs(args) { * .onSnapshot({ complete: () => {}, error: (e) => {}, next: (snapshot) => {} }) */ if (isObject(args[0]) && args[0].includeMetadataChanges === undefined) { - if (args[0].error) onError = args[0].error; - if (args[0].next) onNext = args[0].next; + if (args[0].error) { + onError = args[0].error; + } + if (args[0].next) { + onNext = args[0].next; + } } /** @@ -223,23 +227,27 @@ export function parseSnapshotArgs(args) { /** * .onSnapshot(SnapshotListenOptions, { complete: () => {}, error: (e) => {}, next: (snapshot) => {} }); */ - if (isFunction(args[1].error)) onError = args[1].error; - if (isFunction(args[1].next)) onNext = args[1].next; + if (isFunction(args[1].error)) { + onError = args[1].error; + } + if (isFunction(args[1].next)) { + onNext = args[1].next; + } } } if (hasOwnProperty(snapshotListenOptions, 'includeMetadataChanges')) { if (!isBoolean(snapshotListenOptions.includeMetadataChanges)) { - throw new Error(`'options' SnapshotOptions.includeMetadataChanges must be a boolean value.`); + throw new Error("'options' SnapshotOptions.includeMetadataChanges must be a boolean value."); } } if (!isFunction(onNext)) { - throw new Error(`'observer.next' or 'onNext' expected a function.`); + throw new Error("'observer.next' or 'onNext' expected a function."); } if (!isFunction(onError)) { - throw new Error(`'observer.error' or 'onError' expected a function.`); + throw new Error("'observer.error' or 'onError' expected a function."); } return { snapshotListenOptions, callback, onNext, onError }; diff --git a/lib/utils/serialize.js b/lib/utils/serialize.js index fa74f3dfc0..69b39d448c 100644 --- a/lib/utils/serialize.js +++ b/lib/utils/serialize.js @@ -46,7 +46,9 @@ export function buildNativeMap(data) { for (let i = 0; i < keys.length; i++) { const key = keys[i]; const typeMap = generateNativeData(data[key]); - if (typeMap) nativeData[key] = typeMap; + if (typeMap) { + nativeData[key] = typeMap; + } } } return nativeData; @@ -63,7 +65,9 @@ export function buildNativeArray(array) { for (let i = 0; i < array.length; i++) { const value = array[i]; const typeMap = generateNativeData(value); - if (typeMap) nativeArray.push(typeMap); + if (typeMap) { + nativeArray.push(typeMap); + } } } return nativeArray; @@ -101,7 +105,9 @@ export function generateNativeData(value) { } if (isBoolean(value)) { - if (value === true) return getTypeMapInt('booleanTrue'); + if (value === true) { + return getTypeMapInt('booleanTrue'); + } return getTypeMapInt('booleanFalse'); } @@ -110,7 +116,9 @@ export function generateNativeData(value) { } if (isString(value)) { - if (value === '') return getTypeMapInt('stringEmpty'); + if (value === '') { + return getTypeMapInt('stringEmpty'); + } return getTypeMapInt('string', value); } diff --git a/lib/utils/typemap.js b/lib/utils/typemap.js index c0fbce548f..76936ff8cd 100644 --- a/lib/utils/typemap.js +++ b/lib/utils/typemap.js @@ -49,7 +49,9 @@ const MAP_ENTRIES = Object.entries(MAP); export function getTypeMapInt(type, value = undefined) { if (hasOwnProperty(MAP, type)) { const array = [MAP[type]]; - if (value !== undefined) array.push(value); + if (value !== undefined) { + array.push(value); + } return array; } @@ -64,7 +66,9 @@ export function getTypeMapInt(type, value = undefined) { export function getTypeMapName(value) { for (let i = 0; i < MAP_ENTRIES.length; i++) { const [name, int] = MAP_ENTRIES[i]; - if (value === int) return name; + if (value === int) { + return name; + } } return null;