I have put a pre-commit script in my git hooks so that it uses eslint before committing the nodejs code. It analyses only the files that are to be committed. I had declare a global variable in my main entry point to my project. This is how I did it.
global.foo = true
The problem that I am facing now is, I am using this foo
variable at many places in my code and without using global extension (which is valid in nodejs)
if(foo)
// do somethins
else
// do nothing
the code works perfectly as this is valid use of global variable. But when I commit the code, the eslint shows error on all the uses of foo
saying that it is undeclared.
error "foo" is not defined no-undef
I cant think of any solution for this. Please suggest a workaround
via molecule
No comments:
Post a Comment