Skip to content

Commit 5f1f5bd

Browse files
feat: add ESlint rule no-sparse-arrays for config check (#3911)
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. ```
1 parent b09a27a commit 5f1f5bd

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ planned for 2026-01-01
1919

2020
### Fixed
2121

22+
- feat: add ESlint rule `no-sparse-arrays` for config check to fix #3910 (#3911)
23+
2224
### Updated
2325

2426
- [core] Update dependencies (#3909)

js/check_config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ function checkConfigFile () {
5858
...globals.node
5959
}
6060
},
61-
rules: { "no-undef": "error" }
61+
rules: {
62+
"no-sparse-arrays": "error",
63+
"no-undef": "error"
64+
}
6265
},
6366
configFileName
6467
);

0 commit comments

Comments
 (0)