firebase / firebase/firebase-js-sdk

FR: rule-unit-testing's withSecurityRulesDisabled method JSDoc incorrect

Open
#6,668 2 comments 0 reactions 0 assignees View on GitHub
bug documentation needs-attention testing-sdk
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### [REQUIRED] Describe your environment

* Operating System version: Pop OS 22.04 LTS
* Browser version: Firefox 105.0.1
* Firebase SDK version: 9.10.0
* Firebase Product: rules unit testing (auth, database, storage, etc)

### [REQUIRED] Describe the problem

#### Steps to reproduce:

The method withSecurityRulesDisabled has no documentation. After digging, it turns out it does have documentation but it is missing a * to make it a JS doc, resulting in the doc being a comment. This means the api extractor never picks it up during build.
#### Relevant Code:
The relevant line is [here](https://github.com/firebase/firebase-js-sdk/blob/29d034072c20af394ce384e42aa10a37d5dfcb18/packages/rules-unit-testing/src/public_types/index.ts#L205).

I would like to submit a PR to correct the issue. Also, I would like to include an example in the JS Doc to add clarity, since this method differs from the other context methods. I plan on including the following example.
```javascript
const addTestData = async ({ testEnv, collectionName, testData }) => {
let docId;
await testEnv.withSecurityRulesDisabled(async (noRulesContext) => {
const db = await noRulesContext.firestore();
const dbCollection = collection(db, collectionName);
docId = await (await addDoc(dbCollection, testData)).id;
});
return docId;
};
```
I ran the script ```yarn docgen devsite``` and everything looks ok. Let me know if I'm missing anything or if I should use a different example.
[Here's](https://github.com/firebase/firebase-js-sdk/compare/master...palmerusaf:firebase-js-sdk:rut_doc_improvement) a link to my proposed change.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.