Skip to content

Commit

Permalink
🚨 Fix eslint problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Gossens committed Sep 14, 2020
1 parent 39f3136 commit 17c0931
Show file tree
Hide file tree
Showing 25 changed files with 58 additions and 57 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/href-no-hash": "off",
"jsx-a11y/label-has-for": "off",
"react-hooks/exhaustive-deps": "warn"
"react-hooks/exhaustive-deps": "warn",
"react/jsx-props-no-spreading": "off"
},
"extends": "airbnb"
}
1 change: 0 additions & 1 deletion src/react-chayns-accordion/component/Accordion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default class Accordion extends PureComponent {
window.clearTimeout(this.timeout);
}


getBody() {
const { renderClosed, children, removeContentClosed } = this.props;
const { currentState, showBody } = this.state;
Expand Down
2 changes: 1 addition & 1 deletion src/react-chayns-button/component/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const Button = forwardRef((props, ref) => {
};

return (
// eslint-disable-next-line react/button-has-type
<button
/* eslint-disable-next-line react/button-has-type */
type={type}
className={classNames(className, {
button: !chooseButton,
Expand Down
1 change: 0 additions & 1 deletion src/react-chayns-calendar/component/Calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Month from './Month';
import areDatesEqual from '../utils/areDatesEqual';
import Icon from '../../react-chayns-icon/component/Icon';


const TODAY = new Date();
const MONTH_NAMES = {
de: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
Expand Down
1 change: 1 addition & 0 deletions src/react-chayns-color_scheme/component/ColorScheme.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const ColorScheme = ({ color, colorMode, children, style, cssVariables, ...props
'--chayns-bg-rgb': `${bgRgbColor.r}, ${bgRgbColor.g}, ${bgRgbColor.b}`,
};

// eslint-disable-next-line no-unused-vars
for (const colorName of chayns.utils.colors.getAvailableColorList()) {
const hexColor = chayns.utils.colors.getColorFromPalette(colorName, color, colorMode);
styles[`--chayns-color--${colorName}`] = hexColor;
Expand Down
1 change: 0 additions & 1 deletion src/react-chayns-contextmenu/component/ContextMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export default class ContextMenu extends Component {
}
}


async showSelectDialog() {
const { items, onLayerClick } = this.props;
const list = items.map((item, index) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/react-chayns-filterbutton/component/FilterButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ FilterButton.propTypes = {
}).isRequired,
]),
className: PropTypes.string,
style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]),),
style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
id: PropTypes.string,
disabled: PropTypes.bool,
stopPropagation: PropTypes.bool,
Expand Down
1 change: 0 additions & 1 deletion src/react-chayns-gallery/component/Gallery.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default class Gallery extends Component {
}
}


onDown = (event, index, image) => {
// deactivate refresh scroll in apps
if (chayns.env.isApp || chayns.env.isMyChaynsApp) chayns.disallowRefreshScroll();
Expand Down
4 changes: 2 additions & 2 deletions src/react-chayns-gridcalendar/component/content/User.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export default class User extends PureComponent {
}

User.propTypes = {
entries: PropTypes.arrayOf(PropTypes.array,),
entries: PropTypes.arrayOf(PropTypes.array),
groups: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.number,
name: PropTypes.string,
color: PropTypes.string,
}),),
})),
onClick: PropTypes.func,
focus: PropTypes.objectOf(Date),
groupFocus: PropTypes.number,
Expand Down
2 changes: 1 addition & 1 deletion src/react-chayns-gridcalendar/component/content/Week.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class Week extends Component {
background = `linear-gradient(to right, rgba(${color.r},${color.g},${color.b},0.5) ${start}%,rgba(${color.r},${color.g},${color.b},1) ${start + 1}%,rgba(${color.r},${color.g},${color.b},1) ${start + percentage}%,rgba(${color.r},${color.g},${color.b},0.5) ${start + percentage + 1}%)`;
}

days.push(<div className={classes} style={{ background, backgroundColor }} key={i} onClick={(event) => onClick(event, day)}/>,);
days.push(<div className={classes} style={{ background, backgroundColor }} key={i} onClick={(event) => onClick(event, day)}/>);
}
return days;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ export default class ImageAccordionGroup extends React.Component {
itemsPerRow={itemsPerRow}
/>
</div>
))
}
))}
{/* Body of Row */}
<div
className="image-accordion-body"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ export default class ImageAccordionHead extends React.PureComponent {
>
{item.props.headline}
</p>
)
}
)}

<h5
className="subheadline"
Expand All @@ -71,8 +70,7 @@ export default class ImageAccordionHead extends React.PureComponent {
>
{item.props.icon}
</div>
)
}
)}
</div>
);
}
Expand Down
10 changes: 5 additions & 5 deletions src/react-chayns-input_box/component/InputBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ import TappPortal from '../../react-chayns-tapp_portal/component/TappPortal';
import { isFunction } from '../../utils/is';

export default class InputBox extends Component {
state = {
hidden: true,
position: null,
};

references = {
box: null,
wrapper: null,
Expand All @@ -29,6 +24,11 @@ export default class InputBox extends Component {
this.blur = this.blur.bind(this);
this.focus = this.focus.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);

this.state = {
hidden: true,
position: null,
};
}

componentDidMount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import ExpandableContext from './ExpandableContext';
import AbstractList from '../AbstractList';

export default class ExpandableList extends Component {
state = {
open: [],
};

constructor(props) {
super(props);

Expand All @@ -18,6 +14,10 @@ export default class ExpandableList extends Component {
onClose: this.onClose.bind(this),
onToggle: this.onToggle.bind(this),
};

this.state = {
open: [],
};
}

onOpen(id) {
Expand Down
2 changes: 1 addition & 1 deletion src/react-chayns-modeswitch/component/ModeSwitch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ ModeSwitch.propTypes = {
id: PropTypes.number,
name: PropTypes.string,
uacIds: PropTypes.arrayOf(PropTypes.number),
}),),
})),
save: PropTypes.bool,
onChange: PropTypes.func,
defaultMode: PropTypes.number,
Expand Down
21 changes: 13 additions & 8 deletions src/react-chayns-openingtimes/component/TimeSpan.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ function inspectTimeStr(str) {
const char = str.charAt(i);
const charCode = str.charCodeAt(i);

if (char === ':') foundColons += 1;
else if (charCode > 47 && charCode < 58) {
if (foundColons === 0 && leftDigits.length < 2) leftDigits.push(char);
else if (rightDigits.length < 2) rightDigits.push(char);
if (char === ':') {
foundColons += 1;
} else if (charCode > 47 && charCode < 58) {
if (foundColons === 0 && leftDigits.length < 2) {
leftDigits.push(char);
} else if (rightDigits.length < 2) rightDigits.push(char);
}
}

Expand Down Expand Up @@ -106,13 +108,16 @@ const TimeSpan = React.memo(({ startTime, endTime, onChange, childrenRef, isInva
let minutePart = generateTimePart(inspectResult.right, 'minutes');
let hourPart = generateTimePart(inspectResult.left, 'hours');

if (parseInt(minutePart, 0) > 59) minutePart = '59';
if (parseInt(hourPart, 0) > 23) hourPart = '23';
if (parseInt(minutePart, 10) > 59) minutePart = '59';
if (parseInt(hourPart, 10) > 23) hourPart = '23';

const timeStr = `${hourPart}:${minutePart}`;

if (inputField === 'start') newState.startTime = timeStr;
else newState.endTime = timeStr;
if (inputField === 'start') {
newState.startTime = timeStr;
} else {
newState.endTime = timeStr;
}

if (newState.startTime === newState.endTime) {
newState.endTime = getTimeStringFromMinutes(getTimeStringMinutes(newState.endTime + 60));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const setFriend = async (personId, friendship = true) => {
return response.status === 200;
};


export const fetchPersons = async (value, skip, take) => {
if (!chayns.env.user.isAuthenticated) {
chayns.login();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const toPropTypes = (events, returnDefaultProps) => events.reduce((props,
[toHandlerName(eventName)]: returnDefaultProps ? null : PropTypes.func,
}), {});


export const PositionProps = PropTypes.shape({
lat: PropTypes.number.isRequired,
lng: PropTypes.number.isRequired,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-nested-ternary,react/forbid-prop-types */
import { CSSTransition, TransitionGroup } from 'react-transition-group';
import React, { Component, Fragment } from 'react';
import React, { Component } from 'react';
import isEqual from 'lodash.isequal';
import PropTypes from 'prop-types';

Expand Down Expand Up @@ -123,7 +123,7 @@ export default class ReceiverSearchPopup extends Component {
{showPopup ? (
<div className="receiver-popup" style={receiverPopupStyles}>
{onlyPersons ? false : (
<Fragment>
<>
<div className="group-headline popup-item">Sites</div>
{locations}
{locationResultState > 0 ? (
Expand All @@ -135,10 +135,10 @@ export default class ReceiverSearchPopup extends Component {
) : (
<div className="popup-item"/>
)}
</Fragment>
</>
)}
{onlySites ? false : (
<Fragment>
<>
<div className="group-headline popup-item">Personen</div>
{users}
{userResultState > 0 ? (
Expand All @@ -150,10 +150,10 @@ export default class ReceiverSearchPopup extends Component {
) : (
<div className="popup-item"/>
)}
</Fragment>
</>
)}
{!isLocation ? false : (
<Fragment>
<>
<div className="group-headline popup-item">Gruppen</div>
{groups}
{groupResultState > 0 ? (
Expand All @@ -165,7 +165,7 @@ export default class ReceiverSearchPopup extends Component {
) : (
<div className="popup-item"/>
)}
</Fragment>
</>
)}
</div>
) : (
Expand Down
15 changes: 10 additions & 5 deletions src/react-chayns-rfid_input/component/RfidInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@ import Button from '../../react-chayns-button/component/Button';

export default class RfidInput extends Component {
static pretifyRfid(rfid) {
return rfid ? rfid.match(SPLIT_RFID).join(' ') : '';
return rfid ? rfid.match(SPLIT_RFID)
.join(' ') : '';
}

static isNfcAvailable() {
return (chayns.env.isMyChaynsApp && (chayns.env.isAndroid || (chayns.env.isIOS && chayns.env.myChaynsAppVersion >= 5764)))
|| (chayns.env.isApp && (chayns.env.isAndroid));
}

state = {
isScanning: false,
};
constructor(props) {
super(props);
this.state = {
isScanning: false,
};
}

onConfirm = () => {
const { onConfirm, value } = this.props;
Expand All @@ -29,7 +33,8 @@ export default class RfidInput extends Component {
onInput = (newRfid) => {
const { onInput } = this.props;

const newValue = newRfid.toUpperCase().replace(/\s/g, '');
const newValue = newRfid.toUpperCase()
.replace(/\s/g, '');
if (!RFID_CONTENT.test(newValue)) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions src/react-chayns-tag_input/component/TagInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ const KEY_ENTER = 13;
const BIGGEST_LETTER = 'm';

export default class TagInput extends Component {
state = {
selectedIndex: null,
};

constructor(props) {
super(props);

Expand All @@ -23,6 +19,10 @@ export default class TagInput extends Component {
this.handleTagRemove = this.handleTagRemove.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleClick = this.handleClick.bind(this);

this.state = {
selectedIndex: null,
};
}

setInputRef(ref) {
Expand Down
2 changes: 1 addition & 1 deletion src/react-chayns-textstring/component/TextString.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export default class TextString extends Component {
if (result.ResultCode === 0) {
chayns.dialog.alert(
'',
'Die Änderungen wurden erfolgreich gespeichert. Es kann bis zu 5 Minuten dauern, bis die Änderung sichtbar wird.'
'Die Änderungen wurden erfolgreich gespeichert. Es kann bis zu 5 Minuten dauern, bis die Änderung sichtbar wird.',
);
} else {
chayns.dialog.alert('', 'Es ist ein Fehler aufgetreten.');
Expand Down
1 change: 0 additions & 1 deletion src/utils/events/EventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default class EventEmitter {
this.removeListener = this.removeListener.bind(this);
}


on(event, listener) {
if (!this.#events[event]) {
this.#events[event] = [];
Expand Down
4 changes: 2 additions & 2 deletions src/utils/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function reloadCache(reload) {
if (data !== true) {
window.chayns.dialog.alert(
window.chayns.utils.lang.get('txt_shopMashup_reloadCache'),
window.chayns.utils.lang.get('txt_shopMashup_reloadCacheWarning')
window.chayns.utils.lang.get('txt_shopMashup_reloadCacheWarning'),
);
reject();
} else {
Expand All @@ -110,7 +110,7 @@ export function reloadCache(reload) {
console.warn(error);
window.chayns.dialog.alert(
window.chayns.utils.lang.get('txt_shopMashup_reloadCache'),
window.chayns.utils.lang.get('txt_shopMashup_reloadCacheWarning')
window.chayns.utils.lang.get('txt_shopMashup_reloadCacheWarning'),
);
reject();
}).then(() => {
Expand Down
1 change: 0 additions & 1 deletion src/utils/tobitEmployee.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

let tobitEmployee = null;

/**
Expand Down

0 comments on commit 17c0931

Please sign in to comment.