background: Add exception to no-loop-func rule

Modifying variables from an outer scope in functions created in a loop
is considered problematic by eslint, because the variable value in the
resulting closure is often not what the coder intended.

In this particular case however, the scoping is correct, so add a comment
to disable the rule locally.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/818
This commit is contained in:
Florian Müllner 2019-09-15 02:51:40 +02:00 committed by Georges Basile Stavracas Neto
parent a32c4f30d1
commit 66fc5c07bb

View File

@ -403,6 +403,7 @@ var Background = GObject.registerClass({
if (numPendingImages == 0)
finish();
} else {
// eslint-disable-next-line no-loop-func
let id = image.connect('loaded', () => {
image.disconnect(id);
numPendingImages--;