Skip to content

[Bug] config.js syntax checker incorrectly flags document. in module config (reproduced in develop 12/19/25) #3990

@sdetweil

Description

@sdetweil

Environment

System Information

  • SYSTEM: manufacturer: System manufacturer; model: System Product Name; virtual: false; MM: 2.34.0-develop
  • OS: platform: linux; distro: Ubuntu; release: 22.04.5 LTS; arch: x64; kernel: 5.15.0-164-generic
  • VERSIONS: electron: 38.1.2; used node: 22.19.0; installed node: 22.21.1; npm: 10.9.4; pm2: 6.0.13
  • ENV: XDG_SESSION_TYPE: x11; MM_CONFIG_FILE: undefined
    WAYLAND_DISPLAY: undefined; DISPLAY: :0.0; ELECTRON_ENABLE_GPU: undefined
  • RAM: total: 48077.13 MB; free: 34387.64 MB; used: 13689.48 MB
  • OTHERS: uptime: 1452 minutes; timeZone: America/Chicago

Which start option are you using?

node --run start

Are you using PM2?

No

Module

None

Have you tried disabling other modules?

  • Yes
  • No

Have you searched if someone else has already reported the issue on the forum or in the issues?

  • Yes

What did you do?

Configuration see https://forum.magicmirror.builders/post/129270
<!-- Paste your configuration here. Don't forget to remove any sensitive information! -->
{

		module: "MMM-CalendarExt3", //https://github.com/MMRIZE/MMM-CalendarExt3

		position: "lower_third",

		//header: "FamCal",

		config: {

			mode: "month",

			useWeather: false,

			weekIndex: 0,

			weeksInView: 5,

			instanceId: "basicCalendar",

			locale: "en-GB",

			maxEventLines: 6,

			firstDayOfWeek: 1,

			headerWeekDayOptions: {weekday: "short"},

			refreshInterval: 60 * 10 * 1000, // 3600000, // every hour // 60 * 10 * 1000, // too frequent refresh. 10 minutes is enough.

			calendarSet: ["Family Calendar", "UK Holidays", "Birthday",],

			manipulateDateCell: (cellDom, events) => {

				if (Array.isArray(events) && events.some(e => e.calendarName === 'Birthday')) {

					let dateIcon = document.createElement ('span')

					dateIcon.classList.add ('fa', 'fa-fas', 'fa-fw', 'fa-gift')

					dateIcon.style.color = 'cornflowerblue'

					let header = cellDom.querySelector ('.cellHeader')

					let celldate = header.querySelector ('.cellDate')

					header.insertBefore (dateIcon, celldate)

				}

			},

			eventTransformer: (ev) => 	{

				if (ev.calendarName === 'Birthday') ev.skip = true

				else if (ev.title.search("B -") > -1) ev.color = "brown"

				else if (ev.title.search("C -") > -1) ev.color = "hotpink"

				else if (ev.title.search("E -") > -1) ev.color = "orange"

				else if (ev.title.search("I -") > -1) ev.color = "green"

				else if (ev.title.search("G") > -1) ev.color = "white"

				else if (ev.title.search("Bday") > -1) ev.title = ""

				return ev

										},

			eventPayload: (payload) => {

				for (let ev of payload) {

					if (ev.fullDayEvent) {

						let gap = +ev.endDate - +ev.startDate

						if (gap % (1000 * 60 * 60 * 24) === 0) {

							ev.startDate = new Date(+ev.startDate).setHours(0, 0, 0, 0)

							ev.endDate = new Date(+ev.startDate + gap).setMilliseconds(-1)

						}

					}

				}

				return payload

			},



		},

	},

Steps to reproduce the issue:

add content to config.js ,
no need to install module itself.

What did you expect to happen?

should have worked.. (used to before 2.33)

fails on npm run coniig:check

'temp fix'
add

var document; 

to top of config.js

What actually happened?

npm run config:check

[email protected] config:check
node js/check_config.js

[2025-12-19 11:20:11.692] [INFO] [check_config] Checking config file /home/sam/MagicMirror/config/config.js ...
[2025-12-19 11:20:11.785] [ERROR] [check_config] Your configuration file contains syntax errors :(
Line 2163 column 26: 'document' is not defined.

Additional comments

No response

Participation

  • I am willing to submit a pull request for this change.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions