From 57554cb147c07a76bb73e2ee78e55ab04d85fd50 Mon Sep 17 00:00:00 2001 From: Peter Muriuki Date: Thu, 19 Dec 2024 19:02:16 +0300 Subject: [PATCH] Fix lint issues --- .../src/containers/ImportDetailView/index.tsx | 2 -- packages/pkg-config/src/constants.ts | 3 +-- packages/rbac/src/constants.ts | 19 ++++++++++++++----- packages/rbac/src/helpers/utils.ts | 7 ------- .../react-utils/src/helpers/test-utils.tsx | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/packages/fhir-import/src/containers/ImportDetailView/index.tsx b/packages/fhir-import/src/containers/ImportDetailView/index.tsx index de91d3db2..89692f968 100644 --- a/packages/fhir-import/src/containers/ImportDetailView/index.tsx +++ b/packages/fhir-import/src/containers/ImportDetailView/index.tsx @@ -80,8 +80,6 @@ export const ImportDetailViewDetails = (_: RouteComponentProps) => { [t('Author')]: data.author, }; - console.log({pageTitle}) - return ( diff --git a/packages/pkg-config/src/constants.ts b/packages/pkg-config/src/constants.ts index 8ce97cae1..cafcd80a5 100644 --- a/packages/pkg-config/src/constants.ts +++ b/packages/pkg-config/src/constants.ts @@ -2,6 +2,5 @@ export const SLICE_NOT_REGISTERED = 'Looks like configuration slice is being used without having been yet registered to the store'; export const USER_PREFERENCE_KEY = 'Preference'; - // magic strings -export const clientIdConfig = "clientId" as const +export const clientIdConfig = 'clientId' as const; diff --git a/packages/rbac/src/constants.ts b/packages/rbac/src/constants.ts index 0a2cd7d89..ec8b079a9 100644 --- a/packages/rbac/src/constants.ts +++ b/packages/rbac/src/constants.ts @@ -11,12 +11,16 @@ export enum Permit { /** Resources that the web client understands */ /** Resources that relate with user self administration like deleting own account */ -export const accountClientResources = ['account_user', 'account_application', 'account_group'] as const -export type AccountClientResources = typeof accountClientResources[number] +export const accountClientResources = [ + 'account_user', + 'account_application', + 'account_group', +] as const; +export type AccountClientResources = typeof accountClientResources[number]; /** Resources that relate to the realm administration like managing other users accounts */ -export const realmClientResources = ['iam_user', 'iam_realm', 'iam_group', 'iam_role'] as const -export type RealmClientResources = typeof realmClientResources[number] +export const realmClientResources = ['iam_user', 'iam_realm', 'iam_group', 'iam_role'] as const; +export type RealmClientResources = typeof realmClientResources[number]; /** * fhir hapi Server resources that this web client is familiar with, thus we can enforce rbac for permissions on views that @@ -55,7 +59,12 @@ export type FhirResources = typeof fhirResources[number]; export const webClientRoles = ['DataImport'] as const; export type WebClientRoles = typeof webClientRoles[number]; -export const allSupportedRoles = [...fhirResources, ...accountClientResources, ...realmClientResources, ...webClientRoles]; +export const allSupportedRoles = [ + ...fhirResources, + ...accountClientResources, + ...realmClientResources, + ...webClientRoles, +]; export type AllSupportedRoles = typeof allSupportedRoles[number]; export type BinaryNumber = number; diff --git a/packages/rbac/src/helpers/utils.ts b/packages/rbac/src/helpers/utils.ts index 38effb3e4..874f888c4 100644 --- a/packages/rbac/src/helpers/utils.ts +++ b/packages/rbac/src/helpers/utils.ts @@ -22,13 +22,6 @@ export function makeArray(obj: T | T[]): T[] { export const permitLiteralKeys = Object.keys(Permit).map((x) => x.toLowerCase()); -/** - * @param resource - */ -function resourceStringIsValid(resource: string): resource is AllSupportedRoles { - return allSupportedRoles.includes(resource as AllSupportedRoles); -} - /** * validates that a string is a valid representation of one of the recognized * resource permit combinations. diff --git a/packages/react-utils/src/helpers/test-utils.tsx b/packages/react-utils/src/helpers/test-utils.tsx index 673c94c91..19d5120fd 100644 --- a/packages/react-utils/src/helpers/test-utils.tsx +++ b/packages/react-utils/src/helpers/test-utils.tsx @@ -1,7 +1,7 @@ import { store } from '@opensrp/store'; import { Provider } from 'react-redux'; import React from 'react'; -import { RoleContext, UserRole, FhirResources, Permit, AllSupportedRoles, allSupportedRoles } from '@opensrp/rbac'; +import { RoleContext, UserRole, Permit, allSupportedRoles } from '@opensrp/rbac'; import { history } from '@onaio/connected-reducer-registry'; import { Router } from 'react-router'; /* eslint-disable @typescript-eslint/no-non-null-assertion */