mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-08-06 16:24:21 +00:00
refactor: enable curly eslint rule (#3137)
This commit is contained in:
@@ -57,10 +57,16 @@ 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");
|
||||
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);
|
||||
if (!res.data.data.viewer.gist) throw new Error("Gist not found");
|
||||
if (res.data.errors) {
|
||||
throw new Error(res.data.errors[0].message);
|
||||
}
|
||||
if (!res.data.data.viewer.gist) {
|
||||
throw new Error("Gist not found");
|
||||
}
|
||||
const data = res.data.data.viewer.gist;
|
||||
return {
|
||||
name: data.files[Object.keys(data.files)[0]].name,
|
||||
|
||||
@@ -73,8 +73,12 @@ const fetchRepo = async (username, reponame) => {
|
||||
if (!username && !reponame) {
|
||||
throw new MissingParamError(["username", "repo"], urlExample);
|
||||
}
|
||||
if (!username) throw new MissingParamError(["username"], urlExample);
|
||||
if (!reponame) throw new MissingParamError(["repo"], urlExample);
|
||||
if (!username) {
|
||||
throw new MissingParamError(["username"], urlExample);
|
||||
}
|
||||
if (!reponame) {
|
||||
throw new MissingParamError(["repo"], urlExample);
|
||||
}
|
||||
|
||||
let res = await retryer(fetcher, { login: username, repo: reponame });
|
||||
|
||||
|
||||
@@ -116,7 +116,9 @@ const statsFetcher = async (username) => {
|
||||
while (hasNextPage) {
|
||||
const variables = { login: username, first: 100, after: endCursor };
|
||||
let res = await retryer(fetcher, variables);
|
||||
if (res.data.errors) return res;
|
||||
if (res.data.errors) {
|
||||
return res;
|
||||
}
|
||||
|
||||
// Store stats data.
|
||||
const repoNodes = res.data.data.user.repositories.nodes;
|
||||
@@ -199,7 +201,9 @@ const fetchStats = async (
|
||||
include_all_commits = false,
|
||||
exclude_repo = [],
|
||||
) => {
|
||||
if (!username) throw new MissingParamError(["username"]);
|
||||
if (!username) {
|
||||
throw new MissingParamError(["username"]);
|
||||
}
|
||||
|
||||
const stats = {
|
||||
name: "",
|
||||
|
||||
@@ -71,7 +71,9 @@ const fetchTopLanguages = async (
|
||||
size_weight = 1,
|
||||
count_weight = 0,
|
||||
) => {
|
||||
if (!username) throw new MissingParamError(["username"]);
|
||||
if (!username) {
|
||||
throw new MissingParamError(["username"]);
|
||||
}
|
||||
|
||||
const res = await retryer(fetcher, { login: username });
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ import { CustomError, MissingParamError } from "../common/utils.js";
|
||||
* @returns {Promise<WakaTimeData>} WakaTime data response.
|
||||
*/
|
||||
const fetchWakatimeStats = async ({ username, api_domain }) => {
|
||||
if (!username) throw new MissingParamError(["username"]);
|
||||
if (!username) {
|
||||
throw new MissingParamError(["username"]);
|
||||
}
|
||||
|
||||
try {
|
||||
const { data } = await axios.get(
|
||||
|
||||
Reference in New Issue
Block a user