Skip to content

Commit 8e1630e

Browse files
refactor: enable ESLint rule "no-unused-vars" and handle related issues (#4080)
In PR #4072 GitHub Bot complained about an unused var. Instead of just removing that one, I checked why ESLint hadn't complained about it: We had disabled the rule for it. So I enabled rule and resolved the issues that ESLint then detected. Related to #4073
1 parent 32aa5c8 commit 8e1630e

File tree

28 files changed

+38
-37
lines changed

28 files changed

+38
-37
lines changed

defaultmodules/calendar/calendar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Module.register("calendar", {
167167
this.selfUpdate();
168168
},
169169

170-
notificationReceived (notification, payload, sender) {
170+
notificationReceived (notification, payload) {
171171
if (notification === "FETCH_CALENDAR") {
172172
this.sendSocketNotification(notification, { url: payload.url, id: this.identifier });
173173
}

defaultmodules/calendar/calendarfetcher.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const ical = require("node-ical");
22
const Log = require("logger");
3-
const { Agent } = require("undici");
43
const CalendarFetcherUtils = require("./calendarfetcherutils");
54
const HTTPFetcher = require("#http_fetcher");
65

defaultmodules/calendar/calendarfetcherutils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const CalendarFetcherUtils = {
6262
// Subtract 1 second so that events that start on the middle of the night will not repeat.
6363
.subtract(1, "seconds");
6464

65-
Object.entries(data).forEach(([key, event]) => {
65+
Object.values(data).forEach((event) => {
6666
if (event.type !== "VEVENT") {
6767
return;
6868
}

defaultmodules/compliments/compliments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ Module.register("compliments", {
308308
},
309309

310310
// Override notification handler.
311-
notificationReceived (notification, payload, sender) {
311+
notificationReceived (notification, payload) {
312312
if (notification === "CURRENTWEATHER_TYPE") {
313313
this.currentWeatherType = payload.type;
314314
}

defaultmodules/newsfeed/newsfeed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ Module.register("newsfeed", {
411411
}
412412
},
413413

414-
notificationReceived (notification, payload, sender) {
414+
notificationReceived (notification) {
415415
const before = this.activeItem;
416416
if (notification === "MODULE_DOM_CREATED" && this.config.hideLoading) {
417417
this.hide();

defaultmodules/updatenotification/git_helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class GitHelper {
5151
// Folder has .git and has at least one git remote, watch this folder
5252
this.gitRepos.push({ module: moduleName, folder: moduleFolder });
5353
}
54-
} catch (err) {
54+
} catch {
5555
// Error when directory .git doesn't exist or doesn't have any remotes
5656
// This module is not managed with git, skip
5757
}

defaultmodules/updatenotification/update_helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class Updater {
113113
Log.info(`Updating ${module.name}...`);
114114

115115
return new Promise((resolve) => {
116-
Exec(Command, { cwd: modulePath, timeout: this.timeout }, (error, stdout, stderr) => {
116+
Exec(Command, { cwd: modulePath, timeout: this.timeout }, (error, stdout) => {
117117
if (error) {
118118
Log.error(`exec error: ${error}`);
119119
Result.error = true;
@@ -143,7 +143,7 @@ class Updater {
143143
pm2Restart () {
144144
Log.info("[PM2] restarting MagicMirror...");
145145
const pm2 = require("pm2");
146-
pm2.restart(this.PM2Id, (err, proc) => {
146+
pm2.restart(this.PM2Id, (err) => {
147147
if (err) {
148148
Log.error("[PM2] restart Error", err);
149149
}

defaultmodules/weather/providers/yr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ class YrProvider {
314314

315315
// Convert collected data to forecast objects
316316
const days = [];
317-
for (const [dateStr, data] of dailyData) {
317+
for (const data of dailyData.values()) {
318318
const stellarInfo = this.#getStellarInfoForDate(data.date);
319319

320320
const dayData = {

defaultmodules/weather/weather.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global WeatherProvider, WeatherUtils, WeatherObject, formatTime */
1+
/* global WeatherUtils, WeatherObject, formatTime */
22

33
Module.register("weather", {
44
// Default module config.

eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export default defineConfig([
6868
"no-throw-literal": "error",
6969
"no-undefined": "off",
7070
"no-unneeded-ternary": "error",
71-
"no-unused-vars": "off",
7271
"no-useless-return": "error",
7372
"no-warning-comments": "off",
7473
"object-shorthand": ["error", "methods"],

0 commit comments

Comments
 (0)