refactor: use const instead of let for variable declarations (#4196)

This replaces `let` with `const` for variable declarations where it was
possible. Using `const` [is considered best
practice](https://www.xjavascript.com/blog/in-javascript-why-should-i-usually-prefer-const-to-let/#5-best-practices-const-first-let-second).

I have enabled the corresponding ESLint rule and let the ESLint auto-fix
the "wrong" usages of `let`.
This commit is contained in:
Kristjan ESPERANTO
2026-07-06 22:47:58 +02:00
committed by GitHub
parent 3e223b7fad
commit cdab7a7ea3
127 changed files with 175 additions and 175 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ describe("Deprecated", () => {
it("should contain clock array with deprecated options as strings", () => {
expect(Array.isArray(["deprecated.clock"])).toBe(true);
for (let option of deprecated.configs) {
for (const option of deprecated.configs) {
expect(typeof option).toBe("string");
}
expect(deprecated.clock).toEqual(expect.arrayContaining(["secondsColor"]));
@@ -135,11 +135,11 @@ END:VEVENT`);
const januaryFirst = filteredEvents.filter((event) => moment(event.startDate, "x").format("MM-DD") === "01-01");
const julyFirst = filteredEvents.filter((event) => moment(event.startDate, "x").format("MM-DD") === "07-01");
let januaryMoment = moment(`${moment(januaryFirst[0].startDate, "x").format("YYYY")}-01-01T09:00:00`)
const januaryMoment = moment(`${moment(januaryFirst[0].startDate, "x").format("YYYY")}-01-01T09:00:00`)
.tz("Europe/Amsterdam", true) // Convert to Europe/Amsterdam timezone (see event ical) but keep 9 o'clock
.tz(moment.tz.guess()); // Convert to guessed timezone as that is used in the filterEvents
let julyMoment = moment(`${moment(julyFirst[0].startDate, "x").format("YYYY")}-07-01T09:00:00`)
const julyMoment = moment(`${moment(julyFirst[0].startDate, "x").format("YYYY")}-07-01T09:00:00`)
.tz("Europe/Amsterdam", true) // Convert to Europe/Amsterdam timezone (see event ical) but keep 9 o'clock
.tz(moment.tz.guess()); // Convert to guessed timezone as that is used in the filterEvents
@@ -29,13 +29,13 @@ describe("WeatherObject", () => {
it("should return sunrise as the next sunaction", () => {
weatherobject.updateSunTime(-6.774877582342688, 37.63345667023327);
let midnight = moment("00:00", "HH:mm");
const midnight = moment("00:00", "HH:mm");
expect(weatherobject.nextSunAction(midnight)).toBe("sunrise");
});
it("should return sunset as the next sunaction", () => {
weatherobject.updateSunTime(-6.774877582342688, 37.63345667023327);
let noon = moment(weatherobject.sunrise).hour(14);
const noon = moment(weatherobject.sunrise).hour(14);
expect(weatherobject.nextSunAction(noon)).toBe("sunset");
});