Skip to content

Commit

Permalink
MNT ESLint issues (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabina-talipova authored Jul 9, 2023
1 parent ed0db23 commit 8a8fe70
Show file tree
Hide file tree
Showing 32 changed files with 77 additions and 74 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle-cms.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions client/src/boot/cms/registerComponents.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Injector from 'lib/Injector'; // eslint-disable-line
import baseRegisterComponents from '../registerComponents';
import MFARegister from 'components/Register';
import RegisteredMFAMethodListField from 'components/FormField/RegisteredMFAMethodListField/RegisteredMFAMethodListField';

import baseRegisterComponents from '../registerComponents';

export default () => {
baseRegisterComponents();
Expand Down
2 changes: 1 addition & 1 deletion client/src/boot/cms/registerReducers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Injector from 'lib/Injector'; // eslint-disable-line
import baseRegisterReducers from '../registerReducers';
import mfaAdministrationReducer from 'state/mfaAdministration/reducer';
import baseRegisterReducers from '../registerReducers';

export default () => {
baseRegisterReducers();
Expand Down
3 changes: 1 addition & 2 deletions client/src/boot/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* global window */
import React from 'react';
import { createRoot } from 'react-dom/client';
import Login from '../containers/Login';
import registerComponents from 'boot/registerComponents';
import registerReducers from 'boot/registerReducers';
import Injector from 'lib/Injector'; // eslint-disable-line
import { createStore, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import Login from '../containers/Login';

window.document.addEventListener('DOMContentLoaded', () => {
registerComponents();
Expand All @@ -32,4 +32,3 @@ window.document.addEventListener('DOMContentLoaded', () => {
// Force this to the end of the execution queue to ensure it's last.
window.setTimeout(() => Injector.load(), 1);
});

1 change: 0 additions & 1 deletion client/src/components/BackupCodes/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ class Register extends Component {
}
}


Register.propTypes = {
codes: PropTypes.arrayOf(PropTypes.string),
// Determines the duration of the 'copied' message (in milliseconds)
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/BackupCodes/tests/Register-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* global jest, test */

import React from 'react';
import Register from '../Register';
import { render, fireEvent, screen } from '@testing-library/react';
import Register from '../Register';

window.ss = {
i18n: { _t: (key, string) => string },
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/BackupCodes/tests/Verify-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* global jest, test */

import React from 'react';
import Verify from '../Verify';
import { render, fireEvent } from '@testing-library/react';
import Verify from '../Verify';

window.ss = {
i18n: { _t: (key, string) => string },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import confirm from 'reactstrap-confirm';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import moment from 'moment';
import methodShape from 'types/registeredMethod';
import Remove from './MethodListItem/Remove';
import Reset from './MethodListItem/Reset';
import SetDefault from './MethodListItem/SetDefault';
import methodShape from 'types/registeredMethod';

import fallbacks from '../../../../lang/src/en.json';

Expand Down Expand Up @@ -113,7 +113,6 @@ class MethodListItem extends PureComponent {
return <SetDefaultComponent method={method} />;
}


renderControls() {
const { canRemove, canReset } = this.props;

Expand All @@ -123,9 +122,9 @@ class MethodListItem extends PureComponent {

return (
<div>
{ this.renderRemove() }
{ this.renderReset() }
{ this.renderSetAsDefault() }
{ this.renderRemove() }
{ this.renderReset() }
{ this.renderSetAsDefault() }
</div>
);
}
Expand Down Expand Up @@ -156,8 +155,8 @@ class MethodListItem extends PureComponent {

return (
<Tag className={classes}>
{ this.renderNameAndStatus() }
{ this.renderControls() }
{ this.renderNameAndStatus() }
{ this.renderControls() }
</Tag>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const Remove = ({
}));
};


return (
<button
className="registered-method-list-item__control"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { connect } from 'react-redux';
import classnames from 'classnames';
import registeredMethodShape from 'types/registeredMethod';
import availableMethodShape from 'types/availableMethod';
import AccountResetUI from './AccountResetUI';
import MethodListItem from './MethodListItem';
import {
chooseMethod,
setAvailableMethods,
Expand All @@ -17,6 +15,8 @@ import {
SCREEN_CHOOSE_METHOD,
SCREEN_INTRODUCTION
} from 'components/Register';
import MethodListItem from './MethodListItem';
import AccountResetUI from './AccountResetUI';
import RegisterModal from '../../RegisterModal';

import fallbacks from '../../../../lang/src/en.json';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

// eslint-disable-next-line no-unused-vars
import React from 'react';
import AccountResetUI from '../AccountResetUI';
import { render, screen, fireEvent } from '@testing-library/react';
import AccountResetUI from '../AccountResetUI';

let resolveApiCall;
let rejectApiCall;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global jest, test, describe, it, expect */
import React from 'react';
import MethodListItem from '../MethodListItem';
import { render } from '@testing-library/react';
import MethodListItem from '../MethodListItem';

window.ss = {
i18n: {
Expand All @@ -14,7 +14,7 @@ window.ss = {
function makeProps(obj = {}) {
return {
method: {
urlSegment: 'foo'
urlSegment: 'foo'
},
RemoveComponent: () => <div className="test-remove" />,
SetDefaultComponent: () => <div className="test-set-default" />,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* global jest, test, describe, it, expect */

import React from 'react';
import { Component as RegisteredMFAMethodListField } from '../RegisteredMFAMethodListField';
import { render } from '@testing-library/react';
import { Component as RegisteredMFAMethodListField } from '../RegisteredMFAMethodListField';

import translationStrings from '../../../../../lang/src/en.json';

window.ss = {
i18n: { _t: (key, string) => string, detectLocale: () => 'en', inject: () => {} },
Expand All @@ -27,8 +29,6 @@ function makeProps(obj = {}) {
};
}

import translationStrings from '../../../../../lang/src/en.json';

test('RegisteredMFAMethodListField filters out backup methods', () => {
const { container } = render(
<RegisteredMFAMethodListField {...makeProps({
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/Register.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-cycle */
/* global window */

import React, { Component } from 'react';
Expand Down Expand Up @@ -169,12 +170,12 @@ class Register extends Component {
if (response && response.errors) {
const formattedErrors = response.errors.join(', ');

this.setState({
this.setState((prevState) => ({
registerProps: {
...this.state.registerProps,
...prevState.registerProps,
error: formattedErrors,
},
});
}));
}
});
}
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/Register/Complete.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-cycle */
import React from 'react';
import PropTypes from 'prop-types';
import Title from './Title';
Expand Down Expand Up @@ -26,12 +27,12 @@ const Complete = ({ onComplete, showTitle, message }) => (
);

Complete.propTypes = {
onComplete: PropTypes.func.isRequired,
showTitle: PropTypes.bool,
onComplete: PropTypes.func.isRequired,
showTitle: PropTypes.bool,
};

Complete.defaultProps = {
showTitle: true,
showTitle: true,
};

export default Complete;
3 changes: 2 additions & 1 deletion client/src/components/Register/Introduction.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint-disable import/no-cycle */
/* global window */

import React from 'react';
import PropTypes from 'prop-types';
import { showScreen, chooseMethod } from 'state/mfaRegister/actions';
import { SCREEN_REGISTER_METHOD } from '../Register';
import { connect } from 'react-redux';
import { SCREEN_REGISTER_METHOD } from '../Register';
import Title from './Title';

import fallbacks from '../../../lang/src/en.json';
Expand Down
5 changes: 3 additions & 2 deletions client/src/components/Register/SelectMethod.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/* eslint-disable import/no-cycle */
/* global window */

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import MethodTile from './MethodTile';
import availableMethodType from 'types/availableMethod';
import classnames from 'classnames';
import { SCREEN_INTRODUCTION, SCREEN_REGISTER_METHOD } from '../Register';
import { showScreen, chooseMethod } from 'state/mfaRegister/actions';
import { compose } from 'redux';
import { connect } from 'react-redux';
import withMethodAvailability from 'state/methodAvailability/withMethodAvailability';
import { SCREEN_INTRODUCTION, SCREEN_REGISTER_METHOD } from '../Register';
import MethodTile from './MethodTile';
import Title from './Title';

/**
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Register/Title.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* eslint-disable import/no-cycle */
import React from 'react';
import { connect } from 'react-redux';
import {
SCREEN_INTRODUCTION,
SCREEN_REGISTER_METHOD,
SCREEN_CHOOSE_METHOD,
SCREEN_COMPLETE,
} from '../Register';
import { connect } from 'react-redux';

import fallbacks from '../../../lang/src/en.json';

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Register/tests/Introduction-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* global jest, test, describe, it, expect */

import React from 'react';
import { Component as Introduction, ActionList } from '../Introduction';
import { fireEvent, render } from '@testing-library/react';
import { Component as Introduction, ActionList } from '../Introduction';

window.ss = {
i18n: { _t: (key, string) => string },
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Register/tests/MethodTile-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* global jest, test, describe, it, expect */

import React from 'react';
import { Component as MethodTile } from '../MethodTile';
import { fireEvent, render } from '@testing-library/react';
import { Component as MethodTile } from '../MethodTile';

function makeProps(obj = {}) {
return {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Register/tests/SelectMethod-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* global jest, test, describe, it, expect */

import React from 'react';
import { Component as SelectMethod } from '../SelectMethod';
import { render, fireEvent } from '@testing-library/react';
import { Component as SelectMethod } from '../SelectMethod';

window.ss = {
i18n: { _t: (key, string) => string },
Expand Down
1 change: 0 additions & 1 deletion client/src/components/RegisterModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class RegisterModal extends Component {
}
}


RegisterModal.propTypes = {
// Boolean for if the modal is open
isOpen: PropTypes.bool,
Expand Down
12 changes: 6 additions & 6 deletions client/src/components/Verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,15 @@ class Verify extends Component {
}

return (
<Fragment>
<>
{this.renderTitle()}
<SelectMethodComponent
resources={resources}
methods={otherMethods}
onClickBack={this.handleHideOtherMethodsPane}
onSelectMethod={method => event => this.handleClickOtherMethod(event, method)}
/>
</Fragment>
</>
);
}

Expand Down Expand Up @@ -327,7 +327,7 @@ class Verify extends Component {
});

return (
<Fragment>
<>
{this.renderTitle()}

<h2 className="mfa-section-title">{leadInLabel}</h2>
Expand All @@ -338,7 +338,7 @@ class Verify extends Component {
onCompleteVerification={this.handleCompleteVerification}
moreOptionsControl={this.renderOtherMethodsControl()}
/>}
</Fragment>
</>
);
}

Expand All @@ -363,10 +363,10 @@ class Verify extends Component {
}

return (
<Fragment>
<>
{this.renderSelectedMethod()}
{this.renderOtherMethods()}
</Fragment>
</>
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Verify/tests/SelectMethod-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

// eslint-disable-next-line no-unused-vars
import React from 'react';
import { Component as SelectMethod } from '../SelectMethod';
import { render, fireEvent } from '@testing-library/react';
import { Component as SelectMethod } from '../SelectMethod';

window.ss = {
i18n: {
Expand Down
Loading

0 comments on commit 8a8fe70

Please sign in to comment.