Skip to content

Commit

Permalink
tidy up semi-colons
Browse files Browse the repository at this point in the history
  • Loading branch information
arachnetech committed Apr 21, 2022
1 parent 60cc907 commit 0fc5028
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module.exports = {
"key-spacing": "error",
"keyword-spacing": "off",
"line-comment-position": "off",
"linebreak-style": "off",
"lines-around-comment": "off",
"lines-around-directive": "error",
"lines-between-class-members": "error",
Expand Down Expand Up @@ -150,7 +151,7 @@ module.exports = {
"allowForLoopAfterthoughts": true
}
],*/
"no-process-env": "error",
"no-process-env": "off",
"no-process-exit": "error",
"no-proto": "error",
"no-prototype-builtins": "off",
Expand Down Expand Up @@ -219,7 +220,7 @@ module.exports = {
"require-await": "error",
"require-jsdoc": "off",
"rest-spread-spacing": "error",
"semi": "off",
"semi": "error",
"semi-spacing": [
"error",
{
Expand Down
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function makeThing( log, accessoryConfig, api ) {
throttledCallTimers[ identifier ] = null;
func();
}, timeout );
}
};

// Controllers
let controllers = [];
Expand Down Expand Up @@ -1784,7 +1784,7 @@ function makeThing( log, accessoryConfig, api ) {
// load TimesOpened counter from counterFile
fs.readFile( counterFile, 'utf8', function( err, data ) {
let cnt = 0;
let res = Math.floor( Date.now() / 1000 ) - 978307200 // seconds since 01.01.2001
let res = Math.floor( Date.now() / 1000 ) - 978307200; // seconds since 01.01.2001
if( err ) {
log.debug( 'No data loaded for TimesOpened' );
} else {
Expand Down Expand Up @@ -2062,7 +2062,7 @@ function makeThing( log, accessoryConfig, api ) {

// Characteristic.WaterLevel
function characteristic_WaterLevel( service ) {
let options = { minValue: 0, maxValue: 100 }
let options = { minValue: 0, maxValue: 100 };
integerCharacteristic( service, 'waterLevel', Characteristic.WaterLevel, config.topics.setWaterLevel, config.topics.getWaterLevel, options);
}

Expand Down Expand Up @@ -2379,7 +2379,7 @@ function makeThing( log, accessoryConfig, api ) {
// load TotalConsumption counter from counterFile
fs.readFile( counterFile, 'utf8', function( err, data ) {
let cnt = 0;
let res = Math.floor( Date.now() / 1000 ) - 978307200 // seconds since 01.01.2001
let res = Math.floor( Date.now() / 1000 ) - 978307200; // seconds since 01.01.2001
if( err ) {
log.debug( 'No data loaded for totalConsumption' );
} else {
Expand Down Expand Up @@ -2983,7 +2983,7 @@ function makeThing( log, accessoryConfig, api ) {
if( Array.isArray( config.topics.getSwitch ) ) {
service = new Service.ServiceLabel( name );
characteristic_ServiceLabelNamespace( service );
services = [ service ]
services = [ service ];
var i = 0;
for( i = 0; i < config.topics.getSwitch.length; i++ ) {
let buttonTopic = config.topics.getSwitch[ i ];
Expand Down Expand Up @@ -3012,7 +3012,7 @@ function makeThing( log, accessoryConfig, api ) {
let buttonSvc = new Service.StatelessProgrammableSwitch( name + "_" + i, i + 1 );
characteristic_ProgrammableSwitchEvent( buttonSvc, 'switch' + i, buttonTopic, switchValues, restrictSwitchValues );
characteristic_ServiceLabelIndex( buttonSvc, i + 1 );
services.push( buttonSvc )
services.push( buttonSvc );
}
} else {
service = new Service.StatelessProgrammableSwitch( name, subtype );
Expand Down Expand Up @@ -3321,7 +3321,7 @@ function makeThing( log, accessoryConfig, api ) {
if( config.zones ) {
let serviceLabel = new Service.ServiceLabel();
serviceLabel.setCharacteristic( Characteristic.ServiceLabelNamespace, Characteristic.ServiceLabelNamespace.ARABIC_NUMERALS );
services.push( serviceLabel )
services.push( serviceLabel );
config.zones.forEach( function( zone, index ) {
let zoneId = index + 1;
let zoneName = zone.name || ''; // default name doesn't seem to work
Expand Down Expand Up @@ -3485,4 +3485,4 @@ module.exports = function( homebridge ) {
homebridgePath = homebridge.user.storagePath();

homebridge.registerAccessory( "homebridge-mqttthing", "mqttthing", makeThing );
}
};
12 changes: 6 additions & 6 deletions libs/mqttlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ var mqttlib = new function() {
debounceTimeout = setTimeout( function() {
origHandler( intopic, message );
}, config.debounceRecvms );
}
};
}

let extendedTopic = null
let extendedTopic = null;
// send through any apply function
if (typeof topic != 'string') {
extendedTopic = topic;
Expand Down Expand Up @@ -312,7 +312,7 @@ var mqttlib = new function() {
log( `jsonpath ${jsonpathQuery} decoded message to [${output}]` );
}
return lastHandler( topic, output );
}
};
}

// register MQTT dispatch and subscribe
Expand All @@ -328,7 +328,7 @@ var mqttlib = new function() {

// Publish
this.publish = function( ctx, topic, property, message ) {
let { config, log, mqttClient, codec } = ctx;
let { log, mqttClient, codec } = ctx;
if( ! mqttClient ) {
log( 'ERROR: Call mqttlib.init() before mqttlib.publish()' );
return;
Expand All @@ -338,7 +338,7 @@ var mqttlib = new function() {
return; // don't publish if message is null or topic is undefined
}

let extendedTopic = null
let extendedTopic = null;
// first of all, pass message through any user-supplied apply() function
if (typeof topic != 'string') {
// encode data with user-supplied apply() function
Expand Down Expand Up @@ -386,7 +386,7 @@ var mqttlib = new function() {
// no confirmation - return generic publishing function
return function( message ) {
mqttlib.publish( ctx, setTopic, property, message );
}
};
}

var timer = null;
Expand Down

0 comments on commit 0fc5028

Please sign in to comment.