refactor: enable curly eslint rule (#3137)

This commit is contained in:
Alexandr Garbuzov
2023-09-12 10:06:01 +02:00
committed by GitHub
parent b611018476
commit c42798b39e
14 changed files with 71 additions and 24 deletions
+9 -3
View File
@@ -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,
+6 -2
View File
@@ -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 });
+6 -2
View File
@@ -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: "",
+3 -1
View File
@@ -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 });
+3 -1
View File
@@ -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(