Skip to content

Commit 2132eb2

Browse files
committed
refactor: eslint and prettier updates
1 parent aae936e commit 2132eb2

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

src/index.js

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class ReactTooltip extends React.Component {
141141
* For unify the bind and unbind listener
142142
*/
143143
bind(methodArray) {
144-
methodArray.forEach(method => {
144+
methodArray.forEach((method) => {
145145
this[method] = this[method].bind(this);
146146
});
147147
}
@@ -158,7 +158,7 @@ class ReactTooltip extends React.Component {
158158
static getDerivedStateFromProps(nextProps, prevState) {
159159
const { ariaProps } = prevState;
160160
const newAriaProps = parseAria(nextProps);
161-
const isChanged = Object.keys(newAriaProps).some(props => {
161+
const isChanged = Object.keys(newAriaProps).some((props) => {
162162
return newAriaProps[props] !== ariaProps[props];
163163
});
164164
if (!isChanged) {
@@ -254,8 +254,8 @@ class ReactTooltip extends React.Component {
254254

255255
// Scan document for shadow DOM elements
256256
nodeListToArray(document.getElementsByTagName('*'))
257-
.filter(element => element.shadowRoot)
258-
.forEach(element => {
257+
.filter((element) => element.shadowRoot)
258+
.forEach((element) => {
259259
targetArray = targetArray.concat(
260260
nodeListToArray(element.shadowRoot.querySelectorAll(selector))
261261
);
@@ -273,7 +273,7 @@ class ReactTooltip extends React.Component {
273273
const { id, globalEventOff, isCapture } = this.props;
274274
const targetArray = this.getTargetArray(id);
275275

276-
targetArray.forEach(target => {
276+
targetArray.forEach((target) => {
277277
if (target.getAttribute('currentItem') === null) {
278278
target.setAttribute('currentItem', 'false');
279279
}
@@ -286,7 +286,7 @@ class ReactTooltip extends React.Component {
286286
if (this.isBodyMode()) {
287287
this.bindBodyListener(targetArray);
288288
} else {
289-
targetArray.forEach(target => {
289+
targetArray.forEach((target) => {
290290
const isCaptureMode = this.isCapture(target);
291291
const effect = this.getEffect(target);
292292
if (this.isCustomEvent(target)) {
@@ -327,7 +327,7 @@ class ReactTooltip extends React.Component {
327327
this.unbindBodyListener();
328328
} else {
329329
const targetArray = this.getTargetArray(id);
330-
targetArray.forEach(target => {
330+
targetArray.forEach((target) => {
331331
this.unbindBasicListener(target);
332332
if (this.isCustomEvent(target)) this.customUnbindListener(target);
333333
});
@@ -389,7 +389,7 @@ class ReactTooltip extends React.Component {
389389
if (isGlobalCall) {
390390
// Don't trigger other elements belongs to other ReactTooltip
391391
const targetArray = this.getTargetArray(this.props.id);
392-
const isMyElement = targetArray.some(ele => ele === e.currentTarget);
392+
const isMyElement = targetArray.some((ele) => ele === e.currentTarget);
393393
if (!isMyElement) return;
394394
}
395395
// Get the tooltip content
@@ -641,7 +641,7 @@ class ReactTooltip extends React.Component {
641641
if (hasTarget) {
642642
// Don't trigger other elements belongs to other ReactTooltip
643643
const targetArray = this.getTargetArray(this.props.id);
644-
const isMyElement = targetArray.some(ele => ele === e.currentTarget);
644+
const isMyElement = targetArray.some((ele) => ele === e.currentTarget);
645645
if (!isMyElement || !this.state.show) return;
646646
}
647647

@@ -703,14 +703,8 @@ class ReactTooltip extends React.Component {
703703

704704
// Calculation the position
705705
updatePosition(callbackAfter) {
706-
const {
707-
currentEvent,
708-
currentTarget,
709-
place,
710-
desiredPlace,
711-
effect,
712-
offset
713-
} = this.state;
706+
const { currentEvent, currentTarget, place, desiredPlace, effect, offset } =
707+
this.state;
714708
const node = this.tooltipRef;
715709
const result = getPosition(
716710
currentEvent,
@@ -742,7 +736,7 @@ class ReactTooltip extends React.Component {
742736
}
743737

744738
if (callbackAfter && typeof callbackAfter === 'function') {
745-
callbackAfter();
739+
callbackAfter();
746740
}
747741

748742
// Set tooltip position
@@ -775,7 +769,7 @@ class ReactTooltip extends React.Component {
775769
hasCustomColors() {
776770
return Boolean(
777771
Object.keys(this.state.customColors).find(
778-
color => color !== 'border' && this.state.customColors[color]
772+
(color) => color !== 'border' && this.state.customColors[color]
779773
) ||
780774
(this.state.border && this.state.customColors['border'])
781775
);
@@ -820,7 +814,7 @@ class ReactTooltip extends React.Component {
820814
<Wrapper
821815
className={`${wrapperClassName}`}
822816
id={this.props.id || uuid}
823-
ref={ref => (this.tooltipRef = ref)}
817+
ref={(ref) => (this.tooltipRef = ref)}
824818
{...ariaProps}
825819
data-id="tooltip"
826820
dangerouslySetInnerHTML={{ __html: htmlContent }}
@@ -832,7 +826,7 @@ class ReactTooltip extends React.Component {
832826
className={`${wrapperClassName}`}
833827
id={this.props.id || uuid}
834828
{...ariaProps}
835-
ref={ref => (this.tooltipRef = ref)}
829+
ref={(ref) => (this.tooltipRef = ref)}
836830
data-id="tooltip"
837831
>
838832
<style

0 commit comments

Comments
 (0)