I use es5, the code is divided into IIFE modules. Between modules I transfer variables in objects of the type:

var MySite = MySite || {}; MySite.Module1 = MySite.Module1 || {}; MySite.Module1.var1 = MySite.Module1.var1 || {}; 

Then in the IIFE modules themselves I appeal to these objects:

 var varFromModule1 = MySite.Module1.var1; 

This last line eslint, of course, swears:

 "MySite" is not defined. (no-undef) 

I don’t want to disable this setting in eslint for obvious reasons. Are there any solutions so that these namespaces are not highlighted as errors?

    1 answer 1

    There is a section in the config globals - in it you need to register all existing global variables. Read more: https://eslint.org/docs/user-guide/configuring#specifying-globals