Enable the no-lonely-if ESLint rule

These changes were mostly done automatically, using `gulp lint --fix`, and only a few spots with comments needed manual tweaking; please see https://eslint.org/docs/latest/rules/no-lonely-if
This commit is contained in:
Jonas Jenwald 2023-07-20 10:57:30 +02:00
parent abb24f82fb
commit c018070e80
15 changed files with 108 additions and 147 deletions

View file

@ -127,12 +127,10 @@ class Field extends PDFObject {
indices.forEach(i => {
this._value.push(this._items[i].displayValue);
});
} else {
if (indices.length > 0) {
indices = indices.splice(1, indices.length - 1);
this._currentValueIndices = indices[0];
this._value = this._items[this._currentValueIndices];
}
} else if (indices.length > 0) {
indices = indices.splice(1, indices.length - 1);
this._currentValueIndices = indices[0];
this._value = this._items[this._currentValueIndices];
}
this._send({ id: this._id, indices });
}
@ -389,12 +387,10 @@ class Field extends PDFObject {
--this._currentValueIndices[index];
}
}
} else {
if (this._currentValueIndices === nIdx) {
this._currentValueIndices = this.numItems > 0 ? 0 : -1;
} else if (this._currentValueIndices > nIdx) {
--this._currentValueIndices;
}
} else if (this._currentValueIndices === nIdx) {
this._currentValueIndices = this.numItems > 0 ? 0 : -1;
} else if (this._currentValueIndices > nIdx) {
--this._currentValueIndices;
}
this._send({ id: this._id, remove: nIdx });