From 971b3d6e88f4cac945e10831e7d25f7a02079315 Mon Sep 17 00:00:00 2001 From: Alexandr Date: Sat, 5 Aug 2023 05:11:16 +0300 Subject: [PATCH] Refactor: Repo card: Use typedef tags inside data fetcher to resolve eslint errors --- src/fetchers/repo-fetcher.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/fetchers/repo-fetcher.js b/src/fetchers/repo-fetcher.js index 412d1d4c28cf1..75c31475a6a1c 100644 --- a/src/fetchers/repo-fetcher.js +++ b/src/fetchers/repo-fetcher.js @@ -2,12 +2,17 @@ import { retryer } from "../common/retryer.js"; import { MissingParamError, request } from "../common/utils.js"; +/** + * @typedef {import('axios').AxiosRequestHeaders} AxiosRequestHeaders Axios request headers. + * @typedef {import('axios').AxiosResponse} AxiosResponse Axios response. + */ + /** * Repo data fetcher. * - * @param {import('axios').AxiosRequestHeaders} variables Fetcher variables. + * @param {AxiosRequestHeaders} variables Fetcher variables. * @param {string} token GitHub token. - * @returns {Promise} The response. + * @returns {Promise} The response. */ const fetcher = (variables, token) => { return request( @@ -53,12 +58,16 @@ const fetcher = (variables, token) => { const urlExample = "/api/pin?username=USERNAME&repo=REPO_NAME"; +/** + * @typedef {import("./types").RepositoryData} RepositoryData Repository data. + */ + /** * Fetch repository data. * * @param {string} username GitHub username. * @param {string} reponame GitHub repository name. - * @returns {Promise} Repository data. + * @returns {Promise} Repository data. */ const fetchRepo = async (username, reponame) => { if (!username && !reponame) {