Repository: anuraghazra/github-readme-stats
Pull request #3102 (2023-08-19 02:54:59)

Enable block-scoped-var and accessor-pairs eslint rules

vercel[bot]: [vc]: #5pbVcj3w0YQgo4ztuqMEjj16iAj17cKEchYVlqJR/zE=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJnaXRodWItcmVhZG1lLXN0YXRzIiwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2dpdGh1Yi1yZWFkbWUtc3RhdHMtdGVhbS9naXRodWItcmVhZG1lLXN0YXRzLzg1UXFEc3dpM0oxNTVFVm9KS0pFTXFtVGRHd1kiLCJwcmV2aWV3VXJsIjoiZ2l0aHViLXJlYWRtZS1zdGF0cy1naXQtZW5hYmxlYi03MGQyZWYtZ2l0aHViLXJlYWRtZS1zdGF0cy10ZWFtLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiUEVORElORyJ9XX0=
**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/85QqDswi3J155EVoJKJEMqmTdGwY)) | [Visit Preview](https://github-readme-stats-git-enableb-70d2ef-github-readme-stats-team.vercel.app) | Aug 19, 2023 2:55am |


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3102?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) Report
Patch and project coverage have no change.
> Comparison is base [(`ea79314`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/commit/ea79314a853ea5480127f646f6ad8cd70d5997bc?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 97.67% compared to head [(`944ad6a`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3102?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 97.67%.

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


```diff
@@           Coverage Diff           @@
##           master    #3102   +/-   ##
=======================================
  Coverage   97.67%   97.67%           
=======================================
  Files          27       27           
  Lines        5810     5810           
  Branches      499      499           
=======================================
  Hits         5675     5675           
  Misses        133      133           
  Partials        2        2           
```




</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3102?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/.eslintrc.json b/.eslintrc.json
index 27ac580..255e9fc 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -33,11 +33,11 @@
 
         // Allowed a getter without setter, but all setters require getters
 
-        // "accessor-pairs": [ "error", {
-        //     "getWithoutSet": false,
-        //     "setWithoutGet": true
-        // }],
-        // "block-scoped-var": "warn",
+        "accessor-pairs": [ "error", {
+            "getWithoutSet": false,
+            "setWithoutGet": true
+        }],
+        "block-scoped-var": "warn",
         "consistent-return": "error",
         // "curly": "error",
         // "default-case": "warn",
diff --git a/src/fetchers/gist-fetcher.js b/src/fetchers/gist-fetcher.js
index 2afc62a..8e1eb75 100644
--- a/src/fetchers/gist-fetcher.js
+++ b/src/fetchers/gist-fetcher.js
@@ -1,6 +1,6 @@
 // @ts-check
 
-import { request } from "../common/utils.js";
+import { request, MissingParamError } from "../common/utils.js";
 import { retryer } from "../common/retryer.js";
 
 /**
@@ -57,6 +57,7 @@ const fetcher = async (variables, token) => {
  * @returns {Promise<GistData>} Gist data.
  */
 const fetchGist = async (id) => {
+  if (!id) throw new MissingParamError(["id"], "/api/gist?id=GIST_ID");
   const res = await retryer(fetcher, { gistName: id });
   if (res.data.errors) throw new Error(res.data.errors[0].message);
   const data = res.data.data.viewer.gist;


Test patch:
diff --git a/tests/fetchGist.test.js b/tests/fetchGist.test.js
index 2cdffcf..da045b0 100644
--- a/tests/fetchGist.test.js
+++ b/tests/fetchGist.test.js
@@ -69,4 +69,10 @@ describe("Test fetchGist", () => {
       "Some test GraphQL error",
     );
   });
+
+  it("should throw error if id is not provided", async () => {
+    await expect(fetchGist()).rejects.toThrow(
+      'Missing params "id" make sure you pass the parameters in URL',
+    );
+  });
 });
diff --git a/tests/gist.test.js b/tests/gist.test.js
index 1413229..985ad6c 100644
--- a/tests/gist.test.js
+++ b/tests/gist.test.js
@@ -70,6 +70,7 @@ describe("Test /api/gist", () => {
   it("should get the query options", async () => {
     const req = {
       query: {
+        id: "bbfce31e0217a3689c8d961a356cb10d",
         title_color: "fff",
         icon_color: "fff",
         text_color: "fff",