From b3bf86ca849a02e35e49596417a0ecf27e43d9ed Mon Sep 17 00:00:00 2001 From: olav Date: Thu, 3 Mar 2022 10:01:04 +0100 Subject: [PATCH] refactor: expect existing TS errors (#767) * refactor: expect existing TS errors * refactor: fail build on new TS errors --- frontend/.env | 1 - .../AddonParameter/AddonParameter.tsx | 2 + .../AddonParameters/AddonParameters.tsx | 1 + .../component/addons/EditAddon/EditAddon.tsx | 3 +- .../api-token/ApiTokenForm/ApiTokenForm.tsx | 3 ++ .../EditProjectRole/EditProjectRole.tsx | 1 + .../ProjectRoleList/ProjectRoleList.tsx | 2 + .../ProjectRoleListItem.tsx | 3 ++ .../project-roles/hooks/useProjectRoleForm.ts | 8 ++++ .../admin/users/UserForm/UserForm.tsx | 2 + .../ChangePassword/ChangePassword.tsx | 12 +++++ .../admin/users/UsersList/UsersList.tsx | 4 ++ .../admin/users/hooks/useAddUserForm.ts | 1 + .../EnvironmentStrategyDialog.tsx | 1 + frontend/src/component/common/Input/Input.tsx | 2 + .../ListPlaceholder/ListPlaceholder.tsx | 1 + .../NoItemsStrategies/NoItemsStrategies.tsx | 1 + .../PermissionButton/PermissionButton.tsx | 1 + .../PermissionIconButton.tsx | 1 + .../ResponsiveButton/ResponsiveButton.tsx | 2 + .../component/common/TagSelect/TagSelect.tsx | 21 +++++---- .../EnvironmentListItem.tsx | 1 + .../feature/CreateFeature/CreateFeature.tsx | 1 + .../feature/FeatureForm/FeatureForm.tsx | 2 + .../FeatureToggleListNewItem.tsx | 1 + .../FeatureOverviewEnvSwitch.tsx | 3 ++ .../FeatureOverviewEnvironment.tsx | 4 ++ .../FeatureOverviewEnvironmentMetrics.tsx | 1 + .../FeatureOverviewEnvironmentStrategy.tsx | 1 + .../FeatureOverviewMetaData.tsx | 3 ++ .../FeatureOverviewTags.tsx | 46 ++++++++++--------- .../FeatureSettingsMetadata.tsx | 1 + .../FeatureTypeSelect/FeatureTypeSelect.tsx | 26 +++++++---- .../FeatureProjectSelect.tsx | 4 ++ .../FeatureSettingsProject.tsx | 1 + .../FeatureSettingsProjectConfirm.tsx | 2 + .../FeatureStrategiesConfigure.tsx | 8 ++++ .../FeatureStrategiesCreateHeader.tsx | 1 + .../FeatureStrategiesEnvironmentList.tsx | 13 +++++- .../useFeatureStrategiesEnvironmentList.ts | 11 +++++ .../FeatureStrategiesEnvironments.tsx | 17 +++++++ .../FeatureStrategyEditable.tsx | 10 ++++ .../FeatureStrategiesList.tsx | 2 + .../FeatureStrategyCard.tsx | 3 +- .../FeatureStrategyAccordion.tsx | 1 + .../FeatureStrategyAccordionBody.tsx | 6 +++ .../FlexibleStrategy/FlexibleStrategy.tsx | 3 ++ .../GeneralStrategy/GeneralStrategy.tsx | 7 +++ .../StrategyConstraints.tsx | 3 ++ .../StrategyInputList/StrategyInputList.tsx | 7 +++ .../AddFeatureVariant/AddFeatureVariant.tsx | 5 ++ .../FeatureVariantsList.tsx | 8 ++++ .../feature/FeatureView/FeatureView.tsx | 1 + .../src/component/project/Project/Project.tsx | 1 + .../Project/ProjectInfo/ProjectInfo.tsx | 1 + .../ProjectAccessListItem.tsx | 1 + .../project/ProjectCard/ProjectCard.tsx | 3 ++ .../providers/SWRProvider/SWRProvider.tsx | 2 + .../StrategiesList/StrategiesList.styles.ts | 1 + .../strategies/StrategyForm/StrategyForm.tsx | 1 + .../strategies/StrategyView/StrategyView.tsx | 2 + .../ForgottenPassword/ForgottenPassword.tsx | 3 +- .../StandaloneBanner/StandaloneBanner.tsx | 2 + .../PasswordChecker/PasswordChecker.styles.ts | 1 + .../actions/useContextsApi/useContextsApi.ts | 3 +- .../api/getters/useProject/useProject.ts | 1 + .../src/hooks/usePersistentGlobalState.ts | 2 +- 67 files changed, 253 insertions(+), 47 deletions(-) delete mode 100644 frontend/.env diff --git a/frontend/.env b/frontend/.env deleted file mode 100644 index 991f007c42..0000000000 --- a/frontend/.env +++ /dev/null @@ -1 +0,0 @@ -TSC_COMPILE_ON_ERROR=true diff --git a/frontend/src/component/addons/AddonForm/AddonParameters/AddonParameter/AddonParameter.tsx b/frontend/src/component/addons/AddonForm/AddonParameters/AddonParameter/AddonParameter.tsx index 40441955f8..67824c586d 100644 --- a/frontend/src/component/addons/AddonForm/AddonParameters/AddonParameter/AddonParameter.tsx +++ b/frontend/src/component/addons/AddonForm/AddonParameters/AddonParameter/AddonParameter.tsx @@ -33,6 +33,7 @@ export const AddonParameter = ({ }: IAddonParameterProps) => { const value = config.parameters[definition.name] || ''; const type = resolveType(definition, value); + // @ts-expect-error const error = errors.parameters[definition.name]; return ( @@ -51,6 +52,7 @@ export const AddonParameter = ({ }} value={value} error={error} + // @ts-expect-error onChange={setParameterValue(definition.name)} variant="outlined" helperText={definition.description} diff --git a/frontend/src/component/addons/AddonForm/AddonParameters/AddonParameters.tsx b/frontend/src/component/addons/AddonForm/AddonParameters/AddonParameters.tsx index 10536f5bd2..8648817c85 100644 --- a/frontend/src/component/addons/AddonForm/AddonParameters/AddonParameters.tsx +++ b/frontend/src/component/addons/AddonForm/AddonParameters/AddonParameters.tsx @@ -30,6 +30,7 @@ export const AddonParameters = ({

) : null} {provider.parameters.map(parameter => ( + // @ts-expect-error { (addon: IAddon) => addon.id === Number(addonId) ) || { ...cloneDeep(DEFAULT_DATA) }; const provider = addon - ? providers.find(provider => provider.name === addon.provider) + ? // @ts-expect-error + providers.find(provider => provider.name === addon.provider) : undefined; return ( diff --git a/frontend/src/component/admin/api-token/ApiTokenForm/ApiTokenForm.tsx b/frontend/src/component/admin/api-token/ApiTokenForm/ApiTokenForm.tsx index d51d191c3f..ef62565172 100644 --- a/frontend/src/component/admin/api-token/ApiTokenForm/ApiTokenForm.tsx +++ b/frontend/src/component/admin/api-token/ApiTokenForm/ApiTokenForm.tsx @@ -92,6 +92,7 @@ const ApiTokenForm: React.FC = ({ label="Token Type" id="api_key_type" name="type" + // @ts-expect-error IconComponent={KeyboardArrowDownOutlined} className={styles.selectInput} /> @@ -104,6 +105,7 @@ const ApiTokenForm: React.FC = ({ options={selectableProjects} onChange={e => setProject(e.target.value as string)} label="Project" + // @ts-expect-error IconComponent={KeyboardArrowDownOutlined} className={styles.selectInput} /> @@ -118,6 +120,7 @@ const ApiTokenForm: React.FC = ({ label="Environment" id="api_key_environment" name="environment" + // @ts-expect-error IconComponent={KeyboardArrowDownOutlined} className={styles.selectInput} /> diff --git a/frontend/src/component/admin/project-roles/EditProjectRole/EditProjectRole.tsx b/frontend/src/component/admin/project-roles/EditProjectRole/EditProjectRole.tsx index 5f30eda6bb..dff08acfc6 100644 --- a/frontend/src/component/admin/project-roles/EditProjectRole/EditProjectRole.tsx +++ b/frontend/src/component/admin/project-roles/EditProjectRole/EditProjectRole.tsx @@ -42,6 +42,7 @@ const EditProjectRole = () => { useEffect(() => { const initialCheckedPermissions = role?.permissions?.reduce( (acc: { [key: string]: IPermission }, curr: IPermission) => { + // @ts-expect-error acc[getRoleKey(curr)] = curr; return acc; }, diff --git a/frontend/src/component/admin/project-roles/ProjectRoles/ProjectRoleList/ProjectRoleList.tsx b/frontend/src/component/admin/project-roles/ProjectRoles/ProjectRoleList/ProjectRoleList.tsx index d29839ab83..718f5bbc7c 100644 --- a/frontend/src/component/admin/project-roles/ProjectRoles/ProjectRoleList/ProjectRoleList.tsx +++ b/frontend/src/component/admin/project-roles/ProjectRoles/ProjectRoleList/ProjectRoleList.tsx @@ -61,6 +61,7 @@ const ProjectRoleList = () => { name={role.name} type={role.type} description={role.description} + // @ts-expect-error setCurrentRole={setCurrentRole} setDelDialog={setDelDialog} /> @@ -94,6 +95,7 @@ const ProjectRoleList = () => {
{ history.push(`/admin/roles/${id}/edit`); @@ -62,8 +63,10 @@ const RoleListItem = ({ { + // @ts-expect-error setCurrentRole({ id, name, description }); setDelDialog(true); }} diff --git a/frontend/src/component/admin/project-roles/hooks/useProjectRoleForm.ts b/frontend/src/component/admin/project-roles/hooks/useProjectRoleForm.ts index 12285388a1..bd45e9a0bc 100644 --- a/frontend/src/component/admin/project-roles/hooks/useProjectRoleForm.ts +++ b/frontend/src/component/admin/project-roles/hooks/useProjectRoleForm.ts @@ -43,6 +43,7 @@ const useProjectRoleForm = ( ) => { const formattedInitialCheckedPermissions = isAllEnvironmentPermissionsChecked( + // @ts-expect-error isAllProjectPermissionsChecked(initialCheckedPermissions) ); @@ -59,6 +60,7 @@ const useProjectRoleForm = ( }); if (isAllChecked) { + // @ts-expect-error initialCheckedPermissions[PROJECT_CHECK_ALL_KEY] = true; } else { delete initialCheckedPermissions[PROJECT_CHECK_ALL_KEY]; @@ -82,6 +84,7 @@ const useProjectRoleForm = ( const key = `${ENVIRONMENT_CHECK_ALL_KEY}-${env.name}`; if (isAllChecked) { + // @ts-expect-error initialCheckedPermissions[key] = true; } else { delete initialCheckedPermissions[key]; @@ -109,10 +112,12 @@ const useProjectRoleForm = ( } if (type === 'project') { + // @ts-expect-error checkedPermissionsCopy = isAllProjectPermissionsChecked( checkedPermissionsCopy ); } else { + // @ts-expect-error checkedPermissionsCopy = isAllEnvironmentPermissionsChecked( checkedPermissionsCopy ); @@ -141,6 +146,7 @@ const useProjectRoleForm = ( }; if (lastItem) { + // @ts-expect-error checkedPermissionsCopy[PROJECT_CHECK_ALL_KEY] = true; } } @@ -173,6 +179,7 @@ const useProjectRoleForm = ( }; if (lastItem) { + // @ts-expect-error checkedPermissionsCopy[environmentCheckAllKey] = true; } } @@ -204,6 +211,7 @@ const useProjectRoleForm = ( try { await validateRole(payload); } catch (e) { + // @ts-expect-error if (e.toString().includes(NAME_EXISTS_ERROR)) { setErrors(prev => ({ ...prev, diff --git a/frontend/src/component/admin/users/UserForm/UserForm.tsx b/frontend/src/component/admin/users/UserForm/UserForm.tsx index 5be7092c79..369418c3d3 100644 --- a/frontend/src/component/admin/users/UserForm/UserForm.tsx +++ b/frontend/src/component/admin/users/UserForm/UserForm.tsx @@ -51,6 +51,7 @@ const UserForm: React.FC = ({ const { roles } = useUsers(); const { bootstrap } = useUiBootstrap(); + // @ts-expect-error const sortRoles = (a, b) => { if (b.name[0] < a.name[0]) { return 1; @@ -102,6 +103,7 @@ const UserForm: React.FC = ({ onChange={e => setRootRole(+e.target.value)} data-loading > + {/* @ts-expect-error */} {roles.sort(sortRoles).map(role => ( { setError({}); setData({ @@ -37,10 +38,12 @@ const ChangePassword = ({ }); }; + // @ts-expect-error const submit = async e => { e.preventDefault(); if (!validPassword) { + // @ts-expect-error if (!data.password || data.password.length < 8) { setError({ password: @@ -48,6 +51,7 @@ const ChangePassword = ({ }); return; } + // @ts-expect-error if (!(data.password === data.confirm)) { setError({ confirm: 'Passwords does not match' }); return; @@ -55,15 +59,18 @@ const ChangePassword = ({ } try { + // @ts-expect-error await changePassword(user, data.password); setData({}); closeDialog(); } catch (error) { + // @ts-expect-error const msg = error.message || 'Could not update password'; setError({ general: msg }); } }; + // @ts-expect-error const onCancel = e => { e.preventDefault(); setData({}); @@ -111,6 +118,7 @@ const ChangePassword = ({ @@ -118,6 +126,7 @@ const ChangePassword = ({ label="New password" name="password" type="password" + // @ts-expect-error value={data.password} helperText={error.password} onChange={updateField} @@ -128,6 +137,7 @@ const ChangePassword = ({ label="Confirm password" name="confirm" type="password" + // @ts-expect-error value={data.confirm} error={error.confirm !== undefined} helperText={error.confirm} @@ -136,7 +146,9 @@ const ChangePassword = ({ size="small" /> diff --git a/frontend/src/component/admin/users/UsersList/UsersList.tsx b/frontend/src/component/admin/users/UsersList/UsersList.tsx index 9d0d6208ba..ed28ea807a 100644 --- a/frontend/src/component/admin/users/UsersList/UsersList.tsx +++ b/frontend/src/component/admin/users/UsersList/UsersList.tsx @@ -73,6 +73,7 @@ const UsersList = () => { const onDeleteUser = async () => { try { + // @ts-expect-error await removeUser(delUser); setToastData({ title: `${delUser?.name} has been deleted`, @@ -113,6 +114,7 @@ const UsersList = () => { return page.map(user => { return ( { diff --git a/frontend/src/component/admin/users/hooks/useAddUserForm.ts b/frontend/src/component/admin/users/hooks/useAddUserForm.ts index c13e1a1554..7d1bbbd937 100644 --- a/frontend/src/component/admin/users/hooks/useAddUserForm.ts +++ b/frontend/src/component/admin/users/hooks/useAddUserForm.ts @@ -54,6 +54,7 @@ const useCreateUserForm = ( }; const validateEmail = () => { + // @ts-expect-error if (users.some(user => user['email'] === email)) { setErrors(prev => ({ ...prev, email: 'Email already exists' })); return false; diff --git a/frontend/src/component/common/EnvironmentStrategiesDialog/EnvironmentStrategyDialog.tsx b/frontend/src/component/common/EnvironmentStrategiesDialog/EnvironmentStrategyDialog.tsx index 2a158ee38d..5338c757fc 100644 --- a/frontend/src/component/common/EnvironmentStrategiesDialog/EnvironmentStrategyDialog.tsx +++ b/frontend/src/component/common/EnvironmentStrategiesDialog/EnvironmentStrategyDialog.tsx @@ -23,6 +23,7 @@ const EnvironmentStrategyDialog = ({ const strategiesLink = `/projects/${projectId}/features/${featureId}/strategies?environment=${environmentName}&addStrategy=true`; return ( + // @ts-expect-error { {text} Add your first toggle} /> diff --git a/frontend/src/component/common/NoItems/NoItemsStrategies/NoItemsStrategies.tsx b/frontend/src/component/common/NoItems/NoItemsStrategies/NoItemsStrategies.tsx index 9abbcae0fb..103d6294d4 100644 --- a/frontend/src/component/common/NoItems/NoItemsStrategies/NoItemsStrategies.tsx +++ b/frontend/src/component/common/NoItems/NoItemsStrategies/NoItemsStrategies.tsx @@ -48,6 +48,7 @@ const NoItemsStrategies = ({ condition={Boolean(onClick)} show={ = ({ onClick={onClick} disabled={disabled || !access} variant="contained" + // @ts-expect-error color="primary" {...rest} endIcon={ diff --git a/frontend/src/component/common/PermissionIconButton/PermissionIconButton.tsx b/frontend/src/component/common/PermissionIconButton/PermissionIconButton.tsx index f4a78c7615..172931613a 100644 --- a/frontend/src/component/common/PermissionIconButton/PermissionIconButton.tsx +++ b/frontend/src/component/common/PermissionIconButton/PermissionIconButton.tsx @@ -46,6 +46,7 @@ const PermissionIconButton: React.FC = ({ return ( + {/* @ts-expect-error */} {children} diff --git a/frontend/src/component/common/ResponsiveButton/ResponsiveButton.tsx b/frontend/src/component/common/ResponsiveButton/ResponsiveButton.tsx index abbc1dd614..42effae513 100644 --- a/frontend/src/component/common/ResponsiveButton/ResponsiveButton.tsx +++ b/frontend/src/component/common/ResponsiveButton/ResponsiveButton.tsx @@ -35,6 +35,7 @@ const ResponsiveButton: React.FC = ({ condition={smallScreen} show={ = ({ permission={permission} projectId={projectId} color="primary" + // @ts-expect-error variant="contained" disabled={disabled} environmentId={environmentId} diff --git a/frontend/src/component/common/TagSelect/TagSelect.tsx b/frontend/src/component/common/TagSelect/TagSelect.tsx index 59a572f838..ea7d66ab1c 100644 --- a/frontend/src/component/common/TagSelect/TagSelect.tsx +++ b/frontend/src/component/common/TagSelect/TagSelect.tsx @@ -17,15 +17,18 @@ const TagSelect = ({ value, onChange, ...rest }: ITagSelect) => { })); return ( - + <> + {/* @ts-expect-error */} + + ); }; diff --git a/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx b/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx index 45d1a207de..4a82ec50f7 100644 --- a/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx +++ b/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx @@ -122,6 +122,7 @@ const EnvironmentListItem = ({ } return ( + // @ts-expect-error { if (validToggleName) { const payload = getTogglePayload(); try { + // @ts-expect-error await createFeatureToggle(project, payload); history.push(`/projects/${project}/features/${name}`); setToastData({ diff --git a/frontend/src/component/feature/FeatureForm/FeatureForm.tsx b/frontend/src/component/feature/FeatureForm/FeatureForm.tsx index a920a34c6e..1e75297b7b 100644 --- a/frontend/src/component/feature/FeatureForm/FeatureForm.tsx +++ b/frontend/src/component/feature/FeatureForm/FeatureForm.tsx @@ -92,6 +92,7 @@ const FeatureForm: React.FC = ({

setType(e.target.value)} label={'Toggle type'} id="feature-type-select" @@ -121,6 +122,7 @@ const FeatureForm: React.FC = ({ }} enabled={editable} filter={projectFilterGenerator(permissions, CREATE_FEATURE)} + // @ts-expect-error IconComponent={KeyboardArrowDownOutlined} className={styles.selectInput} /> diff --git a/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNewItem/FeatureToggleListNewItem.tsx b/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNewItem/FeatureToggleListNewItem.tsx index e5c27fa97b..24f6912a29 100644 --- a/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNewItem/FeatureToggleListNewItem.tsx +++ b/frontend/src/component/feature/FeatureToggleListNew/FeatureToggleListNewItem/FeatureToggleListNewItem.tsx @@ -113,6 +113,7 @@ const FeatureToggleListNewItem = ({ onClick={onClick} > diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvSwitches/FeatureOverviewEnvSwitch/FeatureOverviewEnvSwitch.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvSwitches/FeatureOverviewEnvSwitch/FeatureOverviewEnvSwitch.tsx index 2ec938d3df..092859fa32 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvSwitches/FeatureOverviewEnvSwitch/FeatureOverviewEnvSwitch.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvSwitches/FeatureOverviewEnvSwitch/FeatureOverviewEnvSwitch.tsx @@ -43,9 +43,12 @@ const FeatureOverviewEnvSwitch = ({ callback(); } } catch (e) { + // @ts-expect-error if (e.message === ENVIRONMENT_STRATEGY_ERROR) { + // @ts-expect-error showInfoBox(true); } else { + // @ts-expect-error setToastApiError(e.message); } } diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironment.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironment.tsx index 788ba43819..a223cd5de1 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironment.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironment.tsx @@ -73,6 +73,7 @@ const FeatureOverviewEnvironment = ({ } else { acc[current.name] = { count: 1, + // @ts-expect-error Icon: getFeatureStrategyIcon(current.name), }; } @@ -146,6 +147,7 @@ const FeatureOverviewEnvironment = ({ styles.strategyIconContainer } > + {/* @ts-expect-error */} 0 } show={ diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironmentMetrics/FeatureOverviewEnvironmentMetrics.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironmentMetrics/FeatureOverviewEnvironmentMetrics.tsx index 5ac9cac595..e3742b815b 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironmentMetrics/FeatureOverviewEnvironmentMetrics.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironmentMetrics/FeatureOverviewEnvironmentMetrics.tsx @@ -54,6 +54,7 @@ const FeatureOverviewEnvironmentMetrics = ({

diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewMetaData/FeatureOverviewMetaData.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewMetaData/FeatureOverviewMetaData.tsx index f493ffdb31..327b20aabf 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewMetaData/FeatureOverviewMetaData.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewMetaData/FeatureOverviewMetaData.tsx @@ -39,6 +39,7 @@ const FeatureOverviewMetaData = () => { Project: {project}
@@ -48,6 +49,7 @@ const FeatureOverviewMetaData = () => { @@ -63,6 +65,7 @@ const FeatureOverviewMetaData = () => { diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewMetaData/FeatureOverviewTags/FeatureOverviewTags.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewMetaData/FeatureOverviewTags/FeatureOverviewTags.tsx index 7b3570e72d..85f05aec6b 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewMetaData/FeatureOverviewTags/FeatureOverviewTags.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/FeatureOverviewMetaData/FeatureOverviewTags/FeatureOverviewTags.tsx @@ -98,6 +98,7 @@ const FeatureOverviewTags: React.FC = ({ } }; + // @ts-expect-error const renderTag = t => ( = ({ ); return ( -
- { - setShowDelDialog(false); - setSelectedTag({ type: '', value: '' }); - }} - onClick={() => { - setShowDelDialog(false); - handleDelete(); - setSelectedTag({ type: '', value: '' }); - }} - title="Are you sure you want to delete this tag?" - /> - -
- 0} - show={tags.map(renderTag)} - elseShow={

No tags to display

} + <> + {/* @ts-expect-error */} +
+ { + setShowDelDialog(false); + setSelectedTag({ type: '', value: '' }); + }} + onClick={() => { + setShowDelDialog(false); + handleDelete(); + setSelectedTag({ type: '', value: '' }); + }} + title="Are you sure you want to delete this tag?" /> + +
+ 0} + show={tags.map(renderTag)} + elseShow={

No tags to display

} + /> +
-
+ ); }; diff --git a/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsMetadata/FeatureSettingsMetadata.tsx b/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsMetadata/FeatureSettingsMetadata.tsx index 204431e32e..196b0868c7 100644 --- a/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsMetadata/FeatureSettingsMetadata.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsMetadata/FeatureSettingsMetadata.tsx @@ -65,6 +65,7 @@ const FeatureSettingsMetadata = () => { setType(e.target.value)} label="Feature type" editable={editable} diff --git a/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsMetadata/FeatureTypeSelect/FeatureTypeSelect.tsx b/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsMetadata/FeatureTypeSelect/FeatureTypeSelect.tsx index 2e926f795f..471c2e0a7f 100644 --- a/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsMetadata/FeatureTypeSelect/FeatureTypeSelect.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsMetadata/FeatureTypeSelect/FeatureTypeSelect.tsx @@ -4,10 +4,15 @@ import GeneralSelect, { } from '../../../../../common/GeneralSelect/GeneralSelect'; const FeatureTypeSelect = ({ + // @ts-expect-error editable, + // @ts-expect-error value, + // @ts-expect-error id, + // @ts-expect-error label, + // @ts-expect-error onChange, ...rest }) => { @@ -24,15 +29,18 @@ const FeatureTypeSelect = ({ } return ( - + <> + {/* @ts-expect-error */} + + ); }; diff --git a/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsProject/FeatureProjectSelect/FeatureProjectSelect.tsx b/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsProject/FeatureProjectSelect/FeatureProjectSelect.tsx index 654f7136c4..71c222c71b 100644 --- a/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsProject/FeatureProjectSelect/FeatureProjectSelect.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsProject/FeatureProjectSelect/FeatureProjectSelect.tsx @@ -36,18 +36,22 @@ const FeatureProjectSelect = ({ .filter(project => { return filter(project.id); }) + // @ts-expect-error .map(formatOption); } else { + // @ts-expect-error options = projects.map(formatOption); } if (value && !options.find(o => o.key === value)) { + // @ts-expect-error options.push({ key: value, label: value }); } return ( { setProject(e.target.value)} + // @ts-expect-error label="Project" enabled={editable} filter={filterProjects()} diff --git a/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsProject/FeatureSettingsProjectConfirm/FeatureSettingsProjectConfirm.tsx b/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsProject/FeatureSettingsProjectConfirm/FeatureSettingsProjectConfirm.tsx index 1f73b0d098..d57a4f07dc 100644 --- a/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsProject/FeatureSettingsProjectConfirm/FeatureSettingsProjectConfirm.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureSettings/FeatureSettingsProject/FeatureSettingsProjectConfirm/FeatureSettingsProjectConfirm.tsx @@ -50,6 +50,7 @@ const FeatureSettingsProjectConfirm = ({ incompatible = [...incompatible, env]; } }); + // @ts-expect-error setIncompatibleEnvs(incompatible); }; @@ -77,6 +78,7 @@ const FeatureSettingsProjectConfirm = ({
} elseShow={ + // @ts-expect-error { ); const styles = useStyles(); const { + // @ts-expect-error activeEnvironment, + // @ts-expect-error setConfigureNewStrategy, + // @ts-expect-error configureNewStrategy, + // @ts-expect-error setExpandedSidebar, + // @ts-expect-error featureCache, + // @ts-expect-error setFeatureCache, } = useContext(FeatureStrategiesUIContext); @@ -83,6 +89,7 @@ const FeatureStrategiesConfigure = () => { const feature = cloneDeep(featureCache); const environment = feature.environments.find( + // @ts-expect-error env => env.name === activeEnvironment.name ); @@ -123,6 +130,7 @@ const FeatureStrategiesConfigure = () => { { const styles = useStyles(); + // @ts-expect-error const { expandedSidebar, configureNewStrategy, activeEnvironment } = useContext(FeatureStrategiesUIContext); diff --git a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironmentList/FeatureStrategiesEnvironmentList.tsx b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironmentList/FeatureStrategiesEnvironmentList.tsx index 5b03e163a5..c996d352c5 100644 --- a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironmentList/FeatureStrategiesEnvironmentList.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironmentList/FeatureStrategiesEnvironmentList.tsx @@ -52,6 +52,7 @@ const FeatureStrategiesEnvironmentList = ({ featureId, activeEnvironment, updateFeatureEnvironmentCache, + // @ts-expect-error } = useFeatureStrategiesEnvironmentList(strategies); const [{ isOver }, drop] = useDrop({ @@ -86,19 +87,26 @@ const FeatureStrategiesEnvironmentList = ({ const productionGuardMarkup = useProductionGuardMarkup({ show: productionGuard.show, onClick: () => { + // @ts-expect-error updateStrategy(productionGuard.strategy); + // @ts-expect-error productionGuard.callback(); setProductionGuard({ show: false, + // @ts-expect-error strategy: null, }); }, onClose: () => + // @ts-expect-error setProductionGuard({ show: false, strategy: null, callback: null }), }); + // @ts-expect-error const resolveUpdateStrategy = (strategy: IFeatureStrategy, callback) => { + // @ts-expect-error if (activeEnvironmentsRef?.current?.type === PRODUCTION && !dontShow) { + // @ts-expect-error setProductionGuard({ show: true, strategy, callback }); return; } @@ -115,6 +123,7 @@ const FeatureStrategiesEnvironmentList = ({ @@ -128,6 +137,7 @@ const FeatureStrategiesEnvironmentList = ({ key={strategy.id} setDelDialog={setDelDialog} currentStrategy={strategy} + // @ts-expect-error updateStrategy={resolveUpdateStrategy} index={index} /> @@ -141,6 +151,7 @@ const FeatureStrategiesEnvironmentList = ({ }); const strategiesContainerClasses = classnames({ + // @ts-expect-error [styles.strategiesContainer]: !expandedSidebar, }); @@ -153,7 +164,7 @@ const FeatureStrategiesEnvironmentList = ({ condition={!expandedSidebar} show={
-
+
{ useFeatureStrategyApi(); const { + // @ts-expect-error setConfigureNewStrategy, + // @ts-expect-error configureNewStrategy, + // @ts-expect-error activeEnvironment, + // @ts-expect-error setExpandedSidebar, + // @ts-expect-error expandedSidebar, + // @ts-expect-error setFeatureCache, + // @ts-expect-error featureCache, } = useContext(FeatureStrategiesUIContext); @@ -78,10 +85,12 @@ const useFeatureStrategiesEnvironmentList = () => { const feature = cloneDeep(featureCache); const environment = feature.environments.find( + // @ts-expect-error env => env.name === activeEnvironment.name ); const strategy = environment.strategies.find( + // @ts-expect-error strategy => strategy.id === updatedStrategy.id ); @@ -106,9 +115,11 @@ const useFeatureStrategiesEnvironmentList = () => { const feature = cloneDeep(featureCache); const environment = feature.environments.find( + // @ts-expect-error env => env.name === environmentId ); const strategyIdx = environment.strategies.findIndex( + // @ts-expect-error strategy => strategy.id === strategyId ); diff --git a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironments.tsx b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironments.tsx index 0cc45cf4e0..364c4c432e 100644 --- a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironments.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironments.tsx @@ -42,12 +42,19 @@ const FeatureStrategiesEnvironments = () => { const { a11yProps, activeTabIdx, setActiveTab } = useTabs(startingTabId); const { + // @ts-expect-error setActiveEnvironment, + // @ts-expect-error activeEnvironment, + // @ts-expect-error configureNewStrategy, + // @ts-expect-error expandedSidebar, + // @ts-expect-error setExpandedSidebar, + // @ts-expect-error featureCache, + // @ts-expect-error setFeatureCache, } = useContext(FeatureStrategiesUIContext); @@ -105,6 +112,7 @@ const FeatureStrategiesEnvironments = () => { if (!feature) return null; const renderTabs = () => { + // @ts-expect-error return featureCache?.environments?.map((env, index) => { return ( { feature?.environments?.forEach(env => { const cachedEnv = featureCache?.environments?.find( + // @ts-expect-error cacheEnv => cacheEnv.name === env.name ); @@ -140,6 +149,7 @@ const FeatureStrategiesEnvironments = () => { return; } // If displayName is different + // @ts-expect-error if (env?.displayName !== cachedEnv?.displayName) { equal = false; return; @@ -155,6 +165,7 @@ const FeatureStrategiesEnvironments = () => { feature?.environments?.forEach(env => { const cachedEnv = featureCache?.environments?.find( + // @ts-expect-error cachedEnv => cachedEnv.name === env.name ); @@ -167,14 +178,17 @@ const FeatureStrategiesEnvironments = () => { env?.strategies?.forEach(strategy => { const cachedStrategy = cachedEnv?.strategies?.find( + // @ts-expect-error cachedStrategy => cachedStrategy.id === strategy.id ); // Check stickiness + // @ts-expect-error if (cachedStrategy?.stickiness !== strategy?.stickiness) { equal = false; return; } + // @ts-expect-error if (cachedStrategy?.groupId !== strategy?.groupId) { equal = false; return; @@ -256,6 +270,7 @@ const FeatureStrategiesEnvironments = () => { ), }); + // @ts-expect-error return featureCache?.environments?.map((env, index) => { return ( { className={styles.addStrategyButton} data-test={ADD_NEW_STRATEGY_ID} onClick={() => + // @ts-expect-error setExpandedSidebar(prev => !prev) } Icon={Add} @@ -307,6 +323,7 @@ const FeatureStrategiesEnvironments = () => { envName={env.name} onClick={() => setExpandedSidebar( + // @ts-expect-error prev => !prev ) } diff --git a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategyEditable/FeatureStrategyEditable.tsx b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategyEditable/FeatureStrategyEditable.tsx index 89597a3a24..ce9efc24e7 100644 --- a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategyEditable/FeatureStrategyEditable.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategyEditable/FeatureStrategyEditable.tsx @@ -44,6 +44,7 @@ const FeatureStrategyEditable = ({ const { loading } = useFeatureApi(); const { projectId, featureId } = useParams(); + // @ts-expect-error const { activeEnvironment, featureCache, dirty, setDirty } = useContext( FeatureStrategiesUIContext ); @@ -71,15 +72,18 @@ const FeatureStrategyEditable = ({ mutate(FEATURE_STRATEGY_CACHE_KEY, { ...updatedStrategy }, false); const dirtyParams = isDirtyParams(parameters); + // @ts-expect-error setDirty(prev => ({ ...prev, [strategy.id]: dirtyParams })); }; const updateFeatureStrategy = () => { const cleanup = () => { setStrategyCache(cloneDeep(strategy)); + // @ts-expect-error setDirty(prev => ({ ...prev, [strategy.id]: false })); }; + // @ts-expect-error updateStrategy(strategy, cleanup); }; @@ -109,6 +113,7 @@ const FeatureStrategyEditable = ({ }; const discardChanges = () => { + // @ts-expect-error setDirty(prev => ({ ...prev, [strategy.id]: false })); mutate(FEATURE_STRATEGY_CACHE_KEY, { ...strategyCache }, false); }; @@ -117,6 +122,7 @@ const FeatureStrategyEditable = ({ const updatedStrategy = cloneDeep(strategy); updatedStrategy.constraints = [...cloneDeep(constraints)]; + // @ts-expect-error setDirty(prev => ({ ...prev, [strategy.id]: true })); mutate(FEATURE_STRATEGY_CACHE_KEY, { ...updatedStrategy }, false); }; @@ -136,6 +142,7 @@ const FeatureStrategyEditable = ({ data-test={`${STRATEGY_ACCORDION_ID}-${strategy.name}`} strategy={strategy} setStrategyParams={setStrategyParams} + // @ts-expect-error setStrategyConstraints={setStrategyConstraints} dirty={dirty[strategy.id]} actions={ @@ -147,6 +154,7 @@ const FeatureStrategyEditable = ({ data-test={`${DELETE_STRATEGY_ID}-${strategy.name}`} onClick={e => { e.stopPropagation(); + // @ts-expect-error setDelDialog({ strategyId: strategy.id, show: true, @@ -167,6 +175,7 @@ const FeatureStrategyEditable = ({ permission={UPDATE_FEATURE_STRATEGY} projectId={projectId} environmentId={activeEnvironment?.name} + // @ts-expect-error variant="contained" color="primary" className={styles.editButton} @@ -181,6 +190,7 @@ const FeatureStrategyEditable = ({ className={styles.editButton} disabled={loading} color="tertiary" + // @ts-expect-error variant="text" permission={UPDATE_FEATURE_STRATEGY} projectId={projectId} diff --git a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesList/FeatureStrategiesList.tsx b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesList/FeatureStrategiesList.tsx index ae50fe07fd..0c44ce628d 100644 --- a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesList/FeatureStrategiesList.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesList/FeatureStrategiesList.tsx @@ -9,6 +9,7 @@ import ConditionallyRender from '../../../../common/ConditionallyRender'; const FeatureStrategiesList = () => { const smallScreen = useMediaQuery('(max-width:700px)'); + // @ts-expect-error const { expandedSidebar, setExpandedSidebar } = useContext( FeatureStrategiesUIContext ); @@ -32,6 +33,7 @@ const FeatureStrategiesList = () => { }; const toggleSidebar = () => { + // @ts-expect-error setExpandedSidebar(prev => !prev); }; diff --git a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesList/FeatureStrategyCard/FeatureStrategyCard.tsx b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesList/FeatureStrategyCard/FeatureStrategyCard.tsx index 91e69f83bb..664e2e118f 100644 --- a/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesList/FeatureStrategyCard/FeatureStrategyCard.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureStrategies/FeatureStrategiesList/FeatureStrategyCard/FeatureStrategyCard.tsx @@ -37,6 +37,7 @@ const FeatureStrategyCard = ({ const { featureId, projectId } = useParams(); const { strategies } = useStrategies(); + // @ts-expect-error const { setConfigureNewStrategy, setExpandedSidebar, activeEnvironment } = useContext(FeatureStrategiesUIContext); const { hasAccess } = useContext(AccessContext); @@ -81,7 +82,7 @@ const FeatureStrategyCard = ({ {}
-
+
= ({
+ {/* @ts-expect-error */} builtInStickinessOptions.concat( context + // @ts-expect-error .filter(c => c.stickiness) .filter( + // @ts-expect-error c => !builtInStickinessOptions.find(s => s.key === c.name) ) + // @ts-expect-error .map(c => ({ key: c.name, label: c.name })) ); diff --git a/frontend/src/component/feature/FeatureView/FeatureStrategies/common/GeneralStrategy/GeneralStrategy.tsx b/frontend/src/component/feature/FeatureView/FeatureStrategies/common/GeneralStrategy/GeneralStrategy.tsx index 94c16f9d0e..2decfc5140 100644 --- a/frontend/src/component/feature/FeatureView/FeatureStrategies/common/GeneralStrategy/GeneralStrategy.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureStrategies/common/GeneralStrategy/GeneralStrategy.tsx @@ -28,20 +28,26 @@ const GeneralStrategy = ({ editable, }: IGeneralStrategyProps) => { const styles = useStyles(); + // @ts-expect-error const onChangeTextField = (field, evt) => { const { value } = evt.currentTarget; evt.preventDefault(); + // @ts-expect-error updateParameter(field, value); }; + // @ts-expect-error const onChangePercentage = (field, evt, newValue) => { evt.preventDefault(); + // @ts-expect-error updateParameter(field, newValue); }; + // @ts-expect-error const handleSwitchChange = (key, currentValue) => { const value = currentValue === 'true' ? 'false' : 'true'; + // @ts-expect-error updateParameter(key, value); }; @@ -50,6 +56,7 @@ const GeneralStrategy = ({ strategyDefinition?.parameters.length > 0 ) { return strategyDefinition.parameters.map( + // @ts-expect-error ({ name, type, description, required }) => { let value = parameters[name]; diff --git a/frontend/src/component/feature/FeatureView/FeatureStrategies/common/StrategyConstraints/StrategyConstraints.tsx b/frontend/src/component/feature/FeatureView/FeatureStrategies/common/StrategyConstraints/StrategyConstraints.tsx index 9e13cc8f6a..1241d3a4dd 100644 --- a/frontend/src/component/feature/FeatureView/FeatureStrategies/common/StrategyConstraints/StrategyConstraints.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureStrategies/common/StrategyConstraints/StrategyConstraints.tsx @@ -36,6 +36,7 @@ const StrategyConstraints: React.FC = ({ const contextFields = context; const enabled = uiConfig.flags[C]; + // @ts-expect-error const contextNames = contextFields.map(context => context.name); const onClick = (evt: React.SyntheticEvent) => { @@ -65,9 +66,11 @@ const StrategyConstraints: React.FC = ({ updateConstraints(updatedConstraints); }; + // @ts-expect-error const updateConstraint = (index: number) => (value, field) => { const updatedConstraints = [...constraints]; const constraint = updatedConstraints[index]; + // @ts-expect-error constraint[field] = value; updateConstraints(updatedConstraints); }; diff --git a/frontend/src/component/feature/FeatureView/FeatureStrategies/common/StrategyInputList/StrategyInputList.tsx b/frontend/src/component/feature/FeatureView/FeatureStrategies/common/StrategyInputList/StrategyInputList.tsx index 47cde8175d..d11d745282 100644 --- a/frontend/src/component/feature/FeatureView/FeatureStrategies/common/StrategyInputList/StrategyInputList.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureStrategies/common/StrategyInputList/StrategyInputList.tsx @@ -28,6 +28,7 @@ const StrategyInputList = ({ }; const onKeyDown = (e: ChangeEvent) => { + // @ts-expect-error if (e?.key === ENTERKEY) { setValue(e); e.preventDefault(); @@ -37,11 +38,13 @@ const StrategyInputList = ({ const setValue = (evt: ChangeEvent) => { evt.preventDefault(); + // @ts-expect-error const value = evt.target.value; if (value) { const newValues = value .split(/,\s*/) + // @ts-expect-error .filter(a => !list.includes(a)); if (newValues.length > 0) { const newList = list.concat(newValues).filter(a => a); @@ -52,6 +55,7 @@ const StrategyInputList = ({ }; const onClose = (index: number) => { + // @ts-expect-error list[index] = null; setConfig( name, @@ -59,6 +63,7 @@ const StrategyInputList = ({ ); }; + // @ts-expect-error const onChange = e => { setInput(e.currentTarget.value); }; @@ -96,9 +101,11 @@ const StrategyInputList = ({ placeholder="" onBlur={onBlur} onChange={onChange} + // @ts-expect-error onKeyDown={onKeyDown} data-test={STRATEGY_INPUT_LIST} /> + {/* @ts-expect-error */}
{ setAnchorEl(null); diff --git a/frontend/src/component/providers/SWRProvider/SWRProvider.tsx b/frontend/src/component/providers/SWRProvider/SWRProvider.tsx index 008c217804..a922ed7acf 100644 --- a/frontend/src/component/providers/SWRProvider/SWRProvider.tsx +++ b/frontend/src/component/providers/SWRProvider/SWRProvider.tsx @@ -19,6 +19,7 @@ const SWRProvider: React.FC = ({ const history = useHistory(); const { setToastApiError } = useToast(); + // @ts-expect-error const handleFetchError = error => { if (error.status === 401) { const path = location.pathname; @@ -36,6 +37,7 @@ const SWRProvider: React.FC = ({ return; } + // @ts-expect-error cache.clear(); history.push('/login'); diff --git a/frontend/src/component/strategies/StrategiesList/StrategiesList.styles.ts b/frontend/src/component/strategies/StrategiesList/StrategiesList.styles.ts index 29e0aa2ef3..4c2800d79d 100644 --- a/frontend/src/component/strategies/StrategiesList/StrategiesList.styles.ts +++ b/frontend/src/component/strategies/StrategiesList/StrategiesList.styles.ts @@ -13,6 +13,7 @@ export const useStyles = makeStyles(theme => ({ }, deprecated: { '& a': { + // @ts-expect-error color: theme.palette.links.deprecated, }, }, diff --git a/frontend/src/component/strategies/StrategyForm/StrategyForm.tsx b/frontend/src/component/strategies/StrategyForm/StrategyForm.tsx index 2d87e2ce3a..e1fcbeec9e 100644 --- a/frontend/src/component/strategies/StrategyForm/StrategyForm.tsx +++ b/frontend/src/component/strategies/StrategyForm/StrategyForm.tsx @@ -33,6 +33,7 @@ export const StrategyForm = ({ editMode, strategy }: IStrategyFormProps) => { const [name, setName] = useState(strategy?.name || ''); const [description, setDescription] = useState(strategy?.description || ''); const [params, setParams] = useState( + // @ts-expect-error strategy?.parameters || [] ); const [errors, setErrors] = useState({}); diff --git a/frontend/src/component/strategies/StrategyView/StrategyView.tsx b/frontend/src/component/strategies/StrategyView/StrategyView.tsx index 838af3e6ce..5d968dd109 100644 --- a/frontend/src/component/strategies/StrategyView/StrategyView.tsx +++ b/frontend/src/component/strategies/StrategyView/StrategyView.tsx @@ -30,6 +30,7 @@ export const StrategyView = () => { label: 'Details', component: ( { }, { label: 'Edit', + // @ts-expect-error component: , }, ]; diff --git a/frontend/src/component/user/ForgottenPassword/ForgottenPassword.tsx b/frontend/src/component/user/ForgottenPassword/ForgottenPassword.tsx index d7163ff18f..9249511d1a 100644 --- a/frontend/src/component/user/ForgottenPassword/ForgottenPassword.tsx +++ b/frontend/src/component/user/ForgottenPassword/ForgottenPassword.tsx @@ -79,8 +79,7 @@ const ForgottenPassword = () => { onSubmit={onClick} className={classnames( commonStyles.contentSpacingY, - commonStyles.flexColumn, - styles.container + commonStyles.flexColumn )} > = ({ title, children }) => { return (
diff --git a/frontend/src/component/user/common/ResetPasswordForm/PasswordChecker/PasswordChecker.styles.ts b/frontend/src/component/user/common/ResetPasswordForm/PasswordChecker/PasswordChecker.styles.ts index 13052ad76f..ea612bf84b 100644 --- a/frontend/src/component/user/common/ResetPasswordForm/PasswordChecker/PasswordChecker.styles.ts +++ b/frontend/src/component/user/common/ResetPasswordForm/PasswordChecker/PasswordChecker.styles.ts @@ -10,6 +10,7 @@ export const useStyles = makeStyles(theme => ({ }, headerContainer: { display: 'flex', padding: '0.5rem' }, divider: { + // @ts-expect-error backgroundColor: theme.palette.borders?.main, height: '1px', width: '100%', diff --git a/frontend/src/hooks/api/actions/useContextsApi/useContextsApi.ts b/frontend/src/hooks/api/actions/useContextsApi/useContextsApi.ts index 09d4faf76d..04583624ff 100644 --- a/frontend/src/hooks/api/actions/useContextsApi/useContextsApi.ts +++ b/frontend/src/hooks/api/actions/useContextsApi/useContextsApi.ts @@ -1,4 +1,3 @@ -import { IContext } from '../../../../interfaces/context'; import useAPI from '../useApi/useApi'; const useContextsApi = () => { @@ -23,6 +22,7 @@ const useContextsApi = () => { } }; + // @ts-expect-error const createContext = async (payload: IContext) => { const path = URI; const req = createRequest(path, { @@ -39,6 +39,7 @@ const useContextsApi = () => { } }; + // @ts-expect-error const updateContext = async (context: IContext) => { const path = `${URI}/${context.name}`; const req = createRequest(path, { diff --git a/frontend/src/hooks/api/getters/useProject/useProject.ts b/frontend/src/hooks/api/getters/useProject/useProject.ts index 94b06562bb..0af0dfe650 100644 --- a/frontend/src/hooks/api/getters/useProject/useProject.ts +++ b/frontend/src/hooks/api/getters/useProject/useProject.ts @@ -22,6 +22,7 @@ const useProject = (id: string, options: SWRConfiguration = {}) => { const sortedData = (data: IProject | undefined): IProject => { if (data) { + // @ts-expect-error return { ...data, features: sort(data.features || []) }; } return fallbackProject; diff --git a/frontend/src/hooks/usePersistentGlobalState.ts b/frontend/src/hooks/usePersistentGlobalState.ts index 1f743a23ea..85f9218c64 100644 --- a/frontend/src/hooks/usePersistentGlobalState.ts +++ b/frontend/src/hooks/usePersistentGlobalState.ts @@ -20,7 +20,7 @@ export const createPersistentGlobalStateHook = ( const setGlobalState = (value: React.SetStateAction) => { const prev = container.getGlobalState(key); - const next = typeof value === 'function' ? value(prev) : value; + const next = value instanceof Function ? value(prev) : value; container.setGlobalState(key, next); setLocalStorageItem(key, next); };