Skip to content

Commit 72ea6de

Browse files
authored
Remove old, outdated dependencies (#3021)
* Create `DeepPartial` type * Replace redux imports with RTK * Drop explicit redux dependency * Drop and replace outdated types
1 parent 145ccd9 commit 72ea6de

File tree

25 files changed

+58
-75
lines changed

25 files changed

+58
-75
lines changed

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
"react-sortable-hoc": "^2.0.0",
8888
"react-syntax-highlighter": "^15.5.0",
8989
"react-textarea-autosize": "^8.5.2",
90-
"redux": "^4.2.1",
9190
"redux-mock-store": "^1.5.4",
9291
"redux-saga": "^1.2.3",
9392
"rehype-react": "^8.0.0",
@@ -110,12 +109,11 @@
110109
"@testing-library/jest-dom": "^6.0.0",
111110
"@testing-library/react": "^14.0.0",
112111
"@testing-library/user-event": "^14.4.3",
113-
"@types/acorn": "^6.0.0",
114112
"@types/estree": "^1.0.5",
115113
"@types/gapi": "^0.0.44",
116114
"@types/gapi.auth2": "^0.0.57",
117115
"@types/gapi.client": "^1.0.5",
118-
"@types/gapi.client.drive": "^3.0.14",
116+
"@types/gapi.client.drive-v3": "^0.0.5",
119117
"@types/google.picker": "^0.0.39",
120118
"@types/jest": "^29.0.0",
121119
"@types/js-cookie": "^3.0.6",
@@ -127,7 +125,6 @@
127125
"@types/react-redux": "^7.1.24",
128126
"@types/react-syntax-highlighter": "^15.5.7",
129127
"@types/react-test-renderer": "^18.0.0",
130-
"@types/react-textarea-autosize": "^8.0.0",
131128
"@types/redux-mock-store": "^1.0.3",
132129
"@types/showdown": "^2.0.1",
133130
"@types/uuid": "^9.0.0",

src/commons/application/reducers/RootReducer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { combineReducers } from 'redux';
1+
import { combineReducers, Reducer } from '@reduxjs/toolkit';
2+
import { SourceActionType } from 'src/commons/utils/ActionsHelper';
23

34
import { AchievementReducer as achievement } from '../../../features/achievement/AchievementReducer';
45
import { DashboardReducer as dashboard } from '../../../features/dashboard/DashboardReducer';
@@ -11,7 +12,7 @@ import { OverallState } from '../ApplicationTypes';
1112
import { RouterReducer as router } from './CommonsReducer';
1213
import { SessionsReducer as session } from './SessionsReducer';
1314

14-
const rootReducer = combineReducers<OverallState>({
15+
const rootReducer: Reducer<OverallState, SourceActionType> = combineReducers({
1516
router,
1617
achievement,
1718
dashboard,

src/commons/application/reducers/SessionsReducer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { createReducer } from '@reduxjs/toolkit';
2-
import { Reducer } from 'redux';
1+
import { createReducer, Reducer } from '@reduxjs/toolkit';
32
import RemoteExecutionActions from 'src/features/remoteExecution/RemoteExecutionActions';
43

54
import { SourceActionType } from '../../utils/ActionsHelper';

src/commons/assessment/__tests__/Assessment.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { Store } from '@reduxjs/toolkit';
12
import { act, render, screen } from '@testing-library/react';
23
import { Provider } from 'react-redux';
34
import { createMemoryRouter, RouterProvider } from 'react-router';
4-
import { Store } from 'redux';
55
import { OverallState, Role } from 'src/commons/application/ApplicationTypes';
66
import { mockAssessmentOverviews } from 'src/commons/mocks/AssessmentMocks';
77
import { mockInitialStore } from 'src/commons/mocks/StoreMocks';

src/commons/dropdown/__tests__/Dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { Store } from '@reduxjs/toolkit';
12
import { Provider } from 'react-redux';
23
import { MemoryRouter } from 'react-router';
3-
import { Store } from 'redux';
44
import { OverallState } from 'src/commons/application/ApplicationTypes';
55
import { UserCourse } from 'src/commons/application/types/SessionTypes';
66
import { mockInitialStore } from 'src/commons/mocks/StoreMocks';

src/commons/fileSystem/FileSystemReducer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { createReducer } from '@reduxjs/toolkit';
2-
import { Reducer } from 'redux';
1+
import { createReducer, Reducer } from '@reduxjs/toolkit';
32

43
import { defaultFileSystem } from '../application/ApplicationTypes';
54
import { SourceActionType } from '../utils/ActionsHelper';

src/commons/mocks/StoreMocks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { Store } from '@reduxjs/toolkit';
12
import _ from 'lodash';
2-
import { DeepPartial, Store } from 'redux';
33
import mockStore from 'redux-mock-store';
44

55
import {
@@ -15,6 +15,7 @@ import {
1515
OverallState
1616
} from '../application/ApplicationTypes';
1717
import { SourceActionType } from '../utils/ActionsHelper';
18+
import { DeepPartial } from '../utils/TypeHelper';
1819

1920
export function mockInitialStore(
2021
overrides?: DeepPartial<OverallState>

src/commons/profile/__tests__/Profile.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { act, render, screen } from '@testing-library/react';
22
import { Provider } from 'react-redux';
33
import { MemoryRouter } from 'react-router';
4-
import { DeepPartial } from 'redux';
54
import { OverallState, Role } from 'src/commons/application/ApplicationTypes';
65
import { mockInitialStore } from 'src/commons/mocks/StoreMocks';
7-
import { assertType } from 'src/commons/utils/TypeHelper';
6+
import { assertType, DeepPartial } from 'src/commons/utils/TypeHelper';
87

98
import { AssessmentConfiguration, AssessmentStatuses } from '../../assessment/AssessmentTypes';
109
import { mockAssessmentOverviews } from '../../mocks/AssessmentMocks';

src/commons/sagas/SideContentSaga.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Action } from 'redux';
1+
import { Action } from '@reduxjs/toolkit';
22
import { put, take } from 'redux-saga/effects';
33
import StoriesActions from 'src/features/stories/StoriesActions';
44

src/commons/sideContent/SideContentReducer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Reducer } from '@reduxjs/toolkit';
2+
13
import { defaultSideContent, defaultSideContentManager } from '../application/ApplicationTypes';
24
import { SourceActionType } from '../utils/ActionsHelper';
35
import {
@@ -11,10 +13,10 @@ import {
1113
import { getDynamicTabs, getLocation, getTabId } from './SideContentHelper';
1214
import { SideContentManagerState } from './SideContentTypes';
1315

14-
export function SideContentReducer(
16+
export const SideContentReducer: Reducer<SideContentManagerState, SourceActionType> = (
1517
state: SideContentManagerState = defaultSideContentManager,
1618
action: SourceActionType
17-
): SideContentManagerState {
19+
): SideContentManagerState => {
1820
if (!(action as any).payload?.workspaceLocation) {
1921
return state;
2022
}
@@ -146,4 +148,4 @@ export function SideContentReducer(
146148
default:
147149
return state;
148150
}
149-
}
151+
};

0 commit comments

Comments
 (0)