diff --git a/src/apps/stable/routes/user/userparentalcontrol.tsx b/src/apps/stable/routes/user/userparentalcontrol.tsx index bee0fde1c..691d8ed5e 100644 --- a/src/apps/stable/routes/user/userparentalcontrol.tsx +++ b/src/apps/stable/routes/user/userparentalcontrol.tsx @@ -143,7 +143,7 @@ const UserParentalControl: FunctionComponent = () => { for (const btnDelete of accessScheduleList.querySelectorAll('.btnDelete')) { btnDelete.addEventListener('click', function () { - const index = parseInt(btnDelete.getAttribute('data-index') || '0', 10); + const index = parseInt(btnDelete.getAttribute('data-index') ?? '0', 10); schedules.splice(index, 1); const newindex = schedules.filter(function (i: number) { return i != index; diff --git a/src/apps/stable/routes/user/userprofile.tsx b/src/apps/stable/routes/user/userprofile.tsx index 0c038bc84..04b31785b 100644 --- a/src/apps/stable/routes/user/userprofile.tsx +++ b/src/apps/stable/routes/user/userprofile.tsx @@ -102,7 +102,7 @@ const UserProfile: FunctionComponent = () => { const target = evt.target as HTMLInputElement; const file = (target.files as FileList)[0]; - if (!file || !file.type.match('image.*')) { + if (!/image.*/.exec(file?.type)) { return false; } diff --git a/src/components/ServerContentPage.tsx b/src/components/ServerContentPage.tsx index 5b86d6607..c808b7216 100644 --- a/src/components/ServerContentPage.tsx +++ b/src/components/ServerContentPage.tsx @@ -31,7 +31,7 @@ const ServerContentPage: FunctionComponent = ({ view }) viewManager.tryRestoreView(viewOptions) .catch(async (result?: RestoreViewFailResponse) => { - if (!result || !result.cancelled) { + if (!result?.cancelled) { const apiClient = ServerConnections.currentApiClient(); // Fetch the view html from the server and translate it diff --git a/src/components/alphaPicker/alphaPicker.js b/src/components/alphaPicker/alphaPicker.js index dd97c5907..a90e9a08a 100644 --- a/src/components/alphaPicker/alphaPicker.js +++ b/src/components/alphaPicker/alphaPicker.js @@ -179,7 +179,7 @@ export class AlphaPicker { if (item) { const prefix = item.getAttribute('data-prefix'); - if (prefix && prefix.length) { + if (prefix?.length) { itemFocusValue = prefix[0]; if (itemFocusTimeout) { clearTimeout(itemFocusTimeout);