Skip to content

Update doc comments #5233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 18, 2021
Merged

Update doc comments #5233

merged 14 commits into from
Aug 18, 2021

Conversation

hsubox76
Copy link
Contributor

@hsubox76 hsubox76 commented Aug 2, 2021

  • Add backticks (or links) for literals
  • Fix some spelling errors
  • Uncapitalize "Promise" in several places since promises are standard parts of the language now? We don't capitalize function or class.

Had to make some judgement calls where basically if it's being used as a product name, no backticks, if it's referring to the instance/class then backticks.

It is a little tricky to identify which comments in Firestore and RTDB go into the docs since they don't embed @public tags and use another method to extract public APIs, so might have missed some.

@changeset-bot
Copy link

changeset-bot bot commented Aug 2, 2021

⚠️ No Changeset found

Latest commit: 8daa71d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2021

Changeset File Check ✅

  • No modified packages are missing from the changeset file.
  • No changeset formatting errors detected.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 2, 2021

Binary Size Report

Affected SDKs

  • @firebase/messaging

    Type Base (f825b1d) Head (0df1a9e) Diff
    esm2017 26.2 kB 26.2 kB +41 B (+0.2%)
    main 34.9 kB 35.0 kB +41 B (+0.1%)
    module 34.4 kB 34.4 kB +41 B (+0.1%)
  • @firebase/storage

    Type Base (f825b1d) Head (0df1a9e) Diff
    browser 64.2 kB 64.1 kB -82 B (-0.1%)
    esm2017 55.3 kB 55.2 kB -82 B (-0.1%)
    main 55.8 kB 55.8 kB -82 B (-0.1%)
    module 64.2 kB 64.1 kB -82 B (-0.1%)
  • @firebase/storage-exp

    Type Base (f825b1d) Head (0df1a9e) Diff
    browser 52.0 kB 51.9 kB -82 B (-0.2%)
    main 53.3 kB 53.3 kB -82 B (-0.2%)
    module 52.0 kB 51.9 kB -82 B (-0.2%)
  • firebase

    Type Base (f825b1d) Head (0df1a9e) Diff
    firebase-messaging.js 40.9 kB 41.0 kB +27 B (+0.1%)
    firebase-storage.js 45.0 kB 45.0 kB -74 B (-0.2%)
    firebase.js 896 kB 896 kB -48 B (-0.0%)

Test Logs

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 2, 2021

Size Analysis Report

Affected Products

  • @firebase/messaging-exp

    • deleteToken

      Size Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      size
      8.93 kB
      9.43 kB
      +503 B (+5.6%)
      size-with-ext-deps
      27.4 kB
      27.9 kB
      +507 B (+1.9%)

      Dependency Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      functions

      27 dependencies

      arrayToBase64
      checkTokenDetails
      dbGet
      dbRemove
      dbSet
      deleteToken
      deleteToken$1
      deleteTokenInternal
      externalizePayload
      extractAppConfig
      getDbPromise
      getEndpoint
      getEventType
      getHeaders
      getKey
      getMissingValueError
      isConsoleMessage
      isWindowSupported
      logToScion
      messageEventListener
      migrateOldDatabase
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerDefaultSw
      registerMessagingInWindow
      requestDeleteToken
      

      28 dependencies

      _mergeStrings
      arrayToBase64
      checkTokenDetails
      dbGet
      dbRemove
      dbSet
      deleteToken
      deleteToken$1
      deleteTokenInternal
      externalizePayload
      extractAppConfig
      getDbPromise
      getEndpoint
      getEventType
      getHeaders
      getKey
      getMissingValueError
      isConsoleMessage
      isWindowSupported
      logToScion
      messageEventListener
      migrateOldDatabase
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerDefaultSw
      registerMessagingInWindow
      requestDeleteToken
      

      + _mergeStrings

      variables

      18 dependencies

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      DATABASE_NAME
      DATABASE_VERSION
      DEFAULT_SW_PATH
      DEFAULT_SW_SCOPE
      ENDPOINT
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      OBJECT_STORE_NAME
      OLD_DB_NAME
      OLD_DB_VERSION
      OLD_OBJECT_STORE_NAME
      WindowMessagingFactory
      dbPromise
      

      19 dependencies

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      DATABASE_NAME
      DATABASE_VERSION
      DEFAULT_SW_PATH
      DEFAULT_SW_SCOPE
      ENDPOINT
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      MessageType$1
      OBJECT_STORE_NAME
      OLD_DB_NAME
      OLD_DB_VERSION
      OLD_OBJECT_STORE_NAME
      WindowMessagingFactory
      dbPromise
      

      + MessageType$1

    • getMessaging

      Size Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      size
      5.09 kB
      5.59 kB
      +501 B (+9.8%)
      size-with-ext-deps
      23.5 kB
      24.0 kB
      +507 B (+2.2%)

      Dependency Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      functions

      13 dependencies

      externalizePayload
      extractAppConfig
      getEventType
      getMessaging
      getMissingValueError
      isConsoleMessage
      isWindowSupported
      logToScion
      messageEventListener
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerMessagingInWindow
      

      14 dependencies

      _mergeStrings
      externalizePayload
      extractAppConfig
      getEventType
      getMessaging
      getMissingValueError
      isConsoleMessage
      isWindowSupported
      logToScion
      messageEventListener
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerMessagingInWindow
      

      + _mergeStrings

      variables

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      WindowMessagingFactory
      

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      MessageType$1
      WindowMessagingFactory
      

      + MessageType$1

    • getToken

      Size Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      size
      12.0 kB
      12.5 kB
      +506 B (+4.2%)
      size-with-ext-deps
      30.5 kB
      31.0 kB
      +507 B (+1.7%)

      Dependency Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      functions

      38 dependencies

      arrayToBase64
      base64ToArray
      checkTokenDetails
      dbGet
      dbRemove
      dbSet
      deleteTokenInternal
      externalizePayload
      extractAppConfig
      getBody
      getDbPromise
      getEndpoint
      getEventType
      getHeaders
      getKey
      getMissingValueError
      getNewToken
      getPushSubscription
      getToken
      getToken$1
      getTokenInternal
      isConsoleMessage
      isTokenValid
      isWindowSupported
      logToScion
      messageEventListener
      migrateOldDatabase
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerDefaultSw
      registerMessagingInWindow
      requestDeleteToken
      requestGetToken
      requestUpdateToken
      updateSwReg
      updateToken
      updateVapidKey
      

      39 dependencies

      _mergeStrings
      arrayToBase64
      base64ToArray
      checkTokenDetails
      dbGet
      dbRemove
      dbSet
      deleteTokenInternal
      externalizePayload
      extractAppConfig
      getBody
      getDbPromise
      getEndpoint
      getEventType
      getHeaders
      getKey
      getMissingValueError
      getNewToken
      getPushSubscription
      getToken
      getToken$1
      getTokenInternal
      isConsoleMessage
      isTokenValid
      isWindowSupported
      logToScion
      messageEventListener
      migrateOldDatabase
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerDefaultSw
      registerMessagingInWindow
      requestDeleteToken
      requestGetToken
      requestUpdateToken
      updateSwReg
      updateToken
      updateVapidKey
      

      + _mergeStrings

      variables

      20 dependencies

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      DATABASE_NAME
      DATABASE_VERSION
      DEFAULT_SW_PATH
      DEFAULT_SW_SCOPE
      DEFAULT_VAPID_KEY
      ENDPOINT
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      OBJECT_STORE_NAME
      OLD_DB_NAME
      OLD_DB_VERSION
      OLD_OBJECT_STORE_NAME
      TOKEN_EXPIRATION_MS
      WindowMessagingFactory
      dbPromise
      

      21 dependencies

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      DATABASE_NAME
      DATABASE_VERSION
      DEFAULT_SW_PATH
      DEFAULT_SW_SCOPE
      DEFAULT_VAPID_KEY
      ENDPOINT
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      MessageType$1
      OBJECT_STORE_NAME
      OLD_DB_NAME
      OLD_DB_VERSION
      OLD_OBJECT_STORE_NAME
      TOKEN_EXPIRATION_MS
      WindowMessagingFactory
      dbPromise
      

      + MessageType$1

    • isSupported

      Size Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      size
      4.97 kB
      5.47 kB
      +501 B (+10.1%)
      size-with-ext-deps
      23.3 kB
      23.8 kB
      +507 B (+2.2%)

      Dependency Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      functions

      12 dependencies

      externalizePayload
      extractAppConfig
      getEventType
      getMissingValueError
      isConsoleMessage
      isSupported
      logToScion
      messageEventListener
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerMessagingInWindow
      

      13 dependencies

      _mergeStrings
      externalizePayload
      extractAppConfig
      getEventType
      getMissingValueError
      isConsoleMessage
      isSupported
      logToScion
      messageEventListener
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerMessagingInWindow
      

      + _mergeStrings

      variables

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      WindowMessagingFactory
      

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      MessageType$1
      WindowMessagingFactory
      

      + MessageType$1

    • onMessage

      Size Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      size
      5.16 kB
      5.66 kB
      +501 B (+9.7%)
      size-with-ext-deps
      23.5 kB
      24.0 kB
      +507 B (+2.2%)

      Dependency Table

      TypeBase (f825b1d)Head (0df1a9e)Diff
      functions

      14 dependencies

      externalizePayload
      extractAppConfig
      getEventType
      getMissingValueError
      isConsoleMessage
      isWindowSupported
      logToScion
      messageEventListener
      onMessage
      onMessage$1
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerMessagingInWindow
      

      15 dependencies

      _mergeStrings
      externalizePayload
      extractAppConfig
      getEventType
      getMissingValueError
      isConsoleMessage
      isWindowSupported
      logToScion
      messageEventListener
      onMessage
      onMessage$1
      propagateDataPayload
      propagateFcmOptions
      propagateNotificationPayload
      registerMessagingInWindow
      

      + _mergeStrings

      variables

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      WindowMessagingFactory
      

      CONSOLE_CAMPAIGN_ANALYTICS_ENABLED
      CONSOLE_CAMPAIGN_ID
      CONSOLE_CAMPAIGN_NAME
      CONSOLE_CAMPAIGN_TIME
      ERROR_FACTORY
      ERROR_MAP
      MessageType
      MessageType$1
      WindowMessagingFactory
      

      + MessageType$1

Copy link
Contributor

@sam-gc sam-gc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for Auth

Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a start here, but it's so long that I think we should distribute the review among the writers focused in each area.

Please add Kevin, Rachel, Mark and Greg, and we can send them mail/chat instructions to take a close look at the files for their areas. SG? Thanks!

@@ -59,11 +59,11 @@ declare module '@firebase/component' {
}

/**
* Returns a Firebase Analytics instance for the given app.
* Returns a {@link Analytics} instance for the given app.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Returns an" with "an," if the link text is just "Analytics," here and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -193,7 +193,7 @@ export function onTokenChanged(
onCompletion?: () => void
): Unsubscribe;
/**
* Wraps addTokenListener/removeTokenListener methods in an Observer
* Wraps addTokenListener/removeTokenListener methods in an `Observer`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably also be backticked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -216,7 +216,7 @@ export function setAnalyticsCollectionEnabled(
).catch(e => logger.error(e));
}
/**
* Sends analytics event with given `eventParams`. This method
* Sends Google Analytics event with given `eventParams`. This method
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest "Sends a Google Analytics..."

Here and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
*/
'allow_ad_personalization_signals'?: boolean;
[key: string]: unknown;
}

/**
* Analytics initialization options.
* Firebase Analytics instance initialization options.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Product-wise, we don't say "Firebase Analytics" any more -- just "Google Analytics."

https://firebase.google.com/docs/analytics

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's referring to the service, not the product, so I changed it to {@link Analytics}.

@@ -358,7 +358,7 @@ export interface Persistence {
* Interface representing ID token result obtained from {@link User.getIdTokenResult}.
*
* @remarks
* It contains the ID token JWT string and other helper properties for getting different data
* It contains the ID token JWT string and other helper properties for getting different data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "The result" or something more clear than "It?"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's specifically this interface so I just put the name, in backticks?

Copy link
Collaborator

@kevinthecheung kevinthecheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auth and App Check LGTM

Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a sanity check, you'd want to run yarn docgen:exp to make sure all @links work correctly. The api-documenter will print unresolved links in the console, then we can find root causes and fix them.

@@ -88,7 +88,7 @@ export class TransactionResult {
* transaction will be aborted and the data at this location will not be
* modified.
* @param options - An options object to configure transactions.
* @returns A Promise that can optionally be used instead of the onComplete
* @returns A promise that can optionally be used instead of the `onComplete`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be `Promise` ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either that, or just lowercase "promise." With a cap it's a literal (correct?) and with lowercase it's just a plain old promise, which I think devs will understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Uncapitalize "Promise" in several places since promises are standard parts of the language now? We don't capitalize function or class.

This was my rationale for uncapitalizing it. I think comments were written in the past when promises weren't standard and so we had written an actual custom implementation of them at some point?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! But lowercase seems to work well :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promise is the name of the API and we write it in uppercase in code while we write function/class in lowercase. MDN uses capitalized Promise in their [doc]. so I think we should use literal Promise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little hard to be sure I found all of them but I did as many as I could find.

@Feiyang1 Feiyang1 assigned hsubox76 and unassigned Feiyang1 Aug 13, 2021
Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more things to look at, thanks!

@@ -19,7 +19,8 @@ import { FirebaseApp, getApp, _getProvider } from '@firebase/app-exp';
import { Installations } from '../interfaces/public-types';

/**
* Returns an instance of FirebaseInstallations associated with the given FirebaseApp instance.
* Returns an instance of Firebase Installations associated with the given
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In long discussions when Andreas was still around, we decided not to capitalize "installations," even in the product name, unless heading case or something called for it -- so all of these instances should be lowercase.

These are the names/formats we agreed on: https://source.corp.google.com/piper///depot/google3/third_party/devsite/firebase/en/_internal/includes/_names.html;ws=codereview%2F392183348;rcl=378662242;cl=2;l=241

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's referring to an instance of the SDK service so I went with {@link Installations}.

@@ -51,13 +50,12 @@ export interface HttpsCallableOptions {
}

/**
* `Functions` represents a Functions instance, and is a required argument for
* all Functions operations.
* An instance of Firebase Functions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Firebase Functions" isn't an actual product name.

Is there a reason not to just go with the literal here, like "A Functions instance?"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, done.

Copy link
Contributor

@rachelsaunders rachelsaunders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed the changes for the FirePerf files.

@@ -41,7 +41,7 @@ export * from './src';
*
* @public
*/
export const reactNativeLocalPersistence =
export const reactNativeLocalPersistence: Persistence =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to explicitly import the type here, or else rollup? typescript? transitively gets it from the file getReactNativePersistence comes from, and for some reason codes it as an import() statement in the d.ts, which makes api-extractor error.

@hsubox76
Copy link
Contributor Author

Rebased and made some changes to get rid of warnings when running api-extractor in Auth. Able to get rid of all warnings except the gapi one. Not sure what can be done about that.

@hsubox76 hsubox76 assigned Feiyang1 and unassigned hsubox76 Aug 17, 2021
Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, thanks!

Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending Promise changes.

@hsubox76 hsubox76 merged commit 2901ed0 into master Aug 18, 2021
@hsubox76 hsubox76 deleted the ch-literals branch August 18, 2021 02:24
@firebase firebase locked and limited conversation to collaborators Sep 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants