Over at enwiki WP:VPT, we get an awful lot of people complaining that one gadget or other has stopped working. Invariably it is because one of their personal JavaScript subpages contains invalid JavaScript (e.g. they mistakenly put CSS in their JS subpage, or tried to comment things out with <!-- -->, or other such nonsense). This means that anything appended after the invalid JS by ResourceLoader, including some site gadgets, will not be executed by the browser.
Similar to what is done with Lua, a simple syntax check/lint should be executed when a personal JavaScript page is saved. If there are syntax errors, the user gets a warning, letting them know that if they proceed, some parts of the site may cease to work.
There are other possible resolutions to the underlying problem: for example, if ResourceLoader detects invalid JavaScript in a file it is about to process, it could reject that file. But I think informing and educating the user is a better idea here.