How to force Cloud9 to accept a "global" variable?

From using Cloud9, I noticed that the editor accepts $ as a global variable, but not other variables like _ :

Cloud9 screenshot

Is there any way to tell the editor that he should accept a global underscore variable?


When I say “global” in this context, I mean “defined in a window object”

+5
source share
2 answers

They haven’t answered this yet, so I decided that I’m updating everyone who lands here from Google.

Now you can do this without explicitly defining globals at the top of each javascript file using the .eslintrc file in the root of your C9 project. You can see the documentation for this here on the eslint website.

In your use case, your .eslintrc file would look something like this:

 { "globals": { "_": false } } 

Assigning it to false means that linter will warn you when you try to overwrite the global one. Setting it to true will allow you to reassign the global one. Javascript will allow you to do this anyway, this parameter only affects the behavior of linter.

+3
source

I found a workaround for support.cloud9ide.com :

Cloud9 screenshot

By declaring _ as a global variable in the comment, I avoid warnings, but that still means that I need to modify every single javascript file in my project to calm a single text editor that I don't like. I would prefer the option where I could configure the editor to accept underscores, just as it already accepts $ by default.

+3
source

Source: https://habr.com/ru/post/1210244/


All Articles