Import globals for library

Hi folks,

I’m liking Glitch a lot and I’m putting together some curriculum projects tor teaching coding at the Richmond (BC) Public Library.

I’m using the P5 graphics library a lot, which brings in a bunch of pseudo-globals (they are only global within the preload, setup, and draw methods). To use this library, I have to add an extensive /* global */ comment to tell the linter about every P5 function I’m using. This can be overwhelming and confusing for new students.

What I would like is a way to tell the linter,to bring in all the symbols from the library I’m using, something like /* use p5 globals */.

Thanks, this is a great resource!

You could have them put a /* eslint-disable no-undef */ comment at the start of the file. This will disable warnings for undefined variables.

Yes, and I probably will go that route, but that’s the nuclear option. I’d like for beginners to get warnings for actually undefined variables, just not for variables defined in the library we’re using.

Would it be possible to do this?
I also find it a little annoying you get warnings for undefined variables even though they are defined, just not in the file.