Skip to content

Commit f69b2c1

Browse files
chore: removed eslint-disable statements (#658)
* chore: removed eslint-disable statements * refactor: removed unnecessary files and unintentional eslint-disable statements * refactor: removed eslint import/no-cycle error * fix: failing testcase * style: removed comments * fix: failing testcase --------- Co-authored-by: sohailfatima <[email protected]> Co-authored-by: Fatima Sohail <[email protected]>
1 parent 88a985d commit f69b2c1

File tree

159 files changed

+1153
-1079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+1153
-1079
lines changed

jest.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module.exports = createConfig('jest', {
55
// If you want to add config BEFORE jest loads, use setupFiles instead.
66
setupFiles: ['<rootDir>/.env.test'],
77
setupFilesAfterEnv: [
8-
'<rootDir>/src/setupTest.js',
8+
'<rootDir>/src/setupTest.jsx',
99
],
1010
coveragePathIgnorePatterns: [
11-
'src/setupTest.js',
11+
'src/setupTest.jsx',
1212
'src/i18n',
1313
],
1414
});

src/components/FilterBar.jsx

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable react/forbid-prop-types */
21
import React, { useCallback, useMemo, useState } from 'react';
32
import PropTypes from 'prop-types';
43

@@ -15,7 +14,7 @@ import {
1514
PostsStatusFilter, RequestStatus,
1615
ThreadOrdering, ThreadType,
1716
} from '../data/constants';
18-
import { selectCourseCohorts } from '../discussions/cohorts/data/selectors';
17+
import selectCourseCohorts from '../discussions/cohorts/data/selectors';
1918
import messages from '../discussions/posts/post-filter-bar/messages';
2019
import { ActionItem } from '../discussions/posts/post-filter-bar/PostFilterBar';
2120

@@ -194,8 +193,16 @@ const FilterBar = ({
194193

195194
FilterBar.propTypes = {
196195
intl: intlShape.isRequired,
197-
filters: PropTypes.array.isRequired,
198-
selectedFilters: PropTypes.object.isRequired,
196+
filters: PropTypes.arrayOf(PropTypes.shape({
197+
name: PropTypes.string,
198+
filters: PropTypes.arrayOf(PropTypes.string),
199+
})).isRequired,
200+
selectedFilters: PropTypes.shape({
201+
postType: ThreadType,
202+
status: PostsStatusFilter,
203+
orderBy: ThreadOrdering,
204+
cohort: PropTypes.string,
205+
}).isRequired,
199206
onFilterChange: PropTypes.func.isRequired,
200207
showCohortsFilter: PropTypes.bool,
201208
};

src/components/NavigationBar/CourseTabsNavigation.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useDispatch, useSelector } from 'react-redux';
66

77
import { useIntl } from '@edx/frontend-platform/i18n';
88

9-
import { fetchTab } from './data/thunks';
9+
import fetchTab from './data/thunks';
1010
import Tabs from './tabs/Tabs';
1111
import messages from './messages';
1212

src/components/NavigationBar/data/api.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable import/prefer-default-export */
21
import { camelCaseObject } from '@edx/frontend-platform';
32
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
43

src/components/NavigationBar/data/api.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
55
import { initializeMockApp } from '@edx/frontend-platform/testing';
66

77
import { initializeStore } from '../../../store';
8-
import { executeThunk } from '../../../test-utils';
8+
import executeThunk from '../../../test-utils';
99
import { getCourseMetadataApiUrl } from './api';
10-
import { fetchTab } from './thunks';
10+
import fetchTab from './thunks';
1111

1212
import './__factories__';
1313

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
/* eslint-disable import/prefer-default-export */
1+
const selectCourseTabs = state => state.courseTabs;
22

3-
export const selectCourseTabs = state => state.courseTabs;
3+
export default selectCourseTabs;

src/components/NavigationBar/data/slice.js

+33-22
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-param-reassign */
21
import { createSlice } from '@reduxjs/toolkit';
32

43
export const LOADING = 'loading';
@@ -17,27 +16,39 @@ const slice = createSlice({
1716
org: null,
1817
},
1918
reducers: {
20-
fetchTabDenied: (state, { payload }) => {
21-
state.courseId = payload.courseId;
22-
state.courseStatus = DENIED;
23-
},
24-
fetchTabFailure: (state, { payload }) => {
25-
state.courseId = payload.courseId;
26-
state.courseStatus = FAILED;
27-
},
28-
fetchTabRequest: (state, { payload }) => {
29-
state.courseId = payload.courseId;
30-
state.courseStatus = LOADING;
31-
},
32-
fetchTabSuccess: (state, { payload }) => {
33-
state.courseId = payload.courseId;
34-
state.targetUserId = payload.targetUserId;
35-
state.tabs = payload.tabs;
36-
state.courseStatus = LOADED;
37-
state.courseTitle = payload.courseTitle;
38-
state.courseNumber = payload.courseNumber;
39-
state.org = payload.org;
40-
},
19+
fetchTabDenied: (state, { payload }) => (
20+
{
21+
...state,
22+
courseId: payload.courseId,
23+
courseStatus: DENIED,
24+
}
25+
),
26+
fetchTabFailure: (state, { payload }) => (
27+
{
28+
...state,
29+
courseId: payload.courseId,
30+
courseStatus: FAILED,
31+
}
32+
),
33+
fetchTabRequest: (state, { payload }) => (
34+
{
35+
...state,
36+
courseId: payload.courseId,
37+
courseStatus: LOADING,
38+
}
39+
),
40+
fetchTabSuccess: (state, { payload }) => (
41+
{
42+
...state,
43+
courseId: payload.courseId,
44+
targetUserId: payload.targetUserId,
45+
tabs: payload.tabs,
46+
courseStatus: LOADED,
47+
courseTitle: payload.courseTitle,
48+
courseNumber: payload.courseNumber,
49+
org: payload.org,
50+
}
51+
),
4152
},
4253
});
4354

src/components/NavigationBar/data/thunks.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable import/prefer-default-export, no-unused-expressions */
21
import { logError } from '@edx/frontend-platform/logging';
32

43
import { getHttpErrorStatus } from '../../../discussions/utils';
@@ -10,7 +9,7 @@ import {
109
fetchTabSuccess,
1110
} from './slice';
1211

13-
export function fetchTab(courseId, rootSlug) {
12+
export default function fetchTab(courseId, rootSlug) {
1413
return async (dispatch) => {
1514
dispatch(fetchTabRequest({ courseId }));
1615
try {

src/components/NavigationBar/index.js

-2
This file was deleted.

src/components/Search.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useIntl } from '@edx/frontend-platform/i18n';
99
import { Icon, SearchField } from '@edx/paragon';
1010
import { Search as SearchIcon } from '@edx/paragon/icons';
1111

12-
import { DiscussionContext } from '../discussions/common/context';
12+
import DiscussionContext from '../discussions/common/context';
1313
import { setUsernameSearch } from '../discussions/learners/data';
1414
import { setSearchQuery } from '../discussions/posts/data';
1515
import postsMessages from '../discussions/posts/post-actions-bar/messages';

src/components/icons/InsertLink.jsx

-21
This file was deleted.

src/components/icons/Issue.jsx

-27
This file was deleted.

src/components/icons/People.jsx

-19
This file was deleted.

src/components/icons/PushPin.jsx

-21
This file was deleted.

src/components/icons/Question.jsx

-27
This file was deleted.

src/components/icons/QuestionAnswer.jsx

-19
This file was deleted.

src/components/icons/QuestionAnswerOutline.jsx

-19
This file was deleted.

src/components/icons/StarFilled.jsx

-19
This file was deleted.

src/components/icons/StarOutline.jsx

-19
This file was deleted.

src/components/icons/ThumbUpFilled.jsx

-19
This file was deleted.

0 commit comments

Comments
 (0)