Skip to content

Commit b3d3366

Browse files
authored
Updated frontend-build to v12 (openedx#962)
* feat: rebase previous frontend-build upgrade * chore: make welcome message to default to empty
1 parent b500546 commit b3d3366

File tree

164 files changed

+849
-800
lines changed

Some content is hidden

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

164 files changed

+849
-800
lines changed

.eslintrc.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1+
// eslint-disable-next-line import/no-extraneous-dependencies
12
const { createConfig } = require('@edx/frontend-build');
23

34
const config = createConfig('eslint', {
45
rules: {
56
// TODO: all these rules should be renabled/addressed. temporarily turned off to unblock a release.
67
'react-hooks/rules-of-hooks': 'off',
78
'react-hooks/exhaustive-deps': 'off',
8-
'react/function-component-definition': 'off',
99
'import/no-extraneous-dependencies': 'off',
1010
'no-restricted-exports': 'off',
1111
'react/jsx-no-useless-fragment': 'off',
12-
'react/jsx-no-bind': 'off',
1312
'react/no-unknown-property': 'off',
14-
'react/no-unstable-nested-components': 'off',
15-
'react/jsx-no-constructed-context-values': 'off',
13+
'func-names': 'off',
1614
},
1715
});
1816

src/alerts/access-expiration-alert/AccessExpirationAlert.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Info } from '@edx/paragon/icons';
88

99
import messages from './messages';
1010

11-
function AccessExpirationAlert({ intl, payload }) {
11+
const AccessExpirationAlert = ({ intl, payload }) => {
1212
const {
1313
accessExpiration,
1414
courseId,
@@ -116,7 +116,7 @@ function AccessExpirationAlert({ intl, payload }) {
116116
{deadlineMessage}
117117
</Alert>
118118
);
119-
}
119+
};
120120

121121
AccessExpirationAlert.propTypes = {
122122
intl: intlShape.isRequired,

src/alerts/access-expiration-alert/AccessExpirationMasqueradeBanner.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
33
import { FormattedMessage, FormattedDate } from '@edx/frontend-platform/i18n';
44
import { PageBanner } from '@edx/paragon';
55

6-
function AccessExpirationMasqueradeBanner({ payload }) {
6+
const AccessExpirationMasqueradeBanner = ({ payload }) => {
77
const {
88
expirationDate,
99
userTimezone,
@@ -27,7 +27,7 @@ function AccessExpirationMasqueradeBanner({ payload }) {
2727
/>
2828
</PageBanner>
2929
);
30-
}
30+
};
3131

3232
AccessExpirationMasqueradeBanner.propTypes = {
3333
payload: PropTypes.shape({

src/alerts/access-expiration-alert/hooks.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ const AccessExpirationMasqueradeBanner = React.lazy(() => import('./AccessExpira
77

88
function useAccessExpirationAlert(accessExpiration, courseId, org, userTimezone, topic, analyticsPageName) {
99
const isVisible = accessExpiration && !accessExpiration.masqueradingExpiredCourse; // If it exists, show it.
10-
const payload = {
10+
const payload = useMemo(() => ({
1111
accessExpiration,
1212
courseId,
1313
org,
1414
userTimezone,
1515
analyticsPageName,
16-
};
16+
}), [accessExpiration, analyticsPageName, courseId, org, userTimezone]);
1717

1818
useAlert(isVisible, {
1919
code: 'clientAccessExpirationAlert',
20-
payload: useMemo(() => payload, Object.values(payload).sort()),
20+
payload,
2121
topic,
2222
});
2323

@@ -34,14 +34,14 @@ export function useAccessExpirationMasqueradeBanner(courseId, tab) {
3434

3535
const isVisible = accessExpiration && accessExpiration.masqueradingExpiredCourse;
3636
const expirationDate = accessExpiration && accessExpiration.expirationDate;
37-
const payload = {
37+
const payload = useMemo(() => ({
3838
expirationDate,
3939
userTimezone,
40-
};
40+
}), [expirationDate, userTimezone]);
4141

4242
useAlert(isVisible, {
4343
code: 'clientAccessExpirationMasqueradeBanner',
44-
payload: useMemo(() => payload, Object.values(payload).sort()),
44+
payload,
4545
topic: 'instructor-toolbar-alerts',
4646
});
4747

src/alerts/active-enteprise-alert/ActiveEnterpriseAlert.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { WarningFilled } from '@edx/paragon/icons';
77
import { getConfig } from '@edx/frontend-platform';
88
import genericMessages from './messages';
99

10-
function ActiveEnterpriseAlert({ intl, payload }) {
10+
const ActiveEnterpriseAlert = ({ intl, payload }) => {
1111
const { text, courseId } = payload;
1212
const changeActiveEnterprise = (
1313
<Hyperlink
@@ -35,7 +35,7 @@ function ActiveEnterpriseAlert({ intl, payload }) {
3535
/>
3636
</Alert>
3737
);
38-
}
38+
};
3939

4040
ActiveEnterpriseAlert.propTypes = {
4141
intl: intlShape.isRequired,

src/alerts/active-enteprise-alert/hooks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ export default function useActiveEnterpriseAlert(courseId) {
1212
*/
1313
const isVisible = courseAccess && !courseAccess.hasAccess && courseAccess.errorCode === 'incorrect_active_enterprise';
1414

15-
const payload = {
15+
const payload = useMemo(() => ({
1616
text: courseAccess && courseAccess.userMessage,
1717
courseId,
18-
};
18+
}), [courseAccess, courseId]);
1919
useAlert(isVisible, {
2020
code: 'clientActiveEnterpriseAlert',
2121
topic: 'outline',
2222
dismissible: false,
2323
type: ALERT_TYPES.ERROR,
24-
payload: useMemo(() => payload, Object.values(payload).sort()),
24+
payload,
2525
});
2626

2727
return { clientActiveEnterpriseAlert: ActiveEnterpriseAlert };

src/alerts/course-start-alert/CourseStartAlert.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const DAY_SEC = 24 * 60 * 60; // in seconds
1515
const DAY_MS = DAY_SEC * 1000; // in ms
1616
const YEAR_SEC = 365 * DAY_SEC; // in seconds
1717

18-
function CourseStartAlert({ payload }) {
18+
const CourseStartAlert = ({ payload }) => {
1919
const {
2020
courseId,
2121
} = payload;
@@ -94,7 +94,7 @@ function CourseStartAlert({ payload }) {
9494
/>
9595
</Alert>
9696
);
97-
}
97+
};
9898

9999
CourseStartAlert.propTypes = {
100100
payload: PropTypes.shape({

src/alerts/course-start-alert/CourseStartMasqueradeBanner.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { PageBanner } from '@edx/paragon';
55

66
import { useModel } from '../../generic/model-store';
77

8-
function CourseStartMasqueradeBanner({ payload }) {
8+
const CourseStartMasqueradeBanner = ({ payload }) => {
99
const {
1010
courseId,
1111
} = payload;
@@ -33,7 +33,7 @@ function CourseStartMasqueradeBanner({ payload }) {
3333
/>
3434
</PageBanner>
3535
);
36-
}
36+
};
3737

3838
CourseStartMasqueradeBanner.propTypes = {
3939
payload: PropTypes.shape({

src/alerts/course-start-alert/hooks.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useModel } from '../../generic/model-store';
55
const CourseStartAlert = React.lazy(() => import('./CourseStartAlert'));
66
const CourseStartMasqueradeBanner = React.lazy(() => import('./CourseStartMasqueradeBanner'));
77

8-
function isStartDateInFuture(courseId) {
8+
function IsStartDateInFuture(courseId) {
99
const {
1010
start,
1111
} = useModel('courseHomeMeta', courseId);
@@ -20,15 +20,15 @@ function useCourseStartAlert(courseId) {
2020
isEnrolled,
2121
} = useModel('courseHomeMeta', courseId);
2222

23-
const isVisible = isEnrolled && isStartDateInFuture(courseId);
23+
const isVisible = isEnrolled && IsStartDateInFuture(courseId);
2424

25-
const payload = {
25+
const payload = useMemo(() => ({
2626
courseId,
27-
};
27+
}), [courseId]);
2828

2929
useAlert(isVisible, {
3030
code: 'clientCourseStartAlert',
31-
payload: useMemo(() => payload, Object.values(payload).sort()),
31+
payload,
3232
topic: 'outline-course-alerts',
3333
});
3434

@@ -42,15 +42,15 @@ export function useCourseStartMasqueradeBanner(courseId, tab) {
4242
isMasquerading,
4343
} = useModel('courseHomeMeta', courseId);
4444

45-
const isVisible = isMasquerading && tab === 'progress' && isStartDateInFuture(courseId);
45+
const isVisible = isMasquerading && tab === 'progress' && IsStartDateInFuture(courseId);
4646

47-
const payload = {
47+
const payload = useMemo(() => ({
4848
courseId,
49-
};
49+
}), [courseId]);
5050

5151
useAlert(isVisible, {
5252
code: 'clientCourseStartMasqueradeBanner',
53-
payload: useMemo(() => payload, Object.values(payload).sort()),
53+
payload,
5454
topic: 'instructor-toolbar-alerts',
5555
});
5656

src/alerts/enrollment-alert/EnrollmentAlert.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useModel } from '../../generic/model-store';
1111
import messages from './messages';
1212
import useEnrollClickHandler from './clickHook';
1313

14-
function EnrollmentAlert({ intl, payload }) {
14+
const EnrollmentAlert = ({ intl, payload }) => {
1515
const {
1616
canEnroll,
1717
courseId,
@@ -55,7 +55,7 @@ function EnrollmentAlert({ intl, payload }) {
5555
</div>
5656
</Alert>
5757
);
58-
}
58+
};
5959

6060
EnrollmentAlert.propTypes = {
6161
intl: intlShape.isRequired,

0 commit comments

Comments
 (0)