Skip to content

Commit a3e5389

Browse files
committed
fix eslint
1 parent da09f16 commit a3e5389

File tree

7 files changed

+99
-56
lines changed

7 files changed

+99
-56
lines changed

.eslintrc.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

admin/words.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/*global systemDictionary:true */
2-
'use strict';
31

2+
// /*global systemDictionary:true */
3+
'use strict';
4+
//eslint-disable-next-line
45
systemDictionary = {
56
'viessmannapi adapter settings': {
67
en: 'Adapter settings for viessmannapi',

eslint.config.cjs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
const {
2+
defineConfig,
3+
} = require('eslint/config');
4+
5+
const globals = require('globals');
6+
const js = require('@eslint/js');
7+
8+
const {
9+
FlatCompat,
10+
} = require('@eslint/eslintrc');
11+
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all
16+
});
17+
18+
module.exports = defineConfig([{
19+
extends: compat.extends('eslint:recommended'),
20+
plugins: {},
21+
22+
languageOptions: {
23+
globals: {
24+
...globals.node,
25+
...globals.mocha,
26+
},
27+
28+
ecmaVersion: 2020,
29+
sourceType: 'commonjs',
30+
},
31+
32+
rules: {
33+
indent: ['error', 2, {
34+
SwitchCase: 1,
35+
}],
36+
37+
'no-console': 'off',
38+
39+
'no-unused-vars': ['error', {
40+
ignoreRestSiblings: true,
41+
argsIgnorePattern: '^_',
42+
}],
43+
44+
'no-var': 'error',
45+
'no-trailing-spaces': 'error',
46+
'prefer-const': 'error',
47+
48+
quotes: ['error', 'single', {
49+
avoidEscape: true,
50+
allowTemplateLiterals: true,
51+
}],
52+
53+
semi: ['error', 'always'],
54+
},
55+
}]);

lib/extractKeys.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ async function extractKeys(adapter, path, element, preferedArrayName, forceIndex
126126
if (Object.keys(element.params).length > 1) {
127127
common.param = [];
128128
common.type = 'object';
129-
for (let param of Object.keys(element.params)) {
130-
let curparam = {
129+
for (const param of Object.keys(element.params)) {
130+
const curparam = {
131131
param: param,
132132
type: 'mixed',
133133
};
@@ -153,7 +153,7 @@ async function extractKeys(adapter, path, element, preferedArrayName, forceIndex
153153
common.param.push(curparam);
154154
}
155155
} else {
156-
param = Object.keys(element.params)[0];
156+
const param = Object.keys(element.params)[0];
157157
common.param = param;
158158
if (element.params[param] && element.params[param].type === 'number') {
159159
common.type = 'number';
@@ -291,6 +291,7 @@ function extractArray(adapter, element, key, path, write, preferedArrayName, for
291291
function isJsonString(str) {
292292
try {
293293
JSON.parse(str);
294+
// eslint-disable-next-line
294295
} catch (e) {
295296
return false;
296297
}

main.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Viessmannapi extends utils.Adapter {
3333
statusCodesToRetry: [[500, 599]],
3434
httpMethodsToRetry: ['POST'],
3535
};
36-
const interceptorId = rax.attach(this.requestClient);
36+
// const interceptorId = rax.attach(this.requestClient);
3737
this.updateInterval = null;
3838
this.eventInterval = null;
3939
this.reLoginTimeout = null;
@@ -392,7 +392,7 @@ class Viessmannapi extends utils.Adapter {
392392
return;
393393
}
394394
// Note: The events endpoint /iot/v2/events-history/... was already V2 in the original code. No change needed here.
395-
const gatewaySerial = installation['gateways'][currentGatewayIndex - 1].serial.toString();
395+
// const gatewaySerial = installation['gateways'][currentGatewayIndex - 1].serial.toString();
396396
await this.requestClient({
397397
method: 'get',
398398
url: 'https://api.viessmann.com/iot/v2/events-history/installations/' + installationId + '/events',
@@ -497,6 +497,7 @@ class Viessmannapi extends utils.Adapter {
497497
clearInterval(this.refreshTokenInterval);
498498
callback();
499499
} catch (e) {
500+
this.log.error('Error: ' + e);
500501
callback();
501502
}
502503
}
@@ -513,7 +514,7 @@ class Viessmannapi extends utils.Adapter {
513514
this.log.info('please use setValue Object to set values');
514515
return;
515516
}
516-
const deviceId = id.split('.')[2];
517+
// const deviceId = id.split('.')[2];
517518
const parentPath = id.split('.').slice(1, -1).slice(1).join('.');
518519

519520
const uriState = await this.getStateAsync(parentPath + '.uri');

package-lock.json

Lines changed: 30 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@
2727
"@alcalzone/release-script-plugin-iobroker": "^3.7.2",
2828
"@alcalzone/release-script-plugin-license": "^3.7.0",
2929
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
30+
"@eslint/eslintrc": "^3.3.1",
31+
"@eslint/js": "^9.23.0",
3032
"@iobroker/testing": "^5.0.4",
3133
"@types/node": "^22.13.14",
3234
"axios": "^1.8.4",
3335
"eslint": "^9.23.0",
36+
"globals": "^16.0.0",
3437
"typescript": "^5.8.2"
3538
},
3639
"main": "main.js",

0 commit comments

Comments
 (0)