From 5f1f5bd291209246f2351d9597481b4aa761d513 Mon Sep 17 00:00:00 2001 From: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Date: Mon, 13 Oct 2025 23:40:23 +0200 Subject: [PATCH] feat: add ESlint rule `no-sparse-arrays` for config check (#3911) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding a rule to the config checker config so that unexpected commas in the middle of arrays (reported in issue #3910) are better detected. Two commas in a row inside the modules array create an empty entry (`undefined`). JavaScript accepts that syntax, but MagicMirror would later try to load that “module” and fail. Alternatively, we could filter out undefined entries, but with this PR, the user receives a clear message indicating where the error lies, can easily fix it, and thus has a cleaner configuration. ## Before ``` [2025-10-10 19:33:30.874] [INFO] Checking config file /home/kristjan/MagicMirror/config/config.js ... [2025-10-10 19:33:30.944] [INFO] Your configuration file doesn't contain syntax errors :) [2025-10-10 19:33:30.945] [INFO] Checking modules structure configuration ... [2025-10-10 19:33:31.027] [ERROR] This module configuration contains errors: undefinedmust be object ``` ## After ``` [2025-10-10 19:41:20.030] [INFO] Checking config file /home/kristjan/MagicMirror/config/config.js ... [2025-10-10 19:41:20.107] [ERROR] Your configuration file contains syntax errors :( Line 91 column 1: Unexpected comma in middle of array. ``` --- CHANGELOG.md | 2 ++ js/check_config.js | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 797cb57a..404fdc98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ planned for 2026-01-01 ### Fixed +- feat: add ESlint rule `no-sparse-arrays` for config check to fix #3910 (#3911) + ### Updated - [core] Update dependencies (#3909) diff --git a/js/check_config.js b/js/check_config.js index 14fda3c5..d8c97358 100644 --- a/js/check_config.js +++ b/js/check_config.js @@ -58,7 +58,10 @@ function checkConfigFile () { ...globals.node } }, - rules: { "no-undef": "error" } + rules: { + "no-sparse-arrays": "error", + "no-undef": "error" + } }, configFileName );