eslint - How do I share global javascript variables among multiple files prior to compiling? -


what's best way handle linting when there multiple files compiled single file share global variables/functions. example:

file_1.js:

{ const my_flag = 1; } 

file_2.js:

{   if (my_flag) {   // etc. 

when 2 files compiled , combined, there's no problem. file_1.js throws linting error related unused variable, , file_2.js throws linting error related undefined variable.

i relize ignore specific lines related issue, that's defeating purpose of linting files. what's best way share information between files during linting process?

with eslint can tell script variable global:

/* global my_flag */ 

put line before my_flag used in second file (generally first line of file). avoid linting error undefined variable my_flag


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -