From 3d7112b70217a1adbd1ae16c09b42538dd62b4ff Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Thu, 12 Jan 2023 12:45:07 -0700 Subject: [PATCH] ui: fix eslint --- resources/scripts/api/admin/databases/getDatabases.ts | 4 ++-- resources/scripts/api/admin/databases/searchDatabases.ts | 2 +- resources/scripts/api/admin/locations/getLocations.ts | 4 ++-- resources/scripts/api/admin/locations/searchLocations.ts | 2 +- resources/scripts/api/admin/mounts/getMounts.ts | 4 ++-- resources/scripts/api/admin/nests/getEggs.ts | 4 ++-- resources/scripts/api/admin/nests/getNests.ts | 4 ++-- .../scripts/api/admin/nodes/allocations/getAllocations.ts | 4 ++-- resources/scripts/api/admin/nodes/createNode.ts | 2 +- resources/scripts/api/admin/nodes/getAllocations.ts | 2 +- resources/scripts/api/admin/nodes/getNodes.ts | 4 ++-- resources/scripts/api/admin/nodes/updateNode.ts | 2 +- resources/scripts/api/admin/roles.ts | 6 +++--- resources/scripts/api/admin/servers/getServers.ts | 4 ++-- resources/scripts/api/admin/users.ts | 4 ++-- .../components/admin/servers/settings/NetworkingBox.tsx | 1 - resources/scripts/components/elements/SelectField.tsx | 2 +- .../scripts/components/elements/table/TFootPaginated.tsx | 1 - resources/scripts/helpers/extractSearchFilters.ts | 2 +- 19 files changed, 28 insertions(+), 30 deletions(-) diff --git a/resources/scripts/api/admin/databases/getDatabases.ts b/resources/scripts/api/admin/databases/getDatabases.ts index 622a3eadf..9c48af5dc 100644 --- a/resources/scripts/api/admin/databases/getDatabases.ts +++ b/resources/scripts/api/admin/databases/getDatabases.ts @@ -43,13 +43,13 @@ export default (include: string[] = []) => { const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } if (sort !== null) { - // @ts-ignore + // @ts-expect-error todo params.sort = (sortDirection ? '-' : '') + sort; } diff --git a/resources/scripts/api/admin/databases/searchDatabases.ts b/resources/scripts/api/admin/databases/searchDatabases.ts index 7a9bb9c38..09465cfd9 100644 --- a/resources/scripts/api/admin/databases/searchDatabases.ts +++ b/resources/scripts/api/admin/databases/searchDatabases.ts @@ -10,7 +10,7 @@ export default (filters?: Filters): Promise => { const params = {}; if (filters !== undefined) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } diff --git a/resources/scripts/api/admin/locations/getLocations.ts b/resources/scripts/api/admin/locations/getLocations.ts index f323a1c62..901e41512 100644 --- a/resources/scripts/api/admin/locations/getLocations.ts +++ b/resources/scripts/api/admin/locations/getLocations.ts @@ -33,13 +33,13 @@ export default (include: string[] = []) => { const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } if (sort !== null) { - // @ts-ignore + // @ts-expect-error todo params.sort = (sortDirection ? '-' : '') + sort; } diff --git a/resources/scripts/api/admin/locations/searchLocations.ts b/resources/scripts/api/admin/locations/searchLocations.ts index 88fab075f..226ff513c 100644 --- a/resources/scripts/api/admin/locations/searchLocations.ts +++ b/resources/scripts/api/admin/locations/searchLocations.ts @@ -10,7 +10,7 @@ export default (filters?: Filters): Promise => { const params = {}; if (filters !== undefined) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } diff --git a/resources/scripts/api/admin/mounts/getMounts.ts b/resources/scripts/api/admin/mounts/getMounts.ts index ba5c64dcd..285c49051 100644 --- a/resources/scripts/api/admin/mounts/getMounts.ts +++ b/resources/scripts/api/admin/mounts/getMounts.ts @@ -61,13 +61,13 @@ export default (include: string[] = []) => { const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } if (sort !== null) { - // @ts-ignore + // @ts-expect-error todo params.sort = (sortDirection ? '-' : '') + sort; } diff --git a/resources/scripts/api/admin/nests/getEggs.ts b/resources/scripts/api/admin/nests/getEggs.ts index 6fb586c55..92e402da8 100644 --- a/resources/scripts/api/admin/nests/getEggs.ts +++ b/resources/scripts/api/admin/nests/getEggs.ts @@ -17,13 +17,13 @@ export default (nestId: number, include: string[] = []) => { const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } if (sort !== null) { - // @ts-ignore + // @ts-expect-error todo params.sort = (sortDirection ? '-' : '') + sort; } diff --git a/resources/scripts/api/admin/nests/getNests.ts b/resources/scripts/api/admin/nests/getNests.ts index 702358eb6..4db9020f8 100644 --- a/resources/scripts/api/admin/nests/getNests.ts +++ b/resources/scripts/api/admin/nests/getNests.ts @@ -45,13 +45,13 @@ export default (include: string[] = []) => { const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } if (sort !== null) { - // @ts-ignore + // @ts-expect-error todo params.sort = (sortDirection ? '-' : '') + sort; } diff --git a/resources/scripts/api/admin/nodes/allocations/getAllocations.ts b/resources/scripts/api/admin/nodes/allocations/getAllocations.ts index e26bbf595..770195890 100644 --- a/resources/scripts/api/admin/nodes/allocations/getAllocations.ts +++ b/resources/scripts/api/admin/nodes/allocations/getAllocations.ts @@ -18,13 +18,13 @@ export default (id: number, include: string[] = []) => { const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } if (sort !== null) { - // @ts-ignore + // @ts-expect-error todo params.sort = (sortDirection ? '-' : '') + sort; } diff --git a/resources/scripts/api/admin/nodes/createNode.ts b/resources/scripts/api/admin/nodes/createNode.ts index 49f8447e3..64b27cfc7 100644 --- a/resources/scripts/api/admin/nodes/createNode.ts +++ b/resources/scripts/api/admin/nodes/createNode.ts @@ -30,7 +30,7 @@ export default (values: Values, include: string[] = []): Promise => { .replace('HTTP', 'Http') .replace('SFTP', 'Sftp') .replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`); - // @ts-ignore + // @ts-expect-error todo data[key2] = values[key]; }); diff --git a/resources/scripts/api/admin/nodes/getAllocations.ts b/resources/scripts/api/admin/nodes/getAllocations.ts index 217dfc8dc..4ff156f3d 100644 --- a/resources/scripts/api/admin/nodes/getAllocations.ts +++ b/resources/scripts/api/admin/nodes/getAllocations.ts @@ -51,7 +51,7 @@ export default (id: string | number, filters: Filters = {}, include: string[] = const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } diff --git a/resources/scripts/api/admin/nodes/getNodes.ts b/resources/scripts/api/admin/nodes/getNodes.ts index 6328896fa..50de61263 100644 --- a/resources/scripts/api/admin/nodes/getNodes.ts +++ b/resources/scripts/api/admin/nodes/getNodes.ts @@ -93,13 +93,13 @@ export default (include: string[] = []) => { const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } if (sort !== null) { - // @ts-ignore + // @ts-expect-error todo params.sort = (sortDirection ? '-' : '') + sort; } diff --git a/resources/scripts/api/admin/nodes/updateNode.ts b/resources/scripts/api/admin/nodes/updateNode.ts index 678f808f8..187ac6406 100644 --- a/resources/scripts/api/admin/nodes/updateNode.ts +++ b/resources/scripts/api/admin/nodes/updateNode.ts @@ -9,7 +9,7 @@ export default (id: number, node: Partial, include: string[] = []): Promis .replace('HTTP', 'Http') .replace('SFTP', 'Sftp') .replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`); - // @ts-ignore + // @ts-expect-error todo data[key2] = node[key]; }); diff --git a/resources/scripts/api/admin/roles.ts b/resources/scripts/api/admin/roles.ts index e0b7894e5..2dcd7bdb9 100644 --- a/resources/scripts/api/admin/roles.ts +++ b/resources/scripts/api/admin/roles.ts @@ -46,7 +46,7 @@ const searchRoles = (filters?: { name?: string }): Promise => { const params = {}; if (filters !== undefined) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } @@ -85,13 +85,13 @@ const getRoles = (include: string[] = []) => { const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } if (sort !== null) { - // @ts-ignore + // @ts-expect-error todo params.sort = (sortDirection ? '-' : '') + sort; } diff --git a/resources/scripts/api/admin/servers/getServers.ts b/resources/scripts/api/admin/servers/getServers.ts index acee06d7b..cef280319 100644 --- a/resources/scripts/api/admin/servers/getServers.ts +++ b/resources/scripts/api/admin/servers/getServers.ts @@ -170,13 +170,13 @@ export default (include: string[] = []) => { const params = {}; if (filters !== null) { Object.keys(filters).forEach(key => { - // @ts-ignore + // @ts-expect-error todo params['filter[' + key + ']'] = filters[key]; }); } if (sort !== null) { - // @ts-ignore + // @ts-expect-error todo params.sort = (sortDirection ? '-' : '') + sort; } diff --git a/resources/scripts/api/admin/users.ts b/resources/scripts/api/admin/users.ts index db0f62ed9..a26a73a92 100644 --- a/resources/scripts/api/admin/users.ts +++ b/resources/scripts/api/admin/users.ts @@ -58,7 +58,7 @@ const searchUserAccounts = async (params: QueryBuilderParams<'username' | 'email const createUser = (values: UpdateUserValues, include: string[] = []): Promise => { const data = {}; Object.keys(values).forEach(k => { - // @ts-ignore + // @ts-expect-error todo data[k.replace(/[A-Z]/g, l => `_${l.toLowerCase()}`)] = values[k]; }); @@ -76,7 +76,7 @@ const updateUser = (id: number, values: Partial, include: stri if (k === 'password' && values[k] === '') { return; } - // @ts-ignore + // @ts-expect-error todo data[k.replace(/[A-Z]/g, l => `_${l.toLowerCase()}`)] = values[k]; }); return new Promise((resolve, reject) => { diff --git a/resources/scripts/components/admin/servers/settings/NetworkingBox.tsx b/resources/scripts/components/admin/servers/settings/NetworkingBox.tsx index d3adcf060..67ebc2212 100644 --- a/resources/scripts/components/admin/servers/settings/NetworkingBox.tsx +++ b/resources/scripts/components/admin/servers/settings/NetworkingBox.tsx @@ -16,7 +16,6 @@ export default () => { const loadOptions = async (inputValue: string, callback: (options: Option[]) => void) => { if (!server) { - // eslint-disable-next-line node/no-callback-literal callback([] as Option[]); return; } diff --git a/resources/scripts/components/elements/SelectField.tsx b/resources/scripts/components/elements/SelectField.tsx index bac0cb1b4..3a5ebdaf3 100644 --- a/resources/scripts/components/elements/SelectField.tsx +++ b/resources/scripts/components/elements/SelectField.tsx @@ -1,6 +1,6 @@ import { CSSObject } from '@emotion/serialize'; import { Field as FormikField, FieldProps } from 'formik'; -import React, { forwardRef } from 'react'; +import { forwardRef } from 'react'; import Select, { ContainerProps, ControlProps, diff --git a/resources/scripts/components/elements/table/TFootPaginated.tsx b/resources/scripts/components/elements/table/TFootPaginated.tsx index 371dbe902..2ad70f224 100644 --- a/resources/scripts/components/elements/table/TFootPaginated.tsx +++ b/resources/scripts/components/elements/table/TFootPaginated.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { PaginationDataSet } from '@/api/http'; const TFootPaginated = ({ pagination, span }: { span: number; pagination: PaginationDataSet }) => { diff --git a/resources/scripts/helpers/extractSearchFilters.ts b/resources/scripts/helpers/extractSearchFilters.ts index f01486116..352574f16 100644 --- a/resources/scripts/helpers/extractSearchFilters.ts +++ b/resources/scripts/helpers/extractSearchFilters.ts @@ -42,7 +42,7 @@ const extractSearchFilters = ( return { filters: {} }; } - // @ts-expect-error + // @ts-expect-error todo return { filters: Object.fromEntries(filters) }; };