Skip to content

Commit 8df2464

Browse files
committed
fix: biome floating promises detection
1 parent 5db6ae0 commit 8df2464

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

biome.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"bracketSpacing": false
1313
},
1414
"files": {
15-
"includes": ["**", "!package.json"]
15+
"includes": ["**", "!package.json", "!!**/dist", "!!**/coverage"]
1616
},
1717
"linter": {
1818
"includes": ["**"],
@@ -72,6 +72,11 @@
7272
"suspicious": {
7373
"noConstEnum": "off",
7474
"useAwait": "error"
75+
},
76+
"nursery": {
77+
"useExhaustiveSwitchCases": "error",
78+
"noFloatingPromises": "error",
79+
"noMisusedPromises": "error"
7580
}
7681
}
7782
},

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ async function handleQuit() {
174174

175175
if (require.main === module || require.main.filename.endsWith(`${path.sep}cli.js`)) {
176176
if (process.argv.length === 3 && process.argv[2] === "writehash") {
177-
writeHash();
177+
void writeHash();
178178
} else {
179179
process.on("SIGINT", handleQuit);
180180
process.on("SIGTERM", handleQuit);
181-
start();
181+
void start();
182182
}
183183
} else {
184184
process.on("SIGINT", handleQuit);

lib/controller.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ export class Controller {
9999
// Start zigbee
100100
try {
101101
await this.zigbee.start();
102-
this.eventBus.onAdapterDisconnected(this, this.onZigbeeAdapterDisconnected);
102+
// biome-ignore lint/nursery/noMisusedPromises: TODO
103+
this.eventBus.onAdapterDisconnected(this, async () => {
104+
logger.error("Adapter disconnected, stopping");
105+
await this.stop(false, 2);
106+
});
103107
} catch (error) {
104108
logger.error("Failed to start zigbee-herdsman");
105109
logger.error(
@@ -157,7 +161,10 @@ export class Controller {
157161
}
158162
}
159163

160-
this.eventBus.onLastSeenChanged(this, (data) => utils.publishLastSeen(data, settings.get(), false, this.publishEntityState));
164+
// biome-ignore lint/nursery/noMisusedPromises: TODO
165+
this.eventBus.onLastSeenChanged(this, async (data) => {
166+
await utils.publishLastSeen(data, settings.get(), false, this.publishEntityState);
167+
});
161168

162169
logger.info("Zigbee2MQTT started!");
163170

@@ -317,11 +324,6 @@ export class Controller {
317324
return await this.exitCallback(code, restart);
318325
}
319326

320-
@bind async onZigbeeAdapterDisconnected(): Promise<void> {
321-
logger.error("Adapter disconnected, stopping");
322-
await this.stop(false, 2);
323-
}
324-
325327
@bind async publishEntityState(entity: Group | Device, payload: KeyValue, stateChangeReason?: StateChangeReason): Promise<void> {
326328
let message: Zigbee2MQTTAPI["{friendlyName}"] = {...payload};
327329

scripts/zStackEraseAllNvMem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ if (processArgs.length !== 1) {
9191

9292
const eraser = new ZStackNvMemEraser(processArgs[0]);
9393

94-
eraser.start();
94+
void eraser.start();

0 commit comments

Comments
 (0)