Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ignore): Sync eslint settings from zhc #1185

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default tseslint.config(
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'array-bracket-spacing': ['error', 'never'],
'no-return-await': 'error',
'@typescript-eslint/return-await': ['error', 'always'],
'object-curly-spacing': ['error', 'never'],
'@typescript-eslint/no-floating-promises': 'error',
},
Expand Down
24 changes: 12 additions & 12 deletions src/adapter/deconz/adapter/deconzAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ class DeconzAdapter extends Adapter {
}

public static async isValidPath(path: string): Promise<boolean> {
return Driver.isValidPath(path);
return await Driver.isValidPath(path);
}

public static async autoDetectPath(): Promise<string | undefined> {
return Driver.autoDetectPath();
return await Driver.autoDetectPath();
}

/**
Expand Down Expand Up @@ -351,12 +351,12 @@ class DeconzAdapter extends Adapter {

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async addInstallCode(ieeeAddress: string, key: Buffer): Promise<void> {
return Promise.reject(new Error('Add install code is not supported'));
return await Promise.reject(new Error('Add install code is not supported'));
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async reset(type: 'soft' | 'hard'): Promise<void> {
return Promise.reject(new Error('Reset is not supported'));
return await Promise.reject(new Error('Reset is not supported'));
}

public async lqi(networkAddress: number): Promise<LQI> {
Expand Down Expand Up @@ -454,7 +454,7 @@ class DeconzAdapter extends Adapter {
} catch (error) {
const msg = 'LQI REQUEST FAILED - addr: 0x' + networkAddress.toString(16) + ' ' + error;
logger.debug(msg, NS);
return Promise.reject(new Error(msg));
return await Promise.reject(new Error(msg));
}
};

Expand Down Expand Up @@ -570,7 +570,7 @@ class DeconzAdapter extends Adapter {
} catch (error) {
const msg = 'ROUTING_TABLE REQUEST FAILED - addr: 0x' + networkAddress.toString(16) + ' ' + error;
logger.debug(msg, NS);
return Promise.reject(new Error(msg));
return await Promise.reject(new Error(msg));
}
};

Expand Down Expand Up @@ -634,7 +634,7 @@ class DeconzAdapter extends Adapter {
} catch (error) {
const msg = 'RECEIVING NODE_DESCRIPTOR FAILED - addr: 0x' + networkAddress.toString(16) + ' ' + error;
logger.debug(msg, NS);
return Promise.reject(new Error(msg));
return await Promise.reject(new Error(msg));
}
}

Expand Down Expand Up @@ -678,7 +678,7 @@ class DeconzAdapter extends Adapter {
} catch (error) {
const msg = 'READING ACTIVE_ENDPOINTS FAILED - addr: 0x' + networkAddress.toString(16) + ' ' + error;
logger.debug(msg, NS);
return Promise.reject(new Error(msg));
return await Promise.reject(new Error(msg));
}
}

Expand Down Expand Up @@ -749,7 +749,7 @@ class DeconzAdapter extends Adapter {
} catch (error) {
const msg = 'RECEIVING SIMPLE_DESCRIPTOR FAILED - addr: 0x' + networkAddress.toString(16) + ' ' + error;
logger.debug(msg, NS);
return Promise.reject(new Error(msg));
return await Promise.reject(new Error(msg));
}
}

Expand Down Expand Up @@ -954,7 +954,7 @@ class DeconzAdapter extends Adapter {
request.radius = PARAM.PARAM.txRadius.UNLIMITED;

logger.debug(`sendZclFrameToGroup - message send`, NS);
return this.driver.enqueueSendDataRequest(request) as Promise<void>;
return await (this.driver.enqueueSendDataRequest(request) as Promise<void>);
}

public async sendZclFrameToAll(endpoint: number, zclFrame: Zcl.Frame, sourceEndpoint: number, destination: BroadcastAddress): Promise<void> {
Expand All @@ -978,7 +978,7 @@ class DeconzAdapter extends Adapter {
request.radius = PARAM.PARAM.txRadius.UNLIMITED;

logger.debug(`sendZclFrameToAll - message send`, NS);
return this.driver.enqueueSendDataRequest(request) as Promise<void>;
return await (this.driver.enqueueSendDataRequest(request) as Promise<void>);
}

public async bind(
Expand Down Expand Up @@ -1164,7 +1164,7 @@ class DeconzAdapter extends Adapter {
} catch (error) {
const msg = 'get network parameters Error:' + error;
logger.debug(msg, NS);
return Promise.reject(new Error(msg));
return await Promise.reject(new Error(msg));
}
}

Expand Down
52 changes: 26 additions & 26 deletions src/adapter/ember/adapter/emberAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ export class EmberAdapter extends Adapter {
* On the other hand, the more often this runs, the more secure the network is...
*/
public async broadcastNetworkKeyUpdate(): Promise<void> {
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
logger.warning(`[TRUST CENTER] Performing a network key update. This might take a while and disrupt normal operation.`, NS);

// zero-filled = let stack generate new random network key
Expand Down Expand Up @@ -1585,7 +1585,7 @@ export class EmberAdapter extends Adapter {
}*/
}

return this.emberSetEzspPolicy(EzspPolicyId.TRUST_CENTER_POLICY, policy);
return await this.emberSetEzspPolicy(EzspPolicyId.TRUST_CENTER_POLICY, policy);
}

//---- END EZSP wrappers
Expand Down Expand Up @@ -1689,7 +1689,7 @@ export class EmberAdapter extends Adapter {
}

try {
return SerialPortUtils.is(RealpathSync(path), autoDetectDefinitions);
return await SerialPortUtils.is(RealpathSync(path), autoDetectDefinitions);
} catch (error) {
logger.debug(`Failed to determine if path is valid: '${error}'`, NS);
return false;
Expand Down Expand Up @@ -1720,7 +1720,7 @@ export class EmberAdapter extends Adapter {

// queued, non-InterPAN
public async getCoordinator(): Promise<TsType.Coordinator> {
return this.queue.execute<TsType.Coordinator>(async () => {
return await this.queue.execute<TsType.Coordinator>(async () => {
this.checkInterpanLock();

// in all likelihood this will be retrieved from cache
Expand Down Expand Up @@ -1762,7 +1762,7 @@ export class EmberAdapter extends Adapter {
// queued
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async backup(ieeeAddressesInDatabase: string[]): Promise<Backup> {
return this.queue.execute<Backup>(async () => {
return await this.queue.execute<Backup>(async () => {
// grab fresh version here, bypass cache
const [netStatus, , netParams] = await this.ezsp.ezspGetNetworkParameters();

Expand Down Expand Up @@ -1844,7 +1844,7 @@ export class EmberAdapter extends Adapter {

// queued, non-InterPAN
public async getNetworkParameters(): Promise<TsType.NetworkParameters> {
return this.queue.execute<TsType.NetworkParameters>(async () => {
return await this.queue.execute<TsType.NetworkParameters>(async () => {
this.checkInterpanLock();

// first call will cache for the others, but in all likelihood, it will all be from freshly cached after init
Expand All @@ -1863,7 +1863,7 @@ export class EmberAdapter extends Adapter {

// queued
public async changeChannel(newChannel: number): Promise<void> {
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
this.checkInterpanLock();

const zdoPayload = BuffaloZdo.buildChannelChangeRequest(newChannel, null);
Expand All @@ -1888,7 +1888,7 @@ export class EmberAdapter extends Adapter {

// queued
public async setTransmitPower(value: number): Promise<void> {
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
const status = await this.ezsp.ezspSetRadioPower(value);

if (status !== SLStatus.OK) {
Expand Down Expand Up @@ -1925,7 +1925,7 @@ export class EmberAdapter extends Adapter {
}
}

return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
// Compute the key from the install code and CRC.
const [aesStatus, keyContents] = await this.emberAesHashSimple(key);

Expand Down Expand Up @@ -2019,7 +2019,7 @@ export class EmberAdapter extends Adapter {

if (networkAddress) {
// specific device that is not `Coordinator`
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
this.checkInterpanLock();
await preJoining();

Expand Down Expand Up @@ -2047,7 +2047,7 @@ export class EmberAdapter extends Adapter {
});
} else {
// coordinator-only, or all
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
this.checkInterpanLock();
await preJoining();

Expand Down Expand Up @@ -2081,7 +2081,7 @@ export class EmberAdapter extends Adapter {

// queued, non-InterPAN
public async lqi(networkAddress: number): Promise<TsType.LQI> {
return this.queue.execute<TsType.LQI>(async () => {
return await this.queue.execute<TsType.LQI>(async () => {
this.checkInterpanLock();

const neighbors: TsType.LQINeighbor[] = [];
Expand Down Expand Up @@ -2137,7 +2137,7 @@ export class EmberAdapter extends Adapter {

// queued, non-InterPAN
public async routingTable(networkAddress: number): Promise<TsType.RoutingTable> {
return this.queue.execute<TsType.RoutingTable>(async () => {
return await this.queue.execute<TsType.RoutingTable>(async () => {
this.checkInterpanLock();

const table: TsType.RoutingTableEntry[] = [];
Expand Down Expand Up @@ -2193,7 +2193,7 @@ export class EmberAdapter extends Adapter {

// queued, non-InterPAN
public async nodeDescriptor(networkAddress: number): Promise<TsType.NodeDescriptor> {
return this.queue.execute<TsType.NodeDescriptor>(async () => {
return await this.queue.execute<TsType.NodeDescriptor>(async () => {
this.checkInterpanLock();

const zdoPayload = BuffaloZdo.buildNodeDescriptorRequest(networkAddress);
Expand Down Expand Up @@ -2248,7 +2248,7 @@ export class EmberAdapter extends Adapter {

// queued, non-InterPAN
public async activeEndpoints(networkAddress: number): Promise<TsType.ActiveEndpoints> {
return this.queue.execute<TsType.ActiveEndpoints>(async () => {
return await this.queue.execute<TsType.ActiveEndpoints>(async () => {
this.checkInterpanLock();

const zdoPayload = BuffaloZdo.buildActiveEndpointsRequest(networkAddress);
Expand Down Expand Up @@ -2278,7 +2278,7 @@ export class EmberAdapter extends Adapter {

// queued, non-InterPAN
public async simpleDescriptor(networkAddress: number, endpointID: number): Promise<TsType.SimpleDescriptor> {
return this.queue.execute<TsType.SimpleDescriptor>(async () => {
return await this.queue.execute<TsType.SimpleDescriptor>(async () => {
this.checkInterpanLock();

const zdoPayload = BuffaloZdo.buildSimpleDescriptorRequest(networkAddress, endpointID);
Expand Down Expand Up @@ -2324,7 +2324,7 @@ export class EmberAdapter extends Adapter {
type: 'endpoint' | 'group',
destinationEndpoint?: number,
): Promise<void> {
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
this.checkInterpanLock();

const zdoPayload = BuffaloZdo.buildBindRequest(
Expand Down Expand Up @@ -2370,7 +2370,7 @@ export class EmberAdapter extends Adapter {
type: 'endpoint' | 'group',
destinationEndpoint?: number,
): Promise<void> {
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
this.checkInterpanLock();

const zdoPayload = BuffaloZdo.buildUnbindRequest(
Expand Down Expand Up @@ -2408,7 +2408,7 @@ export class EmberAdapter extends Adapter {

// queued, non-InterPAN
public async removeDevice(networkAddress: number, ieeeAddr: string): Promise<void> {
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
this.checkInterpanLock();

const zdoPayload = BuffaloZdo.buildLeaveRequest(ieeeAddr as EUI64, Zdo.LeaveRequestFlags.WITHOUT_REJOIN);
Expand Down Expand Up @@ -2469,7 +2469,7 @@ export class EmberAdapter extends Adapter {

const data = zclFrame.toBuffer();

return this.queue.execute<ZclPayload | void>(async () => {
return await this.queue.execute<ZclPayload | void>(async () => {
this.checkInterpanLock();

logger.debug(() => `~~~> [ZCL to=${networkAddress} apsFrame=${JSON.stringify(apsFrame)} header=${JSON.stringify(zclFrame.header)}]`, NS);
Expand Down Expand Up @@ -2552,7 +2552,7 @@ export class EmberAdapter extends Adapter {
};
const data = zclFrame.toBuffer();

return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
this.checkInterpanLock();

logger.debug(() => `~~~> [ZCL GROUP apsFrame=${JSON.stringify(apsFrame)} header=${JSON.stringify(zclFrame.header)}]`, NS);
Expand Down Expand Up @@ -2594,7 +2594,7 @@ export class EmberAdapter extends Adapter {
};
const data = zclFrame.toBuffer();

return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
this.checkInterpanLock();

logger.debug(() => `~~~> [ZCL BROADCAST apsFrame=${JSON.stringify(apsFrame)} header=${JSON.stringify(zclFrame.header)}]`, NS);
Expand Down Expand Up @@ -2623,7 +2623,7 @@ export class EmberAdapter extends Adapter {

// queued
public async setChannelInterPAN(channel: number): Promise<void> {
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
this.interpanLock = true;
const status = await this.ezsp.ezspSetLogicalAndRadioChannel(channel);

Expand All @@ -2636,7 +2636,7 @@ export class EmberAdapter extends Adapter {

// queued
public async sendZclFrameInterPANToIeeeAddr(zclFrame: Zcl.Frame, ieeeAddress: string): Promise<void> {
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
const msgBuffalo = new EzspBuffalo(Buffer.alloc(MAXIMUM_INTERPAN_LENGTH));

// cache-enabled getters
Expand Down Expand Up @@ -2689,7 +2689,7 @@ export class EmberAdapter extends Adapter {
sequence: 0, // set by stack
};

return this.queue.execute<ZclPayload>(async () => {
return await this.queue.execute<ZclPayload>(async () => {
const msgBuffalo = new EzspBuffalo(Buffer.alloc(MAXIMUM_INTERPAN_LENGTH));

// cache-enabled getters
Expand Down Expand Up @@ -2734,7 +2734,7 @@ export class EmberAdapter extends Adapter {

// queued
public async restoreChannelInterPAN(): Promise<void> {
return this.queue.execute<void>(async () => {
return await this.queue.execute<void>(async () => {
const status = await this.ezsp.ezspSetLogicalAndRadioChannel(this.networkOptions.channelList[0]);

if (status !== SLStatus.OK) {
Expand Down
10 changes: 5 additions & 5 deletions src/adapter/ember/ezsp/ezsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
return EzspStatus.ERROR_COMMAND_TOO_LONG;
}

return this.queue.execute<EzspStatus>(async () => {
return await this.queue.execute<EzspStatus>(async () => {
let status: EzspStatus = EzspStatus.ASH_ERROR_TIMEOUTS; // will be overwritten below as necessary
const frameId = sendBuffalo.getFrameId();
const frameString = `[FRAME: ID=${frameId}:"${EzspFrameID[frameId]}" Seq=${sequence} Len=${length}]`;
Expand Down Expand Up @@ -1223,7 +1223,7 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
* @returns EzspStatus
*/
public async ezspSetEndpointFlags(endpoint: number, flags: EzspEndpointFlag): Promise<SLStatus> {
return this.ezspSetValue(EzspValueId.ENDPOINT_FLAGS, 3, [endpoint, lowByte(flags), highByte(flags)]);
return await this.ezspSetValue(EzspValueId.ENDPOINT_FLAGS, 3, [endpoint, lowByte(flags), highByte(flags)]);
}

/**
Expand Down Expand Up @@ -1299,7 +1299,7 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
* @returns
*/
public async ezspSetExtendedSecurityBitmask(mask: EmberExtendedSecurityBitmask): Promise<SLStatus> {
return this.ezspSetValue(EzspValueId.EXTENDED_SECURITY_BITMASK, 2, [lowByte(mask), highByte(mask)]);
return await this.ezspSetValue(EzspValueId.EXTENDED_SECURITY_BITMASK, 2, [lowByte(mask), highByte(mask)]);
}

/**
Expand All @@ -1321,15 +1321,15 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
* @returns
*/
public async ezspStartWritingStackTokens(): Promise<SLStatus> {
return this.ezspSetValue(EzspValueId.STACK_TOKEN_WRITING, 1, [1]);
return await this.ezspSetValue(EzspValueId.STACK_TOKEN_WRITING, 1, [1]);
}

/**
* Wrapper for `ezspSetValue`.
* @returns
*/
public async ezspStopWritingStackTokens(): Promise<SLStatus> {
return this.ezspSetValue(EzspValueId.STACK_TOKEN_WRITING, 1, [0]);
return await this.ezspSetValue(EzspValueId.STACK_TOKEN_WRITING, 1, [0]);
}

//-----------------------------------------------------------------------------//
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/ember/uart/ash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ export class UartAsh extends EventEmitter<UartAshEventMap> {
this.socketPort.pipe(this.parser);
this.parser.on('data', this.onFrame.bind(this));

return new Promise((resolve, reject): void => {
return await new Promise((resolve, reject): void => {
const openError = async (err: Error): Promise<void> => {
await this.stop();

Expand Down
Loading