Skip to content

Commit cf91f59

Browse files
authored
Fix linting issues (#196)
1 parent 2e7c86e commit cf91f59

11 files changed

+32
-5
lines changed

lib/parameter-checker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"use strict";
22

3+
const { Buffer } = require('buffer');
4+
35
class ParameterChecker {
46
constructor() {
57
this._error = null;

lib/switchbot-advertising.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"use strict";
22

3+
const { Buffer } = require('buffer');
4+
35
class SwitchbotAdvertising {
46
constructor() {}
57

@@ -595,8 +597,7 @@ class SwitchbotAdvertising {
595597

596598
const temp_sign = byte4 & 0b10000000 ? 1 : -1;
597599
const temp_c = temp_sign * ((byte4 & 0b01111111) + (byte3 & 0b00001111) / 10);
598-
const temp_f = (temp_c * 9 / 5) + 32;
599-
temp_f = Math.round(temp_f * 10) / 10;
600+
const temp_f = Math.round(((temp_c * 9 / 5) + 32) * 10) / 10;
600601

601602
const data = {
602603
model: "i",

lib/switchbot-device-woblindtilt.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"use strict";
2+
3+
const { Buffer } = require('buffer');
4+
25
let SwitchbotDevice = require("./switchbot-device.js");
36

47
class SwitchbotDeviceWoBlindTilt extends SwitchbotDevice {

lib/switchbot-device-wobulb.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"use strict";
2+
3+
const { Buffer } = require('buffer');
4+
25
const SwitchbotDevice = require("./switchbot-device.js");
36

47
/**

lib/switchbot-device-wocurtain.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"use strict";
2+
3+
const { Buffer } = require('buffer');
4+
25
const SwitchbotDevice = require("./switchbot-device.js");
36

47
class SwitchbotDeviceWoCurtain extends SwitchbotDevice {

lib/switchbot-device-wohand.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"use strict";
2+
3+
const { Buffer } = require('buffer');
4+
25
const SwitchbotDevice = require("./switchbot-device.js");
36

47
class SwitchbotDeviceWoHand extends SwitchbotDevice {

lib/switchbot-device-wohumi.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"use strict";
2+
3+
const { Buffer } = require('buffer');
4+
25
const SwitchbotDevice = require("./switchbot-device.js");
36

47
class SwitchbotDeviceWoHumi extends SwitchbotDevice {

lib/switchbot-device-woplugmini.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"use strict";
2+
3+
const { Buffer } = require('buffer');
4+
25
const SwitchbotDevice = require("./switchbot-device.js");
36

47
/**

lib/switchbot-device-wostrip.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"use strict";
2+
3+
const { Buffer } = require('buffer');
4+
25
const SwitchbotDevice = require("./switchbot-device.js");
36

47
/**

lib/switchbot-device.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"use strict";
2+
3+
const { Buffer } = require('buffer');
4+
25
const parameterChecker = require("./parameter-checker.js");
36
const switchbotAdvertising = require("./switchbot-advertising.js");
47

@@ -330,7 +333,7 @@ class SwitchbotDevice {
330333

331334
_disconnect() {
332335
if (this._was_connected_explicitly) {
333-
return new Promise((resolve, reject) => {
336+
return new Promise((resolve) => {
334337
resolve();
335338
});
336339
} else {
@@ -351,7 +354,7 @@ class SwitchbotDevice {
351354
* ---------------------------------------------------------------- */
352355
getDeviceName() {
353356
return new Promise((resolve, reject) => {
354-
const name = "";
357+
let name = "";
355358
this._connect()
356359
.then(() => {
357360
if (!this._chars.device) {

0 commit comments

Comments
 (0)