Skip to content

Commit 653603f

Browse files
committed
Configure linting
1 parent df778a8 commit 653603f

File tree

3 files changed

+60
-39
lines changed

3 files changed

+60
-39
lines changed

.eslintrc

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": [
3+
"plugin:jest/recommended"
4+
],
5+
"plugins": [
6+
"jest"
7+
],
8+
"parserOptions": {
9+
"ecmaVersion": 2018,
10+
"sourceType": "module",
11+
"ecmaFeatures": {
12+
"impliedStrict": true,
13+
"experimentalObjectRestSpread": true
14+
}
15+
},
16+
"env": {
17+
"jest/globals": true
18+
}
19+
}

.prettierrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"useTabs": false,
3+
"printWidth": 120,
4+
"tabWidth": 2,
5+
"singleQuote": true,
6+
"trailingComma": "es5",
7+
"jsxBracketSameLine": false,
8+
"semi": false,
9+
"rcVerbose": true
10+
}

src/client.js

+31-39
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,61 @@
1-
const midi = require("midi");
1+
const midi = require('midi')
22

33
class Client {
44
constructor(mixerPortName) {
5-
this.connect(mixerPortName);
5+
this.connect(mixerPortName)
66
}
77

88
connect(mixerPortName) {
9-
this.output = new midi.Output();
9+
this.output = new midi.Output()
1010

11-
const portNames = [];
12-
for (
13-
let portNumber = 0;
14-
portNumber < this.output.getPortCount();
15-
portNumber++
16-
) {
17-
portNames.push(this.output.getPortName(portNumber));
11+
const portNames = []
12+
for (let portNumber = 0; portNumber < this.output.getPortCount(); portNumber++) {
13+
portNames.push(this.output.getPortName(portNumber))
1814
}
1915

20-
const portIndex = portNames.findIndex(
21-
portName => portName === mixerPortName
22-
);
16+
const portIndex = portNames.findIndex(portName => portName === mixerPortName)
2317
if (portIndex < 0) {
24-
const formattedPortNameList = portNames
25-
.map(portName => `"${portName}"`)
26-
.join(", ");
18+
const formattedPortNameList = portNames.map(portName => `"${portName}"`).join(', ')
2719
throw new Error(
2820
[
29-
"\n",
21+
'\n',
3022
` Connecting to mixer failed: Could not any find port named "${mixerPortName}".`,
31-
` Available ports are: ${formattedPortNameList}\n`
32-
].join("\n")
33-
);
23+
` Available ports are: ${formattedPortNameList}\n`,
24+
].join('\n')
25+
)
3426
}
35-
this.output.openPort(portIndex);
27+
this.output.openPort(portIndex)
3628
}
3729

3830
disconnect() {
39-
this.output.closePort();
31+
this.output.closePort()
4032
}
4133

4234
// percent value between 0 and 127
4335
setFaderPosition({ channel, percent }) {
44-
percent = Math.max(0, percent);
45-
percent = Math.min(127, percent);
46-
this.setNrpnParameter({ channel, value: percent });
36+
percent = Math.max(0, percent)
37+
percent = Math.min(127, percent)
38+
this.setNrpnParameter({ channel, value: percent })
4739
}
4840

4941
setPaflSelect({ channel, active }) {
50-
const value = active ? 1 : 0;
51-
this.setNrpnParameter({ channel, value });
42+
const value = active ? 1 : 0
43+
this.setNrpnParameter({ channel, value })
5244
}
5345

5446
setMute({ channel, active }) {
55-
const value = active ? 0x7f : 0x3f;
56-
const { output } = this;
57-
output.sendMessage([0x90, channel, value]);
58-
output.sendMessage([0x80, channel, 0x00]);
47+
const value = active ? 0x7f : 0x3f
48+
const { output } = this
49+
output.sendMessage([0x90, channel, value])
50+
output.sendMessage([0x80, channel, 0x00])
5951
}
6052

6153
setNrpnParameter({ channel, value, valueIndex = 0x07 }) {
62-
const { output } = this;
63-
output.sendMessage([0xb0, 0x63, channel]);
64-
output.sendMessage([0xb0, 0x62, 0x17]);
65-
output.sendMessage([0xb0, 0x06, value]);
66-
output.sendMessage([0xb0, 0x26, valueIndex]);
54+
const { output } = this
55+
output.sendMessage([0xb0, 0x63, channel])
56+
output.sendMessage([0xb0, 0x62, 0x17])
57+
output.sendMessage([0xb0, 0x06, value])
58+
output.sendMessage([0xb0, 0x26, valueIndex])
6759
}
6860
}
6961

@@ -128,7 +120,7 @@ Client.channels = {
128120
mix_9_10: 0x66,
129121
main_lr: 0x67,
130122
matrix_1_2: 0x6c,
131-
matrix_3_4: 0x6d
132-
};
123+
matrix_3_4: 0x6d,
124+
}
133125

134-
module.exports = Client;
126+
module.exports = Client

0 commit comments

Comments
 (0)