refactor: fix createProgressNode function jsdoc and enable ts-check (#3211)

This commit is contained in:
Alexandr Garbuzov 2023-09-12 10:24:07 +03:00 committed by GitHub
parent 47e6e56eb3
commit 8879c7fe2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -201,7 +201,7 @@ const trimTopLanguages = (topLangs, langs_count, hide) => {
* @param {number} props.width The card width
* @param {string} props.color Color of the programming language.
* @param {string} props.name Name of the programming language.
* @param {string} props.progress Usage of the programming language in percentage.
* @param {number} props.progress Usage of the programming language in percentage.
* @param {number} props.index Index of the programming language.
* @returns {string} Programming language SVG node.
*/
@ -329,7 +329,9 @@ const renderNormalLayout = (langs, width, totalLanguageSize) => {
width,
name: lang.name,
color: lang.color || DEFAULT_LANG_COLOR,
progress: ((lang.size / totalLanguageSize) * 100).toFixed(2),
progress: parseFloat(
((lang.size / totalLanguageSize) * 100).toFixed(2),
),
index,
});
}),

View file

@ -95,7 +95,7 @@ const createLanguageTextNode = ({ langs, y }) => {
* @param {string} args.label The label of the text node item.
* @param {string} args.value The value of the text node item.
* @param {number} args.index The index of the text node item.
* @param {string} args.percent Percentage of the text node item.
* @param {number} args.percent Percentage of the text node item.
* @param {boolean=} args.hideProgress Whether to hide the progress bar.
* @param {string} args.progressBarColor The color of the progress bar.
* @param {string} args.progressBarBackgroundColor The color of the progress bar background.

View file

@ -1,3 +1,5 @@
// @ts-check
import { clampValue } from "./utils.js";
/**
@ -8,7 +10,7 @@ import { clampValue } from "./utils.js";
* @param {number} createProgressNodeParams.y Y-axis position.
* @param {number} createProgressNodeParams.width Width of progress bar.
* @param {string} createProgressNodeParams.color Progress color.
* @param {string} createProgressNodeParams.progress Progress value.
* @param {number} createProgressNodeParams.progress Progress value.
* @param {string} createProgressNodeParams.progressBarBackgroundColor Progress bar bg color.
* @param {number} createProgressNodeParams.delay Delay before animation starts.
* @returns {string} Progress node.