Refactor: Top langs card: Use typedef tags to resolve eslint errors (#3040)

This commit is contained in:
Alexandr Garbuzov 2023-08-04 08:09:20 +03:00 committed by GitHub
parent 4a4531091f
commit 036f80f7ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<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 = {}) => {