Skip to content

Commit 0b7a877

Browse files
authored
Merge pull request #182 from scratchfoundation/renovate/eslint-config-scratch-9.x
chore(deps): update dependency eslint-config-scratch to v9
2 parents 518f1b5 + 068aca6 commit 0b7a877

File tree

10 files changed

+7560
-3440
lines changed

10 files changed

+7560
-3440
lines changed

package-lock.json

Lines changed: 7510 additions & 3389 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
},
2929
"devDependencies": {
3030
"babel-core": "6.26.3",
31-
"babel-eslint": "7.2.3",
31+
"babel-eslint": "10.1.0",
3232
"babel-loader": "7.1.5",
3333
"babel-preset-env": "1.7.0",
34-
"eslint": "3.19.0",
35-
"eslint-config-scratch": "3.1.0",
34+
"eslint": "8.0.1",
35+
"eslint-config-scratch": "9.0.3",
3636
"json": "9.0.6",
3737
"tap": "12.7.0",
3838
"web-audio-test-api": "0.5.2",

src/ADPCMSoundDecoder.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class ADPCMSoundDecoder {
8989
* Decode an ADPCM sound stored in an ArrayBuffer and return a promise
9090
* with the decoded audio buffer.
9191
* @param {ArrayBuffer} audioData - containing ADPCM encoded wav audio
92-
* @return {AudioBuffer} the decoded audio buffer
92+
* @return {Promise.<AudioBuffer>} the decoded audio buffer
9393
*/
9494
decode (audioData) {
9595

@@ -99,7 +99,7 @@ class ADPCMSoundDecoder {
9999
const riffStr = stream.readUint8String(4);
100100
if (riffStr !== 'RIFF') {
101101
log.warn('incorrect adpcm wav header');
102-
reject();
102+
reject(new Error('incorrect adpcm wav header'));
103103
}
104104

105105
const lengthInHeader = stream.readInt32();
@@ -110,7 +110,7 @@ class ADPCMSoundDecoder {
110110
const wavStr = stream.readUint8String(4);
111111
if (wavStr !== 'WAVE') {
112112
log.warn('incorrect adpcm wav header');
113-
reject();
113+
reject(new Error('incorrect adpcm wav header'));
114114
}
115115

116116
const formatChunk = this.extractChunk('fmt ', stream);
@@ -120,7 +120,7 @@ class ADPCMSoundDecoder {
120120
this.bytesPerSecond = formatChunk.readUint32();
121121
this.blockAlignment = formatChunk.readUint16();
122122
this.bitsPerSample = formatChunk.readUint16();
123-
formatChunk.position += 2; // skip extra header byte count
123+
formatChunk.position += 2; // skip extra header byte count
124124
this.samplesPerBlock = formatChunk.readUint16();
125125
this.adpcmBlockSize = ((this.samplesPerBlock - 1) / 2) + 4; // block size in bytes
126126

@@ -168,7 +168,7 @@ class ADPCMSoundDecoder {
168168
const available = compressedData.getBytesAvailable();
169169
const blocks = (available / blockSize) | 0;
170170
// Number of samples in full blocks.
171-
const fullBlocks = blocks * (2 * (blockSize - 4)) + 1;
171+
const fullBlocks = (blocks * (2 * (blockSize - 4))) + 1;
172172
// Number of samples in the last incomplete block. 0 if the last block
173173
// is full.
174174
const subBlock = Math.max((available % blockSize) - 4, 0) * 2;
@@ -216,7 +216,7 @@ class ADPCMSoundDecoder {
216216
// read 4-bit code and compute delta from previous sample
217217
lastByte = compressedData.readUint8();
218218
code = lastByte & 0xF;
219-
delta = DELTA_TABLE[index * 16 + code];
219+
delta = DELTA_TABLE[(index * 16) + code];
220220
// compute next index
221221
index += INDEX_TABLE[code];
222222
if (index > 88) index = 88;
@@ -230,7 +230,7 @@ class ADPCMSoundDecoder {
230230
// use 4-bit code from lastByte and compute delta from previous
231231
// sample
232232
code = (lastByte >> 4) & 0xF;
233-
delta = DELTA_TABLE[index * 16 + code];
233+
delta = DELTA_TABLE[(index * 16) + code];
234234
// compute next index
235235
index += INDEX_TABLE[code];
236236
if (index > 88) index = 88;

src/ArrayBufferStream.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class ArrayBufferStream {
9595
*/
9696
set position (value) {
9797
this._position = value + this.start;
98-
return value;
9998
}
10099

101100
/**

src/AudioEngine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class AudioEngine {
218218
*/
219219
decodeSoundPlayer (sound) {
220220
return this._decodeSound(sound)
221-
.then(([id, buffer]) => new SoundPlayer(this, {id, buffer}));
221+
.then(([id, buffer]) => new SoundPlayer(this, {id, buffer}));
222222
}
223223

224224
/**

src/Loudness.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ class Loudness {
4444
this.mic.connect(this.analyser);
4545
this.micDataArray = new Float32Array(this.analyser.fftSize);
4646
})
47-
.catch(err => {
48-
log.warn(err);
49-
});
47+
.catch(err => {
48+
log.warn(err);
49+
});
5050
}
5151

5252
// If the microphone is set up and active, measure the loudness

src/SoundBank.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class SoundBank {
150150
this.soundEffects.forEach(effects => effects.dispose());
151151
this.soundEffects.clear();
152152
for (const soundId in this.soundPlayers) {
153-
if (this.soundPlayers.hasOwnProperty(soundId)) {
153+
if (Object.prototype.hasOwnProperty.call(this.soundPlayers, soundId)) {
154154
this.soundPlayers[soundId].dispose();
155155
}
156156
}

src/effects/Effect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* An effect on an AudioPlayer and all its SoundPlayers.
33
*/
44
class Effect {
5-
/**
5+
/**
66
* @param {AudioEngine} audioEngine - audio engine this runs with
77
* @param {AudioPlayer} audioPlayer - audio player this affects
88
* @param {Effect} lastEffect - effect in the chain before this one

src/effects/PitchEffect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class PitchEffect extends Effect {
118118
if (!players) return;
119119

120120
for (const id in players) {
121-
if (players.hasOwnProperty(id)) {
121+
if (Object.prototype.hasOwnProperty.call(players, id)) {
122122
this.updatePlayer(players[id]);
123123
}
124124
}

test/SoundPlayer.js

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -157,51 +157,51 @@ tap.test('SoundPlayer', suite => {
157157
audioContext.$processTo(audioEngine.DECAY_DURATION);
158158

159159
return Promise.resolve()
160-
.then(() => {
160+
.then(() => {
161161

162-
t.equal(soundPlayer.outputNode.$state, 'PLAYING');
162+
t.equal(soundPlayer.outputNode.$state, 'PLAYING');
163163

164-
soundPlayer.play();
165-
soundPlayer.finished().then(() => log.push('play 2 finished'));
164+
soundPlayer.play();
165+
soundPlayer.finished().then(() => log.push('play 2 finished'));
166166

167-
// wait for a micro-task loop to fire our previous events
168-
return Promise.resolve();
169-
})
170-
.then(() => {
167+
// wait for a micro-task loop to fire our previous events
168+
return Promise.resolve();
169+
})
170+
.then(() => {
171171

172-
t.equal(log[0], 'play 1 finished');
173-
t.notEqual(soundPlayer.outputNode, firstPlayNode, 'created new player node');
172+
t.equal(log[0], 'play 1 finished');
173+
t.notEqual(soundPlayer.outputNode, firstPlayNode, 'created new player node');
174174

175-
t.equal(help.engineInputs.length, 2, 'there should be 2 players connected');
176-
t.equal(firstPlayNode.$state, 'PLAYING');
177-
t.equal(soundPlayer.outputNode.$state, 'PLAYING');
178-
t.equal(help.engineInputs[0].gain.value, 1, 'old sound connectect to gain node with volume 1');
175+
t.equal(help.engineInputs.length, 2, 'there should be 2 players connected');
176+
t.equal(firstPlayNode.$state, 'PLAYING');
177+
t.equal(soundPlayer.outputNode.$state, 'PLAYING');
178+
t.equal(help.engineInputs[0].gain.value, 1, 'old sound connectect to gain node with volume 1');
179179

180-
const {currentTime} = audioContext;
181-
audioContext.$processTo(currentTime + audioEngine.DECAY_WAIT + 0.001);
182-
t.notEqual(help.engineInputs[0].gain.value, 1,
183-
'old sound connected to gain node which will fade');
180+
const {currentTime} = audioContext;
181+
audioContext.$processTo(currentTime + audioEngine.DECAY_WAIT + 0.001);
182+
t.notEqual(help.engineInputs[0].gain.value, 1,
183+
'old sound connected to gain node which will fade');
184184

185-
audioContext.$processTo(currentTime + audioEngine.DECAY_WAIT + audioEngine.DECAY_DURATION + 0.001);
186-
t.equal(soundPlayer.outputNode.$state, 'PLAYING');
187-
t.equal(firstPlayNode.$state, 'FINISHED');
185+
audioContext.$processTo(currentTime + audioEngine.DECAY_WAIT + audioEngine.DECAY_DURATION + 0.001);
186+
t.equal(soundPlayer.outputNode.$state, 'PLAYING');
187+
t.equal(firstPlayNode.$state, 'FINISHED');
188188

189-
t.equal(help.engineInputs[0].gain.value, 0, 'faded old sound to 0');
189+
t.equal(help.engineInputs[0].gain.value, 0, 'faded old sound to 0');
190190

191-
t.equal(log.length, 1);
192-
audioContext.$processTo(currentTime + audioEngine.DECAY_WAIT + audioEngine.DECAY_DURATION + 0.3);
191+
t.equal(log.length, 1);
192+
audioContext.$processTo(currentTime + audioEngine.DECAY_WAIT + audioEngine.DECAY_DURATION + 0.3);
193193

194-
// wait for a micro-task loop to fire our previous events
195-
return Promise.resolve();
196-
})
197-
.then(() => {
194+
// wait for a micro-task loop to fire our previous events
195+
return Promise.resolve();
196+
})
197+
.then(() => {
198198

199-
t.equal(log[1], 'play 2 finished');
200-
t.equal(help.engineInputs.length, 1, 'old sound disconneted itself after done');
201-
t.equal(log.length, 2);
199+
t.equal(log[1], 'play 2 finished');
200+
t.equal(help.engineInputs.length, 1, 'old sound disconneted itself after done');
201+
t.equal(log.length, 2);
202202

203-
t.end();
204-
});
203+
t.end();
204+
});
205205
});
206206

207207
suite.end();

0 commit comments

Comments
 (0)