Error in the editor

I declared variables in the global object,
oaoaommm)19-12-12-15-51-22
the code works,
oaoaommm)19-12-12-15-53-42
but the editor points to an error.
oaoaommm)19-12-12-15-35-45
how can I get rid of these errors?

Discord isn’t defined. You will need to do something like:

const Discord = require('discord.js);
const { Discord, RichEmbed, Version } = require('discord.js);

I declared Discord in a global object just to avoid writing it in every file.

What happens when you remove global did it fix the problem?

if I remove Discord from the global object, the code will stop working. it’s logical. the problem is only in the editor.

Hm, I see, Probably try refreshing the project with refresh in console?

If you provide your Project Name or Invite link (by Private message) I can try and diagnose it for you.

I tried to record a video but this format is not supported at boot :confused:
using refresh errors disappear before the first change in the file. as soon as you change something, they reappear.

I think it’s because Glitch editors treat global variable as not defined because in global variables, we usually don’t define whether its let or var or const. That is why the code works fine, but the errors is shown in the editor. I think you should just ignore it! :grinning:

I can not ignore, because when I go to the system of global variables, everything will turn into a mess of errors.

This issue is caused by linter used in the code editor. The linter that Glitch uses is called CodeMirror and it’s very tricky to customise. There have been multiple issues in the past, including #feature-ideas to update the linter. For now, it’s a limitation! See: Javascript - Global variables issue