Skip to content

Commit 4096421

Browse files
authored
Merge pull request #60 from sag1v/fix-eslint-path
fix eslint path and run it
2 parents 57222a2 + d935b54 commit 4096421

File tree

4 files changed

+58
-48
lines changed

4 files changed

+58
-48
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
},
1515
"scripts": {
1616
"start": "concurrently -r -k -s all \"yarn run test:watch\" \"docz dev\" \"yarn run lint:watch\"",
17-
"lint:fix": "eslint src/**/*.js --fix",
18-
"lint:watch": "esw --watch --fix src/**/*.js",
17+
"lint:fix": "eslint src/**/*/*.js --fix",
18+
"lint:watch": "esw --watch --fix src/**/*/*.js",
1919
"test": "cross-env CI=1 react-scripts test --env=jsdom",
2020
"test:watch": "react-scripts test --env=jsdom",
2121
"prebuild": "yarn run lint:fix",

src/docs/components/Button.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import styled from "styled-components";
22
export default styled.button`
33
background: none;
4-
border:none;
4+
border: none;
55
font-size: 2.5em;
66
display: flex;
77
justify-content: center;
88
align-items: center;
99
cursor: pointer;
1010
user-select: none;
11-
&:disabled{
11+
&:disabled {
1212
cursor: not-allowed;
1313
}
1414
`;

src/react-elastic-carousel/components/Carousel.js

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Carousel extends React.Component {
5858
const isOutOfRange = firstItem + itemsToShow > lastIndex;
5959
if (isOutOfRange) {
6060
// we are out of boundaries, go "back" to last item of the list (respect itemsToShow)
61-
this.goTo(children.length - itemsToShow)
61+
this.goTo(children.length - itemsToShow);
6262
}
6363
}
6464
}
@@ -265,8 +265,6 @@ class Carousel extends React.Component {
265265
return asObj;
266266
};
267267

268-
269-
270268
onNextStart = () => {
271269
const { onNextStart } = this.props;
272270
const { firstItem } = this.state;
@@ -477,17 +475,24 @@ class Carousel extends React.Component {
477475
className={`${cssPrefix("carousel-wrapper")} ${className}`}
478476
style={style}
479477
>
480-
<StyledCarousel className={cssPrefix("carousel")} size={{ height: rootHeight }}>
478+
<StyledCarousel
479+
className={cssPrefix("carousel")}
480+
size={{ height: rootHeight }}
481+
>
481482
<Only when={showArrows}>
482483
{renderArrow ? (
483-
renderArrow({ type: consts.PREV, onClick: this.onPrevStart, isEdge: !canSlidePrev })
484+
renderArrow({
485+
type: consts.PREV,
486+
onClick: this.onPrevStart,
487+
isEdge: !canSlidePrev
488+
})
484489
) : (
485-
<Arrow
486-
onClick={this.onPrevStart}
487-
direction={verticalMode ? Arrow.up : Arrow.left}
488-
disabled={disabledPrevArrow}
489-
/>
490-
)}
490+
<Arrow
491+
onClick={this.onPrevStart}
492+
direction={verticalMode ? Arrow.up : Arrow.left}
493+
disabled={disabledPrevArrow}
494+
/>
495+
)}
491496
</Only>
492497
<SliderContainer
493498
className={cssPrefix("slider-container")}
@@ -524,14 +529,18 @@ class Carousel extends React.Component {
524529
</SliderContainer>
525530
<Only when={showArrows}>
526531
{renderArrow ? (
527-
renderArrow({ type: consts.NEXT, onClick: this.onNextStart, isEdge: !canSlideNext })
532+
renderArrow({
533+
type: consts.NEXT,
534+
onClick: this.onNextStart,
535+
isEdge: !canSlideNext
536+
})
528537
) : (
529-
<Arrow
530-
onClick={this.onNextStart}
531-
direction={verticalMode ? Arrow.down : Arrow.right}
532-
disabled={disabledNextArrow}
533-
/>
534-
)}
538+
<Arrow
539+
onClick={this.onNextStart}
540+
direction={verticalMode ? Arrow.down : Arrow.right}
541+
disabled={disabledNextArrow}
542+
/>
543+
)}
535544
</Only>
536545
</StyledCarousel>
537546
<Only when={pagination}>
@@ -542,12 +551,12 @@ class Carousel extends React.Component {
542551
onClick: this.onIndicatorClick
543552
})
544553
) : (
545-
<Pagination
546-
numOfPages={numOfPages}
547-
activePage={activePage}
548-
onClick={this.onIndicatorClick}
549-
/>
550-
)}
554+
<Pagination
555+
numOfPages={numOfPages}
556+
activePage={activePage}
557+
onClick={this.onIndicatorClick}
558+
/>
559+
)}
551560
</Only>
552561
</CarouselWrapper>
553562
);
@@ -667,10 +676,10 @@ Carousel.propTypes = {
667676
/** Enable or disable mouse swipe */
668677
enableMouseSwipe: PropTypes.bool,
669678

670-
/** Prevent page scroll on touchmove.
679+
/** Prevent page scroll on touchmove.
671680
* Use this to stop the browser from scrolling while a user swipes.
672681
* More details: https://github.com/FormidableLabs/react-swipeable#preventdefaulttouchmoveevent-details
673-
*/
682+
*/
674683
preventDefaultTouchmoveEvent: PropTypes.bool,
675684

676685
// auto play
@@ -681,7 +690,7 @@ Carousel.propTypes = {
681690
autoPlaySpeed: PropTypes.number,
682691

683692
// callbacks
684-
/** A callback for the change of an item
693+
/** A callback for the change of an item
685694
* - onChange(currentItemObject, currentPageIndex) => {} */
686695
onChange: PropTypes.func,
687696

src/react-elastic-carousel/components/Track.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,24 @@ const Track = ({
3636
onClick={onItemClick}
3737
/>
3838
);
39-
const toRender =
40-
enableSwipe ? (
41-
<Swipeable
42-
stopPropagation
43-
preventDefaultTouchmoveEvent={preventDefaultTouchmoveEvent}
44-
trackMouse={enableMouseSwipe}
45-
onSwipedLeft={onSwipedLeft}
46-
onSwipedRight={onSwipedRight}
47-
onSwipedUp={onSwipedUp}
48-
onSwipedDown={onSwipedDown}
49-
className={cssPrefix(`swipable-${idx}`)}
50-
>
51-
{item}
52-
</Swipeable>)
53-
: item
54-
return <div tabIndex={isVisible ? 0 : -1}>{toRender}</div>
55-
})
39+
const toRender = enableSwipe ? (
40+
<Swipeable
41+
stopPropagation
42+
preventDefaultTouchmoveEvent={preventDefaultTouchmoveEvent}
43+
trackMouse={enableMouseSwipe}
44+
onSwipedLeft={onSwipedLeft}
45+
onSwipedRight={onSwipedRight}
46+
onSwipedUp={onSwipedUp}
47+
onSwipedDown={onSwipedDown}
48+
className={cssPrefix(`swipable-${idx}`)}
49+
>
50+
{item}
51+
</Swipeable>
52+
) : (
53+
item
54+
);
55+
return <div tabIndex={isVisible ? 0 : -1}>{toRender}</div>;
56+
});
5657
return <React.Fragment>{originalChildren}</React.Fragment>;
5758
};
5859

0 commit comments

Comments
 (0)