Lint all files

This commit is contained in:
jeffvli 2023-07-01 19:10:05 -07:00
parent 22af76b4d6
commit 30e52ebb54
334 changed files with 76519 additions and 75932 deletions

View file

@ -1,23 +1,23 @@
export const constrainSidebarWidth = (num: number) => {
if (num < 260) {
return 260;
}
if (num < 260) {
return 260;
}
if (num > 400) {
return 400;
}
if (num > 400) {
return 400;
}
return num;
return num;
};
export const constrainRightSidebarWidth = (num: number) => {
if (num < 250) {
return 250;
}
if (num < 250) {
return 250;
}
if (num > 960) {
return 960;
}
if (num > 960) {
return 960;
}
return num;
return num;
};

View file

@ -1,24 +1,24 @@
import formatDuration from 'format-duration';
export const formatDurationString = (duration: number) => {
const rawDuration = formatDuration(duration).split(':');
const rawDuration = formatDuration(duration).split(':');
let string;
let string;
switch (rawDuration.length) {
case 1:
string = `${rawDuration[0]} sec`;
break;
case 2:
string = `${rawDuration[0]} min ${rawDuration[1]} sec`;
break;
case 3:
string = `${rawDuration[0]} hr ${rawDuration[1]} min ${rawDuration[2]} sec`;
break;
case 4:
string = `${rawDuration[0]} day ${rawDuration[1]} hr ${rawDuration[2]} min ${rawDuration[3]} sec`;
break;
}
switch (rawDuration.length) {
case 1:
string = `${rawDuration[0]} sec`;
break;
case 2:
string = `${rawDuration[0]} min ${rawDuration[1]} sec`;
break;
case 3:
string = `${rawDuration[0]} hr ${rawDuration[1]} min ${rawDuration[2]} sec`;
break;
case 4:
string = `${rawDuration[0]} day ${rawDuration[1]} hr ${rawDuration[2]} min ${rawDuration[3]} sec`;
break;
}
return string;
return string;
};

View file

@ -1,3 +1,3 @@
export const getHeaderColor = (rgbColor: string, opacity?: number) => {
return rgbColor.replace('rgb', 'rgba').replace(')', `, ${opacity || 0.8})`);
return rgbColor.replace('rgb', 'rgba').replace(')', `, ${opacity || 0.8})`);
};

View file

@ -1,4 +1,4 @@
export const normalizeServerUrl = (url: string) => {
// Remove trailing slash
return url.endsWith('/') ? url.slice(0, -1) : url;
// Remove trailing slash
return url.endsWith('/') ? url.slice(0, -1) : url;
};

View file

@ -2,16 +2,16 @@ import isUndefined from 'lodash/isUndefined';
import omitBy from 'lodash/omitBy';
export const parseSearchParams = (searchParams: Record<any, any>) => {
const params = new URLSearchParams();
const paramsWithoutUndefined = omitBy(searchParams, isUndefined);
const params = new URLSearchParams();
const paramsWithoutUndefined = omitBy(searchParams, isUndefined);
Object.entries(paramsWithoutUndefined).forEach(([key, value]) => {
if (!Array.isArray(value)) {
params.append(key, value.toString());
} else {
value.forEach((value) => params.append(key, value.toString()));
}
});
Object.entries(paramsWithoutUndefined).forEach(([key, value]) => {
if (!Array.isArray(value)) {
params.append(key, value.toString());
} else {
value.forEach((value) => params.append(key, value.toString()));
}
});
return params.toString();
return params.toString();
};

View file

@ -1,9 +1,9 @@
export const randomString = (length?: number) => {
const charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let string = '';
for (let i = 0; i < (length || 12); i += 1) {
const randomPoz = Math.floor(Math.random() * charSet.length);
string += charSet.substring(randomPoz, randomPoz + 1);
}
return string;
const charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let string = '';
for (let i = 0; i < (length || 12); i += 1) {
const randomPoz = Math.floor(Math.random() * charSet.length);
string += charSet.substring(randomPoz, randomPoz + 1);
}
return string;
};

View file

@ -1,10 +1,10 @@
export const setLocalStorageSettings = (type: 'player', object: any) => {
const settings = JSON.parse(localStorage.getItem('settings') || '{}');
const settings = JSON.parse(localStorage.getItem('settings') || '{}');
const newSettings = {
...settings,
[type]: { ...object },
};
const newSettings = {
...settings,
[type]: { ...object },
};
localStorage.setItem('settings', JSON.stringify(newSettings));
localStorage.setItem('settings', JSON.stringify(newSettings));
};

View file

@ -1,5 +1,5 @@
export const titleCase = (str: string) => {
return str.replace(/\w\S*/g, (txt) => {
return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase();
});
return str.replace(/\w\S*/g, (txt) => {
return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase();
});
};