Skip to content

Commit

Permalink
Fixes remaining lint errors. (#1083)
Browse files Browse the repository at this point in the history
  • Loading branch information
smurrayatwork authored Jun 10, 2020
1 parent 5323874 commit b3bb43f
Show file tree
Hide file tree
Showing 18 changed files with 138 additions and 123 deletions.
4 changes: 3 additions & 1 deletion react/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"no-use-before-define": ["off"],
"jsx-a11y/anchor-is-valid": ["warn"],
"react/jsx-props-no-spreading": ["off"],
"react/destructuring-assignment": ["off"]
"react/destructuring-assignment": ["off"],
"react/static-property-placement": ["off"],
"react/state-in-constructor": ["off"]
},
"settings": {
"import/resolver": {
Expand Down
1 change: 1 addition & 0 deletions react/src/components/atoms/buttons/ButtonCopy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ButtonCopy = ({ content }) => {
if ((navigator && navigator.clipboard) || (window.location.search.indexOf('backstop') > -1)) {
return(
<button
type="button"
className="ma__button-copy"
onClick={copyAction}
title={copyButtonTitle}
Expand Down
1 change: 1 addition & 0 deletions react/src/components/atoms/links/FootNote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class FootNote extends React.Component {
return(
<div className="ma__footnote-item">
<button
type="button"
id={`footnotemsg${index}`}
onClick={() => this.handleScroll()}
>
Expand Down
1 change: 1 addition & 0 deletions react/src/components/atoms/links/FootNoteLink/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class FootNoteLink extends React.Component {
const { index } = this.props;
return(
<button
type="button"
className={`ma__footnote-link footnoteref${index}`}
aria-describedby={`footnotemsg${index}`}
aria-label={`see footnote ${index}`}
Expand Down
2 changes: 1 addition & 1 deletion react/src/components/forms/CompoundSlider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const Handle = (props) => {
};
}
return(
<button className="ma__slider-handle" {...divProps}>
<button type="button" className="ma__slider-handle" {...divProps}>
{ displayValueFormat && (
<div className="ma__slider-handle-value">
{ displayValueFormat === 'percentage' ? numbro(value).format({ output: 'percent', mantissa: 0 }) : roundedValue }
Expand Down
36 changes: 21 additions & 15 deletions react/src/components/forms/FeedbackForm/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint jsx-a11y/label-has-associated-control: 0 */

/**
* FeedbackForm module.
* @module @massds/mayflower-react/FeedbackForm
Expand Down Expand Up @@ -69,17 +71,31 @@ export default class FeedbackForm extends React.Component {
formSubmitted: false
};

yesRadio = React.createRef();

yesTextArea = React.createRef();

noRadio = React.createRef();

noTextArea = React.createRef();

submitButton = React.createRef();

componentDidMount() {
if (window) {
// We don't have the FormStack class available, but we can fake like we do:
window[`form${this.props.formId}`] = {
onSubmitError: (err) => {
if (err) {
const hasError = [...this.state.hasError];
hasError.push(this.props.radioId);
hasError.push(this.props.noFeedbackId);
const errorMessage = <Paragraph className="error">{err.error}</Paragraph>;
this.setState({ hasError, errorMessage });
this.setState((state, props) => {
const hasError = [...state.hasError];
hasError.push(props.radioId);
hasError.push(props.noFeedbackId);
const errorMessage = <Paragraph className="error">{err.error}</Paragraph>;
return{
hasError, errorMessage
};
});
}
},
onPostSubmit: () => {
Expand All @@ -89,16 +105,6 @@ export default class FeedbackForm extends React.Component {
}
}

yesRadio = React.createRef();

yesTextArea = React.createRef();

noRadio = React.createRef();

noTextArea = React.createRef();

submitButton = React.createRef();

defaultDisclaimer = () => (
<div id="feedback-note" className="ma__disclaimer">
We use your feedback to help us improve this site but we are not able to respond directly.
Expand Down
3 changes: 2 additions & 1 deletion react/src/components/forms/MultiSelectDropDown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export const getObjByValue = (arr, value, key) => {
};

class MultiSelectDropDown extends React.Component {
_timeoutID;

constructor(props) {
super(props);
this.state = {
Expand Down Expand Up @@ -61,7 +63,6 @@ class MultiSelectDropDown extends React.Component {
}, 0);
}

_timeoutID;

handleTagClick = (target, e) => {
e.stopPropagation();
Expand Down
1 change: 1 addition & 0 deletions react/src/components/molecules/AccordionItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class AccordionItem extends React.Component {
<div className={accordionClasses}>
<header className="ma__accordion-header">
<button
type="button"
className={buttonClasses}
aria-label={info}
onClick={this.handleClick}
Expand Down
7 changes: 4 additions & 3 deletions react/src/components/molecules/LinkDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class LinkDropdown extends React.Component {
this.dropDownButtonRef = node;
}

closeDropdown() {
this.setState({ buttonExpand: false });
}

handleSelect = (event) => {
const { target } = event;
Expand Down Expand Up @@ -78,6 +75,10 @@ class LinkDropdown extends React.Component {
}
}

closeDropdown() {
this.setState({ buttonExpand: false });
}

render() {
const { dropdownItems, dropdownButton } = this.props;
const dropdownButtonProps = {
Expand Down
6 changes: 3 additions & 3 deletions react/src/components/molecules/ListingTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class ListingTableItem extends React.Component {
}

handleClick = () => {
this.setState({
open: !this.state.open
});
this.setState((state) => ({
open: !state.open
}));
};

render() {
Expand Down
7 changes: 5 additions & 2 deletions react/src/components/molecules/MainNav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class MainNav extends React.Component {
'aria-label': (isExpanded) ? `Hide submenu for ${item.text}` : `Show submenu for ${item.text}`,
key: buttonId
};
itemBody.push(<button {...buttonProps}>{item.text}</button>);
itemBody.push(<button type="button" {...buttonProps}>{item.text}</button>);
const navItemClasses = classNames({
'ma__main-nav__subitems': true,
'is-open-react': isExpanded,
Expand All @@ -147,6 +147,7 @@ class MainNav extends React.Component {
<ul role="menu" aria-label={`Submenu of ${buttonId}`} className="ma__main-nav__container">
<li role="menuitem" className="ma__main-nav__subitem">
<button
type="button"
onClick={(e) => this.onNavigate({ e, href: item.href })}
className="ma__main-nav__link"
tabIndex={!isExpanded ? -1 : null}
Expand All @@ -158,6 +159,7 @@ class MainNav extends React.Component {
/* eslint-disable-next-line react/no-array-index-key */
<li className="ma__main-nav__subitem" key={`liProps.${index}.${subItemIndex}`}>
<button
type="button"
onClick={(e) => this.onNavigate({ e, href: subItem.href })}
className="ma__main-nav__link"
>
Expand All @@ -169,6 +171,7 @@ class MainNav extends React.Component {
item.href && (
<li role="menuitem" className="ma__main-nav__subitem ma__main-nav__subitem--main">
<button
type="button"
onClick={(e) => this.onNavigate({ e, href: item.href })}
className="ma__main-nav__link"
>
Expand All @@ -189,7 +192,7 @@ class MainNav extends React.Component {
role: 'menuitem',
'aria-label': (isExpanded) ? `Hide submenu for ${item.text}` : `Show submenu for ${item.text}`
};
itemBody.push(<button {...buttonProps}>{item.text}</button>);
itemBody.push(<button type="button" {...buttonProps}>{item.text}</button>);
}
return(
/* eslint-disable-next-line jsx-a11y/mouse-events-have-key-events */
Expand Down
1 change: 1 addition & 0 deletions react/src/components/molecules/Tabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const Tabs = ({ handleClick, tabs, selectedTab }) => {
if (isClickFunction) {
return(
<button
type="button"
key={`tab_${value}`}
className={`ma__tabs-item ${isSelected}`}
name={value}
Expand Down
Loading

0 comments on commit b3bb43f

Please sign in to comment.