From e541c3e85aa358999514d9cdefecebcefb6231a0 Mon Sep 17 00:00:00 2001 From: Alexandr Date: Fri, 4 Aug 2023 04:23:01 +0300 Subject: [PATCH] Refactor: Top langs card: Use typedef tags to resolve eslint errors --- src/cards/top-languages-card.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/cards/top-languages-card.js b/src/cards/top-languages-card.js index 5c8e8b59b517e..bd8103edce730 100644 --- a/src/cards/top-languages-card.js +++ b/src/cards/top-languages-card.js @@ -661,13 +661,18 @@ const renderDonutLayout = (langs, width, totalLanguageSize) => { `; }; +/** + * @typedef {import("./types").TopLangOptions} TopLangOptions + * @typedef {TopLangOptions["layout"]} Layout + */ + /** * Creates the no languages data SVG node. * * @param {object} props Object with function properties. * @param {string} props.color No languages data text color. * @param {string} props.text No languages data translated text. - * @param {import("./types").TopLangOptions["layout"] | undefined} props.layout Card layout. + * @param {Layout | undefined} props.layout Card layout. * @returns {string} No languages data SVG node string. */ const noLanguagesDataNode = ({ color, text, layout }) => { @@ -682,7 +687,7 @@ const noLanguagesDataNode = ({ color, text, layout }) => { * Get default languages count for provided card layout. * * @param {object} props Function properties. - * @param {import("./types").TopLangOptions["layout"]=} props.layout Input layout string. + * @param {Layout=} props.layout Input layout string. * @param {boolean=} props.hide_progress Input hide_progress parameter value. * @returns {number} Default languages count for input layout. */ @@ -700,11 +705,15 @@ const getDefaultLanguagesCountByLayout = ({ layout, hide_progress }) => { } }; +/** + * @typedef {import('../fetchers/types').TopLangData} TopLangData + */ + /** * Renders card that display user's most frequently used programming languages. * - * @param {import('../fetchers/types').TopLangData} topLangs User's most frequently used programming languages. - * @param {Partial} options Card options. + * @param {TopLangData} topLangs User's most frequently used programming languages. + * @param {Partial} options Card options. * @returns {string} Language card SVG object. */ const renderTopLanguages = (topLangs, options = {}) => {