Skip to content

Commit

Permalink
Refactor: Top langs card: Use typedef tags to resolve eslint errors (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 authored and devantler committed Sep 24, 2023
1 parent c79074c commit 3aa0ec6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/cards/top-languages-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand All @@ -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.
*/
Expand All @@ -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<import("./types").TopLangOptions>} options Card options.
* @param {TopLangData} topLangs User's most frequently used programming languages.
* @param {Partial<TopLangOptions>} options Card options.
* @returns {string} Language card SVG object.
*/
const renderTopLanguages = (topLangs, options = {}) => {
Expand Down

0 comments on commit 3aa0ec6

Please sign in to comment.