Javascript - Global variables issue

Hey guys.
I found a mistake in the glitch editor.

If you define a variable in one .js file and use it somehow in another file then in the second file it’ll say the variable hasn’t been defined even though it was defined in another variable and works perfectly on the actual website.

Not a serious issue, but I still find it a little annoying :stuck_out_tongue:

This is actually not a mistake, that is how the linter in the editor is made, it doesn’t check cross references. I assume that you can add some linting rule in the top of your file to declare the variable name and its type.

1 Like

I can indeed, but i’d still consider this a mistake. Since it tells me it’s an error but it’s in reality not.

@darknessgamingdk from what I’ve read in the forums, Glitch doesn’t have a lot of control re: what comes out of the box with CodeMirror, which is what they use for linting. If you take a look the Glitch Feature Ideas channel, you can vote for one of the ideas that fits what you want (or create your own) and if it gains enough traction the team will look into it! This one in particular seemed to fit what you’re interested in:

2 Likes