From e5144c3ecefac5d44d4bbd3942eb0b1aeb9b4ed5 Mon Sep 17 00:00:00 2001 From: zepumph Date: Thu, 7 Nov 2019 15:33:44 -0900 Subject: [PATCH] add setTimeout/Interval lint rules, and escape a few usages, https://github.com/phetsims/phet-info/issues/59 --- js/accessibility/AccessiblePeer.js | 2 +- js/accessibility/KeyStateTrackerTests.js | 6 +++--- js/accessibility/reader/Reader.js | 2 +- js/tests/PixelComparisonTests.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/accessibility/AccessiblePeer.js b/js/accessibility/AccessiblePeer.js index 6421cde8f..5d16a3d3b 100644 --- a/js/accessibility/AccessiblePeer.js +++ b/js/accessibility/AccessiblePeer.js @@ -704,7 +704,7 @@ define( require => { // https://stackoverflow.com/questions/2600186/focus-doesnt-work-in-ie const self = this; if ( platform.ie11 && FullScreen.isFullScreen() ) { - window.setTimeout( function() { + window.setTimeout( function() { // eslint-disable-line bad-sim-text // make sure that the primary sibling hasn't been removed from the document since the timeout was added self._primarySibling && self._primarySibling.blur(); diff --git a/js/accessibility/KeyStateTrackerTests.js b/js/accessibility/KeyStateTrackerTests.js index 5f368300b..abcf6a03c 100644 --- a/js/accessibility/KeyStateTrackerTests.js +++ b/js/accessibility/KeyStateTrackerTests.js @@ -32,7 +32,7 @@ define( require => { // step the timer, because utteranceQueue runs on timer let previousTime = Date.now(); - intervalID = setInterval( () => { + intervalID = setInterval( () => { // eslint-disable-line bad-sim-text const currentTime = Date.now(); const timeStep = ( currentTime - previousTime ) / 1000; // convert to seconds previousTime = currentTime; @@ -118,12 +118,12 @@ define( require => { let currentTimeDown = testTracker.timeDownForKey( spaceKeyEvent.domEvent.keyCode ); assert.ok( currentTimeDown === 0, 'should be zero, has not been down any time' ); - timer.setTimeout( () => { + timer.setTimeout( () => { // eslint-disable-line bad-sim-text currentTimeDown = testTracker.timeDownForKey( spaceKeyEvent.domEvent.keyCode ); assert.ok( currentTimeDown >= firstPressTime && currentTimeDown <= totalPressTime, 'key pressed for ' + firstPressTime + ' ms' ); - timer.setTimeout( () => { + timer.setTimeout( () => { // eslint-disable-line bad-sim-text currentTimeDown = testTracker.timeDownForKey( spaceKeyEvent.domEvent.keyCode ); assert.ok( currentTimeDown >= totalPressTime, 'key pressed for ' + secondPressTime + ' more ms.' ); diff --git a/js/accessibility/reader/Reader.js b/js/accessibility/reader/Reader.js index 8c78c4973..e2315beac 100644 --- a/js/accessibility/reader/Reader.js +++ b/js/accessibility/reader/Reader.js @@ -125,7 +125,7 @@ define( require => { // a small delay will allow the utterance to be read in full, even if // added after cancel(). if ( self.speaking ) { - setTimeout( function() { readPolite(); }, 2000 ); + setTimeout( function() { readPolite(); }, 2000 ); // eslint-disable-line bad-sim-text } else { self.synth.speak( utterThis ); diff --git a/js/tests/PixelComparisonTests.js b/js/tests/PixelComparisonTests.js index c1a4cfe49..15ab10cbd 100644 --- a/js/tests/PixelComparisonTests.js +++ b/js/tests/PixelComparisonTests.js @@ -881,7 +881,7 @@ define( require => { // add handler after creating the image img.onload = function() { // a bit of extra time afterwards - setTimeout( function() { + setTimeout( function() { // eslint-disable-line bad-sim-text display.updateDisplay(); asyncCallback();