Skip to content

Commit 88ce0f2

Browse files
authored
Revert "Configure eslint and prettier" (#144)
Revert "Configure eslint and prettier"
2 parents 55240b4 + fdc2fec commit 88ce0f2

File tree

6 files changed

+23
-8994
lines changed

6 files changed

+23
-8994
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

app/index.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ export default class InfiniteScroll extends Component {
8787

8888
componentWillReceiveProps(props) {
8989
// do nothing when dataLength and key are unchanged
90-
if (
91-
this.props.key === props.key &&
92-
this.props.dataLength === props.dataLength
93-
)
94-
return;
90+
if (this.props.key === props.key && this.props.dataLength === props.dataLength) return;
9591

9692
this.actionTriggered = false;
9793
// update state when new data was sent in
@@ -102,9 +98,8 @@ export default class InfiniteScroll extends Component {
10298
}
10399

104100
getScrollableTarget() {
105-
if (this.props.scrollableTarget instanceof HTMLElement)
106-
return this.props.scrollableTarget;
107-
if (typeof this.props.scrollableTarget === "string") {
101+
if (this.props.scrollableTarget instanceof HTMLElement) return this.props.scrollableTarget;
102+
if (typeof this.props.scrollableTarget === 'string') {
108103
return document.getElementById(this.props.scrollableTarget);
109104
}
110105
if (this.props.scrollableTarget === null) {
@@ -124,8 +119,7 @@ export default class InfiniteScroll extends Component {
124119
this.currentY = this.startY;
125120

126121
this._infScroll.style.willChange = "transform";
127-
this._infScroll.style.transition =
128-
"transform 0.2s cubic-bezier(0,0,0.31,1)";
122+
this._infScroll.style.transition = `transform 0.2s cubic-bezier(0,0,0.31,1)`;
129123
}
130124

131125
onMove(evt) {
@@ -149,7 +143,7 @@ export default class InfiniteScroll extends Component {
149143
this.startY}px, 0px)`;
150144
}
151145

152-
onEnd() {
146+
onEnd(evt) {
153147
this.startY = 0;
154148
this.currentY = 0;
155149

@@ -162,9 +156,9 @@ export default class InfiniteScroll extends Component {
162156
requestAnimationFrame(() => {
163157
// this._infScroll
164158
if (this._infScroll) {
165-
this._infScroll.style.overflow = "auto";
166-
this._infScroll.style.transform = "none";
167-
this._infScroll.style.willChange = "none";
159+
this._infScroll.style.overflow = "auto";
160+
this._infScroll.style.transform = "none";
161+
this._infScroll.style.willChange = "none";
168162
}
169163
});
170164
}
@@ -184,8 +178,7 @@ export default class InfiniteScroll extends Component {
184178
}
185179

186180
return (
187-
target.scrollTop + clientHeight >=
188-
(threshold.value / 100) * target.scrollHeight
181+
target.scrollTop + clientHeight >= threshold.value / 100 * target.scrollHeight
189182
);
190183
}
191184

@@ -200,8 +193,8 @@ export default class InfiniteScroll extends Component {
200193
this.props.height || this._scrollableNode
201194
? event.target
202195
: document.documentElement.scrollTop
203-
? document.documentElement
204-
: document.body;
196+
? document.documentElement
197+
: document.body;
205198

206199
// return immediately if the action has already been triggered,
207200
// prevents multiple triggers.
@@ -239,7 +232,7 @@ export default class InfiniteScroll extends Component {
239232
return (
240233
<div style={outerDivStyle}>
241234
<div
242-
className={`infinite-scroll-component ${this.props.className || ""}`}
235+
className={`infinite-scroll-component ${this.props.className || ''}`}
243236
ref={infScroll => (this._infScroll = infScroll)}
244237
style={style}
245238
>

app/utils/threshold.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,42 @@
11
export const ThresholdUnits = {
2-
Pixel: "Pixel",
3-
Percent: "Percent"
2+
Pixel: 'Pixel',
3+
Percent: 'Percent',
44
};
55

66
const defaultThreshold = {
77
unit: ThresholdUnits.Percent,
8-
value: 0.8
8+
value: 0.8,
99
};
1010

1111
export function parseThreshold(scrollThreshold) {
1212
if (typeof scrollThreshold === "number") {
1313
return {
1414
unit: ThresholdUnits.Percent,
15-
value: scrollThreshold * 100
15+
value: scrollThreshold * 100,
1616
};
1717
}
1818

1919
if (typeof scrollThreshold === "string") {
2020
if (scrollThreshold.match(/^(\d*(\.\d+)?)px$/)) {
2121
return {
2222
unit: ThresholdUnits.Pixel,
23-
value: parseFloat(scrollThreshold)
23+
value: parseFloat(scrollThreshold),
2424
};
2525
}
2626

2727
if (scrollThreshold.match(/^(\d*(\.\d+)?)%$/)) {
2828
return {
2929
unit: ThresholdUnits.Percent,
30-
value: parseFloat(scrollThreshold)
30+
value: parseFloat(scrollThreshold),
3131
};
3232
}
3333

34-
console.warn(
35-
"scrollThreshold format is invalid. Valid formats: '120px', '50%'..."
36-
);
34+
console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...');
3735

3836
return defaultThreshold;
3937
}
4038

41-
console.warn("scrollThreshold should be string or number");
39+
console.warn('scrollThreshold should be string or number');
4240

4341
return defaultThreshold;
4442
}

0 commit comments

Comments
 (0)