Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Commit f5e68bd

Browse files
committed
Make the linter pass with the new rules
1 parent b985443 commit f5e68bd

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/react-image-lightbox.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class ReactImageLightbox extends Component {
140140
let sourcesChanged = false;
141141
const prevSrcDict = {};
142142
const nextSrcDict = {};
143-
this.getSrcTypes().forEach(srcType => {
143+
this.getSrcTypes().forEach((srcType) => {
144144
if (this.props[srcType.name] !== nextProps[srcType.name]) {
145145
sourcesChanged = true;
146146

@@ -151,7 +151,7 @@ class ReactImageLightbox extends Component {
151151

152152
if (sourcesChanged || this.moveRequested) {
153153
// Reset the loaded state for images not rendered next
154-
Object.keys(prevSrcDict).forEach(prevSrc => {
154+
Object.keys(prevSrcDict).forEach((prevSrc) => {
155155
if (!(prevSrc in nextSrcDict) && (prevSrc in this.imageCache)) {
156156
this.imageCache[prevSrc].loaded = false;
157157
}
@@ -718,7 +718,7 @@ class ReactImageLightbox extends Component {
718718

719719
// Load all images and their thumbnails
720720
loadAllImages(props = this.props) {
721-
const generateImageLoadedCallback = (srcType, imageSrc) => err => {
721+
const generateImageLoadedCallback = (srcType, imageSrc) => (err) => {
722722
// Give up showing image on error
723723
if (err) {
724724
if (window.console) {
@@ -738,7 +738,7 @@ class ReactImageLightbox extends Component {
738738
};
739739

740740
// Load the images
741-
this.getSrcTypes().forEach(srcType => {
741+
this.getSrcTypes().forEach((srcType) => {
742742
const type = srcType.name;
743743

744744
// Load unloaded images
@@ -810,7 +810,7 @@ class ReactImageLightbox extends Component {
810810
}
811811

812812
// Request to transition to the previous image
813-
getTransform({ x = null, y = null, zoom = null }) {
813+
static getTransform({ x = null, y = null, zoom = null }) {
814814
const isOldIE = _ieVersion < 10;
815815
const transforms = [];
816816
if (x !== null || y !== null) {
@@ -871,14 +871,14 @@ class ReactImageLightbox extends Component {
871871
});
872872

873873
// Images to be displayed
874-
let images = [];
874+
const images = [];
875875
const addImage = (srcType, imageClass, baseStyle = {}) => {
876876
// Ignore types that have no source defined for their full size image
877877
if (!this.props[srcType]) {
878878
return;
879879
}
880880

881-
let imageStyle = { ...baseStyle, ...transitionStyle };
881+
const imageStyle = { ...baseStyle, ...transitionStyle };
882882
if (zoomLevel > MIN_ZOOM_LEVEL) {
883883
imageStyle.cursor = 'move';
884884
}
@@ -964,13 +964,13 @@ class ReactImageLightbox extends Component {
964964
addImage(
965965
'nextSrc',
966966
`image-next ril-image-next ${styles.imageNext}`,
967-
this.getTransform({ x: boxSize.width })
967+
ReactImageLightbox.getTransform({ x: boxSize.width })
968968
);
969969
// Main Image
970970
addImage(
971971
'mainSrc',
972972
'image-current ril-image-current',
973-
this.getTransform({
973+
ReactImageLightbox.getTransform({
974974
x: -1 * offsetX,
975975
y: -1 * offsetY,
976976
zoom: zoomMultiplier,
@@ -980,7 +980,7 @@ class ReactImageLightbox extends Component {
980980
addImage(
981981
'prevSrc',
982982
`image-prev ril-image-prev ${styles.imagePrev}`,
983-
this.getTransform({ x: -1 * boxSize.width })
983+
ReactImageLightbox.getTransform({ x: -1 * boxSize.width })
984984
);
985985

986986
const noop = () => {};
@@ -1054,7 +1054,7 @@ class ReactImageLightbox extends Component {
10541054
animationDuration: `${animationDuration}ms`,
10551055
animationDirection: isClosing ? 'normal' : 'reverse',
10561056
}}
1057-
ref={el => { this.outerEl = el; }}
1057+
ref={(el) => { this.outerEl = el; }}
10581058
onWheel={this.handleOuterMousewheel}
10591059
onMouseMove={this.handleOuterMouseMove}
10601060
onMouseDown={this.handleOuterMouseDown}
@@ -1159,7 +1159,7 @@ ReactImageLightbox.propTypes = {
11591159
//-----------------------------
11601160

11611161
// Main display image url
1162-
mainSrc: PropTypes.string.isRequired,
1162+
mainSrc: PropTypes.string.isRequired, // eslint-disable-line react/no-unused-prop-types
11631163

11641164
// Previous display image url (displayed to the left)
11651165
// If left undefined, movePrev actions will not be performed, and the button not displayed
@@ -1174,13 +1174,13 @@ ReactImageLightbox.propTypes = {
11741174
//-----------------------------
11751175

11761176
// Thumbnail image url corresponding to props.mainSrc
1177-
mainSrcThumbnail: PropTypes.string,
1177+
mainSrcThumbnail: PropTypes.string, // eslint-disable-line react/no-unused-prop-types
11781178

11791179
// Thumbnail image url corresponding to props.prevSrc
1180-
prevSrcThumbnail: PropTypes.string,
1180+
prevSrcThumbnail: PropTypes.string, // eslint-disable-line react/no-unused-prop-types
11811181

11821182
// Thumbnail image url corresponding to props.nextSrc
1183-
nextSrcThumbnail: PropTypes.string,
1183+
nextSrcThumbnail: PropTypes.string, // eslint-disable-line react/no-unused-prop-types
11841184

11851185
//-----------------------------
11861186
// Event Handlers

0 commit comments

Comments
 (0)