Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix linter errors #2202

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .eslintrc.json

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ You can thank the authors by these links:
* to Arthur Rupp https://paypal.me/ArthurRupp

-----------------------------------------------------------------------------------------------------
## Changelog

### UNRELEASED
* (lebrinkma) fix linter errors

### 1.10.9 (2024-09-05)
* (arteck) typo admin settings
* (arteck) eslint config
Expand Down
35 changes: 17 additions & 18 deletions admin/adapter-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const parts = path.split('/');
parts.splice(-3);

const socket = io.connect('/', { path: parts.join('/') + '/socket.io' });
var query = (window.location.search || '').replace(/^\?/, '').replace(/#.*$/, '');
var args = {};
const query = (window.location.search || '').replace(/^\?/, '').replace(/#.*$/, '');
const args = {};
let theme = null;

// parse parameters
Expand All @@ -14,7 +14,7 @@ query.trim().split('&').filter(function (t) { return t.trim(); }).forEach(functi
if (!i && parts.length === 1 && !isNaN(parseInt(b, 10))) {
args.instance = parseInt(b, 10);
}
var name = parts[0];
const name = parts[0];
args[name] = parts.length === 2 ? parts[1] : true;

if (name === 'instance') {
Expand All @@ -28,7 +28,7 @@ query.trim().split('&').filter(function (t) { return t.trim(); }).forEach(functi
}
});

var instance = args.instance;
const instance = args.instance;

let common = null; // common information of adapter
const host = null; // host object on which the adapter runs
Expand Down Expand Up @@ -96,23 +96,23 @@ function loadSettings(callback) {
if (typeof load === 'undefined') {
alert('Please implement save function in your admin/index.html');
} else {
const _query = query.split('&');
for (var q = 0; q < _query.length; q++) {
if (_query[q].indexOf('react=') !== -1) {
$('.adapter-container').addClass('react-' + _query[q].substring(6));
theme = 'react-' + _query[q].substring(6);
const _query = query.split('&');
for (let q = 0; q < _query.length; q++) {
if (_query[q].indexOf('react=') !== -1) {
$('.adapter-container').addClass('react-' + _query[q].substring(6));
theme = 'react-' + _query[q].substring(6);
}
}
}
load(res.native, onChange);
load(res.native, onChange);
}
if (typeof callback === 'function') {
callback();
}
} else {
if (typeof callback === 'function') {
callback();
}
alert('error loading settings for ' + _adapterInstance + '\n\n' + err);
if (typeof callback === 'function') {
callback();
}
alert('error loading settings for ' + _adapterInstance + '\n\n' + err);
}
});
}
Expand Down Expand Up @@ -152,7 +152,7 @@ function prepareTooltips() {
link = 'https://github.com/ioBroker/ioBroker.' + common.name + '#' + id;
}
}
if (!link.match('^https?:\/\/')) {
if (!link.match('^https?:\/\/')) { //eslint-disable-line no-useless-escape
if (common.readme) {
link = common.readme + '#' + link;
} else {
Expand Down Expand Up @@ -207,9 +207,8 @@ function onChange(isChanged) {
}

function showMessage(message, title, icon) {
var $dialogMessage;
// noinspection JSJQueryEfficiency
$dialogMessage = $('#dialog-message');
let $dialogMessage = $('#dialog-message');
if (!$dialogMessage.length) {
$('body').append(
'<div class="m"><div id="dialog-message" class="modal modal-fixed-footer">' +
Expand Down
40 changes: 20 additions & 20 deletions admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let devices = [],
networkEvents,
responseCodes = false,
groups = {},
devGroups = {},
devGroups = {}, // eslint-disable-line prefer-const
binding = [],
excludes = [],
coordinatorinfo = {
Expand Down Expand Up @@ -396,7 +396,7 @@ function editName(id, name) {
if (d.hasOwnProperty('memberinfo')) {
for (const member of d.memberinfo) {
const epid = EndPointIDfromEndPoint(member.ep);
for (var i = 0; i < groupables.length; i++) {
for (let i = 0; i < groupables.length; i++) {
if (groupables[i].epid == epid) {
groupables[i].memberOf.push(d.native.id.replace('group_', ''));
}
Expand All @@ -406,7 +406,7 @@ function editName(id, name) {
}
}
console.log('groupables: ' + JSON.stringify(groupables));
for (var i = 0; i < groupables.length; i++) {
for (let i = 0; i < groupables.length; i++) {
if (i > 1) {
$('#modaledit').find('translate.device_with_endpoint').innerHtml = name + ' ' + groupables[i].epid;
}
Expand All @@ -419,10 +419,10 @@ function editName(id, name) {
const newName = $('#modaledit').find('input[id=\'d_name\']').val();
const groupsbyid = {};
if (groupables.length > 0) {
for (var i = 0; i < groupables.length; i++) {
for (let i = 0; i < groupables.length; i++) {
const ng = $('#d_groups_ep' + i).val();
if (ng.toString() != groupables[i].memberOf.toString())
groupsbyid[groupables[i].ep.ID] = GenerateGroupChange(groupables[i].memberOf, ng);
groupsbyid[groupables[i].ep.ID] = GenerateGroupChange(groupables[i].memberOf, ng);
}
}
console.log('grpid ' + JSON.stringify(groupsbyid));
Expand All @@ -433,7 +433,7 @@ function editName(id, name) {
}

function GenerateGroupChange(oldmembers, newmembers) {
let grpchng = [];
const grpchng = [];
for (const oldg of oldmembers)
if (!newmembers.includes(oldg)) grpchng.push('-' + oldg);
for (const newg of newmembers)
Expand Down Expand Up @@ -529,7 +529,7 @@ function showDevices() {
} else {
//if (d.groups && d.info && d.info.device._type == "Router") {
if (d.groups) {
// devGroups[d._id] = d.groups;
//devGroups[d._id] = d.groups;
if (typeof d.groups.map == 'function') {
d.groupNames = d.groups.map(item => {
return groups[item] || '';
Expand Down Expand Up @@ -557,10 +557,10 @@ function showDevices() {
roomSelector.empty();
roomSelector.append(`<li class="device-order-item" data-type="All" tabindex="0"><a class="translate" data-lang="All">All</a></li>`);
Array.from(allRooms)
.sort()
.forEach((item) => {
roomSelector.append(`<li class="device-order-item" data-type="${item}" tabindex="0"><a class="translate" data-lang="${item}">${item}</a></li>`);
});
.sort()
.forEach((item) => {
roomSelector.append(`<li class="device-order-item" data-type="${item}" tabindex="0"><a class="translate" data-lang="${item}">${item}</a></li>`);
});
$('#room-filter a').click(function () {
$('#room-filter-btn').text($(this).text());
doFilter();
Expand Down Expand Up @@ -692,7 +692,7 @@ function letsPairingWithCode(code) {
showMessage(msg.error, _('Error'));
}
else {
showPairingProcess();
showPairingProcess();
}
});
}
Expand Down Expand Up @@ -887,13 +887,13 @@ function load(settings, onChange) {
});

$('#code_pairing').click(function () {
if (!$('#pairing').hasClass('pulse')) {
$('#codeentry a.btn[name=\'pair\']').click(() => {
const code = $('#codeentry').find('input[id=\'qr_code\']').val();
letsPairingWithCode(code)
});
$('#codeentry').modal('open');
}
if (!$('#pairing').hasClass('pulse')) {
$('#codeentry a.btn[name=\'pair\']').click(() => {
const code = $('#codeentry').find('input[id=\'qr_code\']').val();
letsPairingWithCode(code)
});
$('#codeentry').modal('open');
}
});

$(document).ready(function () {
Expand Down Expand Up @@ -2794,7 +2794,7 @@ function doFilter(inputText) {
break;
default: valid = true;
}
}
}
return valid;
});
} else {
Expand Down
7 changes: 5 additions & 2 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const compat = new FlatCompat({

module.exports = [
{
ignores: ['.dev-server/**'],
ignores: [
'.dev-server/**',
'admin/*.min.js',
'admin/words.js'
],
},
...compat.extends('eslint:recommended', 'plugin:prettier/recommended'),
{
Expand All @@ -38,7 +42,6 @@ module.exports = [
'no-fallthrough': 'off',
'no-console': 'off',
'no-prototype-builtins': 'off',
'no-useless-escape': 'off',
'no-undef': 'warn',
'no-empty': 'warn',
'no-var': 'warn',
Expand Down
1 change: 0 additions & 1 deletion lib/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ class Backup {
}
}

// eslint-disable-next-line no-unused-vars
delBackupsFiles(options, files) {
const arr = files.length;
if (arr > 10) {
Expand Down