Skip to content

Commit 386f51c

Browse files
committed
chore: lint
1 parent b29c480 commit 386f51c

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

packages/connector/src/connection/mosMessageParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ export class MosMessageParser extends EventEmitter<MosMessageParserEvents> {
138138
}
139139
private debugTrace(str: string) {
140140
if (this.debug) {
141-
// Supress console spam:
142-
if (!`${str}`.match(/<heartbeat>/)) {
141+
// Suppress console spam:
142+
if (!/<heartbeat>/.exec(`${str}`)) {
143143
// eslint-disable-next-line no-console
144144
console.log(str)
145145
}

packages/connector/src/connection/mosSocketClient.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class MosSocketClient extends EventEmitter<MosSocketClientEvents> {
101101
if (!this._lastConnectionAttempt || Date.now() - this._lastConnectionAttempt >= this._reconnectDelay) {
102102
// !_lastReconnectionAttempt (means first attempt) OR time > _reconnectionDelay since last attempt
103103
// recreate client if new attempt:
104-
if (this._client && this._client.connecting) {
104+
if (this._client?.connecting) {
105105
this._client.destroy()
106106
this._client.removeAllListeners()
107107
delete this._client
@@ -274,8 +274,8 @@ export class MosSocketClient extends EventEmitter<MosSocketClientEvents> {
274274
/**
275275
* convenience wrapper to expose all logging calls to parent object
276276
*/
277-
log(args: string | number | any): void {
278-
this.debugTrace(args)
277+
log(...args: any[]): void {
278+
this.debugTrace(...args)
279279
}
280280
public setDebug(debug: boolean): void {
281281
this._debug = debug
@@ -544,8 +544,8 @@ export class MosSocketClient extends EventEmitter<MosSocketClientEvents> {
544544
}
545545
}, this._commandTimeout)
546546
}
547-
private debugTrace(...strs: any[]) {
547+
private debugTrace(...args: any[]) {
548548
// eslint-disable-next-line no-console
549-
if (this._debug) console.log(...strs)
549+
if (this._debug) console.log(...args)
550550
}
551551
}

packages/helper/src/mosModel/MosMessage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export abstract class MosMessage {
2929
prepare(messageID?: number): void {
3030
if (!this.mosID) throw new Error(`Can't prepare message: mosID missing`)
3131
if (!this.ncsID) throw new Error(`Can't prepare message: ncsID missing`)
32-
this._messageID = messageID ? messageID : MosMessage.getNewMessageID()
32+
this._messageID = messageID ?? MosMessage.getNewMessageID()
3333
}
3434

3535
/** */

packages/helper/src/mosModel/parseMosTypes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function getSpecialMosTypes(strict: boolean) {
215215
validate: (_value: string) => true,
216216
valueOf: (value: string) => value,
217217
stringify: (value: string) => value,
218-
is: (value: string | any): value is string => typeof value !== 'string',
218+
is: (value: any): value is string => typeof value !== 'string',
219219
fallback: () => '',
220220
}
221221
const stringEnum: MosType<string, string, { enum: { [key: string]: string }; value: AnyXMLValue }> = {
@@ -237,7 +237,7 @@ function getSpecialMosTypes(strict: boolean) {
237237
validate: (_value: string) => true,
238238
valueOf: (value: string) => value,
239239
stringify: (value: string) => value,
240-
is: (value: string | any): value is string => typeof value !== 'string',
240+
is: (value: any): value is string => typeof value !== 'string',
241241
fallback: () => '',
242242
}
243243
const number: MosType<number, number, AnyXMLValue> = {
@@ -248,7 +248,7 @@ function getSpecialMosTypes(strict: boolean) {
248248
validate: (_value: number) => true,
249249
valueOf: (value: number) => value,
250250
stringify: (value: number) => `${value}`,
251-
is: (value: number | any): value is number => typeof value !== 'number',
251+
is: (value: any): value is number => typeof value !== 'number',
252252
fallback: () => 0,
253253
}
254254

packages/helper/src/mosModel/profile1/xmlConversion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export namespace XMLMosAck {
2727

2828
const ack: IMOSAck = {
2929
ID: mosTypes.mosString128.createRequired(xml.objID, 'objID'),
30-
Revision: mosTypes.number.createOptional(xml.objRev, 'objRev') || 0,
30+
Revision: mosTypes.number.createOptional(xml.objRev, 'objRev') ?? 0,
3131
Status:
3232
mosTypes.stringEnum.createOptional({ value: xml.status, enum: IMOSAckStatus }, 'status') ||
3333
IMOSAckStatus.ACK,

packages/model/src/mosTypes/mosDuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function create(anyValue: AnyValue, strict: boolean): IMOSDuration {
1111
if (typeof anyValue === 'number') {
1212
value = anyValue
1313
} else if (typeof anyValue === 'string') {
14-
const m = anyValue.match(/(\d+):(\d+):(\d+)/)
14+
const m = /(\d+):(\d+):(\d+)/.exec(anyValue)
1515
if (!m) throw new Error(`MosDuration: Invalid input format: "${anyValue}"!`)
1616

1717
const hh: number = parseInt(m[1], 10)

0 commit comments

Comments
 (0)