mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-12-26 23:16:47 +01:00
more linting
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
module.exports = function (RED) {
|
module.exports = function (RED) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var multilangsentiment = require('multilang-sentiment');
|
var multilangSentiment = require('multilang-sentiment');
|
||||||
|
|
||||||
function MultiLangSentimentNode(n) {
|
function MultiLangSentimentNode(n) {
|
||||||
RED.nodes.createNode(this, n);
|
RED.nodes.createNode(this, n);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
module.exports = function(RED) {
|
module.exports = function(RED) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var util = require("util");
|
|
||||||
//var exec = require('child_process').exec;
|
//var exec = require('child_process').exec;
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
module.exports = function(RED) {
|
module.exports = function(RED) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var util = require("util");
|
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ module.exports = function(RED) {
|
|||||||
// Create a RED node
|
// Create a RED node
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
|
|
||||||
var msg = {};
|
|
||||||
var ble_name;
|
|
||||||
var node = this;
|
var node = this;
|
||||||
|
|
||||||
//get name and uuid from user
|
//get name and uuid from user
|
||||||
@@ -23,7 +21,7 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
noble.on('scanStart', function(msg) {
|
noble.on('scanStart', function(msg) {
|
||||||
msg = {};
|
let msg = {};
|
||||||
msg.topic = node.topic;
|
msg.topic = node.topic;
|
||||||
msg.payload = "Scanning initiated..." //debugging
|
msg.payload = "Scanning initiated..." //debugging
|
||||||
//console.log('scanning initiated...');
|
//console.log('scanning initiated...');
|
||||||
@@ -31,7 +29,7 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
noble.on('discover', function(peripheral) {
|
noble.on('discover', function(peripheral) {
|
||||||
var msg = {};
|
let msg = {};
|
||||||
msg.topic = node.topic;
|
msg.topic = node.topic;
|
||||||
msg.payload = "not found";
|
msg.payload = "not found";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ module.exports = function(RED) {
|
|||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var PNG = require('pngjs').PNG;
|
var PNG = require('pngjs').PNG;
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
var execSync = require('child_process').execSync;
|
|
||||||
|
|
||||||
var hatCommand = __dirname+'/unihat';
|
var hatCommand = __dirname+'/unihat';
|
||||||
var allOK = true;
|
var allOK = true;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ module.exports = function(RED) {
|
|||||||
this.port = n.port;
|
this.port = n.port;
|
||||||
this.name = n.name;
|
this.name = n.name;
|
||||||
this.txt = n.txt;
|
this.txt = n.txt;
|
||||||
if (this.txt && (this.txt !== '')) {
|
if (this?.txt && (this.txt !== '')) {
|
||||||
try { this.txt = JSON.parse('{'+this.txt+'}'); }
|
try { this.txt = JSON.parse('{'+this.txt+'}'); }
|
||||||
catch (e) { delete this.txt; }
|
catch (e) { delete this.txt; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,17 +6,15 @@ module.exports = function(RED) {
|
|||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
// ------------------- State --------------------
|
// ------------------- State --------------------
|
||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
function updateStatus(node, allNodes) {
|
// function updateStatus(node, allNodes) {
|
||||||
let setStatus = setStatusDisconnected;
|
// let setStatus = setStatusDisconnected;
|
||||||
|
// if (node.connecting) {
|
||||||
if (node.connecting) {
|
// setStatus = setStatusConnecting;
|
||||||
setStatus = setStatusConnecting;
|
// } else if (node.connected) {
|
||||||
} else if (node.connected) {
|
// setStatus = setStatusConnected;
|
||||||
setStatus = setStatusConnected;
|
// }
|
||||||
}
|
// setStatus(node, allNodes);
|
||||||
|
// }
|
||||||
setStatus(node, allNodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setStatusDisconnected(node, allNodes) {
|
function setStatusDisconnected(node, allNodes) {
|
||||||
if (allNodes) {
|
if (allNodes) {
|
||||||
@@ -483,9 +481,8 @@ module.exports = function(RED) {
|
|||||||
const topic = node.topic || msg.topic;
|
const topic = node.topic || msg.topic;
|
||||||
if (topic.length > 0) {
|
if (topic.length > 0) {
|
||||||
node.serverConnection.ack(topic, msg.messageId, msg.transaction);
|
node.serverConnection.ack(topic, msg.messageId, msg.transaction);
|
||||||
} else if (!(topic.length > 0)) {
|
} else if (typeof topic !== "string") {
|
||||||
node.warn('No valid publish topic');
|
node.warn('No valid publish topic');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
node.warn('Payload or topic is undefined/null')
|
node.warn('Payload or topic is undefined/null')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
const { domainToUnicode } = require("url");
|
// const { domainToUnicode } = require("url");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* POP3 protocol - RFC1939 - https://www.ietf.org/rfc/rfc1939.txt
|
* POP3 protocol - RFC1939 - https://www.ietf.org/rfc/rfc1939.txt
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ module.exports = function(RED) {
|
|||||||
if (fs.existsSync(msg.icon)) { icon = msg.icon; }
|
if (fs.existsSync(msg.icon)) { icon = msg.icon; }
|
||||||
else { node.error("Bad Icon file: "+msg.icon,msg); }
|
else { node.error("Bad Icon file: "+msg.icon,msg); }
|
||||||
}
|
}
|
||||||
var icon = msg.icon || image;
|
|
||||||
if (typeof(title) !== 'undefined') {
|
if (typeof(title) !== 'undefined') {
|
||||||
notifier.notify({ message:msg.payload, title:title, icon:icon });
|
notifier.notify({ message:msg.payload, title:title, icon:icon });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ module.exports = function(RED) {
|
|||||||
sun.altitude = sun.altitude * 180 / Math.PI;
|
sun.altitude = sun.altitude * 180 / Math.PI;
|
||||||
sun.azimuth = sun.azimuth * 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};
|
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 (oldval == null && !node.sendAtStartup) { oldval = msg.payload; }
|
||||||
if (msg.payload == 1) { node.status({fill:"yellow",shape:"dot",text:"sunrise.dayState"}); }
|
if (msg.payload == 1) { node.status({fill:"yellow",shape:"dot",text:"sunrise.dayState"}); }
|
||||||
else { node.status({fill:"blue",shape:"dot",text:"sunrise.nightState"}); }
|
else { node.status({fill:"blue",shape:"dot",text:"sunrise.nightState"}); }
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ module.exports = function(RED) {
|
|||||||
else {
|
else {
|
||||||
//not enought room above imagebox, put label on the bottom
|
//not enought room above imagebox, put label on the bottom
|
||||||
if (y < 0 + (20+((defaultLineWidth*0.5)+(Number(defaultFontSize))))) {
|
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";
|
ctx.textBaseline = "bottom";
|
||||||
}
|
}
|
||||||
//else put the label on the top
|
//else put the label on the top
|
||||||
|
|||||||
Reference in New Issue
Block a user