Improve code quality

Fix lint warnings
This commit is contained in:
Przemek Więch
2026-05-10 21:56:51 +02:00
parent ea82bc4c98
commit 8202c9cd05
29 changed files with 315 additions and 221 deletions

View File

@@ -54,7 +54,7 @@ const SEX_ARG = new Map<string, Sex>([
const SEX_ARG_INVERSE = new Map<Sex, string>();
SEX_ARG.forEach((v, k) => SEX_ARG_INVERSE.set(v, k));
export function argsToConfig(args: ParsedQuery<any>): Config {
export function argsToConfig(args: ParsedQuery<unknown>): Config {
const getParam = (name: string) => {
const value = args[name];
return typeof value === 'string' ? value : undefined;
@@ -67,12 +67,21 @@ export function argsToConfig(args: ParsedQuery<any>): Config {
};
}
export function configToArgs(config: Config): ParsedQuery<any> {
return {
c: COLOR_ARG_INVERSE.get(config.color),
i: ID_ARG_INVERSE.get(config.id),
s: SEX_ARG_INVERSE.get(config.sex),
};
export function configToArgs(config: Config): ParsedQuery {
const result: ParsedQuery = {};
const color = COLOR_ARG_INVERSE.get(config.color);
if (color){
result.c = color;
}
const id = ID_ARG_INVERSE.get(config.id);
if (id) {
result.i = id;
}
const sex = SEX_ARG_INVERSE.get(config.sex);
if (sex) {
result.s = sex;
}
return result;
}
export function ConfigPanel(props: {