Skip to content
Open
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 @@ -122,7 +122,7 @@ export default defineConfig([
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-require-imports": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430
"@typescript-eslint/prefer-nullish-coalescing": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/no-empty-object-type": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430
"@typescript-eslint/no-floating-promises": "off", // https://github.com/eclipse-thingweb/node-wot/issues/1430

Expand Down
4 changes: 1 addition & 3 deletions packages/binding-coap/src/coap-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ export default class CoapServer implements ProtocolServer {
return;
}

if (thing.forms == null) {
thing.forms = [];
}
thing.forms ??= [];

const form = this.createAffordanceForm(base, this.PROPERTY_DIR, offeredMediaType, opValues, thing.uriVariables);

Expand Down
2 changes: 1 addition & 1 deletion packages/binding-http/src/http-client-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export default class HttpClient implements ProtocolClient {

const url = HttpClient.fixLocalhostName(form.href);

requestInit.method = form["htv:methodName"] ? form["htv:methodName"] : defaultMethod;
requestInit.method = form["htv:methodName"] ?? defaultMethod;

requestInit.headers = requestInit.headers ?? [];
requestInit.headers = requestInit.headers as string[][];
Expand Down
4 changes: 1 addition & 3 deletions packages/binding-http/src/http-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,7 @@ export default class HttpServer implements ProtocolServer {
"writemultipleproperties",
];
}
if (thing.forms == null) {
thing.forms = [];
}
thing.forms ??= [];
thing.forms.push(form);
this.addUrlRewriteEndpoints(form, thing.forms);
}
Expand Down
8 changes: 3 additions & 5 deletions packages/binding-modbus/src/modbus-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ class ModbusSubscription {
error?: (error: Error) => void,
complete?: () => void
) {
if (!complete) {
complete = () => {
// do nothing.
};
}
complete ??= () => {
// do nothing.
};
this.interval = global.setInterval(async () => {
try {
const result = await client.readResource(form);
Expand Down
4 changes: 1 addition & 3 deletions packages/binding-opcua/src/opcua-protocol-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ export class OPCUAProtocolClient implements ProtocolClient {

private async _getNamespaceArray(form: OPCUAForm): Promise<string[]> {
return this._withConnection(form, async (c: OPCUAConnection) => {
if (!c.namespaceArray) {
c.namespaceArray = await readNamespaceArray(c.session);
}
c.namespaceArray ??= await readNamespaceArray(c.session);
return c.namespaceArray;
});
}
Expand Down