Skip to content

Commit 9dfbe93

Browse files
committed
Fixed linter
1 parent 644831e commit 9dfbe93

File tree

8 files changed

+38
-39
lines changed

8 files changed

+38
-39
lines changed

packages/cli/src/lib/cli/cliLogs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class CLILogs extends CLICommand {
4343

4444
const config = fs.readJSONSync(require.resolve(getConfigFileName()));
4545
const logger = toolsLogger(config.log);
46-
/** @ts-expect-error todo adjust logger type */
46+
// @ts-expect-error todo adjust logger type
4747
let fileName = logger.getFileName();
4848
if (fileName) {
4949
let lines = fs.readFileSync(fileName).toString('utf-8').split('\n');

packages/cli/src/lib/setup/dbConnection.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export function dbConnect(onlyCheck: boolean, params: Record<string, any>, callb
3232
/**
3333
* Connects to the DB or tests the connection.
3434
*
35-
* @param onlyCheck
36-
* @param params
37-
* @param callback
35+
* @param onlyCheck if only connection check should be performed
36+
* @param params options used by dbConnect
37+
* @param callback called when connection is established or check is done
3838
*/
3939
export async function dbConnect(
4040
onlyCheck: boolean | Record<string, any> | DbConnectCallback,
@@ -134,17 +134,16 @@ export async function dbConnect(
134134
});
135135
} else {
136136
console.log(
137-
`No connection to objects ${config.objects.host}:${config.objects.port}[${config.objects.type}]`,
137+
`No connection to objects ${Array.isArray(config.objects.host) ? config.objects.host.join(', ') : config.objects.host}:${Array.isArray(config.objects.port) ? config.objects.port.join(', ') : config.objects.port}[${config.objects.type}]`,
138138
);
139139
if (onlyCheck) {
140-
callback &&
141-
callback({
142-
objects: objects!,
143-
states: states!,
144-
isOffline: true,
145-
objectsDBType: config.objects.type,
146-
config,
147-
});
140+
callback?.({
141+
objects: objects!,
142+
states: states!,
143+
isOffline: true,
144+
objectsDBType: config.objects.type,
145+
config,
146+
});
148147
callback = undefined;
149148
} else {
150149
return void exitApplicationSave(EXIT_CODES.NO_CONNECTION_TO_OBJ_DB);
@@ -215,7 +214,7 @@ export async function dbConnect(
215214
objects = null;
216215
}
217216
console.log(
218-
`No connection to states ${config.states.host}:${config.states.port}[${config.states.type}]`,
217+
`No connection to states ${Array.isArray(config.states.host) ? config.states.host.join(', ') : config.states.host}:${Array.isArray(config.states.port) ? config.states.port.join(', ') : config.states.port}[${config.states.type}]`,
219218
);
220219
if (onlyCheck) {
221220
callback &&

packages/cli/src/lib/setup/setupVendor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ interface iobVendorFile {
6262
defaultLogLevel?: false;
6363
};
6464
adapters?: {
65-
gitHubInstall?: false; // hide button install from github/npm
65+
gitHubInstall?: false; // hide button install from GitHub/npm
6666
statistics?: false; // hide statistics on the right top
6767
filterUpdates?: false; // hide button filter updates in adapter tab
6868
allowAdapterRating?: false; // do not show and do not load adapter ratings

packages/common-db/src/lib/common/logger.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export function logger(
172172
prefix = userOptions.prefix || '';
173173
noStdout = userOptions.noStdout;
174174
const winstonFormats = [];
175-
/** @ts-expect-error formatter arg wrongly documented */
175+
// @ts-expect-error formatter arg wrongly documented
176176
winstonFormats.push(winston.format.timestamp({ format: timestamp }));
177177
if (userOptions.json === undefined || userOptions.json) {
178178
winstonFormats.push(winston.format.json());
@@ -410,14 +410,14 @@ export function logger(
410410

411411
const log = winston.createLogger(options);
412412

413-
/** @ts-expect-error why do we override/add method to foreign instance? TODO */
413+
// @ts-expect-error why do we override/add method to foreign instance? TODO
414414
log.getFileName = function () {
415-
/** @ts-expect-error we use undocumented stuff here TODO */
415+
// @ts-expect-error we use undocumented stuff here TODO
416416
let transport = this.transports.find(t => (t.transport && t.transport.dirname) || t.dirname);
417417
if (transport) {
418-
/** @ts-expect-error we use undocumented stuff here TODO */
418+
// @ts-expect-error we use undocumented stuff here TODO
419419
transport = transport.transport ? transport.transport : transport;
420-
/** @ts-expect-error we use undocumented stuff here TODO */
420+
// @ts-expect-error we use undocumented stuff here TODO
421421
return `${transport.dirname}/${transport.filename.replace('%DATE%', getDate())}`;
422422
}
423423
return '';
@@ -435,36 +435,36 @@ export function logger(
435435
*/
436436
// @ts-expect-error why do we override/add method to foreign instance? TODO
437437
log.activateDateChecker = function (isEnabled, daysCount) {
438-
/** @ts-expect-error we use undocumented stuff here TODO */
438+
// @ts-expect-error we use undocumented stuff here TODO
439439
if (!isEnabled && this._fileChecker) {
440-
/** @ts-expect-error we use undocumented stuff here TODO */
440+
// @ts-expect-error we use undocumented stuff here TODO
441441
clearInterval(this._fileChecker);
442-
/** @ts-expect-error we use undocumented stuff here TODO */
442+
// @ts-expect-error we use undocumented stuff here TODO
443443
} else if (isEnabled && !this._fileChecker) {
444444
if (!daysCount) {
445445
daysCount = 3;
446446
}
447447

448448
// Check every hour
449-
/** @ts-expect-error we use undocumented stuff here TODO */
449+
// @ts-expect-error we use undocumented stuff here TODO
450450
this._fileChecker = setInterval(() => {
451451
this.transports.forEach(transport => {
452452
if (
453-
/** @ts-expect-error we use undocumented stuff here TODO */
453+
// @ts-expect-error we use undocumented stuff here TODO
454454
transport.name !== 'dailyRotateFile' ||
455-
/** @ts-expect-error we use undocumented stuff here TODO */
455+
// @ts-expect-error we use undocumented stuff here TODO
456456
!transport.options ||
457-
/** @ts-expect-error we use undocumented stuff here TODO */
457+
// @ts-expect-error we use undocumented stuff here TODO
458458
transport.options.name !== tools.appName
459459
) {
460460
return;
461461
}
462462

463-
/** @ts-expect-error we use undocumented stuff here TODO */
463+
// @ts-expect-error we use undocumented stuff here TODO
464464
if (transport && fs.existsSync(transport.dirname)) {
465465
let files;
466466
try {
467-
/** @ts-expect-error we use undocumented stuff here TODO */
467+
// @ts-expect-error we use undocumented stuff here TODO
468468
files = fs.readdirSync(transport.dirname);
469469
} catch (e) {
470470
console.error(`host.${hostname} Cannot read log directory: ${e.message}`);
@@ -485,20 +485,20 @@ export function logger(
485485
message: `host.${hostname} Delete log file ${files[i]}`,
486486
});
487487
console.log(`host.${hostname} Delete log file ${files[i]}`);
488-
/** @ts-expect-error we use undocumented stuff here TODO */
488+
// @ts-expect-error we use undocumented stuff here TODO
489489
fs.unlinkSync(`${transport.dirname}/${files[i]}`);
490490
} catch (e) {
491491
// there is a bug under windows, that file stays opened and cannot be deleted
492492
this.log({
493493
level: os.platform().startsWith('win') ? 'info' : 'error',
494494
message: `host.${hostname} Cannot delete file "${path.normalize(
495-
/** @ts-expect-error we use undocumented stuff here TODO */
495+
// @ts-expect-error we use undocumented stuff here TODO
496496
`${transport.dirname}/${files[i]}`,
497497
)}": ${e}`,
498498
});
499499
console.log(
500500
`host.${hostname} Cannot delete file "${path.normalize(
501-
/** @ts-expect-error we use undocumented stuff here TODO */
501+
// @ts-expect-error we use undocumented stuff here TODO
502502
`${transport.dirname}/${files[i]}`,
503503
)}": ${e.message}`,
504504
);

packages/controller/src/lib/restart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ export default async function restart(callback?: () => void): Promise<void> {
5858
// eslint-disable-next-line unicorn/prefer-module
5959
const modulePath = url.fileURLToPath(import.meta.url || `file://${__filename}`);
6060
if (process.argv[1] === modulePath) {
61-
restart();
61+
void restart();
6262
}

packages/controller/src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ async function startMultihost(__config?: ioBroker.IoBrokerJson): Promise<boolean
324324

325325
if (!_config.objects.host || hasLocalObjectsServer) {
326326
logger.warn(
327-
`${hostLogPrefix} Multihost Master on this system is not possible, because IP address for objects is ${_config.objects.host}. Please allow remote connections to the server by adjusting the IP.`,
327+
`${hostLogPrefix} Multihost Master on this system is not possible, because IP address for objects is ${Array.isArray(_config.objects.host) ? _config.objects.host.join(', ') : _config.objects.host}. Please allow remote connections to the server by adjusting the IP.`,
328328
);
329329
return false;
330330
} else if (!_config.states.host || hasLocalStatesServer) {
331331
logger.warn(
332-
`${hostLogPrefix} Multihost Master on this system is not possible, because IP address for states is ${_config.states.host}. Please allow remote connections to the server by adjusting the IP.`,
332+
`${hostLogPrefix} Multihost Master on this system is not possible, because IP address for states is ${Array.isArray(_config.states.host) ? _config.states.host.join(', ') : _config.states.host}. Please allow remote connections to the server by adjusting the IP.`,
333333
);
334334
return false;
335335
}

packages/controller/test/lib/testAdapter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ export default function testAdapter(options: Record<string, any>): void {
6262
];
6363

6464
const context: TestContext = {
65-
/** @ts-expect-error will be filled in time */
65+
// @ts-expect-error will be filled in time
6666
objects: null,
67-
/** @ts-expect-error will be filled in time */
67+
// @ts-expect-error will be filled in time
6868
states: null,
69-
/** @ts-expect-error will be filled in time */
69+
// @ts-expect-error will be filled in time
7070
adapter: null,
7171
onControllerStateChanged: null,
7272
onControllerObjectChanged: null,

schemas/updateSchemas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ async function getSpdxLicenseIds(): Promise<string[]> {
6060
}
6161

6262
updateIobJSON();
63-
updateLicenseArray();
63+
void updateLicenseArray();

0 commit comments

Comments
 (0)