From 0205d27c7997a3028406f01e3f64809ca63be471 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 10 Jul 2020 01:12:20 +0000 Subject: [PATCH 1/4] Update dependency prettier to v2 --- package.json | 2 +- yarn.lock | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 85191d3bdf9..5a9a7b12221 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "npm-run-path": "4.0.1", "nyc": "15.0.1", "ora": "4.0.4", - "prettier": "1.19.1", + "prettier": "2.0.5", "protractor": "5.4.2", "rxjs": "6.5.5", "semver": "7.3.2", diff --git a/yarn.lock b/yarn.lock index 765de8339b9..16b87c05c34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11995,7 +11995,12 @@ prepend-http@^1.0.1: resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= -prettier@1.19.1, prettier@^1.18.2: +prettier@2.0.5: + version "2.0.5" + resolved "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" + integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== + +prettier@^1.18.2: version "1.19.1" resolved "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== From f5cfbae48e4e94124aebec5b9442337ff3ac4144 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 9 Jul 2020 20:21:10 -0700 Subject: [PATCH 2/4] update configuration --- .prettierrc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.prettierrc b/.prettierrc index cab76c0e1a2..6c4a0f88d09 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,6 @@ { singleQuote: true, printWidth: 80, - quoteProps: preserve -} + quoteProps: preserve, + trailingComma: none, + arrowParens: avoid From ff04a00da7d135b78501fb4e339ca9be3178799d Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 9 Jul 2020 20:21:49 -0700 Subject: [PATCH 3/4] add parenthese --- .prettierrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierrc b/.prettierrc index 6c4a0f88d09..4d7de7c6cc9 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,3 +4,4 @@ quoteProps: preserve, trailingComma: none, arrowParens: avoid +} \ No newline at end of file From d3e2ae70708a91a8aab7820672a5eeb08df6cc30 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 9 Jul 2020 20:27:33 -0700 Subject: [PATCH 4/4] run prettier --- config/karma.saucelabs.js | 2 +- integration/browserify/karma.conf.js | 4 +- integration/browserify/src/namespace.test.js | 4 +- integration/firestore/karma.conf.js | 2 +- .../messaging/test/test-deleteToken.js | 16 +- integration/messaging/test/test-send.js | 22 +- .../messaging/test/test-updateToken.js | 16 +- .../test/test-useDefaultServiceWorker.js | 10 +- .../messaging/test/test-useValidManifest.js | 8 +- integration/shared/validator.js | 10 +- integration/typescript/karma.conf.js | 4 +- integration/typescript/test/namespace.test.ts | 2 +- integration/webpack/karma.conf.js | 4 +- integration/webpack/src/namespace.test.js | 4 +- packages-exp/app-exp/karma.conf.js | 2 +- packages-exp/firebase-exp/gulpfile.js | 2 +- packages-exp/functions-exp/karma.conf.js | 2 +- packages/analytics/karma.conf.js | 4 +- packages/analytics/src/helpers.ts | 2 +- packages/app/index.ts | 2 +- packages/app/karma.conf.js | 4 +- packages/app/src/firebaseNamespaceCore.ts | 2 +- packages/component/karma.conf.js | 4 +- packages/database/karma.conf.js | 4 +- packages/database/src/api/Reference.ts | 14 +- packages/database/src/api/internal.ts | 16 +- packages/database/src/api/test_access.ts | 14 +- .../database/src/core/PersistentConnection.ts | 11 +- .../database/src/core/Repo_transaction.ts | 34 +-- packages/database/src/core/SyncPoint.ts | 28 +-- packages/database/src/core/WriteTree.ts | 2 +- .../database/src/core/operation/Operation.ts | 2 +- packages/database/src/core/snap/childSet.ts | 10 +- packages/database/src/core/snap/snap.ts | 4 +- packages/database/src/core/storage/storage.ts | 2 +- packages/database/src/core/util/NextPushId.ts | 4 +- .../database/src/core/util/ServerValues.ts | 12 +- .../database/src/core/util/libs/parser.ts | 4 +- packages/database/src/core/util/util.ts | 64 +++--- packages/database/src/core/util/validation.ts | 40 ++-- .../src/core/view/EventRegistration.ts | 8 +- .../database/src/core/view/ViewProcessor.ts | 27 +-- .../src/realtime/BrowserPollConnection.ts | 2 +- packages/database/test/datasnapshot.test.ts | 16 +- packages/database/test/helpers/events.ts | 30 +-- packages/database/test/helpers/util.ts | 2 +- packages/database/test/info.test.ts | 8 +- packages/database/test/node.test.ts | 7 +- packages/database/test/order_by.test.ts | 15 +- packages/database/test/path.test.ts | 51 +---- packages/database/test/promise.test.ts | 5 +- packages/database/test/query.test.ts | 50 ++--- packages/database/test/sortedmap.test.ts | 16 +- packages/database/test/transaction.test.ts | 4 +- .../firebase/externs/firebase-app-externs.js | 36 +-- .../externs/firebase-app-internal-externs.js | 34 +-- .../firebase/externs/firebase-auth-externs.js | 209 +++++++++--------- .../externs/firebase-client-auth-externs.js | 22 +- .../externs/firebase-database-externs.js | 104 ++++----- .../firebase-database-internal-externs.js | 2 +- packages/firebase/externs/firebase-externs.js | 6 +- .../externs/firebase-firestore-externs.js | 173 ++++++++------- .../externs/firebase-messaging-externs.js | 20 +- .../externs/firebase-storage-externs.js | 56 ++--- packages/firestore/karma.conf.js | 2 +- packages/firestore/src/local/simple_db.ts | 10 +- .../test/integration/api/batch_writes.test.ts | 14 +- .../test/integration/api/cursor.test.ts | 15 +- .../test/integration/api/database.test.ts | 10 +- .../test/integration/api/transactions.test.ts | 80 ++----- .../test/integration/api/validation.test.ts | 20 +- .../test/integration/prime_backend.test.ts | 2 +- .../test/unit/local/mutation_queue.test.ts | 4 +- .../unit/local/remote_document_cache.test.ts | 11 +- .../test/unit/model/document_set.test.ts | 5 +- .../firestore/test/unit/model/path.test.ts | 25 +-- .../test/unit/remote/serializer.helper.ts | 4 +- .../test/unit/util/sorted_map.test.ts | 10 +- .../test/unit/util/sorted_set.test.ts | 30 +-- .../firestore/test/util/equality_matcher.ts | 2 +- packages/functions/karma.conf.js | 2 +- packages/installations/karma.conf.js | 2 +- packages/logger/karma.conf.js | 4 +- packages/messaging/karma.conf.js | 2 +- .../src/helpers/array-base64-translator.ts | 5 +- .../messaging/src/helpers/idb-manager.test.ts | 4 +- packages/performance/karma.conf.js | 4 +- packages/remote-config/karma.conf.js | 4 +- packages/remote-config/test_app/index.js | 4 +- packages/rxfire/karma.conf.js | 4 +- packages/rxfire/test/database.test.ts | 5 +- packages/rxfire/test/firestore.test.ts | 5 +- packages/storage/karma.conf.js | 4 +- packages/storage/src/implementation/args.ts | 4 +- .../storage/src/implementation/requests.ts | 6 +- packages/storage/src/implementation/string.ts | 6 +- packages/storage/test/reference.test.ts | 7 +- packages/storage/test/task.test.ts | 4 +- packages/template/karma.conf.js | 2 +- packages/testing/test/database.test.ts | 26 +-- packages/util/karma.conf.js | 4 +- packages/util/src/assert.ts | 4 +- packages/util/src/crypt.ts | 8 +- packages/util/src/jwt.ts | 10 +- packages/util/src/utf8.ts | 4 +- packages/util/src/validation.ts | 2 +- 106 files changed, 718 insertions(+), 962 deletions(-) diff --git a/config/karma.saucelabs.js b/config/karma.saucelabs.js index 3f9a6d929ff..4517d5b6ee1 100644 --- a/config/karma.saucelabs.js +++ b/config/karma.saucelabs.js @@ -153,7 +153,7 @@ function appiumLauncher( }; } -module.exports = function(config) { +module.exports = function (config) { const { packageName, files: testFiles } = getTestFiles(); const sauceLabsBrowsers = getSauceLabsBrowsers(packageName); diff --git a/integration/browserify/karma.conf.js b/integration/browserify/karma.conf.js index c0fb150a1ad..47d215c8a5c 100644 --- a/integration/browserify/karma.conf.js +++ b/integration/browserify/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`dist/**/*`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/integration/browserify/src/namespace.test.js b/integration/browserify/src/namespace.test.js index 17b18cd3754..e1bec802d76 100644 --- a/integration/browserify/src/namespace.test.js +++ b/integration/browserify/src/namespace.test.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,6 @@ firebase.initializeApp({ appId: 'myAppId' }); -describe('Firebase Namespace Validation', function() { +describe('Firebase Namespace Validation', function () { validateNamespace(namespaceDefinition, firebase); }); diff --git a/integration/firestore/karma.conf.js b/integration/firestore/karma.conf.js index 96b256dd907..a659abea7cf 100644 --- a/integration/firestore/karma.conf.js +++ b/integration/firestore/karma.conf.js @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = ['./dist/test-harness.js']; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/integration/messaging/test/test-deleteToken.js b/integration/messaging/test/test-deleteToken.js index 3eea890b98d..65dcab7e251 100644 --- a/integration/messaging/test/test-deleteToken.js +++ b/integration/messaging/test/test-deleteToken.js @@ -26,16 +26,16 @@ const createPermittedWebDriver = require('./utils/createPermittedWebDriver'); const TEST_SUITE_TIMEOUT_MS = 100000; const TEST_DOMAIN = 'valid-vapid-key'; -describe('Firebase Messaging Integration Tests > get and delete token', function() { +describe('Firebase Messaging Integration Tests > get and delete token', function () { this.timeout(TEST_SUITE_TIMEOUT_MS); this.retries(3); let globalWebDriver; - before(async function() { + before(async function () { await testServer.start(); }); - after(async function() { + after(async function () { await testServer.stop(); }); @@ -46,8 +46,8 @@ describe('Firebase Messaging Integration Tests > get and delete token', function return; } - describe(`Testing browser: ${assistantBrowser.getPrettyName()} : ${TEST_DOMAIN}`, function() { - before(async function() { + describe(`Testing browser: ${assistantBrowser.getPrettyName()} : ${TEST_DOMAIN}`, function () { + before(async function () { // Use one webDriver per browser instead of one per test to speed up test. globalWebDriver = createPermittedWebDriver( /* browser= */ assistantBrowser.getId() @@ -58,15 +58,15 @@ describe('Firebase Messaging Integration Tests > get and delete token', function ); }); - after(async function() { + after(async function () { await seleniumAssistant.killWebDriver(globalWebDriver); }); - afterEach(async function() { + afterEach(async function () { await clearAppForTest(globalWebDriver); }); - it(`Test app can delete a valid token`, async function() { + it(`Test app can delete a valid token`, async function () { const token = await retrieveToken(globalWebDriver); expect(token).to.exist; try { diff --git a/integration/messaging/test/test-send.js b/integration/messaging/test/test-send.js index 7570bdd7d69..9c196e0825e 100644 --- a/integration/messaging/test/test-send.js +++ b/integration/messaging/test/test-send.js @@ -43,15 +43,15 @@ const WAIT_TIME_BEFORE_RETRIEVING_BACKGROUND_MESSAGES_MILLISECONDS = 60000; const wait = ms => new Promise(res => setTimeout(res, ms)); -describe('Starting Integration Test > Sending and Receiving ', function() { +describe('Starting Integration Test > Sending and Receiving ', function () { this.retries(3); let globalWebDriver; - before(async function() { + before(async function () { await testServer.start(); }); - after(async function() { + after(async function () { await testServer.stop(); }); @@ -61,14 +61,14 @@ describe('Starting Integration Test > Sending and Receiving ', function() { return; } - describe(`Testing browser: ${assistantBrowser.getPrettyName()} : ${TEST_DOMAIN}`, function() { - before(async function() { + describe(`Testing browser: ${assistantBrowser.getPrettyName()} : ${TEST_DOMAIN}`, function () { + before(async function () { globalWebDriver = createPermittedWebDriver( /* browser= */ assistantBrowser.getId() ); }); - it('Background app can receive a {} empty message from sw', async function() { + it('Background app can receive a {} empty message from sw', async function () { this.timeout(TIMEOUT_BACKGROUND_MESSAGE_TEST_UNIT_MILLISECONDS); // Clearing the cache and db data by killing the previously instantiated driver. Note that ideally this call is placed inside the after/before hooks. However, Mocha forbids operations longer than 2s in hooks. Hence, this clearing call needs to be inside the test unit. @@ -97,7 +97,7 @@ describe('Starting Integration Test > Sending and Receiving ', function() { ); }); - it('Background app can receive a {"data"} message frow sw', async function() { + it('Background app can receive a {"data"} message frow sw', async function () { this.timeout(TIMEOUT_BACKGROUND_MESSAGE_TEST_UNIT_MILLISECONDS); await seleniumAssistant.killWebDriver(globalWebDriver); @@ -126,7 +126,7 @@ describe('Starting Integration Test > Sending and Receiving ', function() { ); }); - it('Foreground app can receive a {} empty message in onMessage', async function() { + it('Foreground app can receive a {} empty message in onMessage', async function () { this.timeout(TIMEOUT_FOREGROUND_MESSAGE_TEST_UNIT_MILLISECONDS); await seleniumAssistant.killWebDriver(globalWebDriver); @@ -153,7 +153,7 @@ describe('Starting Integration Test > Sending and Receiving ', function() { ); }); - it('Foreground app can receive a {"notification"} message in onMessage', async function() { + it('Foreground app can receive a {"notification"} message in onMessage', async function () { this.timeout(TIMEOUT_FOREGROUND_MESSAGE_TEST_UNIT_MILLISECONDS); await seleniumAssistant.killWebDriver(globalWebDriver); @@ -180,7 +180,7 @@ describe('Starting Integration Test > Sending and Receiving ', function() { ); }); - it('Foreground app can receive a {"data"} message in onMessage', async function() { + it('Foreground app can receive a {"data"} message in onMessage', async function () { this.timeout(TIMEOUT_FOREGROUND_MESSAGE_TEST_UNIT_MILLISECONDS); await seleniumAssistant.killWebDriver(globalWebDriver); @@ -207,7 +207,7 @@ describe('Starting Integration Test > Sending and Receiving ', function() { ); }); - it('Foreground app can receive a {"notification", "data"} message in onMessage', async function() { + it('Foreground app can receive a {"notification", "data"} message in onMessage', async function () { this.timeout(TIMEOUT_FOREGROUND_MESSAGE_TEST_UNIT_MILLISECONDS); await seleniumAssistant.killWebDriver(globalWebDriver); diff --git a/integration/messaging/test/test-updateToken.js b/integration/messaging/test/test-updateToken.js index bc7676b74f7..a18311f8d28 100644 --- a/integration/messaging/test/test-updateToken.js +++ b/integration/messaging/test/test-updateToken.js @@ -28,17 +28,17 @@ const getErrors = require('./utils/getErrors'); const TEST_SUITE_TIMEOUT_MS = 70000; const TEST_DOMAIN = 'valid-vapid-key'; -describe('Firebase Messaging Integration Tests > update a token', function() { +describe('Firebase Messaging Integration Tests > update a token', function () { this.timeout(TEST_SUITE_TIMEOUT_MS); this.retries(3); let globalWebDriver; - before(async function() { + before(async function () { await testServer.start(); }); - after(async function() { + after(async function () { await testServer.stop(); }); @@ -49,8 +49,8 @@ describe('Firebase Messaging Integration Tests > update a token', function() { return; } - describe(`Testing browser: ${assistantBrowser.getPrettyName()} : ${TEST_DOMAIN}`, function() { - before(async function() { + describe(`Testing browser: ${assistantBrowser.getPrettyName()} : ${TEST_DOMAIN}`, function () { + before(async function () { // Use one webDriver per browser instead of one per test to speed up test. globalWebDriver = createPermittedWebDriver( /* browser= */ assistantBrowser.getId() @@ -60,15 +60,15 @@ describe('Firebase Messaging Integration Tests > update a token', function() { ); }); - after(async function() { + after(async function () { await seleniumAssistant.killWebDriver(globalWebDriver); }); - afterEach(async function() { + afterEach(async function () { await clearAppForTest(globalWebDriver); }); - it(`should update a token`, async function() { + it(`should update a token`, async function () { const token = await retrieveToken(globalWebDriver); expect(token).to.exist; diff --git a/integration/messaging/test/test-useDefaultServiceWorker.js b/integration/messaging/test/test-useDefaultServiceWorker.js index f27b4067481..0d29f22b0ab 100644 --- a/integration/messaging/test/test-useDefaultServiceWorker.js +++ b/integration/messaging/test/test-useDefaultServiceWorker.js @@ -24,23 +24,23 @@ const createPermittedWebDriver = require('./utils/createPermittedWebDriver'); const TEST_DOMAIN = 'default-sw'; const TEST_SUITE_TIMEOUT_MS = 70000; -describe(`Firebase Messaging Integration Tests > Use 'firebase-messaging-sw.js' by default`, function() { +describe(`Firebase Messaging Integration Tests > Use 'firebase-messaging-sw.js' by default`, function () { this.timeout(TEST_SUITE_TIMEOUT_MS); this.retries(3); let globalWebDriver; - before(async function() { + before(async function () { await testServer.start(); }); - after(async function() { + after(async function () { await testServer.stop(); await seleniumAssistant.killWebDriver(globalWebDriver); }); - it(`should use default SW by default`, async function() { + it(`should use default SW by default`, async function () { globalWebDriver = createPermittedWebDriver('chrome'); await globalWebDriver.get(`${testServer.serverAddress}/${TEST_DOMAIN}/`); @@ -48,7 +48,7 @@ describe(`Firebase Messaging Integration Tests > Use 'firebase-messaging-sw.js' const token = await retrieveToken(globalWebDriver); expect(token).to.exist; - const result = await globalWebDriver.executeAsyncScript(function(cb) { + const result = await globalWebDriver.executeAsyncScript(function (cb) { navigator.serviceWorker .getRegistrations() .then(swReg => { diff --git a/integration/messaging/test/test-useValidManifest.js b/integration/messaging/test/test-useValidManifest.js index 23210a25b4e..da2a8c3f15f 100644 --- a/integration/messaging/test/test-useValidManifest.js +++ b/integration/messaging/test/test-useValidManifest.js @@ -24,23 +24,23 @@ const createPermittedWebDriver = require('./utils/createPermittedWebDriver'); const TEST_DOMAIN = 'valid-manifest'; const TEST_SUITE_TIMEOUT_MS = 70000; -describe(`Firebase Messaging Integration Tests > Use 'use valid manifest`, function() { +describe(`Firebase Messaging Integration Tests > Use 'use valid manifest`, function () { this.timeout(TEST_SUITE_TIMEOUT_MS); this.retries(3); let globalWebDriver; - before(async function() { + before(async function () { await testServer.start(); }); - after(async function() { + after(async function () { await testServer.stop(); await seleniumAssistant.killWebDriver(globalWebDriver); }); - it(`should allow valid manifest`, async function() { + it(`should allow valid manifest`, async function () { globalWebDriver = createPermittedWebDriver('chrome'); await globalWebDriver.get(`${testServer.serverAddress}/${TEST_DOMAIN}/`); diff --git a/integration/shared/validator.js b/integration/shared/validator.js index 398c1dc614e..27bb3625dc1 100644 --- a/integration/shared/validator.js +++ b/integration/shared/validator.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,8 @@ function validateNamespace(definition, candidate) { const keys = Object.keys(definition).filter(key => !~key.indexOf('__')); if (!validatedVersion) { - describe('Firebase SDK Version', function() { - it('Should be properly defined', function() { + describe('Firebase SDK Version', function () { + it('Should be properly defined', function () { __expect(candidate.SDK_VERSION).to.equal( require('../../packages/firebase/package.json').version ); @@ -54,12 +54,12 @@ function validateNamespace(definition, candidate) { iKey => ~iKey.indexOf('__return') ); - describe(`${key}`, function() { + describe(`${key}`, function () { /** * Tests of the actual API */ if (definitionChunk.__type) { - it(`Should be a \`${definitionChunk.__type}\``, function() { + it(`Should be a \`${definitionChunk.__type}\``, function () { __expect(candidateChunk).to.be.a(definitionChunk.__type); }); } diff --git a/integration/typescript/karma.conf.js b/integration/typescript/karma.conf.js index 0feefd7d804..c1210c70fe0 100644 --- a/integration/typescript/karma.conf.js +++ b/integration/typescript/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = ['test/**/*.test.*']; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/integration/typescript/test/namespace.test.ts b/integration/typescript/test/namespace.test.ts index 2ebe32d83d5..46eb6b0a25d 100644 --- a/integration/typescript/test/namespace.test.ts +++ b/integration/typescript/test/namespace.test.ts @@ -29,6 +29,6 @@ firebase.initializeApp({ appId: 'myAppId' }); -describe('Firebase Namespace Validation', function() { +describe('Firebase Namespace Validation', function () { validateNamespace(namespaceDefinition, firebase); }); diff --git a/integration/webpack/karma.conf.js b/integration/webpack/karma.conf.js index c0fb150a1ad..47d215c8a5c 100644 --- a/integration/webpack/karma.conf.js +++ b/integration/webpack/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`dist/**/*`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/integration/webpack/src/namespace.test.js b/integration/webpack/src/namespace.test.js index 17b18cd3754..e1bec802d76 100644 --- a/integration/webpack/src/namespace.test.js +++ b/integration/webpack/src/namespace.test.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,6 @@ firebase.initializeApp({ appId: 'myAppId' }); -describe('Firebase Namespace Validation', function() { +describe('Firebase Namespace Validation', function () { validateNamespace(namespaceDefinition, firebase); }); diff --git a/packages-exp/app-exp/karma.conf.js b/packages-exp/app-exp/karma.conf.js index fe4ace4252f..c0917db53d1 100644 --- a/packages-exp/app-exp/karma.conf.js +++ b/packages-exp/app-exp/karma.conf.js @@ -19,7 +19,7 @@ const karmaBase = require('../../config/karma.base'); const files = ['src/**/*.test.ts']; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/packages-exp/firebase-exp/gulpfile.js b/packages-exp/firebase-exp/gulpfile.js index 10bbfea2751..a1a9a2c5cc5 100644 --- a/packages-exp/firebase-exp/gulpfile.js +++ b/packages-exp/firebase-exp/gulpfile.js @@ -25,7 +25,7 @@ const files = [ ...pkgJson.components.map(component => `firebase-${component}.js`) ]; -gulp.task('firebase-js', function() { +gulp.task('firebase-js', function () { return gulp .src(files) .pipe(sourcemaps.init({ loadMaps: true })) diff --git a/packages-exp/functions-exp/karma.conf.js b/packages-exp/functions-exp/karma.conf.js index 31f6baa0917..d180371aeba 100644 --- a/packages-exp/functions-exp/karma.conf.js +++ b/packages-exp/functions-exp/karma.conf.js @@ -19,7 +19,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`src/**/*.test.ts`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files, diff --git a/packages/analytics/karma.conf.js b/packages/analytics/karma.conf.js index 0e7f195b148..c6488ea06bd 100644 --- a/packages/analytics/karma.conf.js +++ b/packages/analytics/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2019 Google Inc. + * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`**/*.test.ts`]; -module.exports = function(config) { +module.exports = function (config) { config.set({ ...karmaBase, files, diff --git a/packages/analytics/src/helpers.ts b/packages/analytics/src/helpers.ts index 1db23ad3cf1..a25c0dd7604 100644 --- a/packages/analytics/src/helpers.ts +++ b/packages/analytics/src/helpers.ts @@ -184,7 +184,7 @@ export function wrapOrCreateGtag( wrappedGtag: Gtag; } { // Create a basic core gtag function - let gtagCore: Gtag = function(..._args: unknown[]) { + let gtagCore: Gtag = function (..._args: unknown[]) { // Must push IArguments object, not an array. (window[dataLayerName] as DataLayer).push(arguments); }; diff --git a/packages/app/index.ts b/packages/app/index.ts index f6a32c844bb..342dd8034d7 100644 --- a/packages/app/index.ts +++ b/packages/app/index.ts @@ -44,7 +44,7 @@ const initializeApp = firebaseNamespace.initializeApp; // TODO: This disable can be removed and the 'ignoreRestArgs' option added to // the no-explicit-any rule when ESlint releases it. // eslint-disable-next-line @typescript-eslint/no-explicit-any -firebaseNamespace.initializeApp = function(...args: any) { +firebaseNamespace.initializeApp = function (...args: any) { // Environment check before initializing app // Do the check in initializeApp, so people have a chance to disable it by setting logLevel // in @firebase/logger diff --git a/packages/app/karma.conf.js b/packages/app/karma.conf.js index 16c3a0d9bc3..1249eb1ebcc 100644 --- a/packages/app/karma.conf.js +++ b/packages/app/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = ['test/**/*', 'src/**/*.test.ts']; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/packages/app/src/firebaseNamespaceCore.ts b/packages/app/src/firebaseNamespaceCore.ts index eb42fcea07b..b985f8b2091 100644 --- a/packages/app/src/firebaseNamespaceCore.ts +++ b/packages/app/src/firebaseNamespaceCore.ts @@ -223,7 +223,7 @@ export function createFirebaseNamespaceCore( // TODO: The eslint disable can be removed and the 'ignoreRestArgs' // option added to the no-explicit-any rule when ESlint releases it. // eslint-disable-next-line @typescript-eslint/no-explicit-any - function(...args: any) { + function (...args: any) { const serviceFxn = this._getService.bind(this, componentName); return serviceFxn.apply( this, diff --git a/packages/component/karma.conf.js b/packages/component/karma.conf.js index 9da71b4327f..e3c01e1c27e 100644 --- a/packages/component/karma.conf.js +++ b/packages/component/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = ['src/**/*.test.ts']; -module.exports = function(config) { +module.exports = function (config) { config.set({ ...karmaBase, // files to load into karma diff --git a/packages/database/karma.conf.js b/packages/database/karma.conf.js index d372034d90a..566897507b1 100644 --- a/packages/database/karma.conf.js +++ b/packages/database/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`test/**/*.test.ts`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/packages/database/src/api/Reference.ts b/packages/database/src/api/Reference.ts index c5bf2ec3b2a..3523ede29f0 100644 --- a/packages/database/src/api/Reference.ts +++ b/packages/database/src/api/Reference.ts @@ -213,9 +213,11 @@ export class Reference extends Query { validateCallback('Reference.setWithPriority', 3, onComplete, true); if (this.getKey() === '.length' || this.getKey() === '.keys') { - throw 'Reference.setWithPriority failed: ' + + throw ( + 'Reference.setWithPriority failed: ' + this.getKey() + - ' is a read-only object.'; + ' is a read-only object.' + ); } const deferred = new Deferred(); @@ -260,9 +262,11 @@ export class Reference extends Query { validateBoolean('Reference.transaction', 3, applyLocally, true); if (this.getKey() === '.length' || this.getKey() === '.keys') { - throw 'Reference.transaction failed: ' + + throw ( + 'Reference.transaction failed: ' + this.getKey() + - ' is a read-only object.'; + ' is a read-only object.' + ); } if (applyLocally === undefined) { @@ -274,7 +278,7 @@ export class Reference extends Query { deferred.promise.catch(() => {}); } - const promiseComplete = function( + const promiseComplete = function ( error: Error, committed: boolean, snapshot: DataSnapshot diff --git a/packages/database/src/api/internal.ts b/packages/database/src/api/internal.ts index 166aea1bee1..68d875f39a4 100644 --- a/packages/database/src/api/internal.ts +++ b/packages/database/src/api/internal.ts @@ -27,21 +27,21 @@ import { Reference } from './Reference'; * @const */ -export const forceLongPolling = function() { +export const forceLongPolling = function () { WebSocketConnection.forceDisallow(); BrowserPollConnection.forceAllow(); }; -export const forceWebSockets = function() { +export const forceWebSockets = function () { BrowserPollConnection.forceDisallow(); }; /* Used by App Manager */ -export const isWebSocketsAvailable = function(): boolean { +export const isWebSocketsAvailable = function (): boolean { return WebSocketConnection['isAvailable'](); }; -export const setSecurityDebugCallback = function( +export const setSecurityDebugCallback = function ( ref: Reference, callback: (a: object) => void ) { @@ -49,19 +49,19 @@ export const setSecurityDebugCallback = function( (ref.repo.persistentConnection_ as any).securityDebugCallback_ = callback; }; -export const stats = function(ref: Reference, showDelta?: boolean) { +export const stats = function (ref: Reference, showDelta?: boolean) { ref.repo.stats(showDelta); }; -export const statsIncrementCounter = function(ref: Reference, metric: string) { +export const statsIncrementCounter = function (ref: Reference, metric: string) { ref.repo.statsIncrementCounter(metric); }; -export const dataUpdateCount = function(ref: Reference): number { +export const dataUpdateCount = function (ref: Reference): number { return ref.repo.dataUpdateCount; }; -export const interceptServerData = function( +export const interceptServerData = function ( ref: Reference, callback: ((a: string, b: unknown) => void) | null ) { diff --git a/packages/database/src/api/test_access.ts b/packages/database/src/api/test_access.ts index 9f6ad0f8fdb..5826c8b23df 100644 --- a/packages/database/src/api/test_access.ts +++ b/packages/database/src/api/test_access.ts @@ -28,7 +28,7 @@ export const DataConnection = PersistentConnection; * @param {function(*)} onComplete */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(PersistentConnection.prototype as any).simpleListen = function( +(PersistentConnection.prototype as any).simpleListen = function ( pathString: string, onComplete: (a: unknown) => void ) { @@ -40,7 +40,7 @@ export const DataConnection = PersistentConnection; * @param {function(*)} onEcho */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(PersistentConnection.prototype as any).echo = function( +(PersistentConnection.prototype as any).echo = function ( data: unknown, onEcho: (a: unknown) => void ) { @@ -54,9 +54,9 @@ export const RealTimeConnection = Connection; * @param {function(): string} newHash * @return {function()} */ -export const hijackHash = function(newHash: () => string) { +export const hijackHash = function (newHash: () => string) { const oldPut = PersistentConnection.prototype.put; - PersistentConnection.prototype.put = function( + PersistentConnection.prototype.put = function ( pathString, data, onComplete, @@ -67,7 +67,7 @@ export const hijackHash = function(newHash: () => string) { } oldPut.call(this, pathString, data, onComplete, hash); }; - return function() { + return function () { PersistentConnection.prototype.put = oldPut; }; }; @@ -81,7 +81,7 @@ export const ConnectionTarget = RepoInfo; * @param {!Query} query * @return {!string} */ -export const queryIdentifier = function(query: Query) { +export const queryIdentifier = function (query: Query) { return query.queryIdentifier(); }; @@ -90,6 +90,6 @@ export const queryIdentifier = function(query: Query) { * * @param {boolean} forceRestClient */ -export const forceRestClient = function(forceRestClient: boolean) { +export const forceRestClient = function (forceRestClient: boolean) { RepoManager.getInstance().forceRestClient(forceRestClient); }; diff --git a/packages/database/src/core/PersistentConnection.ts b/packages/database/src/core/PersistentConnection.ts index 6007305d6f6..a79d20b8d96 100644 --- a/packages/database/src/core/PersistentConnection.ts +++ b/packages/database/src/core/PersistentConnection.ts @@ -269,12 +269,7 @@ export class PersistentConnection extends ServerActions { const warnings = safeGet(payload as any, 'w'); if (Array.isArray(warnings) && ~warnings.indexOf('no_index')) { const indexSpec = - '".indexOn": "' + - query - .getQueryParams() - .getIndex() - .toString() + - '"'; + '".indexOn": "' + query.getQueryParams().getIndex().toString() + '"'; const indexPath = query.path.toString(); warn( `Using an unspecified index. Your data will be downloaded and ` + @@ -750,7 +745,7 @@ export class PersistentConnection extends ServerActions { const lastSessionId = this.lastSessionId; let canceled = false; let connection: Connection | null = null; - const closeFn = function() { + const closeFn = function () { if (connection) { connection.close(); } else { @@ -758,7 +753,7 @@ export class PersistentConnection extends ServerActions { onDisconnect(); } }; - const sendRequestFn = function(msg: object) { + const sendRequestFn = function (msg: object) { assert( connection, "sendRequest call when we're not connected not allowed." diff --git a/packages/database/src/core/Repo_transaction.ts b/packages/database/src/core/Repo_transaction.ts index 2800eb6c932..d3e146d830c 100644 --- a/packages/database/src/core/Repo_transaction.ts +++ b/packages/database/src/core/Repo_transaction.ts @@ -109,7 +109,7 @@ interface Transaction { * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).transactionsInit_ = function() { +(Repo.prototype as any).transactionsInit_ = function () { /** * Stores queues of outstanding transactions for Firebase locations. * @@ -138,7 +138,7 @@ declare module './Repo' { * @param {?function(?Error, boolean, ?DataSnapshot)} onComplete Completion callback. * @param {boolean} applyLocally Whether or not to make intermediate results visible */ -Repo.prototype.startTransaction = function( +Repo.prototype.startTransaction = function ( path: Path, transactionUpdate: (a: unknown) => unknown, onComplete: ((a: Error, b: boolean, c: DataSnapshot) => void) | null, @@ -147,10 +147,10 @@ Repo.prototype.startTransaction = function( this.log_('transaction on ' + path); // Add a watch to make sure we get server updates. - const valueCallback = function() {}; + const valueCallback = function () {}; const watchRef = new Reference(this, path); watchRef.on('value', valueCallback); - const unwatcher = function() { + const unwatcher = function () { watchRef.off('value', valueCallback); }; @@ -274,7 +274,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).getLatestState_ = function( +(Repo.prototype as any).getLatestState_ = function ( path: Path, excludeSets?: number[] ): Node { @@ -295,7 +295,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).sendReadyTransactions_ = function( +(Repo.prototype as any).sendReadyTransactions_ = function ( node: Tree = this.transactionQueueTree_ ) { // Before recursing, make sure any completed transactions are removed. @@ -330,7 +330,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).sendTransactionQueue_ = function( +(Repo.prototype as any).sendTransactionQueue_ = function ( path: Path, queue: Transaction[] ) { @@ -445,7 +445,9 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).rerunTransactions_ = function(changedPath: Path): Path { +(Repo.prototype as any).rerunTransactions_ = function ( + changedPath: Path +): Path { const rootMostTransactionNode = this.getAncestorTransactionNode_(changedPath); const path = rootMostTransactionNode.path(); @@ -463,7 +465,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).rerunTransactionQueue_ = function( +(Repo.prototype as any).rerunTransactionQueue_ = function ( queue: Transaction[], path: Path ) { @@ -571,7 +573,7 @@ Repo.prototype.startTransaction = function( // Removing a listener can trigger pruning which can muck with mergedData/visibleData (as it prunes data). // So defer the unwatcher until we're done. - (function(unwatcher) { + (function (unwatcher) { setTimeout(unwatcher, Math.floor(0)); })(queue[i].unwatcher); @@ -612,7 +614,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).getAncestorTransactionNode_ = function( +(Repo.prototype as any).getAncestorTransactionNode_ = function ( path: Path ): Tree { let front; @@ -637,7 +639,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).buildTransactionQueue_ = function( +(Repo.prototype as any).buildTransactionQueue_ = function ( transactionNode: Tree ): Transaction[] { // Walk any child transaction queues and aggregate them into a single queue. @@ -658,7 +660,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).aggregateTransactionQueuesForNode_ = function( +(Repo.prototype as any).aggregateTransactionQueuesForNode_ = function ( node: Tree, queue: Transaction[] ) { @@ -681,7 +683,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).pruneCompletedTransactionsBelowNode_ = function( +(Repo.prototype as any).pruneCompletedTransactionsBelowNode_ = function ( node: Tree ) { const queue = node.getValue(); @@ -711,7 +713,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).abortTransactions_ = function(path: Path): Path { +(Repo.prototype as any).abortTransactions_ = function (path: Path): Path { const affectedPath = this.getAncestorTransactionNode_(path).path(); const transactionNode = this.transactionQueueTree_.subTree(path); @@ -736,7 +738,7 @@ Repo.prototype.startTransaction = function( * @private */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -(Repo.prototype as any).abortTransactionsOnNode_ = function( +(Repo.prototype as any).abortTransactionsOnNode_ = function ( node: Tree ) { const queue = node.getValue(); diff --git a/packages/database/src/core/SyncPoint.ts b/packages/database/src/core/SyncPoint.ts index 613d54cd2aa..24d3b840e15 100644 --- a/packages/database/src/core/SyncPoint.ts +++ b/packages/database/src/core/SyncPoint.ts @@ -179,12 +179,7 @@ export class SyncPoint { this.views.delete(viewQueryId); // We'll deal with complete views later. - if ( - !view - .getQuery() - .getQueryParams() - .loadsAllData() - ) { + if (!view.getQuery().getQueryParams().loadsAllData()) { removed.push(view.getQuery()); } } @@ -200,12 +195,7 @@ export class SyncPoint { this.views.delete(queryId); // We'll deal with complete views later. - if ( - !view - .getQuery() - .getQueryParams() - .loadsAllData() - ) { + if (!view.getQuery().getQueryParams().loadsAllData()) { removed.push(view.getQuery()); } } @@ -225,12 +215,7 @@ export class SyncPoint { getQueryViews(): View[] { const result = []; for (const view of this.views.values()) { - if ( - !view - .getQuery() - .getQueryParams() - .loadsAllData() - ) { + if (!view.getQuery().getQueryParams().loadsAllData()) { result.push(view); } } @@ -269,12 +254,7 @@ export class SyncPoint { getCompleteView(): View | null { for (const view of this.views.values()) { - if ( - view - .getQuery() - .getQueryParams() - .loadsAllData() - ) { + if (view.getQuery().getQueryParams().loadsAllData()) { return view; } } diff --git a/packages/database/src/core/WriteTree.ts b/packages/database/src/core/WriteTree.ts index 2566581e839..c0a6a1f95bc 100644 --- a/packages/database/src/core/WriteTree.ts +++ b/packages/database/src/core/WriteTree.ts @@ -273,7 +273,7 @@ export class WriteTree { ) { return null; } else { - const filter = function(write: WriteRecord) { + const filter = function (write: WriteRecord) { return ( (write.visible || includeHiddenWrites) && (!writeIdsToExclude || diff --git a/packages/database/src/core/operation/Operation.ts b/packages/database/src/core/operation/Operation.ts index 6def5c5d61d..c5e743666c3 100644 --- a/packages/database/src/core/operation/Operation.ts +++ b/packages/database/src/core/operation/Operation.ts @@ -97,7 +97,7 @@ export class OperationSource { * @param {string} queryId * @return {!OperationSource} */ - static forServerTaggedQuery = function(queryId: string): OperationSource { + static forServerTaggedQuery = function (queryId: string): OperationSource { return new OperationSource( false, /*fromServer=*/ true, diff --git a/packages/database/src/core/snap/childSet.ts b/packages/database/src/core/snap/childSet.ts index 645eec29bca..cc77fda3695 100644 --- a/packages/database/src/core/snap/childSet.ts +++ b/packages/database/src/core/snap/childSet.ts @@ -69,7 +69,7 @@ class Base12Num { * @param {(function(K, K):number)=} mapSortFn An optional override for comparator used by the generated sorted map * @return {SortedMap.} */ -export const buildChildSet = function( +export const buildChildSet = function ( childList: NamedNode[], cmp: (a: NamedNode, b: NamedNode) => number, keyFn?: (a: NamedNode) => K, @@ -77,7 +77,7 @@ export const buildChildSet = function( ): SortedMap { childList.sort(cmp); - const buildBalancedTree = function( + const buildBalancedTree = function ( low: number, high: number ): LLRBNode | null { @@ -113,12 +113,12 @@ export const buildChildSet = function( } }; - const buildFrom12Array = function(base12: Base12Num): LLRBNode { + const buildFrom12Array = function (base12: Base12Num): LLRBNode { let node: LLRBNode = null; let root = null; let index = childList.length; - const buildPennant = function(chunkSize: number, color: boolean) { + const buildPennant = function (chunkSize: number, color: boolean) { const low = index - chunkSize; const high = index; index -= chunkSize; @@ -136,7 +136,7 @@ export const buildChildSet = function( ); }; - const attachPennant = function(pennant: LLRBNode) { + const attachPennant = function (pennant: LLRBNode) { if (node) { node.left = pennant; node = pennant; diff --git a/packages/database/src/core/snap/snap.ts b/packages/database/src/core/snap/snap.ts index 2084736b667..b70b5363008 100644 --- a/packages/database/src/core/snap/snap.ts +++ b/packages/database/src/core/snap/snap.ts @@ -31,7 +31,7 @@ export function setMaxNode(val: Node) { * @param {(!string|!number)} priority * @return {!string} */ -export const priorityHashText = function(priority: string | number): string { +export const priorityHashText = function (priority: string | number): string { if (typeof priority === 'number') { return 'number:' + doubleToIEEE754String(priority); } else { @@ -44,7 +44,7 @@ export const priorityHashText = function(priority: string | number): string { * * @param {!Node} priorityNode */ -export const validatePriorityNode = function(priorityNode: Node) { +export const validatePriorityNode = function (priorityNode: Node) { if (priorityNode.isLeafNode()) { const val = priorityNode.val(); assert( diff --git a/packages/database/src/core/storage/storage.ts b/packages/database/src/core/storage/storage.ts index 1fdc93dcd2c..14740ed4f68 100644 --- a/packages/database/src/core/storage/storage.ts +++ b/packages/database/src/core/storage/storage.ts @@ -29,7 +29,7 @@ declare const window: Window; * (e.g. 'localStorage' or 'sessionStorage'). * @return {?} Turning off type information until a common interface is defined. */ -const createStoragefor = function( +const createStoragefor = function ( domStorageName: string ): DOMStorageWrapper | MemoryStorage { try { diff --git a/packages/database/src/core/util/NextPushId.ts b/packages/database/src/core/util/NextPushId.ts index 6eac38cc1ae..8296e4f4169 100644 --- a/packages/database/src/core/util/NextPushId.ts +++ b/packages/database/src/core/util/NextPushId.ts @@ -31,7 +31,7 @@ import { assert } from '@firebase/util'; * this by using the previous random bits but "incrementing" them by 1 (only * in the case of a timestamp collision). */ -export const nextPushId = (function() { +export const nextPushId = (function () { // Modeled after base64 web-safe chars, but ordered by ASCII. const PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; @@ -46,7 +46,7 @@ export const nextPushId = (function() { // we'll use those same characters except "incremented" by one. const lastRandChars: number[] = []; - return function(now: number) { + return function (now: number) { const duplicateTime = now === lastPushTime; lastPushTime = now; diff --git a/packages/database/src/core/util/ServerValues.ts b/packages/database/src/core/util/ServerValues.ts index c31a39cc479..95cbbee0146 100644 --- a/packages/database/src/core/util/ServerValues.ts +++ b/packages/database/src/core/util/ServerValues.ts @@ -75,7 +75,7 @@ class DeferredValueProvider implements ValueProvider { * @param {?Object} values * @return {!Object} */ -export const generateWithValues = function( +export const generateWithValues = function ( values: { [k: string]: unknown; } | null @@ -92,7 +92,7 @@ export const generateWithValues = function( * @param {!Object} serverValues * @return {!(string|number|boolean)} */ -export const resolveDeferredLeafValue = function( +export const resolveDeferredLeafValue = function ( value: { [k: string]: unknown } | string | number | boolean, existingVal: ValueProvider, serverValues: { [k: string]: unknown } @@ -111,7 +111,7 @@ export const resolveDeferredLeafValue = function( } }; -const resolveScalarDeferredValue = function( +const resolveScalarDeferredValue = function ( op: string, existing: ValueProvider, serverValues: { [k: string]: unknown } @@ -124,7 +124,7 @@ const resolveScalarDeferredValue = function( } }; -const resolveComplexDeferredValue = function( +const resolveComplexDeferredValue = function ( op: object, existing: ValueProvider, unused: { [k: string]: unknown } @@ -167,7 +167,7 @@ const resolveComplexDeferredValue = function( * @param {!Object} serverValues * @return {!SparseSnapshotTree} */ -export const resolveDeferredValueTree = function( +export const resolveDeferredValueTree = function ( path: Path, node: Node, syncTree: SyncTree, @@ -188,7 +188,7 @@ export const resolveDeferredValueTree = function( * @param {!Object} serverValues * @return {!Node} */ -export const resolveDeferredValueSnapshot = function( +export const resolveDeferredValueSnapshot = function ( node: Node, existing: Node, serverValues: Indexable diff --git a/packages/database/src/core/util/libs/parser.ts b/packages/database/src/core/util/libs/parser.ts index 0ef62fd11ba..5ae1979eaef 100644 --- a/packages/database/src/core/util/libs/parser.ts +++ b/packages/database/src/core/util/libs/parser.ts @@ -66,7 +66,7 @@ function decodeQuery(queryString: string): { [key: string]: string } { * @param {!string} dataURL * @return {{repoInfo: !RepoInfo, path: !Path}} */ -export const parseRepoInfo = function( +export const parseRepoInfo = function ( dataURL: string ): { repoInfo: RepoInfo; path: Path } { const parsedUrl = parseDatabaseURL(dataURL), @@ -114,7 +114,7 @@ export const parseRepoInfo = function( * @param {!string} dataURL * @return {{host: string, port: number, domain: string, subdomain: string, secure: boolean, scheme: string, pathString: string, namespace: string}} */ -export const parseDatabaseURL = function( +export const parseDatabaseURL = function ( dataURL: string ): { host: string; diff --git a/packages/database/src/core/util/util.ts b/packages/database/src/core/util/util.ts index c243b24cb5e..515ea728011 100644 --- a/packages/database/src/core/util/util.ts +++ b/packages/database/src/core/util/util.ts @@ -37,9 +37,9 @@ const logClient = new Logger('@firebase/database'); * Returns a locally-unique ID (generated by just incrementing up from 0 each time its called). * @type {function(): number} Generated ID. */ -export const LUIDGenerator: () => number = (function() { +export const LUIDGenerator: () => number = (function () { let id = 1; - return function() { + return function () { return id++; }; })(); @@ -49,7 +49,7 @@ export const LUIDGenerator: () => number = (function() { * @param {!string} str The string to hash * @return {!string} The resulting hash */ -export const sha1 = function(str: string): string { +export const sha1 = function (str: string): string { const utf8Bytes = stringToByteArray(str); const sha1 = new Sha1(); sha1.update(utf8Bytes); @@ -62,7 +62,7 @@ export const sha1 = function(str: string): string { * @return {string} * @private */ -const buildLogMessage_ = function(...varArgs: unknown[]): string { +const buildLogMessage_ = function (...varArgs: unknown[]): string { let message = ''; for (let i = 0; i < varArgs.length; i++) { const arg = varArgs[i]; @@ -103,7 +103,7 @@ let firstLog_ = true; * @param {boolean|?function(string)} logger_ A flag to turn on logging, or a custom logger * @param {boolean=} persistent Whether or not to persist logging settings across refreshes */ -export const enableLogging = function( +export const enableLogging = function ( logger_?: boolean | ((a: string) => void) | null, persistent?: boolean ) { @@ -129,7 +129,7 @@ export const enableLogging = function( * * @param {...(string|Arguments)} varArgs */ -export const log = function(...varArgs: unknown[]) { +export const log = function (...varArgs: unknown[]) { if (firstLog_ === true) { firstLog_ = false; if (logger === null && SessionStorage.get('logging_enabled') === true) { @@ -147,10 +147,10 @@ export const log = function(...varArgs: unknown[]) { * @param {!string} prefix * @return {function(...[*])} */ -export const logWrapper = function( +export const logWrapper = function ( prefix: string ): (...varArgs: unknown[]) => void { - return function(...varArgs: unknown[]) { + return function (...varArgs: unknown[]) { log(prefix, ...varArgs); }; }; @@ -158,7 +158,7 @@ export const logWrapper = function( /** * @param {...string} varArgs */ -export const error = function(...varArgs: string[]) { +export const error = function (...varArgs: string[]) { const message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_(...varArgs); logClient.error(message); }; @@ -166,7 +166,7 @@ export const error = function(...varArgs: string[]) { /** * @param {...string} varArgs */ -export const fatal = function(...varArgs: string[]) { +export const fatal = function (...varArgs: string[]) { const message = `FIREBASE FATAL ERROR: ${buildLogMessage_(...varArgs)}`; logClient.error(message); throw new Error(message); @@ -175,7 +175,7 @@ export const fatal = function(...varArgs: string[]) { /** * @param {...*} varArgs */ -export const warn = function(...varArgs: unknown[]) { +export const warn = function (...varArgs: unknown[]) { const message = 'FIREBASE WARNING: ' + buildLogMessage_(...varArgs); logClient.warn(message); }; @@ -184,7 +184,7 @@ export const warn = function(...varArgs: unknown[]) { * Logs a warning if the containing page uses https. Called when a call to new Firebase * does not use https. */ -export const warnIfPageIsSecure = function() { +export const warnIfPageIsSecure = function () { // Be very careful accessing browser globals. Who knows what may or may not exist. if ( typeof window !== 'undefined' && @@ -202,7 +202,7 @@ export const warnIfPageIsSecure = function() { /** * @param {!String} methodName */ -export const warnAboutUnsupportedMethod = function(methodName: string) { +export const warnAboutUnsupportedMethod = function (methodName: string) { warn( methodName + ' is unsupported and will likely change soon. ' + @@ -215,7 +215,7 @@ export const warnAboutUnsupportedMethod = function(methodName: string) { * @param {*} data * @return {boolean} */ -export const isInvalidJSONNumber = function(data: unknown): boolean { +export const isInvalidJSONNumber = function (data: unknown): boolean { return ( typeof data === 'number' && (data !== data || // NaN @@ -227,7 +227,7 @@ export const isInvalidJSONNumber = function(data: unknown): boolean { /** * @param {function()} fn */ -export const executeWhenDOMReady = function(fn: () => void) { +export const executeWhenDOMReady = function (fn: () => void) { if (isNodeSdk() || document.readyState === 'complete') { fn(); } else { @@ -235,7 +235,7 @@ export const executeWhenDOMReady = function(fn: () => void) { // fire before onload), but fall back to onload. let called = false; - const wrappedFn = function() { + const wrappedFn = function () { if (!document.body) { setTimeout(wrappedFn, Math.floor(10)); return; @@ -289,7 +289,7 @@ export const MAX_NAME = '[MAX_NAME]'; * @param {!string} b * @return {!number} */ -export const nameCompare = function(a: string, b: string): number { +export const nameCompare = function (a: string, b: string): number { if (a === b) { return 0; } else if (a === MIN_NAME || b === MAX_NAME) { @@ -319,7 +319,7 @@ export const nameCompare = function(a: string, b: string): number { * @param {!string} b * @return {!number} comparison result. */ -export const stringCompare = function(a: string, b: string): number { +export const stringCompare = function (a: string, b: string): number { if (a === b) { return 0; } else if (a < b) { @@ -334,7 +334,7 @@ export const stringCompare = function(a: string, b: string): number { * @param {Object} obj * @return {*} */ -export const requireKey = function( +export const requireKey = function ( key: string, obj: { [k: string]: unknown } ): unknown { @@ -351,7 +351,7 @@ export const requireKey = function( * @param {*} obj * @return {string} */ -export const ObjectToUniqueKey = function(obj: unknown): string { +export const ObjectToUniqueKey = function (obj: unknown): string { if (typeof obj !== 'object' || obj === null) { return stringify(obj); } @@ -384,7 +384,7 @@ export const ObjectToUniqueKey = function(obj: unknown): string { * @param {!number} segsize The maximum number of chars in the string. * @return {Array.} The string, split into appropriately-sized chunks */ -export const splitStringBySize = function( +export const splitStringBySize = function ( str: string, segsize: number ): string[] { @@ -425,7 +425,7 @@ export function each(obj: object, fn: (k: string, v: unknown) => void) { * @param {?Object=} context Optional context to bind to. * @return {function(*)} */ -export const bindCallback = function( +export const bindCallback = function ( callback: (a: unknown) => void, context?: object | null ): Function { @@ -439,7 +439,7 @@ export const bindCallback = function( * @param {!number} v A double * @return {string} */ -export const doubleToIEEE754String = function(v: number): string { +export const doubleToIEEE754String = function (v: number): string { assert(!isInvalidJSONNumber(v), 'Invalid JSON number'); // MJL const ebits = 11, @@ -500,7 +500,7 @@ export const doubleToIEEE754String = function(v: number): string { * isolated environment where long-polling doesn't work). * @return {boolean} */ -export const isChromeExtensionContentScript = function(): boolean { +export const isChromeExtensionContentScript = function (): boolean { return !!( typeof window === 'object' && window['chrome'] && @@ -513,7 +513,7 @@ export const isChromeExtensionContentScript = function(): boolean { * Used to detect if we're in a Windows 8 Store app. * @return {boolean} */ -export const isWindowsStoreApp = function(): boolean { +export const isWindowsStoreApp = function (): boolean { // Check for the presence of a couple WinRT globals return typeof Windows === 'object' && typeof Windows.UI === 'object'; }; @@ -524,7 +524,7 @@ export const isWindowsStoreApp = function(): boolean { * @param {!Query} query * @return {Error} */ -export const errorForServerCode = function(code: string, query: Query): Error { +export const errorForServerCode = function (code: string, query: Query): Error { let reason = 'Unknown Error'; if (code === 'too_big') { reason = @@ -556,7 +556,7 @@ export const INTEGER_REGEXP_ = new RegExp('^-?(0*)\\d{1,10}$'); * @param {!string} str * @return {?number} */ -export const tryParseInt = function(str: string): number | null { +export const tryParseInt = function (str: string): number | null { if (INTEGER_REGEXP_.test(str)) { const intVal = Number(str); if (intVal >= -2147483648 && intVal <= 2147483647) { @@ -583,7 +583,7 @@ export const tryParseInt = function(str: string): number | null { * * @param {!function()} fn The code to guard. */ -export const exceptionGuard = function(fn: () => void) { +export const exceptionGuard = function (fn: () => void) { try { fn(); } catch (e) { @@ -608,7 +608,7 @@ export const exceptionGuard = function(fn: () => void) { * @param {?Function=} callback Optional onComplete callback. * @param {...*} varArgs Arbitrary args to be passed to opt_onComplete */ -export const callUserCallback = function( +export const callUserCallback = function ( callback?: Function | null, ...varArgs: unknown[] ) { @@ -622,7 +622,7 @@ export const callUserCallback = function( /** * @return {boolean} true if we think we're currently being crawled. */ -export const beingCrawled = function(): boolean { +export const beingCrawled = function (): boolean { const userAgent = (typeof window === 'object' && window['navigator'] && @@ -647,7 +647,7 @@ export const beingCrawled = function(): boolean { * @param {string} name * @param {!function(): *} fnGet */ -export const exportPropGetter = function( +export const exportPropGetter = function ( object: object, name: string, fnGet: () => unknown @@ -664,7 +664,7 @@ export const exportPropGetter = function( * @param {number} time Milliseconds to wait before running. * @return {number|Object} The setTimeout() return value. */ -export const setTimeoutNonBlocking = function( +export const setTimeoutNonBlocking = function ( fn: Function, time: number ): number | object { diff --git a/packages/database/src/core/util/validation.ts b/packages/database/src/core/util/validation.ts index 2bb7166dd09..e036933a61e 100644 --- a/packages/database/src/core/util/validation.ts +++ b/packages/database/src/core/util/validation.ts @@ -52,7 +52,7 @@ export const MAX_LEAF_SIZE_ = 10 * 1024 * 1024; * @param {*} key * @return {boolean} */ -export const isValidKey = function(key: unknown): boolean { +export const isValidKey = function (key: unknown): boolean { return ( typeof key === 'string' && key.length !== 0 && !INVALID_KEY_REGEX_.test(key) ); @@ -62,7 +62,7 @@ export const isValidKey = function(key: unknown): boolean { * @param {string} pathString * @return {boolean} */ -export const isValidPathString = function(pathString: string): boolean { +export const isValidPathString = function (pathString: string): boolean { return ( typeof pathString === 'string' && pathString.length !== 0 && @@ -74,7 +74,7 @@ export const isValidPathString = function(pathString: string): boolean { * @param {string} pathString * @return {boolean} */ -export const isValidRootPathString = function(pathString: string): boolean { +export const isValidRootPathString = function (pathString: string): boolean { if (pathString) { // Allow '/.info/' at the beginning. pathString = pathString.replace(/^\/*\.info(\/|$)/, '/'); @@ -87,7 +87,7 @@ export const isValidRootPathString = function(pathString: string): boolean { * @param {*} priority * @return {boolean} */ -export const isValidPriority = function(priority: unknown): boolean { +export const isValidPriority = function (priority: unknown): boolean { return ( priority === null || typeof priority === 'string' || @@ -108,7 +108,7 @@ export const isValidPriority = function(priority: unknown): boolean { * @param {!Path} path * @param {boolean} optional */ -export const validateFirebaseDataArg = function( +export const validateFirebaseDataArg = function ( fnName: string, argumentNumber: number, data: unknown, @@ -133,7 +133,7 @@ export const validateFirebaseDataArg = function( * @param {*} data * @param {!Path|!ValidationPath} path_ */ -export const validateFirebaseData = function( +export const validateFirebaseData = function ( errorPrefix: string, data: unknown, path_: Path | ValidationPath @@ -222,7 +222,7 @@ export const validateFirebaseData = function( * @param {string} errorPrefix * @param {Array} mergePaths */ -export const validateFirebaseMergePaths = function( +export const validateFirebaseMergePaths = function ( errorPrefix: string, mergePaths: Path[] ) { @@ -277,7 +277,7 @@ export const validateFirebaseMergePaths = function( * @param {!Path} path * @param {boolean} optional */ -export const validateFirebaseMergeDataArg = function( +export const validateFirebaseMergeDataArg = function ( fnName: string, argumentNumber: number, data: unknown, @@ -316,7 +316,7 @@ export const validateFirebaseMergeDataArg = function( validateFirebaseMergePaths(errorPrefix, mergePaths); }; -export const validatePriority = function( +export const validatePriority = function ( fnName: string, argumentNumber: number, priority: unknown, @@ -344,7 +344,7 @@ export const validatePriority = function( } }; -export const validateEventType = function( +export const validateEventType = function ( fnName: string, argumentNumber: number, eventType: string, @@ -370,7 +370,7 @@ export const validateEventType = function( } }; -export const validateKey = function( +export const validateKey = function ( fnName: string, argumentNumber: number, key: string, @@ -390,7 +390,7 @@ export const validateKey = function( } }; -export const validatePathString = function( +export const validatePathString = function ( fnName: string, argumentNumber: number, pathString: string, @@ -411,7 +411,7 @@ export const validatePathString = function( } }; -export const validateRootPathString = function( +export const validateRootPathString = function ( fnName: string, argumentNumber: number, pathString: string, @@ -425,13 +425,13 @@ export const validateRootPathString = function( validatePathString(fnName, argumentNumber, pathString, optional); }; -export const validateWritablePath = function(fnName: string, path: Path) { +export const validateWritablePath = function (fnName: string, path: Path) { if (path.getFront() === '.info') { throw new Error(fnName + " failed = Can't modify data under /.info/"); } }; -export const validateUrl = function( +export const validateUrl = function ( fnName: string, argumentNumber: number, parsedUrl: { repoInfo: RepoInfo; path: Path } @@ -453,7 +453,7 @@ export const validateUrl = function( } }; -export const validateCredential = function( +export const validateCredential = function ( fnName: string, argumentNumber: number, cred: unknown, @@ -470,7 +470,7 @@ export const validateCredential = function( } }; -export const validateBoolean = function( +export const validateBoolean = function ( fnName: string, argumentNumber: number, bool: unknown, @@ -486,7 +486,7 @@ export const validateBoolean = function( } }; -export const validateString = function( +export const validateString = function ( fnName: string, argumentNumber: number, string: unknown, @@ -503,7 +503,7 @@ export const validateString = function( } }; -export const validateObject = function( +export const validateObject = function ( fnName: string, argumentNumber: number, obj: unknown, @@ -520,7 +520,7 @@ export const validateObject = function( } }; -export const validateObjectContainsKey = function( +export const validateObjectContainsKey = function ( fnName: string, argumentNumber: number, obj: unknown, diff --git a/packages/database/src/core/view/EventRegistration.ts b/packages/database/src/core/view/EventRegistration.ts index 1cf2ca16b18..064a8850bfe 100644 --- a/packages/database/src/core/view/EventRegistration.ts +++ b/packages/database/src/core/view/EventRegistration.ts @@ -123,13 +123,13 @@ export class ValueEventRegistration implements EventRegistration { 'Raising a cancel event on a listener with no cancel callback' ); const cancelCB = this.cancelCallback_; - return function() { + return function () { // We know that error exists, we checked above that this is a cancel event cancelCB.call(ctx, (eventData as CancelEvent).error); }; } else { const cb = this.callback_; - return function() { + return function () { cb.call(ctx, (eventData as DataEvent).snapshot); }; } @@ -241,13 +241,13 @@ export class ChildEventRegistration implements EventRegistration { 'Raising a cancel event on a listener with no cancel callback' ); const cancelCB = this.cancelCallback_; - return function() { + return function () { // We know that error exists, we checked above that this is a cancel event cancelCB.call(ctx, (eventData as CancelEvent).error); }; } else { const cb = this.callbacks_[(eventData as DataEvent).eventType]; - return function() { + return function () { cb.call( ctx, (eventData as DataEvent).snapshot, diff --git a/packages/database/src/core/view/ViewProcessor.ts b/packages/database/src/core/view/ViewProcessor.ts index 4fcba158f5b..2895c6b8064 100644 --- a/packages/database/src/core/view/ViewProcessor.ts +++ b/packages/database/src/core/view/ViewProcessor.ts @@ -65,17 +65,11 @@ export class ViewProcessor { */ assertIndexed(viewCache: ViewCache) { assert( - viewCache - .getEventCache() - .getNode() - .isIndexed(this.filter_.getIndex()), + viewCache.getEventCache().getNode().isIndexed(this.filter_.getIndex()), 'Event snap not indexed' ); assert( - viewCache - .getServerCache() - .getNode() - .isIndexed(this.filter_.getIndex()), + viewCache.getServerCache().getNode().isIndexed(this.filter_.getIndex()), 'Server snap not indexed' ); } @@ -207,10 +201,7 @@ export class ViewProcessor { !oldViewCache.getEventCache().isFullyInitialized() || (isLeafOrEmpty && !eventSnap.getNode().equals(/** @type {!Node} */ oldCompleteSnap)) || - !eventSnap - .getNode() - .getPriority() - .equals(oldCompleteSnap.getPriority()) + !eventSnap.getNode().getPriority().equals(oldCompleteSnap.getPriority()) ) { accumulator.push( Change.valueChange( @@ -639,10 +630,7 @@ export class ViewProcessor { // If we don't have a cache yet, this merge was intended for a previously listen in the same location. Ignore it and // wait for the complete data update coming soon. if ( - viewCache - .getServerCache() - .getNode() - .isEmpty() && + viewCache.getServerCache().getNode().isEmpty() && !viewCache.getServerCache().isFullyInitialized() ) { return viewCache; @@ -890,12 +878,7 @@ export class ViewProcessor { source, accumulator ); - } else if ( - viewCache - .getEventCache() - .getNode() - .hasChild(childKey) - ) { + } else if (viewCache.getEventCache().getNode().hasChild(childKey)) { // No complete child available, delete the existing one, if any newEventCache = this.filter_.updateChild( oldEventCache, diff --git a/packages/database/src/realtime/BrowserPollConnection.ts b/packages/database/src/realtime/BrowserPollConnection.ts index fba3e50c971..b39e2fb500b 100644 --- a/packages/database/src/realtime/BrowserPollConnection.ts +++ b/packages/database/src/realtime/BrowserPollConnection.ts @@ -725,7 +725,7 @@ export class FirebaseIFrameScriptHolder { newScript.async = true; newScript.src = url; // eslint-disable-next-line @typescript-eslint/no-explicit-any - newScript.onload = (newScript as any).onreadystatechange = function() { + newScript.onload = (newScript as any).onreadystatechange = function () { // eslint-disable-next-line @typescript-eslint/no-explicit-any const rstate = (newScript as any).readyState; if (!rstate || rstate === 'loaded' || rstate === 'complete') { diff --git a/packages/database/test/datasnapshot.test.ts b/packages/database/test/datasnapshot.test.ts index 1e64dead7f5..e19602dbb41 100644 --- a/packages/database/test/datasnapshot.test.ts +++ b/packages/database/test/datasnapshot.test.ts @@ -24,7 +24,7 @@ import { Reference } from '../src/api/Reference'; describe('DataSnapshot Tests', () => { /** @return {!DataSnapshot} */ - const snapshotForJSON = function(json) { + const snapshotForJSON = function (json) { const dummyRef = getRandomNode() as Reference; return new DataSnapshot(nodeFromJSON(json), dummyRef, PRIORITY_INDEX); }; @@ -83,21 +83,11 @@ describe('DataSnapshot Tests', () => { const snap = snapshotForJSON({ x: 5, y: { yy: 3, yz: 4 } }); expect(snap.child('x').val()).to.equal(5); expect(snap.child('y').val()).to.deep.equal({ yy: 3, yz: 4 }); - expect( - snap - .child('y') - .child('yy') - .val() - ).to.equal(3); + expect(snap.child('y').child('yy').val()).to.equal(3); expect(snap.child('y/yz').val()).to.equal(4); expect(snap.child('z').val()).to.equal(null); expect(snap.child('x/y').val()).to.equal(null); - expect( - snap - .child('x') - .child('y') - .val() - ).to.equal(null); + expect(snap.child('x').child('y').val()).to.equal(null); }); it('DataSnapshot.hasChild() works.', () => { diff --git a/packages/database/test/helpers/events.ts b/packages/database/test/helpers/events.ts index ae8f82d1b63..c92b563175b 100644 --- a/packages/database/test/helpers/events.ts +++ b/packages/database/test/helpers/events.ts @@ -67,8 +67,8 @@ export function eventTestHelper(pathAndEvents, helperName?) { // Listen on all of the required paths, with a callback function that just // appends to actualPathAndEvents. - const makeEventCallback = function(type) { - return function(snap) { + const makeEventCallback = function (type) { + return function (snap) { // Get the ref of where the snapshot came from. const ref = type === 'value' ? snap.ref : snap.ref.parent; @@ -99,8 +99,8 @@ export function eventTestHelper(pathAndEvents, helperName?) { // in the correct order. If anything is wrong (too many events or // incorrect events, we throw). Else we return false, indicating we should // keep waiting. - const waiter = function() { - const pathAndEventToString = function(pathAndEvent) { + const waiter = function () { + const pathAndEventToString = function (pathAndEvent) { return ( '{path: ' + pathAndEvent[0] + @@ -122,22 +122,26 @@ export function eventTestHelper(pathAndEvents, helperName?) { expected[1][0] !== actual[1][0] || expected[1][1] !== actual[1][1] ) { - throw helperName + + throw ( + helperName + 'Event ' + i + ' incorrect. Expected: ' + pathAndEventToString(expected) + ' Actual: ' + - pathAndEventToString(actual); + pathAndEventToString(actual) + ); } i++; } if (expectedPathAndEvents.length < actualPathAndEvents.length) { - throw helperName + + throw ( + helperName + "Extra event detected '" + pathAndEventToString(actualPathAndEvents[i]) + - "'."; + "'." + ); } // If we haven't thrown and both arrays are the same length, then we're @@ -145,7 +149,7 @@ export function eventTestHelper(pathAndEvents, helperName?) { return expectedPathAndEvents.length === actualPathAndEvents.length; }; - const listenOnPath = function(path) { + const listenOnPath = function (path) { const valueCB = makeEventCallback('value'); const addedCB = makeEventCallback('child_added'); const removedCB = makeEventCallback('child_removed'); @@ -156,7 +160,7 @@ export function eventTestHelper(pathAndEvents, helperName?) { path.on('child_moved', movedCB); path.on('child_changed', changedCB); path.on('value', valueCB); - return function() { + return function () { path.off('child_removed', removedCB); path.off('child_added', addedCB); path.off('child_moved', movedCB); @@ -165,7 +169,7 @@ export function eventTestHelper(pathAndEvents, helperName?) { }; }; - const addExpectedEvents = function(pathAndEvents) { + const addExpectedEvents = function (pathAndEvents) { const pathsToListenOn = []; for (let i = 0; i < pathAndEvents.length; i++) { const pathAndEvent = pathAndEvents[i]; @@ -216,7 +220,7 @@ export function eventTestHelper(pathAndEvents, helperName?) { addExpectedEvents(pathAndEvents); - const watchesInitializedWaiter = function() { + const watchesInitializedWaiter = function () { for (const path in pathEventListeners) { if (!pathEventListeners[path].initialized) { return false; @@ -234,7 +238,7 @@ export function eventTestHelper(pathAndEvents, helperName?) { return true; }; - const unregister = function() { + const unregister = function () { for (const path in pathEventListeners) { if (pathEventListeners.hasOwnProperty(path)) { pathEventListeners[path].unlisten(); diff --git a/packages/database/test/helpers/util.ts b/packages/database/test/helpers/util.ts index d6ade20e920..6bb47dac547 100644 --- a/packages/database/test/helpers/util.ts +++ b/packages/database/test/helpers/util.ts @@ -161,7 +161,7 @@ export function getFreshRepoFromReference(ref) { // Little helpers to get the currently cached snapshot / value. export function getSnap(path) { let snap; - const callback = function(snapshot) { + const callback = function (snapshot) { snap = snapshot; }; path.once('value', callback); diff --git a/packages/database/test/info.test.ts b/packages/database/test/info.test.ts index 5a79676508a..2e2aba452c4 100644 --- a/packages/database/test/info.test.ts +++ b/packages/database/test/info.test.ts @@ -36,7 +36,7 @@ declare const waitsFor; declare const TEST_ALT_NAMESPACE; declare const TEST_NAMESPACE; -describe('.info Tests', function() { +describe('.info Tests', function () { this.timeout(3000); it('Can get a reference to .info nodes.', () => { const f = getRootNode() as Reference; @@ -146,7 +146,7 @@ describe('.info Tests', function() { // Wait until we're connected to both Firebases runs(() => { ready = 0; - const eventHandler = function(snap) { + const eventHandler = function (snap) { if (snap.val() === true) { snap.ref.off(); ready += 1; @@ -167,7 +167,7 @@ describe('.info Tests', function() { // Ensure we're disconnected from both Firebases runs(() => { ready = 0; - const eventHandler = function(snap) { + const eventHandler = function (snap) { expect(snap.val() === false); ready += 1; }; @@ -203,7 +203,7 @@ describe('.info Tests', function() { // Ensure we're connected to both Firebases runs(() => { ready = 0; - const eventHandler = function(snap) { + const eventHandler = function (snap) { if (snap.val() === true) { snap.ref.off(); ready += 1; diff --git a/packages/database/test/node.test.ts b/packages/database/test/node.test.ts index c63eb278bc1..9983246d8c4 100644 --- a/packages/database/test/node.test.ts +++ b/packages/database/test/node.test.ts @@ -277,12 +277,7 @@ describe('Node Tests', () => { expect((node.getImmediateChild('c') as LeafNode).getValue()).to.equal( false ); - expect( - node - .getImmediateChild('c') - .getPriority() - .val() - ).to.equal(null); + expect(node.getImmediateChild('c').getPriority().val()).to.equal(null); expect(node.getPriority().val()).to.equal(1000); }); diff --git a/packages/database/test/order_by.test.ts b/packages/database/test/order_by.test.ts index eaa02a4ddb9..da3a2da0da9 100644 --- a/packages/database/test/order_by.test.ts +++ b/packages/database/test/order_by.test.ts @@ -211,10 +211,7 @@ describe('.orderBy tests', () => { await ref.set(data); - const snap = await ref - .orderByKey() - .startAt('c') - .once('value'); + const snap = await ref.orderByKey().startAt('c').once('value'); let keys = []; snap.forEach(child => { @@ -305,10 +302,7 @@ describe('.orderBy tests', () => { const actual = []; - const orderedRef = reader - .orderByKey() - .startAt('b') - .limitToFirst(2); + const orderedRef = reader.orderByKey().startAt('b').limitToFirst(2); writer.set(initial, () => { orderedRef.on('value', snap => { snap.forEach(childSnap => { @@ -338,10 +332,7 @@ describe('.orderBy tests', () => { const addedOrder = []; const addedPrevNames = []; - const orderedRef = ref - .orderByValue() - .startAt(52, 'tony') - .endAt(59); + const orderedRef = ref.orderByValue().startAt(52, 'tony').endAt(59); orderedRef.on('value', snap => { snap.forEach(childSnap => { diff --git a/packages/database/test/path.test.ts b/packages/database/test/path.test.ts index fddb3d064cc..efa3b6eee46 100644 --- a/packages/database/test/path.test.ts +++ b/packages/database/test/path.test.ts @@ -19,7 +19,7 @@ import { expect } from 'chai'; import { Path } from '../src/core/util/Path'; describe('Path Tests', () => { - const expectGreater = function(left, right) { + const expectGreater = function (left, right) { expect( Path.comparePaths(new Path(left), new Path(right)) ).to.be.greaterThan(0); @@ -28,7 +28,7 @@ describe('Path Tests', () => { ); }; - const expectEqual = function(left, right) { + const expectEqual = function (left, right) { expect(Path.comparePaths(new Path(left), new Path(right))).to.equal(0); }; @@ -65,51 +65,24 @@ describe('Path Tests', () => { it('popFront() returns the parent', () => { expect(new Path('/a/b/c').popFront().toString()).to.equal('/b/c'); + expect(new Path('/a/b/c').popFront().popFront().toString()).to.equal('/c'); expect( - new Path('/a/b/c') - .popFront() - .popFront() - .toString() - ).to.equal('/c'); - expect( - new Path('/a/b/c') - .popFront() - .popFront() - .popFront() - .toString() + new Path('/a/b/c').popFront().popFront().popFront().toString() ).to.equal('/'); expect( - new Path('/a/b/c') - .popFront() - .popFront() - .popFront() - .popFront() - .toString() + new Path('/a/b/c').popFront().popFront().popFront().popFront().toString() ).to.equal('/'); }); it('parent() returns the parent', () => { expect(new Path('/a/b/c').parent().toString()).to.equal('/a/b'); - expect( - new Path('/a/b/c') - .parent() - .parent() - .toString() - ).to.equal('/a'); - expect( - new Path('/a/b/c') - .parent() - .parent() - .parent() - .toString() - ).to.equal('/'); - expect( - new Path('/a/b/c') - .parent() - .parent() - .parent() - .parent() - ).to.equal(null); + expect(new Path('/a/b/c').parent().parent().toString()).to.equal('/a'); + expect(new Path('/a/b/c').parent().parent().parent().toString()).to.equal( + '/' + ); + expect(new Path('/a/b/c').parent().parent().parent().parent()).to.equal( + null + ); }); it('comparePaths() works as expected', () => { diff --git a/packages/database/test/promise.test.ts b/packages/database/test/promise.test.ts index 8bd675005d4..7b429895058 100644 --- a/packages/database/test/promise.test.ts +++ b/packages/database/test/promise.test.ts @@ -183,10 +183,7 @@ describe.skip('Promise Tests', () => { .child('here today') .set('gone tomorrow') .then(() => { - const p = writer - .child('here today') - .onDisconnect() - .remove(); + const p = writer.child('here today').onDisconnect().remove(); expect(typeof p.then === 'function').to.equal(true); return p; }) diff --git a/packages/database/test/query.test.ts b/packages/database/test/query.test.ts index 8608ba8e6a2..ea778b623d1 100644 --- a/packages/database/test/query.test.ts +++ b/packages/database/test/query.test.ts @@ -30,14 +30,14 @@ type TaskList = Array<[Query, any]>; describe('Query Tests', () => { // Little helper class for testing event callbacks w/ contexts. - const EventReceiver = function() { + const EventReceiver = function () { this.gotValue = false; this.gotChildAdded = false; }; - EventReceiver.prototype.onValue = function() { + EventReceiver.prototype.onValue = function () { this.gotValue = true; }; - EventReceiver.prototype.onChildAdded = function() { + EventReceiver.prototype.onChildAdded = function () { this.gotChildAdded = true; }; @@ -295,7 +295,7 @@ describe('Query Tests', () => { it('Query.queryIdentifier works.', () => { const path = getRandomNode() as Reference; - const queryId = function(query) { + const queryId = function (query) { return query.queryIdentifier(query); }; @@ -447,7 +447,7 @@ describe('Query Tests', () => { const path = getRandomNode() as Reference; let eventFired = false; - const callback = function() { + const callback = function () { eventFired = true; }; path.limitToLast(5).on('value', callback); @@ -465,7 +465,7 @@ describe('Query Tests', () => { const path = getRandomNode() as Reference; let eventFired = false; - const callback = function() { + const callback = function () { eventFired = true; }; path.limitToLast(5).on('value', callback); @@ -483,10 +483,10 @@ describe('Query Tests', () => { const path = getRandomNode() as Reference; let eventFired = false; - const callback1 = function() { + const callback1 = function () { eventFired = true; }; - const callback2 = function() { + const callback2 = function () { eventFired = true; }; path.on('value', callback1); @@ -505,10 +505,10 @@ describe('Query Tests', () => { const path = getRandomNode() as Reference; let eventFired = false; - const callback1 = function() { + const callback1 = function () { eventFired = true; }; - const callback2 = function() { + const callback2 = function () { eventFired = true; }; path.on('value', callback1); @@ -1491,7 +1491,7 @@ describe('Query Tests', () => { it('Ensure on() returns callback function.', () => { const node = getRandomNode() as Reference; - const callback = function() {}; + const callback = function () {}; const ret = node.on('value', callback); expect(ret).to.equal(callback); }); @@ -1680,14 +1680,8 @@ describe('Query Tests', () => { node.limitToLast(1).off('value', rootLim1On); expect(dumpListens(node)).to.equal('/a:{"l":1,"vf":"r"},{"l":5,"vf":"r"}'); - node - .child('a') - .limitToLast(1) - .off('value', aLim1On); - node - .child('a') - .limitToLast(5) - .off('value', aLim5On); + node.child('a').limitToLast(1).off('value', aLim1On); + node.child('a').limitToLast(5).off('value', aLim5On); expect(dumpListens(node)).to.equal(''); }); @@ -1712,19 +1706,13 @@ describe('Query Tests', () => { expect(dumpListens(node)).to.equal(':default'); // remove in slightly random order. - node - .child('a') - .limitToLast(1) - .off('value', aLim1On); + node.child('a').limitToLast(1).off('value', aLim1On); expect(dumpListens(node)).to.equal(':default'); node.off('value', rootOn); expect(dumpListens(node)).to.equal('/b:{"l":1,"vf":"r"}'); - node - .child('b') - .limitToLast(1) - .off('value', bLim1On); + node.child('b').limitToLast(1).off('value', bLim1On); expect(dumpListens(node)).to.equal(''); }); @@ -1775,10 +1763,10 @@ describe('Query Tests', () => { it('.on() with a context works.', () => { const ref = getRandomNode() as Reference; - const ListenerDoohickey = function() { + const ListenerDoohickey = function () { this.snap = null; }; - ListenerDoohickey.prototype.onEvent = function(snap) { + ListenerDoohickey.prototype.onEvent = function (snap) { this.snap = snap; }; @@ -1798,10 +1786,10 @@ describe('Query Tests', () => { it('.once() with a context works.', () => { const ref = getRandomNode() as Reference; - const ListenerDoohickey = function() { + const ListenerDoohickey = function () { this.snap = null; }; - ListenerDoohickey.prototype.onEvent = function(snap) { + ListenerDoohickey.prototype.onEvent = function (snap) { this.snap = snap; }; diff --git a/packages/database/test/sortedmap.test.ts b/packages/database/test/sortedmap.test.ts index 68164eb1cb2..af5352b6dff 100644 --- a/packages/database/test/sortedmap.test.ts +++ b/packages/database/test/sortedmap.test.ts @@ -22,7 +22,7 @@ import { shuffle } from './helpers/util'; // Many of these were adapted from the mugs source code. // http://mads379.github.com/mugs/ describe('SortedMap Tests', () => { - const defaultCmp = function(a, b) { + const defaultCmp = function (a, b) { if (a === b) { return 0; } else if (a < b) { @@ -194,18 +194,12 @@ describe('SortedMap Tests', () => { expect(map.count()).to.equal(6); expect((map as any).root_.checkMaxDepth_()).to.equal(true); - const m2 = map - .insert(20, 20) - .insert(18, 18) - .insert(2, 2); + const m2 = map.insert(20, 20).insert(18, 18).insert(2, 2); expect(m2.count()).to.equal(9); expect((m2 as any).root_.checkMaxDepth_()).to.equal(true); - const m3 = m2 - .insert(71, 71) - .insert(42, 42) - .insert(88, 88); + const m3 = m2.insert(71, 71).insert(42, 42).insert(88, 88); expect(m3.count()).to.equal(12); expect((m3 as any).root_.checkMaxDepth_()).to.equal(true); @@ -305,7 +299,7 @@ describe('SortedMap Tests', () => { }); xit('Perf: Insertion and removal with various # of items.', () => { - const verifyTraversal = function(map, max) { + const verifyTraversal = function (map, max) { let next = 0; map.inorderTraversal((key, value) => { expect(key).to.equal(next); @@ -346,7 +340,7 @@ describe('SortedMap Tests', () => { }); xit('Perf: Comparison with {}: Insertion and removal with various # of items.', () => { - const verifyTraversal = function(tree, max) { + const verifyTraversal = function (tree, max) { const keys = []; for (const k of Object.keys(tree)) { keys.push(k); diff --git a/packages/database/test/transaction.test.ts b/packages/database/test/transaction.test.ts index 898a2522be0..52e7409dc39 100644 --- a/packages/database/test/transaction.test.ts +++ b/packages/database/test/transaction.test.ts @@ -860,7 +860,7 @@ describe('Transaction Tests', () => { ); // Meanwhile, do sets from the second connection. - const doSet = function() { + const doSet = function () { ref2.set(setsDone, () => { setsDone++; if (setsDone < SETS) { @@ -1282,7 +1282,7 @@ describe('Transaction Tests', () => { readSnaps = [], writeSnaps = []; - const evaluateCompletionCriteria = function() { + const evaluateCompletionCriteria = function () { if (readSnaps.length === 1 && writeSnaps.length === 2) { expect( Math.abs(new Date().getTime() - writeSnaps[0].val()) < 10000 diff --git a/packages/firebase/externs/firebase-app-externs.js b/packages/firebase/externs/firebase-app-externs.js index 613b487afb1..06c5db9841e 100644 --- a/packages/firebase/externs/firebase-app-externs.js +++ b/packages/firebase/externs/firebase-app-externs.js @@ -63,7 +63,7 @@ var firebase = {}; * * @return {!firebase.app.App} The initialized app. */ -firebase.initializeApp = function(options, name) {}; +firebase.initializeApp = function (options, name) {}; /** * Retrieves a Firebase {@link firebase.app.App app} instance. @@ -89,7 +89,7 @@ firebase.initializeApp = function(options, name) {}; * @return {!firebase.app.App} The app corresponding to the provided app name. * If no app name is provided, the default app is returned. */ -firebase.app = function(name) {}; +firebase.app = function (name) {}; /** * A (read-only) array of all initialized apps. @@ -112,7 +112,7 @@ firebase.SDK_VERSION; * * @interface */ -firebase.app.App = function() {}; +firebase.app.App = function () {}; /** * The (read-only) name for this app. @@ -162,7 +162,7 @@ firebase.app.App.prototype.options; * @return {!firebase.Promise} An empty promise fulfilled when the app has * been deleted. */ -firebase.app.App.prototype.delete = function() {}; +firebase.app.App.prototype.delete = function () {}; /** * A Thenable is the standard interface returned by a Promise. @@ -170,7 +170,7 @@ firebase.app.App.prototype.delete = function() {}; * @template T * @interface */ -firebase.Thenable = function() {}; +firebase.Thenable = function () {}; /** * Assign callback functions called when the Thenable value either @@ -181,7 +181,7 @@ firebase.Thenable = function() {}; * (with an error). * @return {!firebase.Thenable<*>} */ -firebase.Thenable.prototype.then = function(onResolve, onReject) {}; +firebase.Thenable.prototype.then = function (onResolve, onReject) {}; /** * Assign a callback when the Thenable rejects. @@ -190,7 +190,7 @@ firebase.Thenable.prototype.then = function(onResolve, onReject) {}; * (with an error). * @return {!firebase.Thenable<*>} */ -firebase.Thenable.prototype.catch = function(onReject) {}; +firebase.Thenable.prototype.catch = function (onReject) {}; /** * A Promise represents an eventual (asynchronous) value. A Promise should @@ -208,7 +208,7 @@ firebase.Thenable.prototype.catch = function(onReject) {}; * @param {function((function(T): void), * (function(!Error): void))} resolver */ -firebase.Promise = function(resolver) {}; +firebase.Promise = function (resolver) {}; /** * Assign callback functions called when the Promise either resolves, or is @@ -220,7 +220,7 @@ firebase.Promise = function(resolver) {}; * @return {!firebase.Promise<*>} * @override */ -firebase.Promise.prototype.then = function(onResolve, onReject) {}; +firebase.Promise.prototype.then = function (onResolve, onReject) {}; /** * Assign a callback when the Promise rejects. @@ -229,7 +229,7 @@ firebase.Promise.prototype.then = function(onResolve, onReject) {}; * (with an error). * @override */ -firebase.Promise.prototype.catch = function(onReject) {}; +firebase.Promise.prototype.catch = function (onReject) {}; /** * Return a resolved Promise. @@ -238,7 +238,7 @@ firebase.Promise.prototype.catch = function(onReject) {}; * @param {T=} value The value to be returned by the Promise. * @return {!firebase.Promise} */ -firebase.Promise.resolve = function(value) {}; +firebase.Promise.resolve = function (value) {}; /** * Return (an immediately) rejected Promise. @@ -246,7 +246,7 @@ firebase.Promise.resolve = function(value) {}; * @param {!Error} error The reason for the Promise being rejected. * @return {!firebase.Promise<*>} */ -firebase.Promise.reject = function(error) {}; +firebase.Promise.reject = function (error) {}; /** * Convert an array of Promises, to a single array of values. @@ -259,25 +259,25 @@ firebase.Promise.reject = function(error) {}; * @param {!Array>} values * @return {!firebase.Promise>} */ -firebase.Promise.all = function(values) {}; +firebase.Promise.all = function (values) {}; /** * @template V, E * @interface **/ -firebase.Observer = function() {}; +firebase.Observer = function () {}; /** * @param {?V} value */ -firebase.Observer.prototype.next = function(value) {}; +firebase.Observer.prototype.next = function (value) {}; /** * @param {!E} error */ -firebase.Observer.prototype.error = function(error) {}; +firebase.Observer.prototype.error = function (error) {}; -firebase.Observer.prototype.complete = function() {}; +firebase.Observer.prototype.complete = function () {}; /** @typedef {function(): void} */ firebase.CompleteFn; @@ -290,4 +290,4 @@ firebase.Unsubscribe; * @param {string} version * @param {?string} variant */ -firebase.registerVersion = function(name, version, variant) {}; +firebase.registerVersion = function (name, version, variant) {}; diff --git a/packages/firebase/externs/firebase-app-internal-externs.js b/packages/firebase/externs/firebase-app-internal-externs.js index c900b2d6b33..14a8c7265a6 100644 --- a/packages/firebase/externs/firebase-app-internal-externs.js +++ b/packages/firebase/externs/firebase-app-internal-externs.js @@ -22,12 +22,12 @@ /** * @param {!firebase.FirebaseComponent} */ -firebase.INTERNAL.registerComponent = function(component) {}; +firebase.INTERNAL.registerComponent = function (component) {}; /** @param {!Object} props */ -firebase.INTERNAL.extendNamespace = function(props) {}; +firebase.INTERNAL.extendNamespace = function (props) {}; -firebase.INTERNAL.resetNamespace = function() {}; +firebase.INTERNAL.resetNamespace = function () {}; /** @typedef {function(*): void} */ firebase.NextFn; @@ -47,16 +47,16 @@ firebase.Subscribe; * @param {(function (!firebase.Observer): void)=} onNoObservers * @return {!firebase.Subscribe} */ -firebase.INTERNAL.createSubscribe = function(executor, onNoObservers) {}; +firebase.INTERNAL.createSubscribe = function (executor, onNoObservers) {}; /** * @param {*} target * @param {*} source */ -firebase.INTERNAL.deepExtend = function(target, source) {}; +firebase.INTERNAL.deepExtend = function (target, source) {}; /** @param {string} name */ -firebase.INTERNAL.removeApp = function(name) {}; +firebase.INTERNAL.removeApp = function (name) {}; /** * @type {!Object} errors */ -firebase.INTERNAL.ErrorFactory = function(service, serviceName, errors) {}; +firebase.INTERNAL.ErrorFactory = function (service, serviceName, errors) {}; /** * @param {string} code * @param {Object=} data * @return {!firebase.FirebaseError} */ -firebase.INTERNAL.ErrorFactory.prototype.create = function(code, data) {}; +firebase.INTERNAL.ErrorFactory.prototype.create = function (code, data) {}; /** @interface */ -firebase.Service = function() {}; +firebase.Service = function () {}; /** @type {!firebase.app.App} */ firebase.Service.prototype.app; @@ -98,7 +98,7 @@ firebase.Service.prototype.app; firebase.Service.prototype.INTERNAL; /** @return {firebase.Promise} */ -firebase.Service.prototype.INTERNAL.delete = function() {}; +firebase.Service.prototype.INTERNAL.delete = function () {}; /** * @typedef {function(!firebase.app.App, @@ -108,7 +108,7 @@ firebase.Service.prototype.INTERNAL.delete = function() {}; firebase.ServiceFactory; /** @interface */ -firebase.ServiceNamespace = function() {}; +firebase.ServiceNamespace = function () {}; /** * Given an (optional) app, return the instance of the service @@ -117,7 +117,7 @@ firebase.ServiceNamespace = function() {}; * @param {firebase.app.App=} app * @return {!firebase.Service} */ -firebase.ServiceNamespace.prototype.app = function(app) {}; +firebase.ServiceNamespace.prototype.app = function (app) {}; /** * Firebase App.INTERNAL methods - default implementations in firebase-app, @@ -154,7 +154,7 @@ firebase.app.App.prototype.INTERNAL; * * @return {?string} */ -firebase.app.App.prototype.INTERNAL.getUid = function() {}; +firebase.app.App.prototype.INTERNAL.getUid = function () {}; /** * app.INTERNAL.getToken() @@ -162,14 +162,14 @@ firebase.app.App.prototype.INTERNAL.getUid = function() {}; * @param {boolean=} forceRefresh Whether to force sts token refresh. * @return {!Promise} */ -firebase.app.App.prototype.INTERNAL.getToken = function(forceRefresh) {}; +firebase.app.App.prototype.INTERNAL.getToken = function (forceRefresh) {}; /** * Adds an auth state listener. * * @param {!firebase.AuthTokenListener} listener The auth state listener. */ -firebase.app.App.prototype.INTERNAL.addAuthTokenListener = function( +firebase.app.App.prototype.INTERNAL.addAuthTokenListener = function ( listener ) {}; @@ -178,6 +178,6 @@ firebase.app.App.prototype.INTERNAL.addAuthTokenListener = function( * * @param {!firebase.AuthTokenListener} listener The auth state listener. */ -firebase.app.App.prototype.INTERNAL.removeAuthTokenListener = function( +firebase.app.App.prototype.INTERNAL.removeAuthTokenListener = function ( listener ) {}; diff --git a/packages/firebase/externs/firebase-auth-externs.js b/packages/firebase/externs/firebase-auth-externs.js index 1fbd401b53c..c588ea5e2b4 100644 --- a/packages/firebase/externs/firebase-auth-externs.js +++ b/packages/firebase/externs/firebase-auth-externs.js @@ -41,7 +41,7 @@ * * @return {!firebase.auth.Auth} */ -firebase.auth = function(app) {}; +firebase.auth = function (app) {}; /** * Interface that represents the credentials returned by an auth provider. @@ -50,7 +50,7 @@ firebase.auth = function(app) {}; * * @interface */ -firebase.auth.AuthCredential = function() {}; +firebase.auth.AuthCredential = function () {}; /** * The authentication provider ID for the credential. @@ -80,13 +80,13 @@ firebase.auth.AuthCredential.prototype.signInMethod; * AuthCredential. * @return {?firebase.auth.AuthCredential} The auth credential. */ -firebase.auth.AuthCredential.fromJSON = function(json) {}; +firebase.auth.AuthCredential.fromJSON = function (json) {}; /** * Returns a JSON-serializable representation of this object. * @return {!Object} The plain object representation of the `AuthCredential`. */ -firebase.auth.AuthCredential.prototype.toJSON = function() {}; +firebase.auth.AuthCredential.prototype.toJSON = function () {}; /** * Defines the options for initializing an @@ -95,7 +95,7 @@ firebase.auth.AuthCredential.prototype.toJSON = function() {}; * * @interface */ -firebase.auth.OAuthCredentialOptions = function() {}; +firebase.auth.OAuthCredentialOptions = function () {}; /** * The OAuth ID token used to initialize the OAuthCredential. @@ -128,7 +128,7 @@ firebase.auth.OAuthCredentialOptions.prototype.rawNonce; * @interface * @extends {firebase.auth.AuthCredential} */ -firebase.auth.OAuthCredential = function() {}; +firebase.auth.OAuthCredential = function () {}; /** * The OAuth ID token associated with the credential if it belongs to an @@ -160,7 +160,7 @@ firebase.auth.OAuthCredential.prototype.secret; * @interface * @extends {firebase.auth.AuthCredential} */ -firebase.auth.PhoneAuthCredential = function() {}; +firebase.auth.PhoneAuthCredential = function () {}; /** * Gets the {@link firebase.auth.Auth `Auth`} service for the current app. @@ -172,14 +172,14 @@ firebase.auth.PhoneAuthCredential = function() {}; * * @return {!firebase.auth.Auth} */ -firebase.app.App.prototype.auth = function() {}; +firebase.app.App.prototype.auth = function () {}; /** * Interface representing a user's metadata. * * @interface */ -firebase.auth.UserMetadata = function() {}; +firebase.auth.UserMetadata = function () {}; /** * The date the user last signed in, formatted as a UTC string. @@ -203,7 +203,7 @@ firebase.auth.UserMetadata.prototype.creationTime; * * @interface */ -firebase.UserInfo = function() {}; +firebase.UserInfo = function () {}; /** * The user's unique ID. @@ -253,7 +253,7 @@ firebase.UserInfo.prototype.phoneNumber; * @interface * @extends {firebase.UserInfo} */ -firebase.User = function() {}; +firebase.User = function () {}; /** * The phone number normalized based on the E.164 standard (e.g. +16505550101) @@ -331,14 +331,14 @@ firebase.User.prototype.tenantId; * expiration. * @return {!firebase.Promise} */ -firebase.User.prototype.getIdToken = function(forceRefresh) {}; +firebase.User.prototype.getIdToken = function (forceRefresh) {}; /** * Refreshes the current user, if signed in. * * @return {!firebase.Promise} */ -firebase.User.prototype.reload = function() {}; +firebase.User.prototype.reload = function () {}; /** * Sends a verification email to a user. @@ -398,7 +398,9 @@ firebase.User.prototype.reload = function() {}; * are configured in the same Firebase Auth project used. * @return {!firebase.Promise} */ -firebase.User.prototype.sendEmailVerification = function(actionCodeSettings) {}; +firebase.User.prototype.sendEmailVerification = function ( + actionCodeSettings +) {}; /** * Links the user account with the given credentials. @@ -461,7 +463,7 @@ firebase.User.prototype.sendEmailVerification = function(actionCodeSettings) {}; * @param {!firebase.auth.AuthCredential} credential The auth credential. * @return {!firebase.Promise} */ -firebase.User.prototype.linkWithCredential = function(credential) {}; +firebase.User.prototype.linkWithCredential = function (credential) {}; /** * Links the user account with the given credentials, and returns any available @@ -528,7 +530,7 @@ firebase.User.prototype.linkWithCredential = function(credential) {}; * @param {!firebase.auth.AuthCredential} credential The auth credential. * @return {!firebase.Promise} */ -firebase.User.prototype.linkAndRetrieveDataWithCredential = function( +firebase.User.prototype.linkAndRetrieveDataWithCredential = function ( credential ) {}; @@ -573,7 +575,7 @@ firebase.User.prototype.linkAndRetrieveDataWithCredential = function( * @param {!firebase.auth.ApplicationVerifier} applicationVerifier * @return {!firebase.Promise} */ -firebase.User.prototype.linkWithPhoneNumber = function( +firebase.User.prototype.linkWithPhoneNumber = function ( phoneNumber, applicationVerifier ) {}; @@ -591,7 +593,7 @@ firebase.User.prototype.linkWithPhoneNumber = function( * @param {string} providerId * @return {!firebase.Promise} */ -firebase.User.prototype.unlink = function(providerId) {}; +firebase.User.prototype.unlink = function (providerId) {}; /** * Re-authenticates a user using a fresh credential. Use before operations @@ -630,7 +632,7 @@ firebase.User.prototype.unlink = function(providerId) {}; * @param {!firebase.auth.AuthCredential} credential * @return {!firebase.Promise} */ -firebase.User.prototype.reauthenticateWithCredential = function(credential) {}; +firebase.User.prototype.reauthenticateWithCredential = function (credential) {}; /** * Re-authenticates a user using a fresh credential, and returns any available @@ -673,7 +675,7 @@ firebase.User.prototype.reauthenticateWithCredential = function(credential) {}; * @param {!firebase.auth.AuthCredential} credential * @return {!firebase.Promise} */ -firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential = function( +firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential = function ( credential ) {}; @@ -705,7 +707,7 @@ firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential = function( * @param {!firebase.auth.ApplicationVerifier} applicationVerifier * @return {!firebase.Promise} */ -firebase.User.prototype.reauthenticateWithPhoneNumber = function( +firebase.User.prototype.reauthenticateWithPhoneNumber = function ( phoneNumber, applicationVerifier ) {}; @@ -737,7 +739,7 @@ firebase.User.prototype.reauthenticateWithPhoneNumber = function( * @param {string} newEmail The new email address. * @return {!firebase.Promise} */ -firebase.User.prototype.updateEmail = function(newEmail) {}; +firebase.User.prototype.updateEmail = function (newEmail) {}; /** * Updates the user's password. @@ -760,7 +762,7 @@ firebase.User.prototype.updateEmail = function(newEmail) {}; * @param {string} newPassword * @return {!firebase.Promise} */ -firebase.User.prototype.updatePassword = function(newPassword) {}; +firebase.User.prototype.updatePassword = function (newPassword) {}; /** * Updates the user's phone number. @@ -776,7 +778,7 @@ firebase.User.prototype.updatePassword = function(newPassword) {}; * @param {!firebase.auth.AuthCredential} phoneCredential * @return {!firebase.Promise} */ -firebase.User.prototype.updatePhoneNumber = function(phoneCredential) {}; +firebase.User.prototype.updatePhoneNumber = function (phoneCredential) {}; /** * Updates a user's profile data. @@ -813,7 +815,7 @@ firebase.User.prototype.updatePhoneNumber = function(phoneCredential) {}; * displayName and photoURL to update. * @return {!firebase.Promise} */ -firebase.User.prototype.updateProfile = function(profile) {}; +firebase.User.prototype.updateProfile = function (profile) {}; /** * Sends a verification email to a new email address. The user's email will be @@ -878,7 +880,7 @@ firebase.User.prototype.updateProfile = function(profile) {}; * are configured in the same Firebase Auth project used. * @return {!firebase.Promise} */ -firebase.User.prototype.verifyBeforeUpdateEmail = function( +firebase.User.prototype.verifyBeforeUpdateEmail = function ( newEmail, actionCodeSettings ) {}; @@ -901,14 +903,14 @@ firebase.User.prototype.verifyBeforeUpdateEmail = function( * * @return {!firebase.Promise} */ -firebase.User.prototype.delete = function() {}; +firebase.User.prototype.delete = function () {}; /** * Returns a JSON-serializable representation of this object. * * @return {!Object} A JSON-serializable representation of this object. */ -firebase.User.prototype.toJSON = function() {}; +firebase.User.prototype.toJSON = function () {}; /** * The Firebase Auth service interface. @@ -922,7 +924,7 @@ firebase.User.prototype.toJSON = function() {}; * * @interface */ -firebase.auth.Auth = function() {}; +firebase.auth.Auth = function () {}; /** * Checks a password reset code sent to the user by email or other out-of-band @@ -949,14 +951,14 @@ firebase.auth.Auth = function() {}; * @param {string} code A verification code sent to the user. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.verifyPasswordResetCode = function(code) {}; +firebase.auth.Auth.prototype.verifyPasswordResetCode = function (code) {}; /** * A response from {@link firebase.auth.Auth#checkActionCode}. * * @interface */ -firebase.auth.ActionCodeInfo = function() {}; +firebase.auth.ActionCodeInfo = function () {}; /** * The data associated with the action code. @@ -1049,7 +1051,7 @@ firebase.auth.ActionCodeInfo.Operation = { * * @constructor */ -firebase.auth.ActionCodeURL = function() {}; +firebase.auth.ActionCodeURL = function () {}; /** * The API key of the email action link. @@ -1103,7 +1105,7 @@ firebase.auth.ActionCodeURL.prototype.tenantId; * @return {?firebase.auth.ActionCodeURL} The ActionCodeURL object, or null if * the link is invalid. */ -firebase.auth.ActionCodeURL.parseLink = function(link) {}; +firebase.auth.ActionCodeURL.parseLink = function (link) {}; /** * This is the interface that defines the required continue/state URL with @@ -1171,7 +1173,7 @@ firebase.auth.ActionCodeSettings; * @param {string} code A verification code sent to the user. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.checkActionCode = function(code) {}; +firebase.auth.Auth.prototype.checkActionCode = function (code) {}; /** * Applies a verification code sent to the user by email or other out-of-band @@ -1196,7 +1198,7 @@ firebase.auth.Auth.prototype.checkActionCode = function(code) {}; * @param {string} code A verification code sent to the user. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.applyActionCode = function(code) {}; +firebase.auth.Auth.prototype.applyActionCode = function (code) {}; /** * The {@link firebase.app.App app} associated with the `Auth` service @@ -1303,7 +1305,7 @@ firebase.auth.Auth.Persistence = { * persistence mechanism. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.setPersistence = function(persistence) {}; +firebase.auth.Auth.prototype.setPersistence = function (persistence) {}; /** * The current Auth instance's language code. This is a readable/writable @@ -1321,7 +1323,7 @@ firebase.auth.Auth.prototype.languageCode; /** * Sets the current language to the default device/browser preference. */ -firebase.auth.Auth.prototype.useDeviceLanguage = function() {}; +firebase.auth.Auth.prototype.useDeviceLanguage = function () {}; /** * The current Auth instance's settings. This is used to edit/read configuration @@ -1377,7 +1379,7 @@ firebase.auth.Auth.prototype.settings; * @param {string} password The user's chosen password. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.createUserWithEmailAndPassword = function( +firebase.auth.Auth.prototype.createUserWithEmailAndPassword = function ( email, password ) {}; @@ -1397,7 +1399,7 @@ firebase.auth.Auth.prototype.createUserWithEmailAndPassword = function( * @param {string} email An email address. * @return {!firebase.Promise>} */ -firebase.auth.Auth.prototype.fetchSignInMethodsForEmail = function(email) {}; +firebase.auth.Auth.prototype.fetchSignInMethodsForEmail = function (email) {}; /** * Checks if an incoming link is a sign-in with email link. @@ -1405,7 +1407,7 @@ firebase.auth.Auth.prototype.fetchSignInMethodsForEmail = function(email) {}; * @param {string} emailLink Sign-in email link. * @return {boolean} Whether the link is a sign-in with email link. */ -firebase.auth.Auth.prototype.isSignInWithEmailLink = function(emailLink) {}; +firebase.auth.Auth.prototype.isSignInWithEmailLink = function (emailLink) {}; /** * Adds an observer for changes to the user's sign-in state. @@ -1432,7 +1434,7 @@ firebase.auth.Auth.prototype.isSignInWithEmailLink = function(emailLink) {}; * observer is removed. * @return {!firebase.Unsubscribe} The unsubscribe function for the observer. */ -firebase.auth.Auth.prototype.onAuthStateChanged = function( +firebase.auth.Auth.prototype.onAuthStateChanged = function ( nextOrObserver, error, completed @@ -1458,7 +1460,7 @@ firebase.auth.Auth.prototype.onAuthStateChanged = function( * observer is removed. * @return {!firebase.Unsubscribe} The unsubscribe function for the observer. */ -firebase.auth.Auth.prototype.onIdTokenChanged = function( +firebase.auth.Auth.prototype.onIdTokenChanged = function ( nextOrObserver, error, completed @@ -1535,7 +1537,7 @@ firebase.auth.Auth.prototype.onIdTokenChanged = function( * are configured in the same Firebase Auth project used. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.sendSignInLinkToEmail = function( +firebase.auth.Auth.prototype.sendSignInLinkToEmail = function ( email, actionCodeSettings ) {}; @@ -1605,7 +1607,7 @@ firebase.auth.Auth.prototype.sendSignInLinkToEmail = function( * are configured in the same Firebase Auth project used. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.sendPasswordResetEmail = function( +firebase.auth.Auth.prototype.sendPasswordResetEmail = function ( email, actionCodeSettings ) {}; @@ -1636,7 +1638,7 @@ firebase.auth.Auth.prototype.sendPasswordResetEmail = function( * @param {string} newPassword The new password. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.confirmPasswordReset = function( +firebase.auth.Auth.prototype.confirmPasswordReset = function ( code, newPassword ) {}; @@ -1701,7 +1703,7 @@ firebase.auth.Auth.prototype.confirmPasswordReset = function( * @param {!firebase.auth.AuthCredential} credential The auth credential. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signInWithCredential = function(credential) {}; +firebase.auth.Auth.prototype.signInWithCredential = function (credential) {}; /** * Asynchronously signs in with the given credentials, and returns any available @@ -1756,7 +1758,7 @@ firebase.auth.Auth.prototype.signInWithCredential = function(credential) {}; * @param {!firebase.auth.AuthCredential} credential The auth credential. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential = function( +firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential = function ( credential ) {}; @@ -1792,7 +1794,7 @@ firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential = function( * @param {string} token The custom token to sign in with. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signInWithCustomToken = function(token) {}; +firebase.auth.Auth.prototype.signInWithCustomToken = function (token) {}; /** * Asynchronously signs in using an email and password. @@ -1837,7 +1839,7 @@ firebase.auth.Auth.prototype.signInWithCustomToken = function(token) {}; * @param {string} password The users password. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signInWithEmailAndPassword = function( +firebase.auth.Auth.prototype.signInWithEmailAndPassword = function ( email, password ) {}; @@ -1876,7 +1878,7 @@ firebase.auth.Auth.prototype.signInWithEmailAndPassword = function( * URL is used instead. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signInWithEmailLink = function( +firebase.auth.Auth.prototype.signInWithEmailLink = function ( email, emailLink ) {}; @@ -1931,7 +1933,7 @@ firebase.auth.Auth.prototype.signInWithEmailLink = function( * @param {!firebase.auth.ApplicationVerifier} applicationVerifier * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signInWithPhoneNumber = function( +firebase.auth.Auth.prototype.signInWithPhoneNumber = function ( phoneNumber, applicationVerifier ) {}; @@ -1940,7 +1942,7 @@ firebase.auth.Auth.prototype.signInWithPhoneNumber = function( * A result from a phone number sign-in, link, or reauthenticate call. * @interface */ -firebase.auth.ConfirmationResult = function() {}; +firebase.auth.ConfirmationResult = function () {}; /** * The phone number authentication operation's verification ID. This can be used @@ -1964,7 +1966,7 @@ firebase.auth.ConfirmationResult.prototype.verificationId; * @param {string} verificationCode * @return {!firebase.Promise} */ -firebase.auth.ConfirmationResult.prototype.confirm = function( +firebase.auth.ConfirmationResult.prototype.confirm = function ( verificationCode ) {}; @@ -1997,7 +1999,7 @@ firebase.auth.ConfirmationResult.prototype.confirm = function( * * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signInAnonymously = function() {}; +firebase.auth.Auth.prototype.signInAnonymously = function () {}; /** * Asynchronously sets the provided user as `currentUser` on the current Auth @@ -2028,7 +2030,7 @@ firebase.auth.Auth.prototype.signInAnonymously = function() {}; * @param {?firebase.User} user * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.updateCurrentUser = function(user) {}; +firebase.auth.Auth.prototype.updateCurrentUser = function (user) {}; /** * A structure containing a User, an AuthCredential, the operationType, and @@ -2069,7 +2071,7 @@ firebase.auth.AdditionalUserInfo; * * @interface */ -firebase.auth.IdTokenResult = function() {}; +firebase.auth.IdTokenResult = function () {}; /** * The Firebase Auth ID token JWT string. @@ -2130,7 +2132,7 @@ firebase.auth.IdTokenResult.prototype.claims; * * @interface */ -firebase.auth.AuthSettings = function() {}; +firebase.auth.AuthSettings = function () {}; /** * When set, this property disables app verification for the purpose of testing @@ -2155,7 +2157,7 @@ firebase.auth.AuthSettings.prototype.appVerificationDisabledForTesting; * * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signOut = function() {}; +firebase.auth.Auth.prototype.signOut = function () {}; /** * An authentication error. @@ -2218,7 +2220,7 @@ firebase.auth.Auth.prototype.signOut = function() {}; * * @interface */ -firebase.auth.Error = function() {}; +firebase.auth.Error = function () {}; /** * Unique error code. @@ -2281,7 +2283,7 @@ firebase.auth.Error.prototype.message; * @interface * @extends {firebase.auth.Error} */ -firebase.auth.AuthError = function() {}; +firebase.auth.AuthError = function () {}; /** * The {@link firebase.auth.AuthCredential} that can be used to resolve the @@ -2346,7 +2348,7 @@ firebase.auth.AuthError.prototype.tenantId; * @interface * @extends {firebase.auth.Error} */ -firebase.auth.MultiFactorError = function() {}; +firebase.auth.MultiFactorError = function () {}; /** * The multi-factor resolver to complete second factor sign-in. @@ -2364,7 +2366,7 @@ firebase.auth.MultiFactorError.prototype.resolver; * * @interface */ -firebase.auth.AuthProvider = function() {}; +firebase.auth.AuthProvider = function () {}; /** @type {string} */ firebase.auth.AuthProvider.prototype.providerId; @@ -2406,7 +2408,7 @@ firebase.auth.AuthProvider.prototype.providerId; * @constructor * @implements {firebase.auth.AuthProvider} */ -firebase.auth.OAuthProvider = function(providerId) {}; +firebase.auth.OAuthProvider = function (providerId) {}; /** * Creates a Firebase credential from a generic OAuth provider's access token or @@ -2429,7 +2431,7 @@ firebase.auth.OAuthProvider = function(providerId) {}; * @param {?string=} accessToken The OAuth access token. * @return {!firebase.auth.OAuthCredential} The auth provider credential. */ -firebase.auth.OAuthProvider.prototype.credential = function( +firebase.auth.OAuthProvider.prototype.credential = function ( optionsOrIdToken, accessToken ) {}; @@ -2441,7 +2443,7 @@ firebase.auth.OAuthProvider.prototype.providerId; * @param {string} scope Provider OAuth scope to add. * @return {!firebase.auth.OAuthProvider} The provider instance. */ -firebase.auth.OAuthProvider.prototype.addScope = function(scope) {}; +firebase.auth.OAuthProvider.prototype.addScope = function (scope) {}; /** * Sets the OAuth custom parameters to pass in an OAuth request for popup @@ -2453,7 +2455,7 @@ firebase.auth.OAuthProvider.prototype.addScope = function(scope) {}; * in the OAuth request. * @return {!firebase.auth.OAuthProvider} The provider instance. */ -firebase.auth.OAuthProvider.prototype.setCustomParameters = function( +firebase.auth.OAuthProvider.prototype.setCustomParameters = function ( customOAuthParameters ) {}; @@ -2490,7 +2492,7 @@ firebase.auth.OAuthProvider.prototype.setCustomParameters = function( * @constructor * @implements {firebase.auth.AuthProvider} */ -firebase.auth.FacebookAuthProvider = function() {}; +firebase.auth.FacebookAuthProvider = function () {}; /** @type {string} */ firebase.auth.FacebookAuthProvider.PROVIDER_ID; @@ -2513,7 +2515,7 @@ firebase.auth.FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD; * @param {string} token Facebook access token. * @return {!firebase.auth.OAuthCredential} The auth provider credential. */ -firebase.auth.FacebookAuthProvider.credential = function(token) {}; +firebase.auth.FacebookAuthProvider.credential = function (token) {}; /** @type {string} */ firebase.auth.FacebookAuthProvider.prototype.providerId; @@ -2522,7 +2524,7 @@ firebase.auth.FacebookAuthProvider.prototype.providerId; * @param {string} scope Facebook OAuth scope. * @return {!firebase.auth.AuthProvider} The provider instance itself. */ -firebase.auth.FacebookAuthProvider.prototype.addScope = function(scope) {}; +firebase.auth.FacebookAuthProvider.prototype.addScope = function (scope) {}; /** * Sets the OAuth custom parameters to pass in a Facebook OAuth request for @@ -2537,7 +2539,7 @@ firebase.auth.FacebookAuthProvider.prototype.addScope = function(scope) {}; * in the OAuth request. * @return {!firebase.auth.AuthProvider} The provider instance itself. */ -firebase.auth.FacebookAuthProvider.prototype.setCustomParameters = function( +firebase.auth.FacebookAuthProvider.prototype.setCustomParameters = function ( customOAuthParameters ) {}; @@ -2606,7 +2608,7 @@ firebase.auth.FacebookAuthProvider.prototype.setCustomParameters = function( * @constructor * @implements {firebase.auth.AuthProvider} */ -firebase.auth.GithubAuthProvider = function() {}; +firebase.auth.GithubAuthProvider = function () {}; /** @type {string} */ firebase.auth.GithubAuthProvider.PROVIDER_ID; @@ -2629,7 +2631,7 @@ firebase.auth.GithubAuthProvider.GITHUB_SIGN_IN_METHOD; * @param {string} token Github access token. * @return {!firebase.auth.OAuthCredential} The auth provider credential. */ -firebase.auth.GithubAuthProvider.credential = function(token) {}; +firebase.auth.GithubAuthProvider.credential = function (token) {}; /** @type {string} */ firebase.auth.GithubAuthProvider.prototype.providerId; @@ -2638,7 +2640,7 @@ firebase.auth.GithubAuthProvider.prototype.providerId; * @param {string} scope Github OAuth scope. * @return {!firebase.auth.AuthProvider} The provider instance itself. */ -firebase.auth.GithubAuthProvider.prototype.addScope = function(scope) {}; +firebase.auth.GithubAuthProvider.prototype.addScope = function (scope) {}; /** * Sets the OAuth custom parameters to pass in a GitHub OAuth request for popup @@ -2652,7 +2654,7 @@ firebase.auth.GithubAuthProvider.prototype.addScope = function(scope) {}; * in the OAuth request. * @return {!firebase.auth.AuthProvider} The provider instance itself. */ -firebase.auth.GithubAuthProvider.prototype.setCustomParameters = function( +firebase.auth.GithubAuthProvider.prototype.setCustomParameters = function ( customOAuthParameters ) {}; @@ -2692,7 +2694,7 @@ firebase.auth.GithubAuthProvider.prototype.setCustomParameters = function( * @constructor * @implements {firebase.auth.AuthProvider} */ -firebase.auth.GoogleAuthProvider = function() {}; +firebase.auth.GoogleAuthProvider = function () {}; /** @type {string} */ firebase.auth.GoogleAuthProvider.PROVIDER_ID; @@ -2719,7 +2721,10 @@ firebase.auth.GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD; * @param {?string=} accessToken Google access token. * @return {!firebase.auth.OAuthCredential} The auth provider credential. */ -firebase.auth.GoogleAuthProvider.credential = function(idToken, accessToken) {}; +firebase.auth.GoogleAuthProvider.credential = function ( + idToken, + accessToken +) {}; /** @type {string} */ firebase.auth.GoogleAuthProvider.prototype.providerId; @@ -2728,7 +2733,7 @@ firebase.auth.GoogleAuthProvider.prototype.providerId; * @param {string} scope Google OAuth scope. * @return {!firebase.auth.AuthProvider} The provider instance itself. */ -firebase.auth.GoogleAuthProvider.prototype.addScope = function(scope) {}; +firebase.auth.GoogleAuthProvider.prototype.addScope = function (scope) {}; /** * Sets the OAuth custom parameters to pass in a Google OAuth request for popup @@ -2744,7 +2749,7 @@ firebase.auth.GoogleAuthProvider.prototype.addScope = function(scope) {}; * in the OAuth request. * @return {!firebase.auth.AuthProvider} The provider instance itself. */ -firebase.auth.GoogleAuthProvider.prototype.setCustomParameters = function( +firebase.auth.GoogleAuthProvider.prototype.setCustomParameters = function ( customOAuthParameters ) {}; @@ -2782,7 +2787,7 @@ firebase.auth.GoogleAuthProvider.prototype.setCustomParameters = function( * @constructor * @implements {firebase.auth.AuthProvider} */ -firebase.auth.TwitterAuthProvider = function() {}; +firebase.auth.TwitterAuthProvider = function () {}; /** @type {string} */ firebase.auth.TwitterAuthProvider.PROVIDER_ID; @@ -2800,7 +2805,7 @@ firebase.auth.TwitterAuthProvider.TWITTER_SIGN_IN_METHOD; * @param {string} secret Twitter secret. * @return {!firebase.auth.OAuthCredential} The auth provider credential. */ -firebase.auth.TwitterAuthProvider.credential = function(token, secret) {}; +firebase.auth.TwitterAuthProvider.credential = function (token, secret) {}; /** @type {string} */ firebase.auth.TwitterAuthProvider.prototype.providerId; @@ -2815,7 +2820,7 @@ firebase.auth.TwitterAuthProvider.prototype.providerId; * in the OAuth request. * @return {!firebase.auth.AuthProvider} The provider instance itself. */ -firebase.auth.TwitterAuthProvider.prototype.setCustomParameters = function( +firebase.auth.TwitterAuthProvider.prototype.setCustomParameters = function ( customOAuthParameters ) {}; @@ -2828,7 +2833,7 @@ firebase.auth.TwitterAuthProvider.prototype.setCustomParameters = function( * @constructor * @implements {firebase.auth.AuthProvider} */ -firebase.auth.EmailAuthProvider = function() {}; +firebase.auth.EmailAuthProvider = function () {}; /** @type {string} */ firebase.auth.EmailAuthProvider.PROVIDER_ID; @@ -2860,7 +2865,7 @@ firebase.auth.EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD; * @param {string} password User account password. * @return {!firebase.auth.AuthCredential} The auth provider credential. */ -firebase.auth.EmailAuthProvider.credential = function(email, password) {}; +firebase.auth.EmailAuthProvider.credential = function (email, password) {}; /** * Initialize an `EmailAuthProvider` credential using an email and an email link @@ -2876,7 +2881,7 @@ firebase.auth.EmailAuthProvider.credential = function(email, password) {}; * @param {string} emailLink Sign-in email link. * @return {!firebase.auth.AuthCredential} The auth provider credential. */ -firebase.auth.EmailAuthProvider.credentialWithLink = function( +firebase.auth.EmailAuthProvider.credentialWithLink = function ( email, emailLink ) {}; @@ -2908,7 +2913,7 @@ firebase.auth.EmailAuthProvider.prototype.providerId; * sign-ins should occur. Uses the default Auth instance if unspecified. * @implements {firebase.auth.AuthProvider} */ -firebase.auth.PhoneAuthProvider = function(auth) {}; +firebase.auth.PhoneAuthProvider = function (auth) {}; /** @type {string} */ firebase.auth.PhoneAuthProvider.PROVIDER_ID; @@ -2940,7 +2945,7 @@ firebase.auth.PhoneAuthProvider.PHONE_SIGN_IN_METHOD; * mobile device. * @return {!firebase.auth.PhoneAuthCredential} The auth provider credential. */ -firebase.auth.PhoneAuthProvider.credential = function( +firebase.auth.PhoneAuthProvider.credential = function ( verificationId, verificationCode ) {}; @@ -2988,7 +2993,7 @@ firebase.auth.PhoneAuthProvider.prototype.providerId; * @param {!firebase.auth.ApplicationVerifier} applicationVerifier * @return {!firebase.Promise} A Promise for the verification ID. */ -firebase.auth.PhoneAuthProvider.prototype.verifyPhoneNumber = function( +firebase.auth.PhoneAuthProvider.prototype.verifyPhoneNumber = function ( phoneInfoOptions, applicationVerifier ) {}; @@ -2998,7 +3003,7 @@ firebase.auth.PhoneAuthProvider.prototype.verifyPhoneNumber = function( * only implementation is {@link firebase.auth.RecaptchaVerifier}. * @interface */ -firebase.auth.ApplicationVerifier = function() {}; +firebase.auth.ApplicationVerifier = function () {}; /** * Identifies the type of application verifier (e.g. "recaptcha"). @@ -3011,7 +3016,7 @@ firebase.auth.ApplicationVerifier.prototype.type; * @return {!firebase.Promise} A Promise for a token that can be used to * assert the validity of a request. */ -firebase.auth.ApplicationVerifier.prototype.verify = function() {}; +firebase.auth.ApplicationVerifier.prototype.verify = function () {}; /** * The interface for asserting ownership of a second factor. This is used to @@ -3020,7 +3025,7 @@ firebase.auth.ApplicationVerifier.prototype.verify = function() {}; * * @interface */ -firebase.auth.MultiFactorAssertion = function() {}; +firebase.auth.MultiFactorAssertion = function () {}; /** * The identifier of the second factor. @@ -3034,7 +3039,7 @@ firebase.auth.MultiFactorAssertion.prototype.factorId; * @interface * @extends {firebase.auth.MultiFactorAssertion} */ -firebase.auth.PhoneMultiFactorAssertion = function() {}; +firebase.auth.PhoneMultiFactorAssertion = function () {}; /** * The interface used to initialize a @@ -3042,7 +3047,7 @@ firebase.auth.PhoneMultiFactorAssertion = function() {}; * * @interface */ -firebase.auth.PhoneMultiFactorGenerator = function() {}; +firebase.auth.PhoneMultiFactorGenerator = function () {}; /** * The identifier of the phone second factor: `phone`. @@ -3058,7 +3063,7 @@ firebase.auth.PhoneMultiFactorGenerator.FACTOR_ID; * Auth credential. * @return {!firebase.auth.PhoneMultiFactorAssertion} */ -firebase.auth.PhoneMultiFactorGenerator.assertion = function( +firebase.auth.PhoneMultiFactorGenerator.assertion = function ( phoneAuthCredential ) {}; @@ -3067,7 +3072,7 @@ firebase.auth.PhoneMultiFactorGenerator.assertion = function( * * @interface */ -firebase.auth.MultiFactorInfo = function() {}; +firebase.auth.MultiFactorInfo = function () {}; /** * The multi-factor enrollment ID. @@ -3101,7 +3106,7 @@ firebase.auth.MultiFactorInfo.prototype.factorId; * @interface * @extends {firebase.auth.MultiFactorInfo} */ -firebase.auth.PhoneMultiFactorInfo = function() {}; +firebase.auth.PhoneMultiFactorInfo = function () {}; /** * The phone number associated with the current second factor. @@ -3210,7 +3215,7 @@ firebase.auth.PhoneInfoOptions; * ``` * @interface */ -firebase.auth.MultiFactorResolver = function() {}; +firebase.auth.MultiFactorResolver = function () {}; /** * The Auth instance used to sign in with the first factor. @@ -3264,7 +3269,7 @@ firebase.auth.MultiFactorResolver.prototype.hints; * @return {!firebase.Promise} The promise that * resolves with the user credential object. */ -firebase.auth.MultiFactorResolver.prototype.resolveSignIn = function( +firebase.auth.MultiFactorResolver.prototype.resolveSignIn = function ( assertion ) {}; @@ -3274,7 +3279,7 @@ firebase.auth.MultiFactorResolver.prototype.resolveSignIn = function( * * @interface */ -firebase.auth.MultiFactorSession = function() {}; +firebase.auth.MultiFactorSession = function () {}; /** * This is the interface that defines the multi-factor related properties and @@ -3282,7 +3287,7 @@ firebase.auth.MultiFactorSession = function() {}; * * @interface */ -firebase.User.MultiFactorUser = function() {}; +firebase.User.MultiFactorUser = function () {}; /** * Returns a list of the user's enrolled second factors. @@ -3364,7 +3369,7 @@ firebase.User.MultiFactorUser.prototype.enrolledFactors; * @param {?string=} displayName The display name of the second factor. * @return {!firebase.Promise} */ -firebase.User.MultiFactorUser.prototype.enroll = function( +firebase.User.MultiFactorUser.prototype.enroll = function ( assertion, displayName ) {}; @@ -3382,7 +3387,7 @@ firebase.User.MultiFactorUser.prototype.enroll = function( * @return {!firebase.Promise} The promise * that resolves with the {@link firebase.auth.MultiFactorSession}. */ -firebase.User.MultiFactorUser.prototype.getSession = function() {}; +firebase.User.MultiFactorUser.prototype.getSession = function () {}; /** * Unenrolls the specified second factor. To specify the factor to remove, pass @@ -3422,4 +3427,4 @@ firebase.User.MultiFactorUser.prototype.getSession = function() {}; * option to unenroll. * @return {!firebase.Promise} */ -firebase.User.MultiFactorUser.prototype.unenroll = function(option) {}; +firebase.User.MultiFactorUser.prototype.unenroll = function (option) {}; diff --git a/packages/firebase/externs/firebase-client-auth-externs.js b/packages/firebase/externs/firebase-client-auth-externs.js index 4897787eed0..7184a54322a 100644 --- a/packages/firebase/externs/firebase-client-auth-externs.js +++ b/packages/firebase/externs/firebase-client-auth-externs.js @@ -104,7 +104,7 @@ * firebase.auth.EmailAuthProvider} will throw an error. * @return {!firebase.Promise} */ -firebase.User.prototype.linkWithPopup = function(provider) {}; +firebase.User.prototype.linkWithPopup = function (provider) {}; /** * Links the authenticated provider to the user account using a full-page @@ -135,7 +135,7 @@ firebase.User.prototype.linkWithPopup = function(provider) {}; * firebase.auth.EmailAuthProvider} will throw an error. * @return {!firebase.Promise} */ -firebase.User.prototype.linkWithRedirect = function(provider) {}; +firebase.User.prototype.linkWithRedirect = function (provider) {}; /** * Authenticates a Firebase client using a popup-based OAuth authentication @@ -224,7 +224,7 @@ firebase.User.prototype.linkWithRedirect = function(provider) {}; * firebase.auth.EmailAuthProvider} will throw an error. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signInWithPopup = function(provider) {}; +firebase.auth.Auth.prototype.signInWithPopup = function (provider) {}; /** * Authenticates a Firebase client using a full-page redirect flow. To handle @@ -252,7 +252,7 @@ firebase.auth.Auth.prototype.signInWithPopup = function(provider) {}; * firebase.auth.EmailAuthProvider} will throw an error. * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.signInWithRedirect = function(provider) {}; +firebase.auth.Auth.prototype.signInWithRedirect = function (provider) {}; /** * Reauthenticates the current user with the specified provider using a pop-up @@ -315,7 +315,7 @@ firebase.auth.Auth.prototype.signInWithRedirect = function(provider) {}; * firebase.auth.EmailAuthProvider} will throw an error. * @return {!firebase.Promise} */ -firebase.User.prototype.reauthenticateWithPopup = function(provider) {}; +firebase.User.prototype.reauthenticateWithPopup = function (provider) {}; /** * Reauthenticates the current user with the specified OAuth provider using a @@ -344,7 +344,7 @@ firebase.User.prototype.reauthenticateWithPopup = function(provider) {}; * firebase.auth.EmailAuthProvider} will throw an error. * @return {!firebase.Promise} */ -firebase.User.prototype.reauthenticateWithRedirect = function(provider) {}; +firebase.User.prototype.reauthenticateWithRedirect = function (provider) {}; /** * Returns a UserCredential from the redirect-based sign-in flow. @@ -451,7 +451,7 @@ firebase.User.prototype.reauthenticateWithRedirect = function(provider) {}; * * @return {!firebase.Promise} */ -firebase.auth.Auth.prototype.getRedirectResult = function() {}; +firebase.auth.Auth.prototype.getRedirectResult = function () {}; /** * An {@link https://www.google.com/recaptcha/ reCAPTCHA}-based application @@ -473,7 +473,7 @@ firebase.auth.Auth.prototype.getRedirectResult = function() {}; * @constructor * @implements {firebase.auth.ApplicationVerifier} */ -firebase.auth.RecaptchaVerifier = function(container, parameters, app) {}; +firebase.auth.RecaptchaVerifier = function (container, parameters, app) {}; /** * The application verifier type. For a reCAPTCHA verifier, this is 'recaptcha'. @@ -484,18 +484,18 @@ firebase.auth.RecaptchaVerifier.prototype.type; /** * Clears the reCAPTCHA widget from the page and destroys the current instance. */ -firebase.auth.RecaptchaVerifier.prototype.clear = function() {}; +firebase.auth.RecaptchaVerifier.prototype.clear = function () {}; /** * Renders the reCAPTCHA widget on the page. * @return {!firebase.Promise} A Promise that resolves with the * reCAPTCHA widget ID. */ -firebase.auth.RecaptchaVerifier.prototype.render = function() {}; +firebase.auth.RecaptchaVerifier.prototype.render = function () {}; /** * Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA * token. * @return {!firebase.Promise} A Promise for the reCAPTCHA token. */ -firebase.auth.RecaptchaVerifier.prototype.verify = function() {}; +firebase.auth.RecaptchaVerifier.prototype.verify = function () {}; diff --git a/packages/firebase/externs/firebase-database-externs.js b/packages/firebase/externs/firebase-database-externs.js index 83248fe721f..a94806b6488 100644 --- a/packages/firebase/externs/firebase-database-externs.js +++ b/packages/firebase/externs/firebase-database-externs.js @@ -46,7 +46,7 @@ * @return {!firebase.database.Database} The default Database service if no app * is provided or the Database service associated with the provided app. */ -firebase.database = function(app) {}; +firebase.database = function (app) {}; /** * Gets the {@link firebase.database.Database `Database`} service for the @@ -59,7 +59,7 @@ firebase.database = function(app) {}; * * @return {!firebase.database.Database} */ -firebase.app.App.prototype.database = function() {}; +firebase.app.App.prototype.database = function () {}; /** * The Firebase Database service interface. @@ -75,7 +75,7 @@ firebase.app.App.prototype.database = function() {}; * * @interface */ -firebase.database.Database = function() {}; +firebase.database.Database = function () {}; /** * Logs debugging information to the console. @@ -104,7 +104,7 @@ firebase.database.Database = function() {}; * @param {boolean=} persistent Remembers the logging state between page * refreshes if `true`. */ -firebase.database.enableLogging = function(logger, persistent) {}; +firebase.database.enableLogging = function (logger, persistent) {}; /** * @namespace @@ -160,7 +160,7 @@ firebase.database.Database.prototype.app; * pointing to the provided path. Otherwise, a `Reference` pointing to the * root of the Database. */ -firebase.database.Database.prototype.ref = function(path) {}; +firebase.database.Database.prototype.ref = function (path) {}; /** * Returns a `Reference` representing the location in the Database @@ -185,7 +185,7 @@ firebase.database.Database.prototype.ref = function(path) {}; * @return {!firebase.database.Reference} A `Reference` pointing to the provided * Firebase URL. */ -firebase.database.Database.prototype.refFromURL = function(url) {}; +firebase.database.Database.prototype.refFromURL = function (url) {}; /** * Disconnects from the server (all Database operations will be completed @@ -209,7 +209,7 @@ firebase.database.Database.prototype.refFromURL = function(url) {}; * @example * firebase.database().goOffline(); */ -firebase.database.Database.prototype.goOffline = function() {}; +firebase.database.Database.prototype.goOffline = function () {}; /** * Reconnects to the server and synchronizes the offline Database state @@ -223,7 +223,7 @@ firebase.database.Database.prototype.goOffline = function() {}; * @example * firebase.database().goOnline(); */ -firebase.database.Database.prototype.goOnline = function() {}; +firebase.database.Database.prototype.goOnline = function () {}; /** * A `Reference` represents a specific location in your Database and can be used @@ -241,7 +241,7 @@ firebase.database.Database.prototype.goOnline = function() {}; * @interface * @extends {firebase.database.Query} */ -firebase.database.Reference = function() {}; +firebase.database.Reference = function () {}; /** * The last part of the `Reference`'s path. @@ -283,7 +283,7 @@ firebase.database.Reference.prototype.key; * location. * @return {!firebase.database.Reference} The specified child location. */ -firebase.database.Reference.prototype.child = function(path) {}; +firebase.database.Reference.prototype.child = function (path) {}; /** * The parent location of a `Reference`. @@ -380,7 +380,7 @@ firebase.database.Reference.prototype.path; * complete. * @return {!firebase.Promise} Resolves when write to server is complete. */ -firebase.database.Reference.prototype.set = function(value, onComplete) {}; +firebase.database.Reference.prototype.set = function (value, onComplete) {}; /** * Writes multiple values to the Database at once. @@ -426,7 +426,7 @@ firebase.database.Reference.prototype.set = function(value, onComplete) {}; * complete. * @return {!firebase.Promise} Resolves when update on server is complete. */ -firebase.database.Reference.prototype.update = function(values, onComplete) {}; +firebase.database.Reference.prototype.update = function (values, onComplete) {}; /** * Writes data the Database location. Like `set()` but also specifies the @@ -443,7 +443,7 @@ firebase.database.Reference.prototype.update = function(values, onComplete) {}; * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ -firebase.database.Reference.prototype.setWithPriority = function( +firebase.database.Reference.prototype.setWithPriority = function ( newVal, newPriority, onComplete @@ -474,7 +474,7 @@ firebase.database.Reference.prototype.setWithPriority = function( * complete. * @return {!firebase.Promise} Resolves when remove on server is complete. */ -firebase.database.Reference.prototype.remove = function(onComplete) {}; +firebase.database.Reference.prototype.remove = function (onComplete) {}; /** * Atomically modifies the data at this location. @@ -562,7 +562,7 @@ firebase.database.Reference.prototype.remove = function(onComplete) {}; * }>} Returns a Promise that can optionally be used instead of the onComplete * callback to handle success and failure. */ -firebase.database.Reference.prototype.transaction = function( +firebase.database.Reference.prototype.transaction = function ( transactionUpdate, onComplete, applyLocally @@ -581,7 +581,7 @@ firebase.database.Reference.prototype.transaction = function( * @param {function(?Error)} onComplete * @return {!firebase.Promise} */ -firebase.database.Reference.prototype.setPriority = function( +firebase.database.Reference.prototype.setPriority = function ( priority, onComplete ) {}; @@ -591,7 +591,7 @@ firebase.database.Reference.prototype.setPriority = function( * @extends {firebase.database.Reference} * @extends {firebase.Thenable} */ -firebase.database.ThenableReference = function() {}; +firebase.database.ThenableReference = function () {}; /** * Generates a new child location using a unique key and returns its @@ -637,7 +637,7 @@ firebase.database.ThenableReference = function() {}; * `Reference`; resolves when write is complete, but can be used immediately * as the `Reference` to the child location. */ -firebase.database.Reference.prototype.push = function(value, onComplete) {}; +firebase.database.Reference.prototype.push = function (value, onComplete) {}; /** * Returns an `OnDisconnect` object - see @@ -648,7 +648,7 @@ firebase.database.Reference.prototype.push = function(value, onComplete) {}; * * @return {!firebase.database.OnDisconnect} */ -firebase.database.Reference.prototype.onDisconnect = function() {}; +firebase.database.Reference.prototype.onDisconnect = function () {}; /** * A `Query` sorts and filters the data at a Database location so only a subset @@ -669,7 +669,7 @@ firebase.database.Reference.prototype.onDisconnect = function() {}; * * @interface */ -firebase.database.Query = function() {}; +firebase.database.Query = function () {}; /** * Returns a `Reference` to the `Query`'s location. @@ -713,7 +713,7 @@ firebase.database.Query.prototype.ref; * @return {boolean} Whether or not the current and provided queries are * equivalent. */ -firebase.database.Query.prototype.isEqual = function(other) {}; +firebase.database.Query.prototype.isEqual = function (other) {}; /** * Listens for data changes at a particular location. @@ -817,7 +817,7 @@ firebase.database.Query.prototype.isEqual = function(other) {}; * you want to pass an inline function to `on()` but store the callback * function for later passing to `off()`. */ -firebase.database.Query.prototype.on = function( +firebase.database.Query.prototype.on = function ( eventType, callback, cancelCallbackOrContext, @@ -862,7 +862,7 @@ firebase.database.Query.prototype.on = function( * callback function that was passed to `on()`. * @param {Object=} context The context that was passed to `on()`. */ -firebase.database.Query.prototype.off = function( +firebase.database.Query.prototype.off = function ( eventType, callback, context @@ -900,7 +900,7 @@ firebase.database.Query.prototype.off = function( * when calling your callback(s). * @return {!firebase.Promise<*>} */ -firebase.database.Query.prototype.once = function( +firebase.database.Query.prototype.once = function ( eventType, successCallback, failureCallbackOrContext, @@ -940,7 +940,7 @@ firebase.database.Query.prototype.once = function( * @param {number} limit The maximum number of nodes to include in this query. * @return {!firebase.database.Query} */ -firebase.database.Query.prototype.limitToFirst = function(limit) {}; +firebase.database.Query.prototype.limitToFirst = function (limit) {}; /** * Generates a new `Query` object limited to the last specific number of @@ -973,7 +973,7 @@ firebase.database.Query.prototype.limitToFirst = function(limit) {}; * @param {number} limit The maximum number of nodes to include in this query. * @return {!firebase.database.Query} */ -firebase.database.Query.prototype.limitToLast = function(limit) {}; +firebase.database.Query.prototype.limitToLast = function (limit) {}; /** * Generates a new `Query` object ordered by the specified child key. @@ -1001,7 +1001,7 @@ firebase.database.Query.prototype.limitToLast = function(limit) {}; * @param {string} path * @return {!firebase.database.Query} */ -firebase.database.Query.prototype.orderByChild = function(path) {}; +firebase.database.Query.prototype.orderByChild = function (path) {}; /** * Generates a new `Query` object ordered by key. @@ -1021,7 +1021,7 @@ firebase.database.Query.prototype.orderByChild = function(path) {}; * * @return {!firebase.database.Query} */ -firebase.database.Query.prototype.orderByKey = function() {}; +firebase.database.Query.prototype.orderByKey = function () {}; /** * Generates a new `Query` object ordered by priority. @@ -1034,7 +1034,7 @@ firebase.database.Query.prototype.orderByKey = function() {}; * * @return {!firebase.database.Query} */ -firebase.database.Query.prototype.orderByPriority = function() {}; +firebase.database.Query.prototype.orderByPriority = function () {}; /** * Generates a new `Query` object ordered by value. @@ -1057,7 +1057,7 @@ firebase.database.Query.prototype.orderByPriority = function() {}; * * @return {!firebase.database.Query} */ -firebase.database.Query.prototype.orderByValue = function() {}; +firebase.database.Query.prototype.orderByValue = function () {}; /** * Creates a `Query` with the specified starting point. @@ -1091,7 +1091,7 @@ firebase.database.Query.prototype.orderByValue = function() {}; * if ordering by child, value, or priority. * @return {!firebase.database.Query} */ -firebase.database.Query.prototype.startAt = function(value, key) {}; +firebase.database.Query.prototype.startAt = function (value, key) {}; /** * Creates a `Query` with the specified ending point. @@ -1126,7 +1126,7 @@ firebase.database.Query.prototype.startAt = function(value, key) {}; * child, value, or priority. * @return {!firebase.database.Query} */ -firebase.database.Query.prototype.endAt = function(value, key) {}; +firebase.database.Query.prototype.endAt = function (value, key) {}; /** * Creates a `Query` that includes children that match the specified value. @@ -1160,7 +1160,7 @@ firebase.database.Query.prototype.endAt = function(value, key) {}; * child, value, or priority. * @return {!firebase.database.Query} */ -firebase.database.Query.prototype.equalTo = function(value, key) {}; +firebase.database.Query.prototype.equalTo = function (value, key) {}; /** * Gets the absolute URL for this location. @@ -1189,14 +1189,14 @@ firebase.database.Query.prototype.equalTo = function(value, key) {}; * @return {string} The absolute URL for this location. * @override */ -firebase.database.Query.prototype.toString = function() {}; +firebase.database.Query.prototype.toString = function () {}; /** * Returns a JSON-serializable representation of this object. * * @return {!Object} A JSON-serializable representation of this object. */ -firebase.database.Query.prototype.toJSON = function() {}; +firebase.database.Query.prototype.toJSON = function () {}; /** * A `DataSnapshot` contains data from a Database location. @@ -1214,7 +1214,7 @@ firebase.database.Query.prototype.toJSON = function() {}; * * @interface */ -firebase.database.DataSnapshot = function() {}; +firebase.database.DataSnapshot = function () {}; /** * Extracts a JavaScript value from a `DataSnapshot`. @@ -1249,7 +1249,7 @@ firebase.database.DataSnapshot = function() {}; * @return {*} The DataSnapshot's contents as a JavaScript value (Object, * Array, string, number, boolean, or `null`). */ -firebase.database.DataSnapshot.prototype.val = function() {}; +firebase.database.DataSnapshot.prototype.val = function () {}; /** * Exports the entire contents of the DataSnapshot as a JavaScript object. @@ -1260,7 +1260,7 @@ firebase.database.DataSnapshot.prototype.val = function() {}; * @return {*} The DataSnapshot's contents as a JavaScript value (Object, * Array, string, number, boolean, or `null`). */ -firebase.database.DataSnapshot.prototype.exportVal = function() {}; +firebase.database.DataSnapshot.prototype.exportVal = function () {}; /** * Returns true if this `DataSnapshot` contains any data. It is slightly more @@ -1287,7 +1287,7 @@ firebase.database.DataSnapshot.prototype.exportVal = function() {}; * * @return {boolean} */ -firebase.database.DataSnapshot.prototype.exists = function() {}; +firebase.database.DataSnapshot.prototype.exists = function () {}; /** * Gets another `DataSnapshot` for the location at the specified relative path. @@ -1321,7 +1321,7 @@ firebase.database.DataSnapshot.prototype.exists = function() {}; * @param {string} path A relative path to the location of child data. * @return {!firebase.database.DataSnapshot} */ -firebase.database.DataSnapshot.prototype.child = function(path) {}; +firebase.database.DataSnapshot.prototype.child = function (path) {}; /** * Returns true if the specified child path has (non-null) data. @@ -1347,7 +1347,7 @@ firebase.database.DataSnapshot.prototype.child = function(path) {}; * @return {boolean} `true` if data exists at the specified child path; else * `false`. */ -firebase.database.DataSnapshot.prototype.hasChild = function(path) {}; +firebase.database.DataSnapshot.prototype.hasChild = function (path) {}; /** * Gets the priority value of the data in this `DataSnapshot`. @@ -1360,7 +1360,7 @@ firebase.database.DataSnapshot.prototype.hasChild = function(path) {}; * * @return {string|number|null} */ -firebase.database.DataSnapshot.prototype.getPriority = function() {}; +firebase.database.DataSnapshot.prototype.getPriority = function () {}; /** * Enumerates the top-level children in the `DataSnapshot`. @@ -1426,7 +1426,7 @@ firebase.database.DataSnapshot.prototype.getPriority = function() {}; * @return {boolean} true if enumeration was canceled due to your callback * returning true. */ -firebase.database.DataSnapshot.prototype.forEach = function(action) {}; +firebase.database.DataSnapshot.prototype.forEach = function (action) {}; /** * Returns whether or not the `DataSnapshot` has any non-`null` child @@ -1457,7 +1457,7 @@ firebase.database.DataSnapshot.prototype.forEach = function(action) {}; * * @return {boolean} true if this snapshot has any children; else false. */ -firebase.database.DataSnapshot.prototype.hasChildren = function() {}; +firebase.database.DataSnapshot.prototype.hasChildren = function () {}; /** * The key (last part of the path) of the location of this `DataSnapshot`. @@ -1517,7 +1517,7 @@ firebase.database.DataSnapshot.prototype.key; * * @return {number} */ -firebase.database.DataSnapshot.prototype.numChildren = function() {}; +firebase.database.DataSnapshot.prototype.numChildren = function () {}; /** * The `Reference` for the location that generated this `DataSnapshot`. @@ -1531,7 +1531,7 @@ firebase.database.DataSnapshot.prototype.ref; * * @return {?Object} A JSON-serializable representation of this object. */ -firebase.database.DataSnapshot.prototype.toJSON = function() {}; +firebase.database.DataSnapshot.prototype.toJSON = function () {}; /** * The `onDisconnect` class allows you to write or clear data when your client @@ -1556,7 +1556,7 @@ firebase.database.DataSnapshot.prototype.toJSON = function() {}; * * @interface */ -firebase.database.OnDisconnect = function() {}; +firebase.database.OnDisconnect = function () {}; /** * Cancels all previously queued `onDisconnect()` set or update events for this @@ -1579,7 +1579,7 @@ firebase.database.OnDisconnect = function() {}; * @return {!firebase.Promise} Resolves when synchronization to the server * is complete. */ -firebase.database.OnDisconnect.prototype.cancel = function(onComplete) {}; +firebase.database.OnDisconnect.prototype.cancel = function (onComplete) {}; /** * Ensures the data at this location is deleted when the client is disconnected @@ -1592,7 +1592,7 @@ firebase.database.OnDisconnect.prototype.cancel = function(onComplete) {}; * @return {!firebase.Promise} Resolves when synchronization to the server * is complete. */ -firebase.database.OnDisconnect.prototype.remove = function(onComplete) {}; +firebase.database.OnDisconnect.prototype.remove = function (onComplete) {}; /** * Ensures the data at this location is set to the specified value when the @@ -1623,7 +1623,7 @@ firebase.database.OnDisconnect.prototype.remove = function(onComplete) {}; * @return {!firebase.Promise} Resolves when synchronization to the * Database is complete. */ -firebase.database.OnDisconnect.prototype.set = function(value, onComplete) {}; +firebase.database.OnDisconnect.prototype.set = function (value, onComplete) {}; /** * Ensures the data at this location is set to the specified value and priority @@ -1635,7 +1635,7 @@ firebase.database.OnDisconnect.prototype.set = function(value, onComplete) {}; * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ -firebase.database.OnDisconnect.prototype.setWithPriority = function( +firebase.database.OnDisconnect.prototype.setWithPriority = function ( value, priority, onComplete @@ -1676,7 +1676,7 @@ firebase.database.OnDisconnect.prototype.setWithPriority = function( * @return {!firebase.Promise} Resolves when synchronization to the * Database is complete. */ -firebase.database.OnDisconnect.prototype.update = function( +firebase.database.OnDisconnect.prototype.update = function ( values, onComplete ) {}; diff --git a/packages/firebase/externs/firebase-database-internal-externs.js b/packages/firebase/externs/firebase-database-internal-externs.js index 3e7ccce34dc..54f274d53a9 100644 --- a/packages/firebase/externs/firebase-database-internal-externs.js +++ b/packages/firebase/externs/firebase-database-internal-externs.js @@ -21,7 +21,7 @@ */ /** @return {!firebase.Promise} */ -firebase.database.Database.prototype.INTERNAL.delete = function() {}; +firebase.database.Database.prototype.INTERNAL.delete = function () {}; /** @const {!Object} */ firebase.database.INTERNAL; diff --git a/packages/firebase/externs/firebase-externs.js b/packages/firebase/externs/firebase-externs.js index 30eef45a4f7..7540deb149c 100644 --- a/packages/firebase/externs/firebase-externs.js +++ b/packages/firebase/externs/firebase-externs.js @@ -20,12 +20,12 @@ var process; * @param {!string} a * @param {!string} b */ -var Buffer = function(a, b) {}; +var Buffer = function (a, b) {}; /** * @param {string=} encoding * @return {!string} */ -Buffer.prototype.toString = function(encoding) { +Buffer.prototype.toString = function (encoding) { return 'dummy'; }; @@ -52,4 +52,4 @@ module.exports = {}; * @param {string} moduleName * @return {*} */ -var require = function(moduleName) {}; +var require = function (moduleName) {}; diff --git a/packages/firebase/externs/firebase-firestore-externs.js b/packages/firebase/externs/firebase-firestore-externs.js index 12c7333dc54..3513c8e0450 100644 --- a/packages/firebase/externs/firebase-firestore-externs.js +++ b/packages/firebase/externs/firebase-firestore-externs.js @@ -25,7 +25,7 @@ * * @return {!firebase.firestore.Firestore} Firestore */ -firebase.firestore = function(app) {}; +firebase.firestore = function (app) {}; /** * The Cloud Firestore service interface. @@ -35,7 +35,7 @@ firebase.firestore = function(app) {}; * * @interface */ -firebase.firestore.Firestore = function() {}; +firebase.firestore.Firestore = function () {}; /** * Specifies custom configurations for your Cloud Firestore instance. @@ -43,7 +43,7 @@ firebase.firestore.Firestore = function() {}; * * @interface */ -firebase.firestore.Settings = function() {}; +firebase.firestore.Settings = function () {}; /** * Enables the use of `Timestamps` for timestamp fields in `DocumentSnapshots`. @@ -79,7 +79,7 @@ firebase.firestore.Settings.prototype.timestampsInSnapshots; *
  • silent to turn off logging.
  • * */ -firebase.firestore.Firestore.prototype.setLogLevel = function(logLevel) {}; +firebase.firestore.Firestore.prototype.setLogLevel = function (logLevel) {}; /** * Specifies custom settings to be used to configure the `Firestore` @@ -88,7 +88,7 @@ firebase.firestore.Firestore.prototype.setLogLevel = function(logLevel) {}; * @param {!firebase.firestore.Settings} settings * The settings for your Cloud Firestore instance. */ -firebase.firestore.Firestore.prototype.settings = function(settings) {}; +firebase.firestore.Firestore.prototype.settings = function (settings) {}; /** * Attempts to enable persistent storage, if possible. @@ -109,7 +109,7 @@ firebase.firestore.Firestore.prototype.settings = function(settings) {}; * @return {!Promise} A promise that represents * successfully enabling persistent storage. */ -firebase.firestore.Firestore.prototype.enablePersistence = function() {}; +firebase.firestore.Firestore.prototype.enablePersistence = function () {}; /** * Re-enables use of the network for this Firestore instance after a prior @@ -119,7 +119,7 @@ firebase.firestore.Firestore.prototype.enablePersistence = function() {}; * @return {!Promise} A promise that is resolved once the network has been * enabled. */ -firebase.firestore.Firestore.prototype.enableNetwork = function() {}; +firebase.firestore.Firestore.prototype.enableNetwork = function () {}; /** * Disables network usage for this instance. It can be re-enabled via @@ -131,7 +131,7 @@ firebase.firestore.Firestore.prototype.enableNetwork = function() {}; * @return {!Promise} A promise that is resolved once the network has been * disabled. */ -firebase.firestore.Firestore.prototype.disableNetwork = function() {}; +firebase.firestore.Firestore.prototype.disableNetwork = function () {}; /** * Gets a `CollectionReference` instance that refers to the collection at @@ -143,7 +143,9 @@ firebase.firestore.Firestore.prototype.disableNetwork = function() {}; * @return {!firebase.firestore.CollectionReference} * The `CollectionReference` instance. */ -firebase.firestore.Firestore.prototype.collection = function(collectionPath) {}; +firebase.firestore.Firestore.prototype.collection = function ( + collectionPath +) {}; /** * Gets a `DocumentReference` instance that refers to the document at the @@ -155,7 +157,7 @@ firebase.firestore.Firestore.prototype.collection = function(collectionPath) {}; * @return {!firebase.firestore.DocumentReference} * The `DocumentReference` instance. */ -firebase.firestore.Firestore.prototype.doc = function(documentPath) {}; +firebase.firestore.Firestore.prototype.doc = function (documentPath) {}; /** * Executes the given `updateFunction` and then attempts to commit the changes @@ -173,7 +175,7 @@ firebase.firestore.Firestore.prototype.doc = function(documentPath) {}; * transaction failed, a rejected promise with the corresponding failure * error will be returned. */ -firebase.firestore.Firestore.prototype.runTransaction = function( +firebase.firestore.Firestore.prototype.runTransaction = function ( updateFunction ) {}; @@ -184,7 +186,7 @@ firebase.firestore.Firestore.prototype.runTransaction = function( * @return {!firebase.firestore.WriteBatch} * A `WriteBatch` that can be used to atomically execute multiple writes. */ -firebase.firestore.Firestore.prototype.batch = function() {}; +firebase.firestore.Firestore.prototype.batch = function () {}; /** * The {@link firebase.app.App app} associated with this `Firestore` service @@ -205,7 +207,7 @@ firebase.firestore.Firestore.prototype.app; * @param {number} longitude * Longitude values are in the range of -180 to 180. */ -firebase.firestore.GeoPoint = function(latitude, longitude) {}; +firebase.firestore.GeoPoint = function (latitude, longitude) {}; /** * The latitude of this GeoPoint instance. @@ -229,13 +231,13 @@ firebase.firestore.GeoPoint.prototype.longitude; * * @return {boolean} 'true' if this `GeoPoint` is equal to the provided one. */ -firebase.firestore.GeoPoint.prototype.isEqual = function(other) {}; +firebase.firestore.GeoPoint.prototype.isEqual = function (other) {}; /** * An immutable object representing an array of bytes. * @interface */ -firebase.firestore.Blob = function() {}; +firebase.firestore.Blob = function () {}; /** * Returns 'true' if this `Blob` is equal to the provided one. @@ -245,7 +247,7 @@ firebase.firestore.Blob = function() {}; * * @return {boolean} 'true' if this `Blob` is equal to the provided one. */ -firebase.firestore.Blob.prototype.isEqual = function(other) {}; +firebase.firestore.Blob.prototype.isEqual = function (other) {}; /** * Creates a new Blob from the given Base64 string, converting it to bytes. @@ -256,7 +258,7 @@ firebase.firestore.Blob.prototype.isEqual = function(other) {}; * @return {!firebase.firestore.Blob} * The Blob created from the Base64 string. */ -firebase.firestore.Blob.fromBase64String = function(base64) {}; +firebase.firestore.Blob.fromBase64String = function (base64) {}; /** * Creates a new Blob from the given Uint8Array. @@ -267,7 +269,7 @@ firebase.firestore.Blob.fromBase64String = function(base64) {}; * @return {!firebase.firestore.Blob} * The Blob created from the Uint8Array. */ -firebase.firestore.Blob.fromUint8Array = function(array) {}; +firebase.firestore.Blob.fromUint8Array = function (array) {}; /** * Returns the bytes of a Blob as a Base64-encoded string. @@ -275,7 +277,7 @@ firebase.firestore.Blob.fromUint8Array = function(array) {}; * @return {string} * The Base64-encoded string created from the Blob object. */ -firebase.firestore.Blob.prototype.toBase64 = function() {}; +firebase.firestore.Blob.prototype.toBase64 = function () {}; /** * Returns the bytes of a Blob in a new Uint8Array. @@ -283,7 +285,7 @@ firebase.firestore.Blob.prototype.toBase64 = function() {}; * @return {!Uint8Array} * The Uint8Array created from the Blob object. */ -firebase.firestore.Blob.prototype.toUint8Array = function() {}; +firebase.firestore.Blob.prototype.toUint8Array = function () {}; /** * A reference to a transaction. @@ -293,7 +295,7 @@ firebase.firestore.Blob.prototype.toUint8Array = function() {}; * within the transaction context. See `Firestore.runTransaction()`. * @interface */ -firebase.firestore.Transaction = function() {}; +firebase.firestore.Transaction = function () {}; /** * Reads the document referenced by the provided `DocumentReference.` @@ -304,7 +306,7 @@ firebase.firestore.Transaction = function() {}; * @return {!Promise} * A promise of the read data in a `DocumentSnapshot`. */ -firebase.firestore.Transaction.prototype.get = function(documentRef) {}; +firebase.firestore.Transaction.prototype.get = function (documentRef) {}; /** * Writes to the document referred to by the provided `DocumentReference`. @@ -325,7 +327,7 @@ firebase.firestore.Transaction.prototype.get = function(documentRef) {}; * @return {!firebase.firestore.Transaction} * This `Transaction` instance. Used for chaining method calls. */ -firebase.firestore.Transaction.prototype.set = function( +firebase.firestore.Transaction.prototype.set = function ( documentRef, data, options @@ -349,7 +351,7 @@ firebase.firestore.Transaction.prototype.set = function( * @return {!firebase.firestore.Transaction} * This `Transaction` instance. Used for chaining method calls. */ -firebase.firestore.Transaction.prototype.update = function( +firebase.firestore.Transaction.prototype.update = function ( documentRef, var_args ) {}; @@ -363,7 +365,7 @@ firebase.firestore.Transaction.prototype.update = function( * @return {!firebase.firestore.Transaction} * This `Transaction` instance. Used for chaining method calls. */ -firebase.firestore.Transaction.prototype.delete = function(documentRef) {}; +firebase.firestore.Transaction.prototype.delete = function (documentRef) {}; /** * A write batch, used to perform multiple writes as a single atomic unit. @@ -377,7 +379,7 @@ firebase.firestore.Transaction.prototype.delete = function(documentRef) {}; * preferable when you don't need to condition your writes on read data. * @interface */ -firebase.firestore.WriteBatch = function() {}; +firebase.firestore.WriteBatch = function () {}; /** * Writes to the document referred to by the provided `DocumentReference`. @@ -398,7 +400,7 @@ firebase.firestore.WriteBatch = function() {}; * @return {!firebase.firestore.WriteBatch} * This `WriteBatch` instance. Used for chaining method calls. */ -firebase.firestore.WriteBatch.prototype.set = function( +firebase.firestore.WriteBatch.prototype.set = function ( documentRef, data, options @@ -422,7 +424,7 @@ firebase.firestore.WriteBatch.prototype.set = function( * @return {!firebase.firestore.WriteBatch} * This `WriteBatch` instance. Used for chaining method calls. */ -firebase.firestore.WriteBatch.prototype.update = function( +firebase.firestore.WriteBatch.prototype.update = function ( documentRef, var_args ) {}; @@ -436,7 +438,7 @@ firebase.firestore.WriteBatch.prototype.update = function( * @return {!firebase.firestore.WriteBatch} * This `WriteBatch` instance. Used for chaining method calls. */ -firebase.firestore.WriteBatch.prototype.delete = function(documentRef) {}; +firebase.firestore.WriteBatch.prototype.delete = function (documentRef) {}; /** * Commits all of the writes in this write batch as a single atomic unit. @@ -446,7 +448,7 @@ firebase.firestore.WriteBatch.prototype.delete = function(documentRef) {}; * successfully written to the backend as an atomic unit. Note that it won't * resolve while you're offline. */ -firebase.firestore.WriteBatch.prototype.commit = function() {}; +firebase.firestore.WriteBatch.prototype.commit = function () {}; /** * An options object that configures the behavior of `set()` calls in @@ -457,7 +459,7 @@ firebase.firestore.WriteBatch.prototype.commit = function() {}; * documents in their entirety by providing a `SetOptions` with `merge: true`. * @interface */ -firebase.firestore.SetOptions = function() {}; +firebase.firestore.SetOptions = function () {}; /** * Changes the behavior of a set() call to only replace the values specified @@ -483,7 +485,7 @@ firebase.firestore.SetOptions.prototype.mergeFields; * also be used to create a `CollectionReference` to a subcollection. * @interface */ -firebase.firestore.DocumentReference = function() {}; +firebase.firestore.DocumentReference = function () {}; /** * The document's identifier within its collection. @@ -514,7 +516,7 @@ firebase.firestore.DocumentReference.prototype.parent; * @return {!firebase.firestore.CollectionReference} * The `CollectionReference` instance. */ -firebase.firestore.DocumentReference.prototype.collection = function( +firebase.firestore.DocumentReference.prototype.collection = function ( collectionPath ) {}; @@ -535,7 +537,10 @@ firebase.firestore.DocumentReference.prototype.collection = function( * A promise that resolves once the data has been successfully written to the * backend. (Note that it won't resolve while you're offline). */ -firebase.firestore.DocumentReference.prototype.set = function(data, options) {}; +firebase.firestore.DocumentReference.prototype.set = function ( + data, + options +) {}; /** * Updates fields in the document referred to by this `DocumentReference`. @@ -553,7 +558,7 @@ firebase.firestore.DocumentReference.prototype.set = function(data, options) {}; * A promise that resolves once the data has been successfully written * to the backend (Note that it won't resolve while you're offline). */ -firebase.firestore.DocumentReference.prototype.update = function(var_args) {}; +firebase.firestore.DocumentReference.prototype.update = function (var_args) {}; /** * Deletes the document referred to by this `DocumentReference`. @@ -562,7 +567,7 @@ firebase.firestore.DocumentReference.prototype.update = function(var_args) {}; * A promise that resolves once the document has been successfully * deleted from the backend (Note that it won't resolve while you're offline). */ -firebase.firestore.DocumentReference.prototype.delete = function() {}; +firebase.firestore.DocumentReference.prototype.delete = function () {}; /** * Reads the document referred to by this `DocumentReference`. @@ -578,7 +583,7 @@ firebase.firestore.DocumentReference.prototype.delete = function() {}; * A promise that resolves with a `DocumentSnapshot` containing the current * document contents. */ -firebase.firestore.DocumentReference.prototype.get = function(options) {}; +firebase.firestore.DocumentReference.prototype.get = function (options) {}; /** * Attaches a listener for DocumentSnapshot events. You may either pass @@ -602,7 +607,7 @@ firebase.firestore.DocumentReference.prototype.get = function(options) {}; * @return {!function()} An unsubscribe function that can be called to cancel * the snapshot listener. */ -firebase.firestore.DocumentReference.prototype.onSnapshot = function( +firebase.firestore.DocumentReference.prototype.onSnapshot = function ( optionsOrObserverOrOnNext, observerOrOnNextOrOnError, onError @@ -614,7 +619,7 @@ firebase.firestore.DocumentReference.prototype.onSnapshot = function( * to their final value). * @interface */ -firebase.firestore.SnapshotOptions = function() {}; +firebase.firestore.SnapshotOptions = function () {}; /** * If set, controls the return value for server timestamps that have not yet @@ -638,7 +643,7 @@ firebase.firestore.SnapshotOptions.prototype.serverTimestamps; * Options that configure how data is retrieved for a `get()` request. * @interface */ -firebase.firestore.GetOptions = function() {}; +firebase.firestore.GetOptions = function () {}; /** * Describes whether a `get()` call in Firestore should return data from the @@ -668,7 +673,7 @@ firebase.firestore.GetOptions.prototype.source; * Metadata about a snapshot, describing the state of the snapshot. * @interface */ -firebase.firestore.SnapshotMetadata = function() {}; +firebase.firestore.SnapshotMetadata = function () {}; /** * True if the snapshot was created from cached data rather than guaranteed @@ -703,7 +708,7 @@ firebase.firestore.SnapshotMetadata.prototype.hasPendingWrites; * @return {boolean} * 'true' if this `SnapshotMetadata` is equal to the provided one. */ -firebase.firestore.SnapshotMetadata.prototype.isEqual = function(other) {}; +firebase.firestore.SnapshotMetadata.prototype.isEqual = function (other) {}; /** * A `DocumentSnapshot` contains data read from a document in your Cloud @@ -716,7 +721,7 @@ firebase.firestore.SnapshotMetadata.prototype.isEqual = function(other) {}; * * @constructor */ -firebase.firestore.DocumentSnapshot = function() {}; +firebase.firestore.DocumentSnapshot = function () {}; /** * Property of the `DocumentSnapshot` that signals whether or not the data @@ -771,7 +776,7 @@ firebase.firestore.DocumentData; * An object containing all fields in the specified document or 'undefined' * if the document doesn't exist. */ -firebase.firestore.DocumentSnapshot.prototype.data = function(options) {}; +firebase.firestore.DocumentSnapshot.prototype.data = function (options) {}; /** * Retrieves the field specified by `fieldPath`. Returns `undefined` if the @@ -793,7 +798,7 @@ firebase.firestore.DocumentSnapshot.prototype.data = function(options) {}; * The data at the specified field location or undefined if no such field * exists in the document. */ -firebase.firestore.DocumentSnapshot.prototype.get = function( +firebase.firestore.DocumentSnapshot.prototype.get = function ( fieldPath, options ) {}; @@ -807,7 +812,7 @@ firebase.firestore.DocumentSnapshot.prototype.get = function( * @return {boolean} * 'true' if this `DocumentSnapshot` is equal to the provided one. */ -firebase.firestore.DocumentSnapshot.prototype.isEqual = function(other) {}; +firebase.firestore.DocumentSnapshot.prototype.isEqual = function (other) {}; /** * A `QueryDocumentSnapshot` contains data read from a document in your @@ -823,7 +828,7 @@ firebase.firestore.DocumentSnapshot.prototype.isEqual = function(other) {}; * @constructor * @extends {firebase.firestore.DocumentSnapshot} */ -firebase.firestore.QueryDocumentSnapshot = function() {}; +firebase.firestore.QueryDocumentSnapshot = function () {}; /** * Retrieves all fields in the document as an Object. @@ -842,7 +847,7 @@ firebase.firestore.QueryDocumentSnapshot = function() {}; * @return {!firebase.firestore.DocumentData} * An object containing all fields in the specified document. */ -firebase.firestore.QueryDocumentSnapshot.prototype.data = function(options) {}; +firebase.firestore.QueryDocumentSnapshot.prototype.data = function (options) {}; /** * Options for use with `Query.onSnapshot() to control the behavior of the @@ -850,7 +855,7 @@ firebase.firestore.QueryDocumentSnapshot.prototype.data = function(options) {}; * @interface * */ -firebase.firestore.SnapshotListenOptions = function() {}; +firebase.firestore.SnapshotListenOptions = function () {}; /** * Raise an event even if only metadata of the query or document @@ -865,7 +870,7 @@ firebase.firestore.SnapshotListenOptions.prototype.includeMetadataChanges; * construct refined `Query` objects by adding filters and ordering. * @constructor */ -firebase.firestore.Query = function() {}; +firebase.firestore.Query = function () {}; /** * The `Firestore` for the Cloud Firestore database (useful for performing @@ -891,7 +896,11 @@ firebase.firestore.Query.prototype.firestore; * @return {!firebase.firestore.Query} * The created query. */ -firebase.firestore.Query.prototype.where = function(fieldPath, opStr, value) {}; +firebase.firestore.Query.prototype.where = function ( + fieldPath, + opStr, + value +) {}; /** * Creates a new query where the results are sorted by the @@ -907,7 +916,7 @@ firebase.firestore.Query.prototype.where = function(fieldPath, opStr, value) {}; * @return {!firebase.firestore.Query} * The created query. */ -firebase.firestore.Query.prototype.orderBy = function( +firebase.firestore.Query.prototype.orderBy = function ( fieldPath, directionStr ) {}; @@ -922,7 +931,7 @@ firebase.firestore.Query.prototype.orderBy = function( * @return {!firebase.firestore.Query} * The created query. */ -firebase.firestore.Query.prototype.limit = function(limit) {}; +firebase.firestore.Query.prototype.limit = function (limit) {}; /** * Creates a new query where the results start at the provided document @@ -937,7 +946,7 @@ firebase.firestore.Query.prototype.limit = function(limit) {}; * @return {!firebase.firestore.Query} * The created query. */ -firebase.firestore.Query.prototype.startAt = function(snapshotOrVarArgs) {}; +firebase.firestore.Query.prototype.startAt = function (snapshotOrVarArgs) {}; /** * Creates a new query where the results start after the provided document @@ -953,7 +962,7 @@ firebase.firestore.Query.prototype.startAt = function(snapshotOrVarArgs) {}; * @return {!firebase.firestore.Query} * The created query. */ -firebase.firestore.Query.prototype.startAfter = function(snapshotOrVarArgs) {}; +firebase.firestore.Query.prototype.startAfter = function (snapshotOrVarArgs) {}; /** * Creates a new query where the results end before the provided document @@ -969,7 +978,7 @@ firebase.firestore.Query.prototype.startAfter = function(snapshotOrVarArgs) {}; * @return {!firebase.firestore.Query} * The created query. */ -firebase.firestore.Query.prototype.endBefore = function(snapshotOrVarArgs) {}; +firebase.firestore.Query.prototype.endBefore = function (snapshotOrVarArgs) {}; /** * Creates a new query where the results end at the provided document @@ -984,7 +993,7 @@ firebase.firestore.Query.prototype.endBefore = function(snapshotOrVarArgs) {}; * @return {!firebase.firestore.Query} * The created query. */ -firebase.firestore.Query.prototype.endAt = function(snapshotOrVarArgs) {}; +firebase.firestore.Query.prototype.endAt = function (snapshotOrVarArgs) {}; /** * Executes the query and returns the results as a `QuerySnapshot`. @@ -995,7 +1004,7 @@ firebase.firestore.Query.prototype.endAt = function(snapshotOrVarArgs) {}; * @return {!firebase.firestore.QuerySnapshot} * A promise that will be resolved with the results of the query. */ -firebase.firestore.Query.prototype.get = function(options) {}; +firebase.firestore.Query.prototype.get = function (options) {}; /** * Attaches a listener for `QuerySnapshot` events. You may either pass @@ -1022,7 +1031,7 @@ firebase.firestore.Query.prototype.get = function(options) {}; * @return {!function()} An unsubscribe function that can be called to cancel * the snapshot listener. */ -firebase.firestore.Query.prototype.onSnapshot = function( +firebase.firestore.Query.prototype.onSnapshot = function ( optionsOrObserverOrOnNext, observerOrOnNextOrOnError, onError @@ -1036,7 +1045,7 @@ firebase.firestore.Query.prototype.onSnapshot = function( * properties. * @interface */ -firebase.firestore.QuerySnapshot = function() {}; +firebase.firestore.QuerySnapshot = function () {}; /** * The query you called `get` or `onSnapshot` on to get the `QuerySnapshot`. @@ -1059,7 +1068,7 @@ firebase.firestore.QuerySnapshot.prototype.metadata; * whether metadata-only changes (i.e. only `DocumentSnapshot.metadata` changed) * should be included. */ -firebase.firestore.QuerySnapshot.prototype.docChanges = function(options) {}; +firebase.firestore.QuerySnapshot.prototype.docChanges = function (options) {}; /** * An array of all the documents in the `QuerySnapshot`. @@ -1086,7 +1095,7 @@ firebase.firestore.QuerySnapshot.prototype.empty; * @param {*=} thisArg * The `this` binding for the callback. */ -firebase.firestore.QuerySnapshot.prototype.forEach = function( +firebase.firestore.QuerySnapshot.prototype.forEach = function ( callback, thisArg ) {}; @@ -1100,14 +1109,14 @@ firebase.firestore.QuerySnapshot.prototype.forEach = function( * @return {boolean} * 'true' if this `QuerySnapshot` is equal to the provided one. */ -firebase.firestore.QuerySnapshot.prototype.isEqual = function(other) {}; +firebase.firestore.QuerySnapshot.prototype.isEqual = function (other) {}; /** * A `DocumentChange` represents a change to a document matching a query. * It contains the document affected and the type of change that occurred. * @interface */ -firebase.firestore.DocumentChange = function() {}; +firebase.firestore.DocumentChange = function () {}; /** * The type of change that occurred. @@ -1147,7 +1156,7 @@ firebase.firestore.DocumentChange.prototype.newIndex; * @constructor * @extends {firebase.firestore.Query} */ -firebase.firestore.CollectionReference = function() {}; +firebase.firestore.CollectionReference = function () {}; /** * The collection's identifier. @@ -1174,7 +1183,7 @@ firebase.firestore.CollectionReference.prototype.parent; * * @return {!firebase.firestore.DocumentReference} */ -firebase.firestore.CollectionReference.prototype.doc = function( +firebase.firestore.CollectionReference.prototype.doc = function ( documentPath ) {}; @@ -1187,7 +1196,7 @@ firebase.firestore.CollectionReference.prototype.doc = function( * A Promise that resolves with a `DocumentReference` pointing to the newly * created document after it has been written to the backend. */ -firebase.firestore.CollectionReference.prototype.add = function(data) {}; +firebase.firestore.CollectionReference.prototype.add = function (data) {}; /** * Returns 'true' if this `CollectionReference` is equal to the provided one. @@ -1198,27 +1207,27 @@ firebase.firestore.CollectionReference.prototype.add = function(data) {}; * @return {boolean} * 'true' if this `CollectionReference` is equal to the provided one. */ -firebase.firestore.CollectionReference.prototype.isEqual = function(other) {}; +firebase.firestore.CollectionReference.prototype.isEqual = function (other) {}; /** * Sentinel values that can be used when writing document fields with `set()` * or `update()`. * @interface */ -firebase.firestore.FieldValue = function() {}; +firebase.firestore.FieldValue = function () {}; /** * Returns a sentinel used with `set()` or `update()` to include a * server-generated timestamp in the written data. * @return {!firebase.firestore.FieldValue} */ -firebase.firestore.FieldValue.serverTimestamp = function() {}; +firebase.firestore.FieldValue.serverTimestamp = function () {}; /** * Returns a sentinel for use with `update()` to mark a field for deletion. * @return {!firebase.firestore.FieldValue} */ -firebase.firestore.FieldValue.delete = function() {}; +firebase.firestore.FieldValue.delete = function () {}; /** * Returns 'true' if this `FieldValue` is equal to the provided one. @@ -1229,7 +1238,7 @@ firebase.firestore.FieldValue.delete = function() {}; * @return {boolean} * 'true' if this `FieldValue` is equal to the provided one. */ -firebase.firestore.FieldValue.prototype.isEqual = function(other) {}; +firebase.firestore.FieldValue.prototype.isEqual = function (other) {}; /** * A FieldPath refers to a field in a document. The path may consist of a @@ -1244,7 +1253,7 @@ firebase.firestore.FieldValue.prototype.isEqual = function(other) {}; * * @constructor */ -firebase.firestore.FieldPath = function(var_args) {}; +firebase.firestore.FieldPath = function (var_args) {}; /** * Returns a special sentinel `FieldPath` to refer to the ID of a document. @@ -1252,7 +1261,7 @@ firebase.firestore.FieldPath = function(var_args) {}; * * @return {!firebase.firestore.FieldPath} */ -firebase.firestore.FieldPath.documentId = function() {}; +firebase.firestore.FieldPath.documentId = function () {}; /** * Returns 'true' if this `FieldPath` is equal to the provided one. @@ -1263,7 +1272,7 @@ firebase.firestore.FieldPath.documentId = function() {}; * @return {boolean} * 'true' if this `FieldPath` is equal to the provided one. */ -firebase.firestore.FieldPath.prototype.isEqual = function(other) {}; +firebase.firestore.FieldPath.prototype.isEqual = function (other) {}; /** * The set of Cloud Firestore status codes. These status codes are also exposed @@ -1304,7 +1313,7 @@ firebase.firestore.FieldPath.prototype.isEqual = function(other) {}; * credentials for the operation. * @interface */ -firebase.firestore.FirestoreError = function() {}; +firebase.firestore.FirestoreError = function () {}; /** * A Timestamp represents a point in time independent of any time zone or @@ -1329,14 +1338,14 @@ firebase.firestore.FirestoreError = function() {}; * * @constructor */ -firebase.firestore.Timestamp = function(seconds, nanoseconds) {}; +firebase.firestore.Timestamp = function (seconds, nanoseconds) {}; /** * Get the current time as a Timestamp object. * * @return {!firebase.firestore.Timestamp} a new Timestamp. */ -firebase.firestore.Timestamp.now = function() {}; +firebase.firestore.Timestamp.now = function () {}; /** * Creates a new timestamp from the given date. @@ -1345,7 +1354,7 @@ firebase.firestore.Timestamp.now = function() {}; * @return {!firebase.firestore.Timestamp} A new `Timestamp` representing * the same point in time as the given date. */ -firebase.firestore.Timestamp.fromDate = function(date) {}; +firebase.firestore.Timestamp.fromDate = function (date) {}; /** * Creates a new timestamp from the given number of milliseconds. @@ -1355,7 +1364,7 @@ firebase.firestore.Timestamp.fromDate = function(date) {}; * @return {!firebase.firestore.Timestamp} A new `Timestamp` representing the * same point in time as the given number of milliseconds. */ -firebase.firestore.Timestamp.fromMillis = function(milliseconds) {}; +firebase.firestore.Timestamp.fromMillis = function (milliseconds) {}; /** * Convert a Timestamp to a JavaScript `Date` object. This conversion causes @@ -1363,7 +1372,7 @@ firebase.firestore.Timestamp.fromMillis = function(milliseconds) {}; * * @return {!Date} a JavaScript date object. */ -firebase.firestore.Timestamp.prototype.toDate = function() {}; +firebase.firestore.Timestamp.prototype.toDate = function () {}; /** * Convert a timestamp to a numeric timestamp (in milliseconds since epoch). @@ -1371,4 +1380,4 @@ firebase.firestore.Timestamp.prototype.toDate = function() {}; * * @return {!number} a numeric timestamp. */ -firebase.firestore.Timestamp.prototype.toMillis = function() {}; +firebase.firestore.Timestamp.prototype.toMillis = function () {}; diff --git a/packages/firebase/externs/firebase-messaging-externs.js b/packages/firebase/externs/firebase-messaging-externs.js index 216140d9596..1b81cde477a 100644 --- a/packages/firebase/externs/firebase-messaging-externs.js +++ b/packages/firebase/externs/firebase-messaging-externs.js @@ -47,7 +47,7 @@ * * @return {!firebase.messaging.Messaging} */ -firebase.messaging = function(app) {}; +firebase.messaging = function (app) {}; /** * Gets the {@link firebase.messaging.Messaging `Messaging`} service for the @@ -60,7 +60,7 @@ firebase.messaging = function(app) {}; * * @return {!firebase.messaging.Messaging} */ -firebase.app.App.prototype.messaging = function() {}; +firebase.app.App.prototype.messaging = function () {}; /** * The Firebase Messaging service interface. @@ -76,7 +76,7 @@ firebase.app.App.prototype.messaging = function() {}; * * @interface */ -firebase.messaging.Messaging = function() {}; +firebase.messaging.Messaging = function () {}; /** * Notification permissions are required to send a user push messages. @@ -86,7 +86,7 @@ firebase.messaging.Messaging = function() {}; * @return {firebase.Promise} The promise resolves if permission is * granted. Otherwise, the promise is rejected with an error. */ -firebase.messaging.Messaging.prototype.requestPermission = function() {}; +firebase.messaging.Messaging.prototype.requestPermission = function () {}; /** * After calling `requestPermission()` you can call this method to get an FCM @@ -96,7 +96,7 @@ firebase.messaging.Messaging.prototype.requestPermission = function() {}; * be retrieved. This method returns null if the current origin does not have * permission to show notifications. */ -firebase.messaging.Messaging.prototype.getToken = function() {}; +firebase.messaging.Messaging.prototype.getToken = function () {}; /** * You should listen for token refreshes so your web app knows when FCM @@ -109,7 +109,7 @@ firebase.messaging.Messaging.prototype.getToken = function() {}; * @return {firebase.Unsubscribe} To stop listening for token * refresh events execute this returned function. */ -firebase.messaging.Messaging.prototype.onTokenRefresh = function( +firebase.messaging.Messaging.prototype.onTokenRefresh = function ( nextOrObserver ) {}; @@ -127,7 +127,7 @@ firebase.messaging.Messaging.prototype.onTokenRefresh = function( * @return {firebase.Unsubscribe} To stop listening for messages * execute this returned function. */ -firebase.messaging.Messaging.prototype.onMessage = function(nextOrObserver) {}; +firebase.messaging.Messaging.prototype.onMessage = function (nextOrObserver) {}; /** * To forceably stop a registration token from being used, delete it @@ -137,7 +137,7 @@ firebase.messaging.Messaging.prototype.onMessage = function(nextOrObserver) {}; * @return {firebase.Promise} The promise resolves when the token has been * successfully deleted. */ -firebase.messaging.Messaging.prototype.deleteToken = function(token) {}; +firebase.messaging.Messaging.prototype.deleteToken = function (token) {}; /** * To use your own service worker for receiving push messages, you @@ -146,7 +146,7 @@ firebase.messaging.Messaging.prototype.deleteToken = function(token) {}; * @param {!ServiceWorkerRegistration} registration The service worker * registration you wish to use for push messaging. */ -firebase.messaging.Messaging.prototype.useServiceWorker = function( +firebase.messaging.Messaging.prototype.useServiceWorker = function ( registration ) {}; @@ -160,6 +160,6 @@ firebase.messaging.Messaging.prototype.useServiceWorker = function( * * @param {!function(!Object)} callback The function to handle the push message. */ -firebase.messaging.Messaging.prototype.setBackgroundMessageHandler = function( +firebase.messaging.Messaging.prototype.setBackgroundMessageHandler = function ( callback ) {}; diff --git a/packages/firebase/externs/firebase-storage-externs.js b/packages/firebase/externs/firebase-storage-externs.js index 77c38de0932..388a76232bf 100644 --- a/packages/firebase/externs/firebase-storage-externs.js +++ b/packages/firebase/externs/firebase-storage-externs.js @@ -43,7 +43,7 @@ * * @return {!firebase.storage.Storage} */ -firebase.storage = function(app) {}; +firebase.storage = function (app) {}; /** * Gets the {@link firebase.storage.Storage `Storage`} service for the current @@ -61,7 +61,7 @@ firebase.storage = function(app) {}; * If not passed, uses the app's default Storage Bucket. * @return {!firebase.storage.Storage} */ -firebase.app.App.prototype.storage = function(url) {}; +firebase.app.App.prototype.storage = function (url) {}; /** * The Firebase Storage service interface. @@ -77,7 +77,7 @@ firebase.app.App.prototype.storage = function(url) {}; * * @interface */ -firebase.storage.Storage = function() {}; +firebase.storage.Storage = function () {}; /** * The {@link firebase.app.App app} associated with the `Storage` service @@ -97,7 +97,7 @@ firebase.storage.Storage.prototype.app; * points to the bucket root. * @return {!firebase.storage.Reference} A reference for the given path. */ -firebase.storage.Storage.prototype.ref = function(path) {}; +firebase.storage.Storage.prototype.ref = function (path) {}; /** * Returns a reference for the given absolute URL. @@ -107,7 +107,7 @@ firebase.storage.Storage.prototype.ref = function(path) {}; * @see {@link firebase.storage.FullMetadata.prototype.downloadURLs} * @return {!firebase.storage.Reference} A reference for the given URL. */ -firebase.storage.Storage.prototype.refFromURL = function(url) {}; +firebase.storage.Storage.prototype.refFromURL = function (url) {}; /** * The maximum time to retry operations other than uploads or downloads in @@ -120,7 +120,9 @@ firebase.storage.Storage.prototype.maxOperationRetryTime; * @param {number} time The new maximum operation retry time in milliseconds. * @see {@link firebase.storage.Storage.prototype.maxOperationRetryTime} */ -firebase.storage.Storage.prototype.setMaxOperationRetryTime = function(time) {}; +firebase.storage.Storage.prototype.setMaxOperationRetryTime = function ( + time +) {}; /** * The maximum time to retry uploads in milliseconds. @@ -132,21 +134,21 @@ firebase.storage.Storage.prototype.maxUploadRetryTime; * @param {number} time The new maximum upload retry time in milliseconds. * @see {@link firebase.storage.Storage.prototype.maxUploadRetryTime} */ -firebase.storage.Storage.prototype.setMaxUploadRetryTime = function(time) {}; +firebase.storage.Storage.prototype.setMaxUploadRetryTime = function (time) {}; /** * Represents a reference to a Google Cloud Storage object. Developers can * upload, download, and delete objects, as well as get/set object metadata. * @interface */ -firebase.storage.Reference = function() {}; +firebase.storage.Reference = function () {}; /** * Returns a gs:// URL for this object in the form * `gs://///` * @return {string} The gs:// URL. */ -firebase.storage.Reference.prototype.toString = function() {}; +firebase.storage.Reference.prototype.toString = function () {}; /** * Returns a reference to a relative path from this reference. @@ -154,7 +156,7 @@ firebase.storage.Reference.prototype.toString = function() {}; * Leading, trailing, and consecutive slashes are removed. * @return {!firebase.storage.Reference} The reference a the given path. */ -firebase.storage.Reference.prototype.child = function(path) {}; +firebase.storage.Reference.prototype.child = function (path) {}; /** * Uploads data to this reference's location. @@ -164,7 +166,7 @@ firebase.storage.Reference.prototype.child = function(path) {}; * @return {!firebase.storage.UploadTask} An object that can be used to monitor * and manage the upload. */ -firebase.storage.Reference.prototype.put = function(data, metadata) {}; +firebase.storage.Reference.prototype.put = function (data, metadata) {}; /** * @enum {string} @@ -216,7 +218,7 @@ firebase.storage.StringFormat = { * @throws If the format is not an allowed format, or if the given string * doesn't conform to the specified format. */ -firebase.storage.Reference.prototype.putString = function( +firebase.storage.Reference.prototype.putString = function ( data, format, metadata @@ -227,7 +229,7 @@ firebase.storage.Reference.prototype.putString = function( * @return {!firebase.Promise} A Promise that resolves if the deletion * succeeded and rejects if it failed, including if the object didn't exist. */ -firebase.storage.Reference.prototype.delete = function() {}; +firebase.storage.Reference.prototype.delete = function () {}; /** * Fetches metadata for the object at this location, if one exists. @@ -235,7 +237,7 @@ firebase.storage.Reference.prototype.delete = function() {}; * resolves with the metadata, or rejects if the fetch failed, including if * the object did not exist. */ -firebase.storage.Reference.prototype.getMetadata = function() {}; +firebase.storage.Reference.prototype.getMetadata = function () {}; /** * Updates the metadata for the object at this location, if one exists. @@ -246,7 +248,7 @@ firebase.storage.Reference.prototype.getMetadata = function() {}; * resolves with the full updated metadata or rejects if the updated failed, * including if the object did not exist. */ -firebase.storage.Reference.prototype.updateMetadata = function(metadata) {}; +firebase.storage.Reference.prototype.updateMetadata = function (metadata) {}; /** * Fetches a long lived download URL for this object. @@ -254,7 +256,7 @@ firebase.storage.Reference.prototype.updateMetadata = function(metadata) {}; * URL or rejects if the fetch failed, including if the object did not * exist. */ -firebase.storage.Reference.prototype.getDownloadURL = function() {}; +firebase.storage.Reference.prototype.getDownloadURL = function () {}; /** * A reference pointing to the parent location of this reference, or null if @@ -298,7 +300,7 @@ firebase.storage.Reference.prototype.storage; * Object metadata that can be set at any time. * @interface */ -firebase.storage.SettableMetadata = function() {}; +firebase.storage.SettableMetadata = function () {}; /** * Served as the 'Cache-Control' header on object download. @@ -341,7 +343,7 @@ firebase.storage.SettableMetadata.prototype.customMetadata; * @interface * @extends {firebase.storage.SettableMetadata} */ -firebase.storage.UploadMetadata = function() {}; +firebase.storage.UploadMetadata = function () {}; /** * A Base64-encoded MD5 hash of the object being uploaded. @@ -354,7 +356,7 @@ firebase.storage.UploadMetadata.prototype.md5Hash; * @interface * @extends {firebase.storage.UploadMetadata} */ -firebase.storage.FullMetadata = function() {}; +firebase.storage.FullMetadata = function () {}; /** * The bucket this object is contained in. @@ -457,7 +459,7 @@ firebase.storage.TaskState = { * manage the upload. * @interface */ -firebase.storage.UploadTask = function() {}; +firebase.storage.UploadTask = function () {}; /** * This object behaves like a Promise, and resolves with its snapshot data when @@ -467,7 +469,7 @@ firebase.storage.UploadTask = function() {}; * @param {(?function(!Error):*)=} onRejected The rejection callback. * @return {!firebase.Promise} */ -firebase.storage.UploadTask.prototype.then = function( +firebase.storage.UploadTask.prototype.then = function ( onFulfilled, onRejected ) {}; @@ -477,7 +479,7 @@ firebase.storage.UploadTask.prototype.then = function( * @param {!function(!Error):*} onRejected * @return {!firebase.Promise} */ -firebase.storage.UploadTask.prototype.catch = function(onRejected) {}; +firebase.storage.UploadTask.prototype.catch = function (onRejected) {}; /** * Listens for events on this task. @@ -586,7 +588,7 @@ firebase.storage.UploadTask.prototype.catch = function(onRejected) {}; * argument is passed, returns a function you can call to unregister the * callbacks. */ -firebase.storage.UploadTask.prototype.on = function( +firebase.storage.UploadTask.prototype.on = function ( event, nextOrObserver, error, @@ -597,19 +599,19 @@ firebase.storage.UploadTask.prototype.on = function( * Resumes a paused task. Has no effect on a running or failed task. * @return {boolean} True if the resume had an effect. */ -firebase.storage.UploadTask.prototype.resume = function() {}; +firebase.storage.UploadTask.prototype.resume = function () {}; /** * Pauses a running task. Has no effect on a paused or failed task. * @return {boolean} True if the pause had an effect. */ -firebase.storage.UploadTask.prototype.pause = function() {}; +firebase.storage.UploadTask.prototype.pause = function () {}; /** * Cancels a running task. Has no effect on a complete or failed task. * @return {boolean} True if the cancel had an effect. */ -firebase.storage.UploadTask.prototype.cancel = function() {}; +firebase.storage.UploadTask.prototype.cancel = function () {}; /** * A snapshot of the current task state. @@ -621,7 +623,7 @@ firebase.storage.UploadTask.prototype.snapshot; * Holds data about the current state of the upload task. * @interface */ -firebase.storage.UploadTaskSnapshot = function() {}; +firebase.storage.UploadTaskSnapshot = function () {}; /** * The number of bytes that have been successfully uploaded so far. diff --git a/packages/firestore/karma.conf.js b/packages/firestore/karma.conf.js index 80a53dc8a0d..89d65b7fd0d 100644 --- a/packages/firestore/karma.conf.js +++ b/packages/firestore/karma.conf.js @@ -18,7 +18,7 @@ const karmaBase = require('../../config/karma.base'); const { argv } = require('yargs'); -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: getTestFiles(argv), diff --git a/packages/firestore/src/local/simple_db.ts b/packages/firestore/src/local/simple_db.ts index 492e71d3714..09cc8705863 100644 --- a/packages/firestore/src/local/simple_db.ts +++ b/packages/firestore/src/local/simple_db.ts @@ -218,10 +218,7 @@ export class SimpleDb { static getIOSVersion(ua: string): number { const iOSVersionRegex = ua.match(/i(?:phone|pad|pod) os ([\d_]+)/i); const version = iOSVersionRegex - ? iOSVersionRegex[1] - .split('_') - .slice(0, 2) - .join('.') + ? iOSVersionRegex[1].split('_').slice(0, 2).join('.') : '-1'; return Number(version); } @@ -231,10 +228,7 @@ export class SimpleDb { static getAndroidVersion(ua: string): number { const androidVersionRegex = ua.match(/Android ([\d.]+)/i); const version = androidVersionRegex - ? androidVersionRegex[1] - .split('.') - .slice(0, 2) - .join('.') + ? androidVersionRegex[1].split('.').slice(0, 2).join('.') : '-1'; return Number(version); } diff --git a/packages/firestore/test/integration/api/batch_writes.test.ts b/packages/firestore/test/integration/api/batch_writes.test.ts index 94af54ee571..a9596d60c30 100644 --- a/packages/firestore/test/integration/api/batch_writes.test.ts +++ b/packages/firestore/test/integration/api/batch_writes.test.ts @@ -78,12 +78,7 @@ apiDescribe('Database batch writes', (persistence: boolean) => { return integrationHelpers.withTestDoc(persistence, doc => { return doc .set({ foo: 'bar' }) - .then(() => - doc.firestore - .batch() - .update(doc, { baz: 42 }) - .commit() - ) + .then(() => doc.firestore.batch().update(doc, { baz: 42 }).commit()) .then(() => doc.get()) .then(snapshot => { expect(snapshot.exists).to.equal(true); @@ -128,12 +123,7 @@ apiDescribe('Database batch writes', (persistence: boolean) => { .then(snapshot => { expect(snapshot.exists).to.equal(true); }) - .then(() => - doc.firestore - .batch() - .delete(doc) - .commit() - ) + .then(() => doc.firestore.batch().delete(doc).commit()) .then(() => doc.get()) .then(snapshot => { expect(snapshot.exists).to.equal(false); diff --git a/packages/firestore/test/integration/api/cursor.test.ts b/packages/firestore/test/integration/api/cursor.test.ts index 80e3fa95c0a..e5300311d06 100644 --- a/packages/firestore/test/integration/api/cursor.test.ts +++ b/packages/firestore/test/integration/api/cursor.test.ts @@ -48,10 +48,7 @@ apiDescribe('Cursors', (persistence: boolean) => { .then(docs => { expect(toDataArray(docs)).to.deep.equal([{ v: 'a' }, { v: 'b' }]); const lastDoc = docs.docs[docs.docs.length - 1]; - return coll - .limit(3) - .startAfter(lastDoc) - .get(); + return coll.limit(3).startAfter(lastDoc).get(); }) .then(docs => { expect(toDataArray(docs)).to.deep.equal([ @@ -60,18 +57,12 @@ apiDescribe('Cursors', (persistence: boolean) => { { v: 'e' } ]); const lastDoc = docs.docs[docs.docs.length - 1]; - return coll - .limit(1) - .startAfter(lastDoc) - .get(); + return coll.limit(1).startAfter(lastDoc).get(); }) .then(docs => { expect(toDataArray(docs)).to.deep.equal([{ v: 'f' }]); const lastDoc = docs.docs[docs.docs.length - 1]; - return coll - .limit(3) - .startAfter(lastDoc) - .get(); + return coll.limit(3).startAfter(lastDoc).get(); }) .then(docs => { expect(toDataArray(docs)).to.deep.equal([]); diff --git a/packages/firestore/test/integration/api/database.test.ts b/packages/firestore/test/integration/api/database.test.ts index 987c5b6b94c..cfc3cf808b1 100644 --- a/packages/firestore/test/integration/api/database.test.ts +++ b/packages/firestore/test/integration/api/database.test.ts @@ -660,16 +660,10 @@ apiDescribe('Database', (persistence: boolean) => { it('inequality same as first orderBy works.', () => { return withTestCollection(persistence, {}, async coll => { expect(() => - coll - .where('x', '>', 32) - .orderBy('x') - .orderBy('y') + coll.where('x', '>', 32).orderBy('x').orderBy('y') ).not.to.throw(); expect(() => - coll - .orderBy('x') - .where('x', '>', 32) - .orderBy('y') + coll.orderBy('x').where('x', '>', 32).orderBy('y') ).not.to.throw(); }); }); diff --git a/packages/firestore/test/integration/api/transactions.test.ts b/packages/firestore/test/integration/api/transactions.test.ts index d3761357853..684f5532ed1 100644 --- a/packages/firestore/test/integration/api/transactions.test.ts +++ b/packages/firestore/test/integration/api/transactions.test.ts @@ -207,10 +207,7 @@ apiDescribe('Database transactions', (persistence: boolean) => { return integrationHelpers.withTestDb(persistence, async db => { const tt = new TransactionTester(db); - await tt - .withExistingDoc() - .run(get, delete1, delete1) - .expectNoDoc(); + await tt.withExistingDoc().run(get, delete1, delete1).expectNoDoc(); await tt .withExistingDoc() .run(get, delete1, update2) @@ -220,10 +217,7 @@ apiDescribe('Database transactions', (persistence: boolean) => { .run(get, delete1, set2) .expectDoc({ foo: 'bar2' }); - await tt - .withExistingDoc() - .run(get, update1, delete1) - .expectNoDoc(); + await tt.withExistingDoc().run(get, update1, delete1).expectNoDoc(); await tt .withExistingDoc() .run(get, update1, update2) @@ -233,10 +227,7 @@ apiDescribe('Database transactions', (persistence: boolean) => { .run(get, update1, set2) .expectDoc({ foo: 'bar2' }); - await tt - .withExistingDoc() - .run(get, set1, delete1) - .expectNoDoc(); + await tt.withExistingDoc().run(get, set1, delete1).expectNoDoc(); await tt .withExistingDoc() .run(get, set1, update2) @@ -252,10 +243,7 @@ apiDescribe('Database transactions', (persistence: boolean) => { return integrationHelpers.withTestDb(persistence, async db => { const tt = new TransactionTester(db); - await tt - .withNonexistentDoc() - .run(get, delete1, delete1) - .expectNoDoc(); + await tt.withNonexistentDoc().run(get, delete1, delete1).expectNoDoc(); await tt .withNonexistentDoc() .run(get, delete1, update2) @@ -278,10 +266,7 @@ apiDescribe('Database transactions', (persistence: boolean) => { .run(get, update1, set1) .expectError('invalid-argument'); - await tt - .withNonexistentDoc() - .run(get, set1, delete1) - .expectNoDoc(); + await tt.withNonexistentDoc().run(get, set1, delete1).expectNoDoc(); await tt .withNonexistentDoc() .run(get, set1, update2) @@ -297,44 +282,23 @@ apiDescribe('Database transactions', (persistence: boolean) => { return integrationHelpers.withTestDb(persistence, async db => { const tt = new TransactionTester(db); - await tt - .withExistingDoc() - .run(delete1, delete1) - .expectNoDoc(); + await tt.withExistingDoc().run(delete1, delete1).expectNoDoc(); await tt .withExistingDoc() .run(delete1, update2) .expectError('invalid-argument'); - await tt - .withExistingDoc() - .run(delete1, set2) - .expectDoc({ foo: 'bar2' }); + await tt.withExistingDoc().run(delete1, set2).expectDoc({ foo: 'bar2' }); - await tt - .withExistingDoc() - .run(update1, delete1) - .expectNoDoc(); + await tt.withExistingDoc().run(update1, delete1).expectNoDoc(); await tt .withExistingDoc() .run(update1, update2) .expectDoc({ foo: 'bar2' }); - await tt - .withExistingDoc() - .run(update1, set2) - .expectDoc({ foo: 'bar2' }); + await tt.withExistingDoc().run(update1, set2).expectDoc({ foo: 'bar2' }); - await tt - .withExistingDoc() - .run(set1, delete1) - .expectNoDoc(); - await tt - .withExistingDoc() - .run(set1, update2) - .expectDoc({ foo: 'bar2' }); - await tt - .withExistingDoc() - .run(set1, set2) - .expectDoc({ foo: 'bar2' }); + await tt.withExistingDoc().run(set1, delete1).expectNoDoc(); + await tt.withExistingDoc().run(set1, update2).expectDoc({ foo: 'bar2' }); + await tt.withExistingDoc().run(set1, set2).expectDoc({ foo: 'bar2' }); }); }); @@ -342,10 +306,7 @@ apiDescribe('Database transactions', (persistence: boolean) => { return integrationHelpers.withTestDb(persistence, async db => { const tt = new TransactionTester(db); - await tt - .withNonexistentDoc() - .run(delete1, delete1) - .expectNoDoc(); + await tt.withNonexistentDoc().run(delete1, delete1).expectNoDoc(); await tt .withNonexistentDoc() .run(delete1, update2) @@ -363,23 +324,14 @@ apiDescribe('Database transactions', (persistence: boolean) => { .withNonexistentDoc() .run(update1, update2) .expectError('not-found'); - await tt - .withNonexistentDoc() - .run(update1, set1) - .expectError('not-found'); + await tt.withNonexistentDoc().run(update1, set1).expectError('not-found'); - await tt - .withNonexistentDoc() - .run(set1, delete1) - .expectNoDoc(); + await tt.withNonexistentDoc().run(set1, delete1).expectNoDoc(); await tt .withNonexistentDoc() .run(set1, update2) .expectDoc({ foo: 'bar2' }); - await tt - .withNonexistentDoc() - .run(set1, set2) - .expectDoc({ foo: 'bar2' }); + await tt.withNonexistentDoc().run(set1, set2).expectDoc({ foo: 'bar2' }); }); }); diff --git a/packages/firestore/test/integration/api/validation.test.ts b/packages/firestore/test/integration/api/validation.test.ts index c981dd33c17..7569c38ec18 100644 --- a/packages/firestore/test/integration/api/validation.test.ts +++ b/packages/firestore/test/integration/api/validation.test.ts @@ -503,19 +503,13 @@ apiDescribe('Validation:', (persistence: boolean) => { return ref .set(data) .then(() => { - return ref.firestore - .batch() - .set(ref, data) - .commit(); + return ref.firestore.batch().set(ref, data).commit(); }) .then(() => { return ref.update(data); }) .then(() => { - return ref.firestore - .batch() - .update(ref, data) - .commit(); + return ref.firestore.batch().update(ref, data).commit(); }) .then(() => { return ref.firestore.runTransaction(async txn => { @@ -1030,16 +1024,10 @@ apiDescribe('Validation:', (persistence: boolean) => { reason ); expect(() => - collection - .where('x', '>', 32) - .orderBy('y') - .orderBy('x') + collection.where('x', '>', 32).orderBy('y').orderBy('x') ).to.throw(reason); expect(() => - collection - .orderBy('y') - .orderBy('x') - .where('x', '>', 32) + collection.orderBy('y').orderBy('x').where('x', '>', 32) ).to.throw(reason); } ); diff --git a/packages/firestore/test/integration/prime_backend.test.ts b/packages/firestore/test/integration/prime_backend.test.ts index 2beb69bcffc..5132536bd3b 100644 --- a/packages/firestore/test/integration/prime_backend.test.ts +++ b/packages/firestore/test/integration/prime_backend.test.ts @@ -27,7 +27,7 @@ const PRIMING_TIMEOUT_MS = 45000; before( 'Prime backend by waiting for a write to show up in the watch stream', - function(): Promise { + function (): Promise { this.timeout(PRIMING_TIMEOUT_MS); return withTestDoc(/*persistence=*/ false, async doc => { diff --git a/packages/firestore/test/unit/local/mutation_queue.test.ts b/packages/firestore/test/unit/local/mutation_queue.test.ts index f559b748bd2..82e99a3fa6c 100644 --- a/packages/firestore/test/unit/local/mutation_queue.test.ts +++ b/packages/firestore/test/unit/local/mutation_queue.test.ts @@ -245,9 +245,7 @@ function genericMutationQueueTests(): void { } const expected = [batches[1], batches[2], batches[4]]; const matches = await mutationQueue.getAllMutationBatchesAffectingDocumentKeys( - documentKeySet() - .add(key('foo/bar')) - .add(key('foo/baz')) + documentKeySet().add(key('foo/bar')).add(key('foo/baz')) ); expectEqualArrays(matches, expected); }); diff --git a/packages/firestore/test/unit/local/remote_document_cache.test.ts b/packages/firestore/test/unit/local/remote_document_cache.test.ts index 46b21a0779d..1a91795569f 100644 --- a/packages/firestore/test/unit/local/remote_document_cache.test.ts +++ b/packages/firestore/test/unit/local/remote_document_cache.test.ts @@ -305,11 +305,7 @@ function genericRemoteDocumentCacheTests( return cache .addEntries(docs, version(VERSION)) .then(() => { - return cache.getEntries( - documentKeySet() - .add(key1) - .add(key2) - ); + return cache.getEntries(documentKeySet().add(key1).add(key2)); }) .then(read => { expectEqual(read.get(key1), docs[0]); @@ -329,10 +325,7 @@ function genericRemoteDocumentCacheTests( .addEntries(docs, version(VERSION)) .then(() => { return cache.getEntries( - documentKeySet() - .add(key1) - .add(key2) - .add(missingKey) + documentKeySet().add(key1).add(key2).add(missingKey) ); }) .then(read => { diff --git a/packages/firestore/test/unit/model/document_set.test.ts b/packages/firestore/test/unit/model/document_set.test.ts index 31fa4382708..781b0232d72 100644 --- a/packages/firestore/test/unit/model/document_set.test.ts +++ b/packages/firestore/test/unit/model/document_set.test.ts @@ -67,10 +67,7 @@ describe('DocumentSet', () => { it('updates documents', () => { const comp = DocComparator.byField('sort'); - let set = new DocumentSet(comp) - .add(d1) - .add(d2) - .add(d3); + let set = new DocumentSet(comp).add(d1).add(d2).add(d3); expect(set.size).to.equal(3); const d2prime = doc('docs/2', 2, { sort: 9 }); diff --git a/packages/firestore/test/unit/model/path.test.ts b/packages/firestore/test/unit/model/path.test.ts index 3843d586a26..a83ed4fbe12 100644 --- a/packages/firestore/test/unit/model/path.test.ts +++ b/packages/firestore/test/unit/model/path.test.ts @@ -68,12 +68,9 @@ describe('Path', () => { expect(path.popFirst().popFirst()).to.deep.equal( new ResourcePath(['messages']) ); - expect( - path - .popFirst() - .popFirst() - .popFirst() - ).to.deep.equal(new ResourcePath([])); + expect(path.popFirst().popFirst().popFirst()).to.deep.equal( + new ResourcePath([]) + ); expect(path.popFirst(0)).to.deep.equal( new ResourcePath(['rooms', 'Eros', 'messages']) ); @@ -91,12 +88,7 @@ describe('Path', () => { expect(path.lastSegment()).to.equal('messages'); expect(path.popLast().lastSegment()).to.equal('Eros'); - expect( - path - .popLast() - .popLast() - .lastSegment() - ).to.equal('rooms'); + expect(path.popLast().popLast().lastSegment()).to.equal('rooms'); }); it('can create child path', () => { @@ -113,12 +105,9 @@ describe('Path', () => { expect(path.popLast()).to.deep.equal(new ResourcePath(['rooms', 'Eros'])); expect(path.popLast().popLast()).to.deep.equal(new ResourcePath(['rooms'])); - expect( - path - .popLast() - .popLast() - .popLast() - ).to.deep.equal(new ResourcePath([])); + expect(path.popLast().popLast().popLast()).to.deep.equal( + new ResourcePath([]) + ); // original remains unmodified expect(path).to.deep.equal(new ResourcePath(['rooms', 'Eros', 'messages'])); diff --git a/packages/firestore/test/unit/remote/serializer.helper.ts b/packages/firestore/test/unit/remote/serializer.helper.ts index 52c4362d461..ec1749fab0f 100644 --- a/packages/firestore/test/unit/remote/serializer.helper.ts +++ b/packages/firestore/test/unit/remote/serializer.helper.ts @@ -1199,9 +1199,7 @@ export function serializerTest( }); it('converts limits', () => { - const q = Query.atPath(path('docs')) - .withLimitToFirst(26) - .toTarget(); + const q = Query.atPath(path('docs')).withLimitToFirst(26).toTarget(); const result = toTarget(s, wrapTargetData(q)); const expected = { query: { diff --git a/packages/firestore/test/unit/util/sorted_map.test.ts b/packages/firestore/test/unit/util/sorted_map.test.ts index 6a3c653829c..3729e0be78a 100644 --- a/packages/firestore/test/unit/util/sorted_map.test.ts +++ b/packages/firestore/test/unit/util/sorted_map.test.ts @@ -193,18 +193,12 @@ describe('SortedMap Tests', () => { expect(map.size).to.equal(6); expect(map.root.checkMaxDepth()).to.equal(true); - const m2 = map - .insert(20, 20) - .insert(18, 18) - .insert(2, 2); + const m2 = map.insert(20, 20).insert(18, 18).insert(2, 2); expect(m2.size).to.equal(9); expect(m2.root.checkMaxDepth()).to.equal(true); - const m3 = m2 - .insert(71, 71) - .insert(42, 42) - .insert(88, 88); + const m3 = m2.insert(71, 71).insert(42, 42).insert(88, 88); expect(m3.size).to.equal(12); expect(m3.root.checkMaxDepth()).to.equal(true); diff --git a/packages/firestore/test/unit/util/sorted_set.test.ts b/packages/firestore/test/unit/util/sorted_set.test.ts index b16787ec553..45e9da35fdf 100644 --- a/packages/firestore/test/unit/util/sorted_set.test.ts +++ b/packages/firestore/test/unit/util/sorted_set.test.ts @@ -25,11 +25,7 @@ describe('SortedSet', () => { it('keeps elements in the right order', () => { let set = new SortedSet(primitiveComparator); - set = set - .add(4) - .add(2) - .add(-1) - .add(0); + set = set.add(4).add(2).add(-1).add(0); expectSetToEqual(set, [-1, 0, 2, 4]); @@ -128,12 +124,7 @@ describe('SortedSet', () => { it('can find element equal or greater to provided.', () => { const empty = new SortedSet(primitiveComparator); - const set = empty - .add(0) - .add(2) - .add(5) - .add(10) - .add(12); + const set = empty.add(0).add(2).add(5).add(10).add(12); expect(set.firstAfterOrEqual(2)).to.equal(2); expect(set.firstAfterOrEqual(3)).to.equal(5); @@ -143,20 +134,9 @@ describe('SortedSet', () => { it('can unionWith another set.', () => { const empty = new SortedSet(primitiveComparator); - const set = empty - .add(0) - .add(1) - .add(2); - const set2 = empty - .add(2) - .add(3) - .add(4); - const expected = empty - .add(0) - .add(1) - .add(2) - .add(3) - .add(4); + const set = empty.add(0).add(1).add(2); + const set2 = empty.add(2).add(3).add(4); + const expected = empty.add(0).add(1).add(2).add(3).add(4); expect(set.unionWith(set2)).to.deep.equal(expected); }); diff --git a/packages/firestore/test/util/equality_matcher.ts b/packages/firestore/test/util/equality_matcher.ts index 3ba85f64d9c..46fbe71715a 100644 --- a/packages/firestore/test/util/equality_matcher.ts +++ b/packages/firestore/test/util/equality_matcher.ts @@ -123,7 +123,7 @@ export function addEqualityMatcher( // eslint-disable-next-line @typescript-eslint/explicit-function-return-type const assertEql = (_super: (r: unknown, l: unknown) => boolean) => { originalFunction = originalFunction || _super; - return function( + return function ( this: Chai.Assertion, expected?: unknown, msg?: unknown diff --git a/packages/functions/karma.conf.js b/packages/functions/karma.conf.js index 87007dadc0a..3d42695ced9 100644 --- a/packages/functions/karma.conf.js +++ b/packages/functions/karma.conf.js @@ -19,7 +19,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`test/**/*`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files, diff --git a/packages/installations/karma.conf.js b/packages/installations/karma.conf.js index d5f3eb24d49..d9f803e18d3 100644 --- a/packages/installations/karma.conf.js +++ b/packages/installations/karma.conf.js @@ -19,7 +19,7 @@ const karmaBase = require('../../config/karma.base'); const files = ['src/**/*.test.ts']; -module.exports = function(config) { +module.exports = function (config) { config.set({ ...karmaBase, files, diff --git a/packages/logger/karma.conf.js b/packages/logger/karma.conf.js index 3b5d500ceb5..3d42695ced9 100644 --- a/packages/logger/karma.conf.js +++ b/packages/logger/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`test/**/*`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files, diff --git a/packages/messaging/karma.conf.js b/packages/messaging/karma.conf.js index 745d0b4bd99..c9bc6b770c9 100644 --- a/packages/messaging/karma.conf.js +++ b/packages/messaging/karma.conf.js @@ -19,7 +19,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`src/**/*.test.ts`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = { ...karmaBase, files, diff --git a/packages/messaging/src/helpers/array-base64-translator.ts b/packages/messaging/src/helpers/array-base64-translator.ts index 49e66d9d057..bbade845ae4 100644 --- a/packages/messaging/src/helpers/array-base64-translator.ts +++ b/packages/messaging/src/helpers/array-base64-translator.ts @@ -18,10 +18,7 @@ export function arrayToBase64(array: Uint8Array | ArrayBuffer): string { const uint8Array = new Uint8Array(array); const base64String = btoa(String.fromCharCode(...uint8Array)); - return base64String - .replace(/=/g, '') - .replace(/\+/g, '-') - .replace(/\//g, '_'); + return base64String.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_'); } export function base64ToArray(base64String: string): Uint8Array { diff --git a/packages/messaging/src/helpers/idb-manager.test.ts b/packages/messaging/src/helpers/idb-manager.test.ts index 9783d486917..98f652840aa 100644 --- a/packages/messaging/src/helpers/idb-manager.test.ts +++ b/packages/messaging/src/helpers/idb-manager.test.ts @@ -68,7 +68,9 @@ describe('idb manager', () => { }); describe('old DB migration', () => { - let migrateOldDatabaseStub: Stub; + let migrateOldDatabaseStub: Stub< + typeof migrateOldDatabaseModule['migrateOldDatabase'] + >; beforeEach(() => { migrateOldDatabaseStub = stub( diff --git a/packages/performance/karma.conf.js b/packages/performance/karma.conf.js index 5f9b33c8141..7d6d24d6c2b 100644 --- a/packages/performance/karma.conf.js +++ b/packages/performance/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`test/**/*`, 'src/**/*.test.ts']; -module.exports = function(config) { +module.exports = function (config) { config.set({ ...karmaBase, // files to load into karma diff --git a/packages/remote-config/karma.conf.js b/packages/remote-config/karma.conf.js index fe4a970d439..5006cd5a4ea 100644 --- a/packages/remote-config/karma.conf.js +++ b/packages/remote-config/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2019 Google Inc. + * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`test/**/*`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/packages/remote-config/test_app/index.js b/packages/remote-config/test_app/index.js index b84a2b6452e..d38847d9f37 100644 --- a/packages/remote-config/test_app/index.js +++ b/packages/remote-config/test_app/index.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2019 Google Inc. + * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ const SUCCESS_MESSAGE = 'Done '; let remoteConfig; const outputBox = document.getElementById('output-box'); -window.onload = function() { +window.onload = function () { document.querySelector( '#firebase-config' ).placeholder = FB_CONFIG_PLACEHOLDER; diff --git a/packages/rxfire/karma.conf.js b/packages/rxfire/karma.conf.js index 63957b21c63..39d8d0dc73c 100644 --- a/packages/rxfire/karma.conf.js +++ b/packages/rxfire/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`./test/**/*`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/packages/rxfire/test/database.test.ts b/packages/rxfire/test/database.test.ts index 847f89dccaf..8aed6c78fc1 100644 --- a/packages/rxfire/test/database.test.ts +++ b/packages/rxfire/test/database.test.ts @@ -36,10 +36,7 @@ import { auditTrail } from '../database/list/audit-trail'; // eslint-disable-next-line @typescript-eslint/no-require-imports export const TEST_PROJECT = require('../../../config/project.json'); -const rando = (): string => - Math.random() - .toString(36) - .substring(5); +const rando = (): string => Math.random().toString(36).substring(5); const batch = ( items: Array<{ name: string; key: string }> diff --git a/packages/rxfire/test/firestore.test.ts b/packages/rxfire/test/firestore.test.ts index c5d96cb9235..32ef204a683 100644 --- a/packages/rxfire/test/firestore.test.ts +++ b/packages/rxfire/test/firestore.test.ts @@ -35,10 +35,7 @@ import { map, take, skip } from 'rxjs/operators'; // eslint-disable-next-line @typescript-eslint/no-require-imports export const TEST_PROJECT = require('../../../config/project.json'); -const createId = (): string => - Math.random() - .toString(36) - .substring(5); +const createId = (): string => Math.random().toString(36).substring(5); /** * Create a collection with a random name. This helps sandbox offline tests and diff --git a/packages/storage/karma.conf.js b/packages/storage/karma.conf.js index c422d2666ef..aa8fac4fdf2 100644 --- a/packages/storage/karma.conf.js +++ b/packages/storage/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`test/**/*`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/packages/storage/src/implementation/args.ts b/packages/storage/src/implementation/args.ts index bb2f2a869bd..3d36071cba8 100644 --- a/packages/storage/src/implementation/args.ts +++ b/packages/storage/src/implementation/args.ts @@ -69,7 +69,7 @@ export class ArgSpec { constructor(validator: (p1: unknown) => void, optional?: boolean) { const self = this; - this.validator = function(p: unknown) { + this.validator = function (p: unknown) { if (self.optional && !type.isJustDef(p)) { return; } @@ -83,7 +83,7 @@ export function and_( v1: (p1: unknown) => void, v2: (p1: unknown) => void ): (p1: unknown) => void { - return function(p) { + return function (p) { v1(p); v2(p); }; diff --git a/packages/storage/src/implementation/requests.ts b/packages/storage/src/implementation/requests.ts index e544be5507d..135d9cc2a4c 100644 --- a/packages/storage/src/implementation/requests.ts +++ b/packages/storage/src/implementation/requests.ts @@ -302,11 +302,7 @@ export function multipartUpload( function genBoundary(): string { let str = ''; for (let i = 0; i < 2; i++) { - str = - str + - Math.random() - .toString() - .slice(2); + str = str + Math.random().toString().slice(2); } return str; } diff --git a/packages/storage/src/implementation/string.ts b/packages/storage/src/implementation/string.ts index d516948f782..1b49adbb528 100644 --- a/packages/storage/src/implementation/string.ts +++ b/packages/storage/src/implementation/string.ts @@ -35,7 +35,8 @@ export function formatValidator(stringFormat: unknown): void { case StringFormat.DATA_URL: return; default: - throw 'Expected one of the event types: [' + + throw ( + 'Expected one of the event types: [' + StringFormat.RAW + ', ' + StringFormat.BASE64 + @@ -43,7 +44,8 @@ export function formatValidator(stringFormat: unknown): void { StringFormat.BASE64URL + ', ' + StringFormat.DATA_URL + - '].'; + '].' + ); } } diff --git a/packages/storage/test/reference.test.ts b/packages/storage/test/reference.test.ts index 6a29cc1cae2..db07a1437c2 100644 --- a/packages/storage/test/reference.test.ts +++ b/packages/storage/test/reference.test.ts @@ -174,12 +174,7 @@ describe('Firebase Storage > Reference', () => { }); it('works chained multiple times with leading slashes', () => { assert.equal( - root - .child('a') - .child('/b') - .child('c') - .child('d/e') - .toString(), + root.child('a').child('/b').child('c').child('d/e').toString(), 'gs://test-bucket/a/b/c/d/e' ); }); diff --git a/packages/storage/test/task.test.ts b/packages/storage/test/task.test.ts index be84a0d5bcb..80ef8bad0cb 100644 --- a/packages/storage/test/task.test.ts +++ b/packages/storage/test/task.test.ts @@ -403,7 +403,7 @@ describe('Firebase Storage > Upload Task', () => { } addCallbacks(task); - (function() { + (function () { let lastState: string; task.on(TaskEvent.STATE_CHANGED, snapshot => { const state = snapshot.state; @@ -461,7 +461,7 @@ describe('Firebase Storage > Upload Task', () => { ); const events2: string[] = []; - (function() { + (function () { let lastState: string; task2.on( TaskEvent.STATE_CHANGED, diff --git a/packages/template/karma.conf.js b/packages/template/karma.conf.js index 5d038e0ec61..1699a0681ec 100644 --- a/packages/template/karma.conf.js +++ b/packages/template/karma.conf.js @@ -19,7 +19,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`src/**/*.test.ts`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = { ...karmaBase, // files to load into karma diff --git a/packages/testing/test/database.test.ts b/packages/testing/test/database.test.ts index 3e17335b53a..034d941a6a8 100644 --- a/packages/testing/test/database.test.ts +++ b/packages/testing/test/database.test.ts @@ -27,8 +27,8 @@ before(() => { chai.use(chaiAsPromised); }); -describe('Testing Module Tests', function() { - it('assertSucceeds() iff success', async function() { +describe('Testing Module Tests', function () { + it('assertSucceeds() iff success', async function () { const success = Promise.resolve('success'); const failure = Promise.reject('failure'); await firebase.assertSucceeds(success).catch(() => { @@ -42,7 +42,7 @@ describe('Testing Module Tests', function() { .catch(() => {}); }); - it('assertFails() iff failure', async function() { + it('assertFails() iff failure', async function () { const success = Promise.resolve('success'); const failure = Promise.reject('failure'); await firebase @@ -56,7 +56,7 @@ describe('Testing Module Tests', function() { }); }); - it('initializeTestApp() with auth=null does not set access token', async function() { + it('initializeTestApp() with auth=null does not set access token', async function () { const app = firebase.initializeTestApp({ projectId: 'foo', auth: undefined @@ -69,7 +69,7 @@ describe('Testing Module Tests', function() { expect(authInternal).to.be.null; }); - it('initializeTestApp() with auth sets the correct access token', async function() { + it('initializeTestApp() with auth sets the correct access token', async function () { const auth = { uid: 'alice' }; const app = firebase.initializeTestApp({ projectId: 'foo', @@ -88,7 +88,7 @@ describe('Testing Module Tests', function() { expect(claims).to.deep.equal({ uid: auth.uid, iat: 0, sub: auth.uid }); }); - it('initializeAdminApp() sets the access token to "owner"', async function() { + it('initializeAdminApp() sets the access token to "owner"', async function () { const app = firebase.initializeAdminApp({ projectId: 'foo' }); const authInternal = ((app as unknown) as _FirebaseApp).container .getProvider('auth-internal') @@ -99,7 +99,7 @@ describe('Testing Module Tests', function() { expect(token!.accessToken).to.be.string('owner'); }); - it('loadDatabaseRules() throws if no databaseName or rules', async function() { + it('loadDatabaseRules() throws if no databaseName or rules', async function () { // eslint-disable-next-line @typescript-eslint/no-explicit-any await expect((firebase as any).loadDatabaseRules.bind(null, {})).to.throw( /databaseName not specified/ @@ -116,14 +116,14 @@ describe('Testing Module Tests', function() { ).to.throw(/databaseName not specified/); }); - it('loadDatabaseRules() succeeds on valid input', async function() { + it('loadDatabaseRules() succeeds on valid input', async function () { await firebase.loadDatabaseRules({ databaseName: 'foo', rules: '{ "rules": {} }' }); }); - it('loadFirestoreRules() succeeds on valid input', async function() { + it('loadFirestoreRules() succeeds on valid input', async function () { await firebase.loadFirestoreRules({ projectId: 'foo', rules: `service cloud.firestore { @@ -134,13 +134,13 @@ describe('Testing Module Tests', function() { }); }); - it('clearFirestoreData() succeeds on valid input', async function() { + it('clearFirestoreData() succeeds on valid input', async function () { await firebase.clearFirestoreData({ projectId: 'foo' }); }); - it('apps() returns apps created with initializeTestApp', async function() { + it('apps() returns apps created with initializeTestApp', async function () { const numApps = firebase.apps().length; await firebase.initializeTestApp({ databaseName: 'foo', auth: undefined }); expect(firebase.apps().length).to.equal(numApps + 1); @@ -148,13 +148,13 @@ describe('Testing Module Tests', function() { expect(firebase.apps().length).to.equal(numApps + 2); }); - it('there is a way to get database timestamps', function() { + it('there is a way to get database timestamps', function () { expect(firebase.database.ServerValue.TIMESTAMP).to.deep.equal({ '.sv': 'timestamp' }); }); - it('there is a way to get firestore timestamps', function() { + it('there is a way to get firestore timestamps', function () { expect(firebase.firestore.FieldValue.serverTimestamp()).not.to.be.null; }); }); diff --git a/packages/util/karma.conf.js b/packages/util/karma.conf.js index c422d2666ef..aa8fac4fdf2 100644 --- a/packages/util/karma.conf.js +++ b/packages/util/karma.conf.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. + * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ const karmaBase = require('../../config/karma.base'); const files = [`test/**/*`]; -module.exports = function(config) { +module.exports = function (config) { const karmaConfig = Object.assign({}, karmaBase, { // files to load into karma files: files, diff --git a/packages/util/src/assert.ts b/packages/util/src/assert.ts index c3e25f44a07..64ed0d9fcb7 100644 --- a/packages/util/src/assert.ts +++ b/packages/util/src/assert.ts @@ -20,7 +20,7 @@ import { CONSTANTS } from './constants'; /** * Throws an error if the provided assertion is falsy */ -export const assert = function(assertion: unknown, message: string): void { +export const assert = function (assertion: unknown, message: string): void { if (!assertion) { throw assertionError(message); } @@ -29,7 +29,7 @@ export const assert = function(assertion: unknown, message: string): void { /** * Returns an Error object suitable for throwing. */ -export const assertionError = function(message: string): Error { +export const assertionError = function (message: string): Error { return new Error( 'Firebase Database (' + CONSTANTS.SDK_VERSION + diff --git a/packages/util/src/crypt.ts b/packages/util/src/crypt.ts index b6779bd9efc..56dba121c0c 100644 --- a/packages/util/src/crypt.ts +++ b/packages/util/src/crypt.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -const stringToByteArray = function(str: string): number[] { +const stringToByteArray = function (str: string): number[] { // TODO(user): Use native implementations if/when available const out: number[] = []; let p = 0; @@ -52,7 +52,7 @@ const stringToByteArray = function(str: string): number[] { * @param bytes Array of numbers representing characters. * @return Stringification of the array. */ -const byteArrayToString = function(bytes: number[]): string { +const byteArrayToString = function (bytes: number[]): string { // TODO(user): Use native implementations if/when available const out: string[] = []; let pos = 0, @@ -336,7 +336,7 @@ export const base64: Base64 = { /** * URL-safe base64 encoding */ -export const base64Encode = function(str: string): string { +export const base64Encode = function (str: string): string { const utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; @@ -350,7 +350,7 @@ export const base64Encode = function(str: string): string { * @param str To be decoded * @return Decoded result, if possible */ -export const base64Decode = function(str: string): string | null { +export const base64Decode = function (str: string): string | null { try { return base64.decodeString(str, true); } catch (e) { diff --git a/packages/util/src/jwt.ts b/packages/util/src/jwt.ts index 5ecd3670e88..cd47388b533 100644 --- a/packages/util/src/jwt.ts +++ b/packages/util/src/jwt.ts @@ -36,7 +36,7 @@ interface DecodedToken { * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ -export const decode = function(token: string): DecodedToken { +export const decode = function (token: string): DecodedToken { let header = {}, claims: Claims = {}, data = {}, @@ -74,7 +74,7 @@ interface DecodedToken { * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ -export const isValidTimestamp = function(token: string): boolean { +export const isValidTimestamp = function (token: string): boolean { const claims: Claims = decode(token).claims; const now: number = Math.floor(new Date().getTime() / 1000); let validSince: number = 0, @@ -111,7 +111,7 @@ export const isValidTimestamp = function(token: string): boolean { * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ -export const issuedAtTime = function(token: string): number | null { +export const issuedAtTime = function (token: string): number | null { const claims: Claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat'] as number; @@ -126,7 +126,7 @@ export const issuedAtTime = function(token: string): number | null { * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ -export const isValidFormat = function(token: string): boolean { +export const isValidFormat = function (token: string): boolean { const decoded = decode(token), claims = decoded.claims; @@ -140,7 +140,7 @@ export const isValidFormat = function(token: string): boolean { * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. */ -export const isAdmin = function(token: string): boolean { +export const isAdmin = function (token: string): boolean { const claims: Claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; diff --git a/packages/util/src/utf8.ts b/packages/util/src/utf8.ts index 92a3cc9fdb1..3f17a12c2b9 100644 --- a/packages/util/src/utf8.ts +++ b/packages/util/src/utf8.ts @@ -32,7 +32,7 @@ import { assert } from './assert'; * @param {string} str * @return {Array} */ -export const stringToByteArray = function(str: string): number[] { +export const stringToByteArray = function (str: string): number[] { const out: number[] = []; let p = 0; for (let i = 0; i < str.length; i++) { @@ -71,7 +71,7 @@ export const stringToByteArray = function(str: string): number[] { * @param {string} str * @return {number} */ -export const stringLength = function(str: string): number { +export const stringLength = function (str: string): number { let p = 0; for (let i = 0; i < str.length; i++) { const c = str.charCodeAt(i); diff --git a/packages/util/src/validation.ts b/packages/util/src/validation.ts index 2a485db5c2d..03157a74395 100644 --- a/packages/util/src/validation.ts +++ b/packages/util/src/validation.ts @@ -24,7 +24,7 @@ * @param maxCount The maximum number of argument to allow for the function call * @param argCount The actual number of arguments provided. */ -export const validateArgCount = function( +export const validateArgCount = function ( fnName: string, minCount: number, maxCount: number,