more linting

This commit is contained in:
Dave Conway-Jones
2025-08-26 17:34:29 +01:00
parent ffc14d0439
commit 900917b9d7
11 changed files with 17 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
module.exports = function (RED) {
"use strict";
var multilangsentiment = require('multilang-sentiment');
var multilangSentiment = require('multilang-sentiment');
function MultiLangSentimentNode(n) {
RED.nodes.createNode(this, n);

View File

@@ -1,7 +1,6 @@
module.exports = function(RED) {
"use strict";
var util = require("util");
//var exec = require('child_process').exec;
var spawn = require('child_process').spawn;
var fs = require('fs');

View File

@@ -1,7 +1,6 @@
module.exports = function(RED) {
"use strict";
var util = require("util");
var spawn = require('child_process').spawn;
var fs = require('fs');

View File

@@ -10,8 +10,6 @@ module.exports = function(RED) {
// Create a RED node
RED.nodes.createNode(this,n);
var msg = {};
var ble_name;
var node = this;
//get name and uuid from user
@@ -23,7 +21,7 @@ module.exports = function(RED) {
});
noble.on('scanStart', function(msg) {
msg = {};
let msg = {};
msg.topic = node.topic;
msg.payload = "Scanning initiated..." //debugging
//console.log('scanning initiated...');
@@ -31,7 +29,7 @@ module.exports = function(RED) {
});
noble.on('discover', function(peripheral) {
var msg = {};
let msg = {};
msg.topic = node.topic;
msg.payload = "not found";

View File

@@ -4,7 +4,6 @@ module.exports = function(RED) {
var fs = require('fs');
var PNG = require('pngjs').PNG;
var spawn = require('child_process').spawn;
var execSync = require('child_process').execSync;
var hatCommand = __dirname+'/unihat';
var allOK = true;

View File

@@ -58,7 +58,7 @@ module.exports = function(RED) {
this.port = n.port;
this.name = n.name;
this.txt = n.txt;
if (this.txt && (this.txt !== '')) {
if (this?.txt && (this.txt !== '')) {
try { this.txt = JSON.parse('{'+this.txt+'}'); }
catch (e) { delete this.txt; }
}

View File

@@ -6,17 +6,15 @@ module.exports = function(RED) {
// ----------------------------------------------
// ------------------- State --------------------
// ----------------------------------------------
function updateStatus(node, allNodes) {
let setStatus = setStatusDisconnected;
if (node.connecting) {
setStatus = setStatusConnecting;
} else if (node.connected) {
setStatus = setStatusConnected;
}
setStatus(node, allNodes);
}
// function updateStatus(node, allNodes) {
// let setStatus = setStatusDisconnected;
// if (node.connecting) {
// setStatus = setStatusConnecting;
// } else if (node.connected) {
// setStatus = setStatusConnected;
// }
// setStatus(node, allNodes);
// }
function setStatusDisconnected(node, allNodes) {
if (allNodes) {
@@ -483,9 +481,8 @@ module.exports = function(RED) {
const topic = node.topic || msg.topic;
if (topic.length > 0) {
node.serverConnection.ack(topic, msg.messageId, msg.transaction);
} else if (!(topic.length > 0)) {
} else if (typeof topic !== "string") {
node.warn('No valid publish topic');
} else {
node.warn('Payload or topic is undefined/null')
}

View File

@@ -1,6 +1,6 @@
/* eslint-disable indent */
const { domainToUnicode } = require("url");
// const { domainToUnicode } = require("url");
/**
* POP3 protocol - RFC1939 - https://www.ietf.org/rfc/rfc1939.txt

View File

@@ -21,7 +21,6 @@ module.exports = function(RED) {
if (fs.existsSync(msg.icon)) { icon = msg.icon; }
else { node.error("Bad Icon file: "+msg.icon,msg); }
}
var icon = msg.icon || image;
if (typeof(title) !== 'undefined') {
notifier.notify({ message:msg.payload, title:title, icon:icon });
}

View File

@@ -48,7 +48,7 @@ module.exports = function(RED) {
sun.altitude = sun.altitude * 180 / Math.PI;
sun.azimuth = sun.azimuth * 180 / Math.PI;
var msg = {payload:0, topic:"sun", sun:sun, moon:moon, start:s1, end:s2, now:now};
if ((e1 > 0) & (e2 < 0)) { msg.payload = 1; }
if ((e1 > 0) && (e2 < 0)) { msg.payload = 1; }
if (oldval == null && !node.sendAtStartup) { oldval = msg.payload; }
if (msg.payload == 1) { node.status({fill:"yellow",shape:"dot",text:"sunrise.dayState"}); }
else { node.status({fill:"blue",shape:"dot",text:"sunrise.nightState"}); }

View File

@@ -102,7 +102,7 @@ module.exports = function(RED) {
else {
//not enought room above imagebox, put label on the bottom
if (y < 0 + (20+((defaultLineWidth*0.5)+(Number(defaultFontSize))))) {
y = y + (10+h+(((defaultLineWidth*0.5)+(Number(defaultFontSize)))));
y = y + (10+h+((defaultLineWidth*0.5)+(Number(defaultFontSize))));
ctx.textBaseline = "bottom";
}
//else put the label on the top