From c4ff21ae304b6a61fa7ad6e6d83ad7260963d922 Mon Sep 17 00:00:00 2001 From: Dave DeSandro Date: Fri, 18 Feb 2022 21:46:15 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=94=20lint=20eqeqeq=20error=20smart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 1 + imagesloaded.js | 6 +++--- test/unit/background.js | 2 +- test/unit/picture.js | 2 +- test/unit/srcset.js | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9a4dfe4..44902cc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,6 +15,7 @@ module.exports = { QUnit: 'readonly', }, rules: { + eqeqeq: [ 'error', 'smart' ], 'id-length': [ 'error', { min: 2, max: 30, diff --git a/imagesloaded.js b/imagesloaded.js index 044710b..4265518 100644 --- a/imagesloaded.js +++ b/imagesloaded.js @@ -94,7 +94,7 @@ const elementNodeTypes = [ 1, 9, 11 ]; */ ImagesLoaded.prototype.addElementImages = function( elem ) { // filter siblings - if ( elem.nodeName == 'IMG' ) { + if ( elem.nodeName === 'IMG' ) { this.addImage( elem ); } // get background image on element @@ -185,7 +185,7 @@ ImagesLoaded.prototype.progress = function( image, elem, message ) { this.jqDeferred.notify( this, image ); } // check if completed - if ( this.progressedCount == this.images.length ) { + if ( this.progressedCount === this.images.length ) { this.complete(); } @@ -247,7 +247,7 @@ LoadingImage.prototype.confirm = function( isLoaded, message ) { this.isLoaded = isLoaded; let { parentNode } = this.img; // emit progress with parent or self - let elem = parentNode.nodeName == 'PICTURE' ? parentNode : this.img; + let elem = parentNode.nodeName === 'PICTURE' ? parentNode : this.img; this.emitEvent( 'progress', [ this, elem, message ] ); }; diff --git a/test/unit/background.js b/test/unit/background.js index 2936734..d333c33 100644 --- a/test/unit/background.js +++ b/test/unit/background.js @@ -16,7 +16,7 @@ QUnit.test( 'background', function( assert ) { assert.equal( imgLoad0.images.length, 1, '1 image on .images' ); imgLoad0.on( 'progress', function( instance, image, element ) { - assert.ok( element.nodeName == 'DIV', 'progress; element is div' ); + assert.ok( element.nodeName === 'DIV', 'progress; element is div' ); assert.ok( image.isLoaded, 'progress; image.isLoaded' ); done(); } ); diff --git a/test/unit/picture.js b/test/unit/picture.js index b6e478d..43e3fac 100644 --- a/test/unit/picture.js +++ b/test/unit/picture.js @@ -9,7 +9,7 @@ QUnit.test( 'picture', function( assert ) { assert.equal( imgLoad0.images.length, 3, '3 images on #picture-list' ); imgLoad0.on( 'progress', function( instance, image, element ) { - assert.ok( element.nodeName == 'PICTURE', 'progress; element is picture' ); + assert.ok( element.nodeName === 'PICTURE', 'progress; element is picture' ); assert.ok( image.isLoaded, 'progress; image.isLoaded' ); done(); } ); diff --git a/test/unit/srcset.js b/test/unit/srcset.js index f282e92..52ceed1 100644 --- a/test/unit/srcset.js +++ b/test/unit/srcset.js @@ -9,7 +9,7 @@ QUnit.test( 'srcset', function( assert ) { assert.equal( imgLoad0.images.length, 3, '3 images on #srcset' ); imgLoad0.on( 'progress', function( instance, image, element ) { - assert.ok( element.nodeName == 'IMG', 'progress; element is img' ); + assert.ok( element.nodeName === 'IMG', 'progress; element is img' ); assert.ok( image.isLoaded, 'progress; image.isLoaded' ); done(); } );