From febccc2ba374acfc0d0e71fabb826fc8539b31c8 Mon Sep 17 00:00:00 2001 From: Antoine C Date: Sat, 3 Jun 2023 21:28:29 +0100 Subject: fix pre-commit failing due to TS new linting rules --- res/controllers/Traktor-Kontrol-S4-MK3.js | 20 ++++++++++---------- res/controllers/common-controller-scripts.js | 5 +++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/res/controllers/Traktor-Kontrol-S4-MK3.js b/res/controllers/Traktor-Kontrol-S4-MK3.js index 258e4911dc..b20056345a 100644 --- a/res/controllers/Traktor-Kontrol-S4-MK3.js +++ b/res/controllers/Traktor-Kontrol-S4-MK3.js @@ -86,7 +86,7 @@ const GridButtonBlinkOverBeat = false; const WheelLedBlinkOnTrackEnd = true; // When shifting either decks, the mixer will control microphones or auxiliary lines. If there is both a mic and an configure on the same channel, the mixer will control the auxiliary. -// Default: true +// Default: false const MixerControlsMixAuxOnShift = false; // Define how many wheel moves are sampled to compute the speed. The more you have, the more the speed is accurate, but the @@ -860,7 +860,7 @@ class SamplerButton extends Button { if (this.number === undefined || !Number.isInteger(this.number) || this.number < 1 || this.number > 64) { throw Error("SamplerButton must have a number property of an integer between 1 and 64"); } - this.group = "[Sampler${this.number}]"; + this.group = `[Sampler${this.number}]`; this.outConnect(); } onShortPress() { @@ -1635,12 +1635,11 @@ class S4Mk3Deck extends Deck { this.indicator(false); const wheelOutput = new Uint8Array(40).fill(0); wheelOutput[0] = decks[0] - 1; - const that = this; controller.sendOutputReport(50, wheelOutput.buffer, true); if (!skipRestore) { - that.deck.wheelMode = that.previousWheelMode; + this.deck.wheelMode = this.previousWheelMode; } - that.previousWheelMode = null; + this.previousWheelMode = null; if (this.loopModeConnection !== null) { this.loopModeConnection.disconnect(); this.loopModeConnection = null; @@ -1721,12 +1720,11 @@ class S4Mk3Deck extends Deck { this.indicator(false); const wheelOutput = new Uint8Array(40).fill(0); wheelOutput[0] = decks[0] - 1; - const that = this; controller.sendOutputReport(wheelOutput.buffer, null, 50, true); if (!skipRestore) { - that.deck.wheelMode = that.previousWheelMode; + this.deck.wheelMode = this.previousWheelMode; } - that.previousWheelMode = null; + this.previousWheelMode = null; if (this.loopModeConnection !== null) { this.loopModeConnection.disconnect(); this.loopModeConnection = null; @@ -2350,8 +2348,10 @@ class S4Mk3Deck extends Deck { outTrigger: function() { const vinylOn = this.deck.wheelMode === wheelModes.vinyl; this.send(this.color + (vinylOn ? this.brightnessOn : this.brightnessOff)); - const motorOn = this.deck.wheelMode === wheelModes.motor; - this.deck.turntableButton.send(this.color + (motorOn ? this.brightnessOn : this.brightnessOff)); + if (this.deck.turntableButton) { + const motorOn = this.deck.wheelMode === wheelModes.motor; + this.deck.turntableButton.send(this.color + (motorOn ? this.brightnessOn : this.brightnessOff)); + } }, }); diff --git a/res/controllers/common-controller-scripts.js b/res/controllers/common-controller-scripts.js index bcc8602f6c..68eed58954 100644 --- a/res/controllers/common-controller-scripts.js +++ b/res/controllers/common-controller-scripts.js @@ -21,7 +21,7 @@ // Returns an ASCII byte array for the string String.prototype.toInt = function() { - const a = new Array(); + const a = []; for (let i = 0; i < this.length; i++) { a[i] = this.charCodeAt(i); } @@ -124,6 +124,7 @@ var colorCodeToObject = function(colorCode) { }; }; +/* eslint @typescript-eslint/no-empty-function: "off" */ var script = function() { }; @@ -494,7 +495,6 @@ script.softStart = function(channel, control, value, status, group, factor) { }; // bpm - Used for tapping the desired BPM for a deck - var bpm = function() { }; @@ -584,6 +584,7 @@ var Controller = function() { Controller.prototype.addButton = function(buttonName, button, eventHandler) { if (eventHandler) { + /* eslint @typescript-eslint/no-this-alias: "off" */ const executionEnvironment = this; const handler = function(value) { button.state = value; -- cgit v1.2.3