Skip to content

Commit

Permalink
fix errors produced by build
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgraham4401 committed Jul 31, 2024
1 parent 8b0fa6e commit 87684d1
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 42 deletions.
15 changes: 0 additions & 15 deletions .idea/runConfigurations/enviroPro.xml

This file was deleted.

9 changes: 5 additions & 4 deletions client/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import reactPlugin from 'eslint-plugin-react'; // https://github.com/jsx-eslint/eslint-plugin-react?tab=readme-ov-file#configuration
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import tsEslint from 'typescript-eslint';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';

export default [
// ToDo: eslint-plugin-react-hooks does not yet support eslint > 9 and this config
pluginJs.configs.recommended,
jsxA11y.flatConfigs.recommended,
// ...tseslint.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
// ...tseslint.configs.recommended, // recommended config is overridden by strict/stylistic
...tsEslint.configs.strict,
...tsEslint.configs.stylistic,
eslintPluginPrettierRecommended,
{
name: 'ignore-outputs',
Expand Down Expand Up @@ -39,6 +39,7 @@ export default [
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-function': 'off',
},
},
{
Expand Down
6 changes: 2 additions & 4 deletions client/src/components/Manifest/Actions/ManifestFABs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ import { QuickSignBtn } from 'components/Manifest/QuickerSign';
import { FloatingActionBtn } from 'components/UI';
import { useReadOnly } from 'hooks/manifest';
import React, { ReactElement, useContext } from 'react';
import { manifest } from 'services';

interface ManifestActionBtnsProps {
onSignClick: () => void;
}

export function ManifestFABs({ onSignClick }: ManifestActionBtnsProps) {
const { nextSigningSite, signAble } = useContext(ManifestContext);
const { signAble } = useContext(ManifestContext);
const [readOnly] = useReadOnly();
const rcraSiteType = manifest.siteTypeToRcraSiteType(nextSigningSite?.siteType);
let component: ReactElement | undefined = undefined;
if (!readOnly) {
component = <ManifestSaveBtn />;
} else if (signAble) {
component = <QuickSignBtn siteType={rcraSiteType} onClick={onSignClick} />;
component = <QuickSignBtn onClick={onSignClick} />;
} else if (readOnly) {
component = <ManifestEditBtn />;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function GeneratorSection({ setupSign, signAble }: GeneratorSectionProps)
const toggleShowGeneratorForm = () => setShowGeneratorForm(!showGeneratorForm);
const urlGeneratorId = searchParams.get('generator');

const { data, isLoading, error } = useGetRcrainfoSiteQuery(urlGeneratorId, {
const { data, isLoading, error } = useGetRcrainfoSiteQuery(urlGeneratorId ?? '', {
skip: !urlGeneratorId,
});

Expand Down Expand Up @@ -72,7 +72,6 @@ export function GeneratorSection({ setupSign, signAble }: GeneratorSectionProps)
<div className="d-flex justify-content-between">
<Col className="text-end">
<QuickSignBtn
siteType={'Generator'}
mtnHandler={generator}
onClick={setupSign}
disabled={generator?.signed || !signAble}
Expand Down
3 changes: 0 additions & 3 deletions client/src/components/Manifest/ManifestForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,10 @@ export interface ManifestContextType {
export const ManifestContext = createContext<ManifestContextType>({
trackingNumber: undefined,
generatorStateCode: undefined,
// eslint-disable-next-line @typescript-eslint/no-empty-function
setGeneratorStateCode: () => {},
tsdfStateCode: undefined,
// eslint-disable-next-line @typescript-eslint/no-empty-function
setTsdfStateCode: () => {},
editWasteLineIndex: undefined,
// eslint-disable-next-line @typescript-eslint/no-empty-function
setEditWasteLineIndex: () => {},
nextSigningSite: undefined,
viewingAsSiteId: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ beforeAll(() => server.listen());
afterAll(() => server.close()); // Disable API mocking after the tests are done.

function TestComponent({
siteType,
handler,
signingSite,
}: {
Expand All @@ -28,7 +27,6 @@ function TestComponent({
transporterOrder?: number | undefined;
};
}) {
if (!siteType) siteType = 'Generator';
const setGeneratorStateCode = vi.fn();
const setTsdfStateCode = vi.fn();
const setEditWasteLineIndex = vi.fn();
Expand All @@ -43,7 +41,7 @@ function TestComponent({
setEditWasteLineIndex,
}}
>
<QuickSignBtn siteType={siteType} mtnHandler={handler} onClick={() => undefined} />
<QuickSignBtn mtnHandler={handler} onClick={() => undefined} />
</ManifestContext.Provider>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ function TransporterTable({ transporters, arrayFieldMethods, setupSign }: Transp
<Col xs={2}>
{readOnly ? (
<QuickSignBtn
siteType={'Transporter'}
mtnHandler={transporter}
onClick={setupSign}
iconOnly={true}
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/Manifest/Tsdf/TsdfSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function TsdfSection({ signAble, setupSign }: TsdfSectionProps) {
const tsdf: Handler | undefined = manifestForm.watch('designatedFacility');
const [readOnly] = useReadOnly();
const urlTsdfId = searchParams.get('tsdf');
const { data, isLoading, error } = useGetRcrainfoSiteQuery(urlTsdfId, {
const { data, isLoading, error } = useGetRcrainfoSiteQuery(urlTsdfId ?? '', {
skip: !urlTsdfId,
});

Expand Down Expand Up @@ -68,7 +68,6 @@ export function TsdfSection({ signAble, setupSign }: TsdfSectionProps) {
{/* Button to bring up the Quicker Sign modal*/}
<Col className="text-end">
<QuickSignBtn
siteType={'Tsdf'}
mtnHandler={tsdf}
onClick={setupSign}
disabled={tsdf.signed || !signAble}
Expand Down
2 changes: 1 addition & 1 deletion client/src/hooks/useUserSiteIds/useUserSiteIds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function useUserSiteIds() {
[]
);

const { userSiteIds, ...rest } = useGetProfileQuery(null, {
const { userSiteIds, ...rest } = useGetProfileQuery(undefined, {
selectFromResult: (result) => ({
...result,
userSiteIds: selectUserSiteIds(result),
Expand Down
9 changes: 6 additions & 3 deletions client/src/store/htApi.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export const haztrakApi = createApi({
params: { epaId: data.siteId, siteType: data.siteType },
}),
}),
getRcrainfoSite: build.query<RcraSite, string | null>({
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
getRcrainfoSite: build.query<RcraSite, string | void>({
query: (epaSiteId) => ({
url: `rcrasite/${epaSiteId}`,
method: 'get',
Expand All @@ -101,7 +102,8 @@ export const haztrakApi = createApi({
getTaskStatus: build.query<TaskStatus, string>({
query: (taskId) => ({ url: `task/${taskId}`, method: 'get' }),
}),
getFedWasteCodes: build.query<Code[], null>({
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
getFedWasteCodes: build.query<Code[], void>({
query: () => ({ url: 'waste/code/federal', method: 'get' }),
providesTags: ['code'],
}),
Expand All @@ -117,7 +119,8 @@ export const haztrakApi = createApi({
query: (id) => ({ url: `org/${id}/sites`, method: 'get' }),
providesTags: ['site'],
}),
getUserHaztrakSites: build.query<HaztrakSite[], null>({
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
getUserHaztrakSites: build.query<HaztrakSite[], void>({
query: () => ({ url: 'site', method: 'get' }),
providesTags: ['site'],
}),
Expand Down
9 changes: 6 additions & 3 deletions client/src/store/userSlice/user.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export const userApi = haztrakApi.injectEndpoints({
}),
invalidatesTags: ['auth'],
}),
getUser: build.query<HaztrakUser, null>({
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
getUser: build.query<HaztrakUser, void>({
query: () => ({
url: 'user',
method: 'GET',
Expand All @@ -116,7 +117,8 @@ export const userApi = haztrakApi.injectEndpoints({
}),
invalidatesTags: ['user'],
}),
getProfile: build.query<ProfileSlice, null>({
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
getProfile: build.query<ProfileSlice, void>({
query: () => ({
url: 'profile',
method: 'GET',
Expand Down Expand Up @@ -166,7 +168,8 @@ export const userApi = haztrakApi.injectEndpoints({
}),
invalidatesTags: ['rcrainfoProfile'],
}),
syncRcrainfoProfile: build.mutation<TaskResponse, null>({
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
syncRcrainfoProfile: build.mutation<TaskResponse, void>({
query: () => ({
url: `rcrainfo-profile/sync`,
method: 'POST',
Expand Down
2 changes: 1 addition & 1 deletion client/src/test-utils/mock/mockUserEndpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const mockUserEndpoints = [
/** GET RCRAInfo profile */
http.get(`${API_BASE_URL}/api/rcrainfo-profile/:username`, (info) => {
const { username } = info.params;
if (!username) {
if (typeof username !== 'string') {
return HttpResponse.json({}, { status: 404 });
}
const rcrainfoProfile = createMockRcrainfoProfileResponse({ user: username });
Expand Down

0 comments on commit 87684d1

Please sign in to comment.