Skip to content

Commit

Permalink
Merge pull request #673 from openedx/abdullahwaheed/eslint-issues-fix
Browse files Browse the repository at this point in the history
fix: migrated functions to arrow functions to fix linting
  • Loading branch information
abdullahwaheed authored Oct 24, 2022
2 parents 9dd0576 + dc26da9 commit e9f6acf
Show file tree
Hide file tree
Showing 45 changed files with 312 additions and 324 deletions.
20 changes: 9 additions & 11 deletions src/account-settings/Alert.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

function Alert(props) {
return (
<div className={classNames('alert d-flex align-items-start', props.className)}>
<div>
{props.icon}
</div>
<div>
{props.children}
</div>
const Alert = (props) => (
<div className={classNames('alert d-flex align-items-start', props.className)}>
<div>
{props.icon}
</div>
);
}
<div>
{props.children}
</div>
</div>
);

Alert.propTypes = {
className: PropTypes.string,
Expand Down
4 changes: 2 additions & 2 deletions src/account-settings/DOBForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { YEAR_OF_BIRTH_OPTIONS } from './data/constants';
import { editableFieldSelector } from './data/selectors';
import { saveSettingsReset } from './data/actions';

function DOBModal(props) {
const DOBModal = (props) => {
const {
saveState,
error,
Expand Down Expand Up @@ -131,7 +131,7 @@ function DOBModal(props) {
</ModalDialog>
</>
);
}
};

DOBModal.propTypes = {
saveState: PropTypes.oneOf(['default', 'pending', 'complete', 'error']),
Expand Down
4 changes: 2 additions & 2 deletions src/account-settings/EditableField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { editableFieldSelector } from './data/selectors';
import CertificatePreference from './certificate-preference/CertificatePreference';

function EditableField(props) {
const EditableField = (props) => {
const {
name,
label,
Expand Down Expand Up @@ -179,7 +179,7 @@ function EditableField(props) {
}}
/>
);
}
};

EditableField.propTypes = {
name: PropTypes.string.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions src/account-settings/EmailField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from './data/actions';
import { editableFieldSelector } from './data/selectors';

function EmailField(props) {
const EmailField = (props) => {
const {
name,
label,
Expand Down Expand Up @@ -169,7 +169,7 @@ function EmailField(props) {
}}
/>
);
}
};

EmailField.propTypes = {
name: PropTypes.string.isRequired,
Expand Down
6 changes: 3 additions & 3 deletions src/account-settings/JumpNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { NavHashLink } from 'react-router-hash-link';
import Scrollspy from 'react-scrollspy';
import messages from './AccountSettingsPage.messages';

function JumpNav({
const JumpNav = ({
intl,
displayDemographicsLink,
}) {
}) => {
const stickToTop = useWindowSize().width > breakpoints.small.minWidth;
return (
<div className={classNames('jump-nav', { 'jump-nav-sm position-sticky pt-3': stickToTop })}>
Expand Down Expand Up @@ -69,7 +69,7 @@ function JumpNav({
</Scrollspy>
</div>
);
}
};

JumpNav.propTypes = {
intl: intlShape.isRequired,
Expand Down
26 changes: 13 additions & 13 deletions src/account-settings/NotFoundPage.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';
import { FormattedMessage } from '@edx/frontend-platform/i18n';

export default function NotFoundPage() {
return (
<div className="container-fluid d-flex py-5 justify-content-center align-items-start text-center">
<p className="my-0 py-5 text-muted" style={{ maxWidth: '32em' }}>
<FormattedMessage
id="error.notfound.message"
defaultMessage="The page you're looking for is unavailable or there's an error in the URL. Please check the URL and try again."
description="Error message when a page does not exist"
/>
</p>
</div>
);
}
const NotFoundPage = () => (
<div className="container-fluid d-flex py-5 justify-content-center align-items-start text-center">
<p className="my-0 py-5 text-muted" style={{ maxWidth: '32em' }}>
<FormattedMessage
id="error.notfound.message"
defaultMessage="The page you're looking for is unavailable or there's an error in the URL. Please check the URL and try again."
description="Error message when a page does not exist"
/>
</p>
</div>
);

export default NotFoundPage;
6 changes: 4 additions & 2 deletions src/account-settings/OneTimeDismissibleAlert.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';

import { Alert } from '@edx/paragon';

export default function OneTimeDismissibleAlert(props) {
const OneTimeDismissibleAlert = (props) => {
const [dismissed, setDismissed] = useState(localStorage.getItem(props.id) !== 'true');

const onClose = () => {
Expand All @@ -25,7 +25,7 @@ export default function OneTimeDismissibleAlert(props) {
</p>
</Alert>
);
}
};

OneTimeDismissibleAlert.propTypes = {
id: PropTypes.string.isRequired,
Expand All @@ -41,3 +41,5 @@ OneTimeDismissibleAlert.defaultProps = {
header: undefined,
body: undefined,
};

export default OneTimeDismissibleAlert;
4 changes: 2 additions & 2 deletions src/account-settings/SwitchContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const onChildExit = (htmlNode) => {
}
};

function SwitchContent({ expression, cases, className }) {
const SwitchContent = ({ expression, cases, className }) => {
const getContent = (caseKey) => {
if (cases[caseKey]) {
if (typeof cases[caseKey] === 'string') {
Expand All @@ -48,7 +48,7 @@ function SwitchContent({ expression, cases, className }) {
{getContent(expression)}
</TransitionReplace>
);
}
};

SwitchContent.propTypes = {
expression: PropTypes.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import { certPreferenceSelector } from '../data/selectors';
import commonMessages from '../AccountSettingsPage.messages';
import messages from './messages';

function CertificatePreference({
const CertificatePreference = ({
intl,
fieldName,
originalFullName,
originalVerifiedName,
saveState,
useVerifiedNameForCerts,
}) {
}) => {
const dispatch = useDispatch();
const [checked, setChecked] = useState(false);
const [modalIsOpen, setModalIsOpen] = useState(false);
Expand Down Expand Up @@ -152,7 +152,7 @@ function CertificatePreference({
</ModalDialog>
</>
) : null;
}
};

CertificatePreference.propTypes = {
intl: intlShape.isRequired,
Expand Down
30 changes: 13 additions & 17 deletions src/account-settings/coaching/CoachingConsent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,24 @@ import LogoSVG from '../../logo.svg';
import { fetchSettings } from '../data/actions';
import { coachingConsentPageSelector } from '../data/selectors';

function Logo({ src, alt, ...attributes }) {
return <img src={src} alt={alt} {...attributes} />;
}
const Logo = ({ src, alt, ...attributes }) => <img src={src} alt={alt} {...attributes} />;

function SuccessMessage(props) {
return (
<div className="col-12 col-lg-6 shadow-lg mx-auto mt-4 p-5">
<FontAwesomeIcon className="text-success" icon={faCheck} size="5x" />
<div className="h3">{props.header}</div>
<div>{props.message}</div>
<Hyperlink destination={props.continueUrl} className="d-block p-2 my-3 text-center text-white bg-primary rounded">
{props.continue}
</Hyperlink>
</div>
);
}
const SuccessMessage = (props) => (
<div className="col-12 col-lg-6 shadow-lg mx-auto mt-4 p-5">
<FontAwesomeIcon className="text-success" icon={faCheck} size="5x" />
<div className="h3">{props.header}</div>
<div>{props.message}</div>
<Hyperlink destination={props.continueUrl} className="d-block p-2 my-3 text-center text-white bg-primary rounded">
{props.continue}
</Hyperlink>
</div>
);

function AutoRedirect(props) {
const AutoRedirect = (props) => {
window.location.href = props.redirectUrl;
// eslint-disable-next-line react/jsx-no-useless-fragment
return <></>;
}
};

const VIEWS = {
NOT_LOADED: 'NOT_LOADED',
Expand Down
Loading

0 comments on commit e9f6acf

Please sign in to comment.