From 29b844fc444a985c062d6a6e17c00d0d4de144eb Mon Sep 17 00:00:00 2001 From: zepumph Date: Thu, 7 Nov 2019 15:33:43 -0900 Subject: [PATCH] add setTimeout/Interval lint rules, and escape a few usages, https://github.com/phetsims/phet-info/issues/59 --- eslint/rules/bad-sim-text.js | 15 +++++++++++++-- js/initialize-globals.js | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/eslint/rules/bad-sim-text.js b/eslint/rules/bad-sim-text.js index 12ff9b08f..0bd1503a2 100644 --- a/eslint/rules/bad-sim-text.js +++ b/eslint/rules/bad-sim-text.js @@ -42,13 +42,24 @@ module.exports = function( context ) { 'ptions = _.extend(', 'onfig = _.extend(' + // In sims, don't allow setTimout and setInterval calls coming from window, see https://github.com/phetsims/phet-info/issues/59 + // TODO: comment back in when all lint errors are taken care of, https://github.com/phetsims/phet-info/issues/59 + // { + // id: 'setTimeout(', + // regex: /(window\.| )setTimeout\(/ + // }, + // { + // id: 'setInterval(', + // regex: /(window\.| )setInterval\(/ + // } + // DOT/Util.toFixed or DOT/Util.toFixedNumber should be used instead of toFixed. // JavaScript's toFixed is notoriously buggy. Behavior differs depending on browser, // because the spec doesn't specify whether to round or floor. - // TODO: comment back in when all issues are done, https://github.com/phetsims/chipper/issues/737 + // TODO: comment back in when all lint errors are taken care of, https://github.com/phetsims/chipper/issues/737 // { // id: '.toFixed(', // support regex with english names this way - // regex: new RegExp( '(?