Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading