diff --git a/plugins/course-apps/live/Settings.jsx b/plugins/course-apps/live/Settings.jsx index af46c40704..b3785d72b7 100644 --- a/plugins/course-apps/live/Settings.jsx +++ b/plugins/course-apps/live/Settings.jsx @@ -71,6 +71,7 @@ const LiveSettings = ({ }; const handleSettingsSave = async (values) => { + // oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info. await dispatch(saveLiveConfiguration(courseId, values, navigate)); }; diff --git a/plugins/course-apps/ora_settings/Settings.jsx b/plugins/course-apps/ora_settings/Settings.jsx index f16d10f48b..2bc06b2375 100644 --- a/plugins/course-apps/ora_settings/Settings.jsx +++ b/plugins/course-apps/ora_settings/Settings.jsx @@ -48,7 +48,7 @@ const ORASettings = ({ onClose }) => { event.preventDefault(); success = success && await handleSettingsSave(formValues); - await setSaveError(!success); + setSaveError(!success); if ((initialFormValues.enableFlexiblePeerGrade !== formValues.enableFlexiblePeerGrade) && success) { success = await dispatch(updateModel({ modelType: 'courseApps', diff --git a/plugins/course-apps/ora_settings/Settings.test.jsx b/plugins/course-apps/ora_settings/Settings.test.jsx index 0dd79a13f2..787042f527 100644 --- a/plugins/course-apps/ora_settings/Settings.test.jsx +++ b/plugins/course-apps/ora_settings/Settings.test.jsx @@ -128,7 +128,7 @@ describe('ORASettings', () => { await mockStore({ apiStatus: 200, enabled: true }); renderComponent(); - const checkbox = await screen.getByRole('checkbox', { name: /Flex Peer Grading/ }); + const checkbox = screen.getByRole('checkbox', { name: /Flex Peer Grading/ }); expect(checkbox).toBeChecked(); await waitFor(() => { diff --git a/plugins/course-apps/xpert_unit_summary/settings-modal/SettingsModal.jsx b/plugins/course-apps/xpert_unit_summary/settings-modal/SettingsModal.jsx index 87c99afac6..32a7218dd9 100644 --- a/plugins/course-apps/xpert_unit_summary/settings-modal/SettingsModal.jsx +++ b/plugins/course-apps/xpert_unit_summary/settings-modal/SettingsModal.jsx @@ -238,8 +238,10 @@ const SettingsModal = ({ const values = { ...rest, enabled: enabled ? checked === 'true' : undefined }; if (enabled) { + // oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info. success = await dispatch(updateXpertSettings(courseId, values)); } else { + // oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info. success = await dispatch(removeXpertSettings(courseId)); } diff --git a/src/certificates/certificates-list/hooks/useCertificatesList.jsx b/src/certificates/certificates-list/hooks/useCertificatesList.jsx index 952fa8534a..34a0b1821d 100644 --- a/src/certificates/certificates-list/hooks/useCertificatesList.jsx +++ b/src/certificates/certificates-list/hooks/useCertificatesList.jsx @@ -25,6 +25,7 @@ const useCertificatesList = (courseId) => { })); const handleSubmit = async (values) => { + // oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info. await dispatch(updateCourseCertificate(courseId, values)); setEditModes({}); dispatch(setMode(MODE_STATES.view)); diff --git a/src/course-checklist/CourseChecklist.test.jsx b/src/course-checklist/CourseChecklist.test.jsx index 69057abf70..bac07d5c6a 100644 --- a/src/course-checklist/CourseChecklist.test.jsx +++ b/src/course-checklist/CourseChecklist.test.jsx @@ -60,9 +60,9 @@ describe('CourseChecklistPage', () => { }); describe('renders', () => { describe('if enable_quality prop is true', () => { - it('two checklist components ', () => { + it('two checklist components ', async () => { renderComponent(); - mockStore(200); + await mockStore(200); expect(screen.getByText(messages.launchChecklistLabel.defaultMessage)).toBeVisible(); @@ -81,7 +81,7 @@ describe('CourseChecklistPage', () => { it('correct content when the launch checklist has loaded', async () => { renderComponent(); - mockStore(404); + await mockStore(404); await waitFor(() => { const { launchChecklistStatus } = store.getState().courseChecklist.loadingStatus; @@ -93,7 +93,7 @@ describe('CourseChecklistPage', () => { it('correct content when the best practices checklist is loading', async () => { renderComponent(); - mockStore(404); + await mockStore(404); await waitFor(() => { const { bestPracticeChecklistStatus } = store.getState().courseChecklist.loadingStatus; @@ -114,9 +114,9 @@ describe('CourseChecklistPage', () => { }); }); - it('one checklist components ', () => { + it('one checklist components ', async () => { renderComponent(); - mockStore(200); + await mockStore(200); expect(screen.getByText(messages.launchChecklistLabel.defaultMessage)).toBeVisible(); @@ -126,7 +126,7 @@ describe('CourseChecklistPage', () => { describe('an aria-live region with', () => { it('correct content when the launch checklist has loaded', async () => { renderComponent(); - mockStore(404); + await mockStore(404); await waitFor(() => { const { launchChecklistStatus } = store.getState().courseChecklist.loadingStatus; @@ -138,7 +138,7 @@ describe('CourseChecklistPage', () => { it('correct content when the best practices checklist is loading', async () => { renderComponent(); - mockStore(404); + await mockStore(404); await waitFor(() => { const { bestPracticeChecklistStatus } = store.getState().courseChecklist.loadingStatus; diff --git a/src/course-unit/CourseUnit.test.jsx b/src/course-unit/CourseUnit.test.jsx index aa993e34b5..45df32c544 100644 --- a/src/course-unit/CourseUnit.test.jsx +++ b/src/course-unit/CourseUnit.test.jsx @@ -838,7 +838,9 @@ describe('', () => { }); render(); // to wait for loading - screen.findByTestId('unit-header-title'); + await waitFor(() => { + screen.getAllByTestId('unit-header-title').toHaveLength(1); + }); // The new unit button should not be visible when childAddable is false expect( screen.queryByRole('button', { name: courseSequenceMessages.newUnitBtnText.defaultMessage }), diff --git a/src/library-authoring/hierarchy/ItemHierarchyPublisher.tsx b/src/library-authoring/hierarchy/ItemHierarchyPublisher.tsx index 6df4b418b2..a70af3752e 100644 --- a/src/library-authoring/hierarchy/ItemHierarchyPublisher.tsx +++ b/src/library-authoring/hierarchy/ItemHierarchyPublisher.tsx @@ -123,10 +123,10 @@ export const ItemHierarchyPublisher = ({ {intl.formatMessage(messages.publishCancel)} { + onClick={(e) => { e.preventDefault(); e.stopPropagation(); - await handlePublish(); + handlePublish(); }} variant="primary rounded-0" label={intl.formatMessage(messages.publishConfirm)} diff --git a/src/optimizer-page/scan-results/ScanResults.tsx b/src/optimizer-page/scan-results/ScanResults.tsx index b1e96e966f..e8a59b6681 100644 --- a/src/optimizer-page/scan-results/ScanResults.tsx +++ b/src/optimizer-page/scan-results/ScanResults.tsx @@ -460,6 +460,7 @@ const ScanResults: FC = ({ const handleUpdateCompletion = async () => { if (rerunLinkUpdateInProgress === false && isUpdateAllInProgress) { try { + // oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info const updateStatusResponse = await dispatch(fetchRerunLinkUpdateStatus(courseId)) as any; if (!updateStatusResponse) { @@ -590,6 +591,7 @@ const ScanResults: FC = ({ try { setUpdatingLinkIds(prev => ({ ...prev, [uniqueId]: true })); const contentType = getContentType(sectionId || ''); + // oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info. await dispatch(updateSinglePreviousRunLink(courseId, link, blockId, contentType)); const pollForSingleLinkResult = async (attempts = 0): Promise => { @@ -597,6 +599,7 @@ const ScanResults: FC = ({ throw new Error('Timeout waiting for link update result'); } + // oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info. const updateStatusResponse = await dispatch(fetchRerunLinkUpdateStatus(courseId)) as any; const pollStatus = updateStatusResponse?.status || updateStatusResponse?.updateStatus; @@ -755,6 +758,7 @@ const ScanResults: FC = ({ try { setProcessedResponseIds(new Set()); setIsUpdateAllInProgress(true); + // oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info. await dispatch(updateAllPreviousRunLinks(courseId)); return true; diff --git a/src/pages-and-resources/app-settings-modal/AppSettingsModal.jsx b/src/pages-and-resources/app-settings-modal/AppSettingsModal.jsx index 429a9677fa..0e5ec40895 100644 --- a/src/pages-and-resources/app-settings-modal/AppSettingsModal.jsx +++ b/src/pages-and-resources/app-settings-modal/AppSettingsModal.jsx @@ -72,13 +72,14 @@ const AppSettingsModal = ({ const handleFormSubmit = async (values) => { let success = true; if (appInfo.enabled !== values.enabled) { + // oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info. success = await dispatch(updateAppStatus(courseId, appInfo.id, values.enabled)); } // Call the submit handler for the settings component to save its settings if (onSettingsSave) { success = success && await onSettingsSave(values); } - await setSaveError(!success); + setSaveError(!success); !success && alertRef?.current.scrollIntoView(); // eslint-disable-line @typescript-eslint/no-unused-expressions }; @@ -86,7 +87,7 @@ const AppSettingsModal = ({ // If submitting the form with errors, show the alert and scroll to it. await handleSubmit(event); if (Object.keys(errors).length > 0) { - await setSaveError(true); + setSaveError(true); alertRef?.current.scrollIntoView?.(); // eslint-disable-line no-unused-expressions } }; diff --git a/src/taxonomy/TaxonomyListPage.test.tsx b/src/taxonomy/TaxonomyListPage.test.tsx index be71ea5f92..0f2dac8451 100644 --- a/src/taxonomy/TaxonomyListPage.test.tsx +++ b/src/taxonomy/TaxonomyListPage.test.tsx @@ -175,7 +175,7 @@ describe('', () => { } = render(); // Open the taxonomies org filter select menu - const taxonomiesFilterSelectMenu = await getByRole('button', { name: 'All taxonomies' }); + const taxonomiesFilterSelectMenu = getByRole('button', { name: 'All taxonomies' }); fireEvent.click(taxonomiesFilterSelectMenu); // Check that the 'Unassigned' option is correctly called