Objects from included libraries are marked as syntax errors

Hello! When I include files in my client JS, and then try to use variables from them (e.g. Vue() for Vue.js, or moment for Moment.js), the editor marks them with a syntax error, because the editor doesn’t think they’re defined, because it can’t see the includes.

I realize trying to look inside all the includes would be prohibitive, but does anyone have a way to trick the editor into thinking they’re defined? I’ve tried things like let Vue = Vue and trickier variants, which fixes the syntax, but causes ReferenceErrors when the script is run.

What might be nice is, say, a special kind of comment (a la Vim modelines) that would list variables the editor should assume are defined elsewhere, but I’m not sure if that would be practical to work into the syntax highlighting.

Hey @cincodenada, welcome to the Glitch forum!

This is a limitation of the linter that the Editor uses, and we have plans to improve that feature in the future, although I don’t have a timeline to share for that work. In the meantime, though, you can declare global variables using the /* global moment */ syntax and that will cause the linter to recognize those references as valid.

Hope this helps!