diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index 3903dd1a..36ad5de5 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -1,6 +1,5 @@ const Cast = require('../util/cast'); const Clone = require('../util/clone'); -const RenderedTarget = require('../sprites/rendered-target'); const uid = require('../util/uid'); const StageLayering = require('../engine/stage-layering'); const getMonitorIdForBlockWithArgs = require('../util/get-monitor-id'); diff --git a/src/cli/index.js b/src/cli/index.js index 525f01b5..92541162 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -1,6 +1,7 @@ const fs = require('fs'); const VirtualMachine = require('../index'); +/* eslint-env node */ /* eslint-disable no-console */ const file = process.argv[2]; diff --git a/src/dispatch/worker-dispatch.js b/src/dispatch/worker-dispatch.js index 0cc18b34..f413e6f3 100644 --- a/src/dispatch/worker-dispatch.js +++ b/src/dispatch/worker-dispatch.js @@ -63,7 +63,9 @@ class WorkerDispatch extends SharedDispatch { log.warn(`Worker dispatch replacing existing service provider for ${service}`); } this.services[service] = provider; - return this.waitForConnection.then(() => this._remoteCall(centralDispatchService, 'dispatch', 'setService', service)); + return this.waitForConnection.then(() => ( + this._remoteCall(centralDispatchService, 'dispatch', 'setService', service) + )); } /** diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 1dd6f11e..5ac87933 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -2495,6 +2495,7 @@ class Runtime extends EventEmitter { this.emit(Runtime.STAGE_SIZE_CHANGED, width, height); } + // eslint-disable-next-line no-unused-vars setInEditor (inEditor) { // no-op } diff --git a/src/extensions/scratch3_pen/index.js b/src/extensions/scratch3_pen/index.js index 965a3ed8..47e0a5d4 100644 --- a/src/extensions/scratch3_pen/index.js +++ b/src/extensions/scratch3_pen/index.js @@ -6,7 +6,6 @@ const Clone = require('../../util/clone'); const Color = require('../../util/color'); const formatMessage = require('format-message'); const MathUtil = require('../../util/math-util'); -const RenderedTarget = require('../../sprites/rendered-target'); const log = require('../../util/log'); const StageLayering = require('../../engine/stage-layering'); diff --git a/src/serialization/tw-compress-sb3.js b/src/serialization/tw-compress-sb3.js index 83d65e16..63c4aed3 100644 --- a/src/serialization/tw-compress-sb3.js +++ b/src/serialization/tw-compress-sb3.js @@ -30,17 +30,15 @@ class Pool { entries.sort((a, b) => b[1] - a[1]); let i = 0; - let newId; for (const entry of entries) { const oldId = entry[0]; - while (true) { + + let newId = generateId(i); + while (this.skippedIds.has(newId)) { + i++; newId = generateId(i); - if (this.skippedIds.has(newId)) { - i++; - } else { - break; - } } + this.generatedIds.set(oldId, newId); i++; } diff --git a/test/fixtures/execute/tw-generate-comparison-matrix-inline.js b/test/fixtures/execute/tw-generate-comparison-matrix-inline.js index 14c97551..2b1b25ed 100644 --- a/test/fixtures/execute/tw-generate-comparison-matrix-inline.js +++ b/test/fixtures/execute/tw-generate-comparison-matrix-inline.js @@ -2,6 +2,8 @@ const fs = require('fs'); const Cast = require('../../../src/util/cast'); /* +This is a command-line tool to generate the tw-comparison-matrix-inline test project. + To use output: Blockly.Xml.domToWorkspace( new DOMParser().parseFromString(XML_GOES_HERE, 'text/xml').documentElement, @@ -9,6 +11,8 @@ Blockly.Xml.domToWorkspace( ); */ +/* eslint-disable no-console */ + const VALUES = [ '0', '0.0', diff --git a/test/unit/engine_runtime.js b/test/unit/engine_runtime.js index e8e67679..f2a696af 100644 --- a/test/unit/engine_runtime.js +++ b/test/unit/engine_runtime.js @@ -273,4 +273,3 @@ test('Clock is reset on runtime dispose', t => { t.ok(c.projectTimer() === 0); t.end(); }); - diff --git a/test/unit/tw_compress.js b/test/unit/tw_compress.js index 223a8e8d..d865b47b 100644 --- a/test/unit/tw_compress.js +++ b/test/unit/tw_compress.js @@ -94,28 +94,25 @@ test('handles type INPUT_DIFF_BLOCK_SHADOW (3) compressed inputs', t => { test('all IDs unique', t => { const soup = 'abcdefghjijklmnopqstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789'; - for (const [ - variableSoup, - listSoup, - broadcastSoup - ] of [ + const items = [ [soup, '', ''], ['', soup, ''], - ['', '', soup], - ]) { + ['', '', soup] + ]; + for (const [variableSoup, listSoup, broadcastSoup] of items) { const data = { targets: [ { isStage: true, name: 'Stage', variables: Object.fromEntries( - variableSoup.split('').map((id) => [id, [id, 0]]) + variableSoup.split('').map(id => [id, [id, 0]]) ), lists: Object.fromEntries( - listSoup.split('').map((id) => [id, [id, []]]) + listSoup.split('').map(id => [id, [id, []]]) ), broadcasts: Object.fromEntries( - broadcastSoup.split('').map((id) => [id, id]) + broadcastSoup.split('').map(id => [id, id]) ), blocks: { 'CmRa^i]o}QL77;hk:54o': {