Skip to content

Commit

Permalink
[NO-ISSUE] customHooks: use not Use
Browse files Browse the repository at this point in the history
The naming convention was wrong, a custom hook must either start with a
capital letter or `use` with a small `u`.
  • Loading branch information
lavocatt committed Aug 19, 2024
1 parent 3adb928 commit 7cff583
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render, screen, waitForI18n } from '../../test-utils';
import { AddressDetailsPage } from './AddressDetails.container';
import { useParams } from 'react-router-dom-v5-compat';
import { JolokiaAuthentication } from '../../jolokia/components/JolokiaAuthentication';
import { UseGetBrokerCR } from '../../k8s/customHooks';
import { useGetBrokerCR } from '../../k8s/customHooks';
import { useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk';

jest.mock('@openshift-console/dynamic-plugin-sdk', () => ({
Expand All @@ -14,7 +14,7 @@ jest.mock('react-router-dom-v5-compat', () => ({
}));

jest.mock('../../k8s/customHooks', () => ({
UseGetBrokerCR: jest.fn(),
useGetBrokerCR: jest.fn(),
}));

jest.mock('./AddressDetails.component', () => ({
Expand All @@ -26,7 +26,7 @@ jest.mock('./AddressDetailsBreadcrumb/AddressDetailsBreadcrumb', () => ({
}));

const mockUseParams = useParams as jest.Mock;
const mockUseGetBrokerCR = UseGetBrokerCR as jest.Mock;
const mockUseGetBrokerCR = useGetBrokerCR as jest.Mock;
const mockUseK8sWatchResource = useK8sWatchResource as jest.Mock;

describe('AddressDetailsPage', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/addresses/address-details/AddressDetails.container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AddressDetailsBreadcrumb } from './AddressDetailsBreadcrumb/AddressDeta

import { useParams } from 'react-router-dom-v5-compat';
import { JolokiaAuthentication } from '../../jolokia/components/JolokiaAuthentication';
import { UseGetBrokerCR } from '../../k8s/customHooks';
import { useGetBrokerCR } from '../../k8s/customHooks';

export const AddressDetailsPage: FC = () => {
const { t } = useTranslation();
Expand All @@ -27,7 +27,7 @@ export const AddressDetailsPage: FC = () => {
podName?: string;
}>();

const { brokerCr: brokerDetails, error: error } = UseGetBrokerCR(
const { brokerCr: brokerDetails, error: error } = useGetBrokerCR(
brokerName,
namespace,
);
Expand Down
4 changes: 2 additions & 2 deletions src/brokers/add-broker/AddBroker.container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '../../reducers/7.12/reducer';
import { AddBrokerResourceValues } from '../../reducers/7.12/import-types';
import { useNavigate, useParams } from 'react-router-dom-v5-compat';
import { UseGetIngressDomain } from '../../k8s/customHooks';
import { useGetIngressDomain } from '../../k8s/customHooks';

export interface AddBrokerProps {
initialValues: AddBrokerResourceValues;
Expand Down Expand Up @@ -55,7 +55,7 @@ export const AddBrokerPage: FC = () => {
setPrevNamespace(namespace);
}

const { clusterDomain, isLoading } = UseGetIngressDomain();
const { clusterDomain, isLoading } = useGetIngressDomain();
const [isDomainSet, setIsDomainSet] = useState(false);
if (!isLoading && !isDomainSet) {
dispatch({
Expand Down
4 changes: 2 additions & 2 deletions src/brokers/broker-details/BrokerDetails.container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
useParams,
} from 'react-router-dom-v5-compat';
import { JolokiaAuthentication } from '../../jolokia/components/JolokiaAuthentication';
import { UseGetBrokerCR } from '../../k8s/customHooks';
import { useGetBrokerCR } from '../../k8s/customHooks';
import { AuthContext } from '../../jolokia/context';
import { BrokerCR } from '../../k8s/types';
import {
Expand Down Expand Up @@ -189,7 +189,7 @@ export const BrokerDetailsPage: FC = () => {
podName?: string;
}>();

const { brokerCr, isLoading, error } = UseGetBrokerCR(brokerName, namespace);
const { brokerCr, isLoading, error } = useGetBrokerCR(brokerName, namespace);

const podOrdinal = parseInt(podName.replace(brokerName + '-ss-', ''));

Expand Down
4 changes: 2 additions & 2 deletions src/brokers/update-broker/UpdateBroker.container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AddBroker } from '../add-broker/AddBroker.component';
import { Loading } from '../../shared-components/Loading/Loading';
import { AMQBrokerModel } from '../../k8s/models';
import { BrokerCR } from '../../k8s/types';
import { UseGetIngressDomain } from '../../k8s/customHooks';
import { useGetIngressDomain } from '../../k8s/customHooks';
import {
ArtemisReducerOperations,
BrokerCreationFormDispatch,
Expand Down Expand Up @@ -71,7 +71,7 @@ export const UpdateBrokerPage: FC = () => {
}, [name]);

const { clusterDomain, isLoading: isLoadingClusterDomain } =
UseGetIngressDomain();
useGetIngressDomain();
const [isDomainSet, setIsDomainSet] = useState(false);
if (!loadingBrokerCR && !isLoadingClusterDomain && !isDomainSet) {
dispatch({
Expand Down
4 changes: 2 additions & 2 deletions src/k8s/customHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState } from 'react';
import { AMQBrokerModel, IngressDomainModel } from './models';
import { BrokerCR, Ingress } from './types';

export const UseGetIngressDomain = (): {
export const useGetIngressDomain = (): {
clusterDomain: string;
isLoading: boolean;
error: string;
Expand Down Expand Up @@ -35,7 +35,7 @@ export const UseGetIngressDomain = (): {
return { clusterDomain: domain, isLoading: loading, error: error };
};

export const UseGetBrokerCR = (
export const useGetBrokerCR = (
brokerName: string,
namespace: string,
): { brokerCr: BrokerCR; isLoading: boolean; error: string } => {
Expand Down

0 comments on commit 7cff583

Please sign in to comment.