Skip to content

Commit a310702

Browse files
committed
Fix eslint issues
1 parent 900a671 commit a310702

File tree

9 files changed

+18
-15
lines changed

9 files changed

+18
-15
lines changed

src/api/http-client-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { addBearerToken } from './interceptors';
77
* @param config HTTP client configuration
88
* @returns HTTP client with Bearer interceptor
99
*/
10-
export function createHttpClientWithBearerInterceptor(config?: CreateAxiosDefaults<any> | undefined): AxiosInstance{
10+
export function createHttpClientWithBearerInterceptor(config?: CreateAxiosDefaults<unknown> | undefined): AxiosInstance{
1111
const client = axios.create(config);
1212

1313
client.interceptors.request.use(addBearerToken);

src/api/interceptors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TokenService } from '../services/token.service';
66
* @param config Axios request configuration
77
* @returns Config with Bearer token
88
*/
9-
export async function addBearerToken(config: InternalAxiosRequestConfig<any>): Promise<InternalAxiosRequestConfig<any>>{
9+
export async function addBearerToken(config: InternalAxiosRequestConfig<unknown>): Promise<InternalAxiosRequestConfig<unknown>>{
1010
const token = await TokenService.instance.getToken();
1111

1212
if(token){

src/models/device.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export interface Device{
1515
/** Device manufacturer */
1616
manufacturer: string;
1717
/** Device model */
18-
model: string[]
18+
model: string[];
1919
}

src/responses/device-status-response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export interface DeviceStatusResponse{
88
data: string;
99
value: string;
1010
updatedTimestamp: number;
11-
}[]
11+
}[];
1212
}

src/responses/devices-response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export interface DeviceResponse{
1212
device: {
1313
manufacturerName: string;
1414
model: string;
15-
}
15+
};
1616
};
1717
}

src/services/account.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { createHttpClientWithBearerInterceptor } from '../api/http-client-factor
99
*/
1010
export class AccountService{
1111
private readonly _client = createHttpClientWithBearerInterceptor({
12-
baseURL: Endpoints.API_BASE_URL,
12+
baseURL: Endpoints.API_BASE_URL
1313
});
1414

1515
private _onAccountLoaded?: () => void | Promise<void>;

src/services/device.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ export class DeviceService{
5454
let deviceStatus: DeviceStatusResponse;
5555

5656
try{
57-
const response = await this._httpClient.get<DeviceStatusResponse>(`accounts/${this._platform.accountService.accountId}/devices/${deviceId}?expansions=attributes`)
57+
const response =
58+
await this._httpClient
59+
.get<DeviceStatusResponse>(`accounts/${this._platform.accountService.accountId}/devices/${deviceId}?expansions=attributes`);
5860
deviceStatus = response.data;
5961
}catch(ex){
60-
this._platform.log.error('Remote service returned an error.', (<AxiosError>ex).message)
62+
this._platform.log.error('Remote service returned an error.', (<AxiosError>ex).message);
6163

6264
return undefined;
6365
}

src/services/discovery.service.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ export class DiscoveryService{
5656
}
5757
}
5858

59-
this.clearStaleAccessories(this._cachedAccessories.filter(a => !devices.some(d => d.uuid === a.UUID)))
59+
this.clearStaleAccessories(this._cachedAccessories.filter(a => !devices.some(d => d.uuid === a.UUID)));
6060
}
6161

6262
private clearStaleAccessories(staleAccessories: PlatformAccessory[]): void{
6363
// Unregister them
64-
this._platform.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, staleAccessories)
64+
this._platform.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, staleAccessories);
6565

6666
// Clear the cache array to reflect this change
6767
for(const accessory of staleAccessories){
@@ -89,12 +89,13 @@ export class DiscoveryService{
8989

9090
private async getDevicesForAccount(): Promise<Device[]>{
9191
try{
92-
const response = await this._httpClient.get<DeviceResponse[]>(`accounts/${this._platform.accountService.accountId}/metadevices`);
92+
const response =
93+
await this._httpClient.get<DeviceResponse[]>(`accounts/${this._platform.accountService.accountId}/metadevices`);
9394
// Get only leaf devices with type of 'device'
9495
return response.data
95-
.filter(d => d.children.length === 0 && d.typeId === 'metadevice.device')
96-
.map(this.mapDeviceResponseToModel.bind(this))
97-
.filter(d => d !== undefined) as Device[];
96+
.filter(d => d.children.length === 0 && d.typeId === 'metadevice.device')
97+
.map(this.mapDeviceResponseToModel.bind(this))
98+
.filter(d => d !== undefined) as Device[];
9899
}catch(ex){
99100
this._platform.log.error('Failed to get devices for account.', (<AxiosError>ex).message);
100101
return [];

src/services/token.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class TokenService{
99
private static _instance: TokenService;
1010

1111
private readonly _httpClient = axios.create({
12-
baseURL: Endpoints.ACCOUNT_BASE_URL,
12+
baseURL: Endpoints.ACCOUNT_BASE_URL
1313
});
1414

1515
private _accessToken?: string;

0 commit comments

Comments
 (0)