Repository: anuraghazra/github-readme-stats
Pull request #3195 (2023-09-03 03:16:40)

refactor: fix I18n class constructor jsdoc to resolve vscode type errors

vercel[bot]: [vc]: #HwDx1H9cwc0yZx10JzGxHKsmZx+MJtzdISqDMsqrJNE=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJnaXRodWItcmVhZG1lLXN0YXRzIiwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2dpdGh1Yi1yZWFkbWUtc3RhdHMtdGVhbS9naXRodWItcmVhZG1lLXN0YXRzLzhWUWNNRTc2UWFBYU1wY01OYmtHZFo3OHdHRlUiLCJwcmV2aWV3VXJsIjoiZ2l0aHViLXJlYWRtZS1zdGF0cy1naXQtcmVmYWN0by05NTY1YmQtZ2l0aHViLXJlYWRtZS1zdGF0cy10ZWFtLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiUEVORElORyJ9XX0=
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Updated (UTC) |
| :--- | :----- | :------ | :------ |
| **github-readme-stats** | 🔄 Building ([Inspect](https://vercel.com/github-readme-stats-team/github-readme-stats/8VQcME76QaAaMpcMNbkGdZ78wGFU)) | [Visit Preview](https://github-readme-stats-git-refacto-9565bd-github-readme-stats-team.vercel.app) | Sep 3, 2023 3:16am |


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3195?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) Report
Patch coverage: **`100.00%`** and no project coverage change.
> Comparison is base [(`438ffb5`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/commit/438ffb5ee87157782f9a2344712d8dd0e3b407cc?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 98.69% compared to head [(`c321e8d`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3195?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 98.69%.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master    #3195   +/-   ##
=======================================
  Coverage   98.69%   98.69%           
=======================================
  Files          27       27           
  Lines        5831     5831           
  Branches      525      525           
=======================================
  Hits         5755     5755           
  Misses         73       73           
  Partials        3        3           
```


| [Files Changed](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3195?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) | Coverage Δ | |
|---|---|---|
| [src/common/I18n.js](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3195?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra#diff-c3JjL2NvbW1vbi9JMThuLmpz) | `100.00% <100.00%> (ø)` | |


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3195?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).


Patch:
diff --git a/readme.md b/readme.md
index 60747cb..f0f5fce 100644
--- a/readme.md
+++ b/readme.md
@@ -426,6 +426,9 @@ The top languages card shows a GitHub user's most frequently used languages.
 > [!WARNING]\
 > This card shows languages usage only inside your own non-forked repositories, not depending from who is the author of the commits. It does not include your contributions into another users/organizations repositories. Currently there are no way to get this data from GitHub API. If you want this behavior to be improved you can support [this feature request](https://github.com/orgs/community/discussions/18230) created by [@rickstaa](https://github.com/rickstaa) inside GitHub Community.
 
+> [!WARNING]\
+> Currently this card shows data only about first 100 repositories. This is because GitHub API limitations which cause downtimes of public instance (see [#1471](https://github.com/anuraghazra/github-readme-stats/issues/1471)). In future this behavior will be improved by releasing GitHub action or providing environment variable for user's own instances.
+
 ### Usage
 
 Copy-paste this code into your readme and change the links.
diff --git a/src/common/I18n.js b/src/common/I18n.js
index 7876ed2..bd5f29f 100644
--- a/src/common/I18n.js
+++ b/src/common/I18n.js
@@ -8,7 +8,7 @@ class I18n {
    * Constructor.
    *
    * @param {Object} options Options.
-   * @param {string} options.locale Locale.
+   * @param {string=} options.locale Locale.
    * @param {Object} options.translations Translations.
    */
   constructor({ locale, translations }) {
diff --git a/src/common/retryer.js b/src/common/retryer.js
index 2a441f1..74f9a0f 100644
--- a/src/common/retryer.js
+++ b/src/common/retryer.js
@@ -26,7 +26,10 @@ const retryer = async (fetcher, variables, retries = 0) => {
     throw new CustomError("No GitHub API tokens found", CustomError.NO_TOKENS);
   }
   if (retries > RETRIES) {
-    throw new CustomError("Maximum retries exceeded", CustomError.MAX_RETRY);
+    throw new CustomError(
+      "Downtime due to GitHub API rate limiting",
+      CustomError.MAX_RETRY,
+    );
   }
   try {
     // try to fetch with the first token since RETRIES is 0 index i'm adding +1
diff --git a/src/common/utils.js b/src/common/utils.js
index 0bf2d05..871c493 100644
--- a/src/common/utils.js
+++ b/src/common/utils.js
@@ -381,7 +381,8 @@ const CONSTANTS = {
 };
 
 const SECONDARY_ERROR_MESSAGES = {
-  MAX_RETRY: "Downtime due to GitHub API rate limiting",
+  MAX_RETRY:
+    "You can deploy own instance or wait until public will be no longer limited",
   NO_TOKENS:
     "Please add an env variable called PAT_1 with your GitHub API token in vercel",
   USER_NOT_FOUND: "Make sure the provided username is not an organization",


Test patch:
diff --git a/tests/retryer.test.js b/tests/retryer.test.js
index 2229bbb..257a70d 100644
--- a/tests/retryer.test.js
+++ b/tests/retryer.test.js
@@ -40,12 +40,12 @@ describe("Test Retryer", () => {
     expect(res).toStrictEqual({ data: "ok" });
   });
 
-  it("retryer should throw error if maximum retries reached", async () => {
+  it("retryer should throw specific error if maximum retries reached", async () => {
     try {
       await retryer(fetcherFail, {});
     } catch (err) {
       expect(fetcherFail).toBeCalledTimes(8);
-      expect(err.message).toBe("Maximum retries exceeded");
+      expect(err.message).toBe("Downtime due to GitHub API rate limiting");
     }
   });
 });