Skip to content

Commit

Permalink
fixed: other eslint / prettier errors and warnings
Browse files Browse the repository at this point in the history
and made config not run into endless loop of adding and removing types... *sigh*
  • Loading branch information
Garfonso committed Feb 6, 2025
1 parent fab337b commit 6579c0a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default [
// as this improves maintainability. jsdoc warnings will not block buiuld process.
rules: {
// 'jsdoc/require-jsdoc': 'off',
'jsdoc/no-types': 'off',
},
},

Expand Down
11 changes: 10 additions & 1 deletion lib/gpioControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ function getRaspberryModelFromCpuInfo(cpuinfo) {
return Number(model);
}

/**
* Class to control GPIO ports.
*/
class GpioControl {
/**
* Constructor
*
* @param adapter {ioBroker.Adapter}
* @param log {ioBroker.Logger}
*/
constructor(adapter, log) {
this.adapter = adapter;
this.gpioChip = null;
Expand Down Expand Up @@ -278,7 +287,7 @@ class GpioControl {
/**
* Cleanup on unload.
*
* @returns
* @returns Promise<void>
*/
async unload() {
// Cancel any debounceTimers
Expand Down
19 changes: 10 additions & 9 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const intervalTimers = [];

class Rpi2 extends utils.Adapter {
/**
* @param [options]
* @param [options] {object} Adapter options
*/
constructor(options) {
super({
Expand Down Expand Up @@ -122,7 +122,7 @@ class Rpi2 extends utils.Adapter {
* Create ioBroker Objects for gpio port.
*
* @param data {object} from config.
* @returns
* @returns {Promise<void>}
*/
async syncPort(data) {
data.isGpio =
Expand Down Expand Up @@ -170,7 +170,7 @@ class Rpi2 extends utils.Adapter {
* Create/Delect Object for GPIO button
*
* @param data {object} from config
* @returns
* @returns {Promise<void>}
*/
async syncPortButton(data) {
const buttonEventsOLD = ['pressed', 'clicked', 'clicked_pressed', 'double_clicked', 'released'];
Expand Down Expand Up @@ -204,7 +204,7 @@ class Rpi2 extends utils.Adapter {
* Create/Delete ioBroker Objects for gpio temperature and humidity.
*
* @param data {object} from config
* @returns
* @returns {Promise<void>}
*/
async syncPortTempHum(data) {
if (data.isTempHum) {
Expand Down Expand Up @@ -242,10 +242,10 @@ class Rpi2 extends utils.Adapter {
}

/**
* Create ioBroker Objects for gpio button.
* Create ioBroker Objects for a gpio button.
*
* @param data
* @returns
* @param data {object} from config
* @returns {Promise<void>}
*/
async syncPortDirection(data) {
const stateName = `gpio.${data.gpio}.isInput`;
Expand Down Expand Up @@ -285,6 +285,7 @@ class Rpi2 extends utils.Adapter {
await this.gpioControl.unload();
callback();
} catch (e) {
this.log.warn(`Error on unload: ${e}`);
callback();
}
}
Expand All @@ -293,7 +294,7 @@ class Rpi2 extends utils.Adapter {
if (require.main !== module) {
// Export the constructor in compact mode
/**
* @param [options]
* @param [options] {object} Adapter options
*/
module.exports = options => new Rpi2(options);
} else {
Expand Down Expand Up @@ -480,7 +481,7 @@ async function parser(adapter) {
try {
value = eval(post.replace('$1', value));
} catch (e) {
adapter.log.error(`Cannot evaluate: ${post.replace('$1', value)}`);
adapter.log.error(`Cannot evaluate: ${post.replace('$1', value)}: ${e}`);
value = NaN;
}
}
Expand Down

0 comments on commit 6579c0a

Please sign in to comment.