Closed ndelage closed 8 years ago
If it's eslint just add that vars to globals section in eslintrc file
Yep! that work great. Thanks for the quick response.
I know this is an old ticket but does anyone have bright ideas on how to stop linters complaining about the $foo
variables?
I guess there is no easy way for this.
What I was able to find is this - https://gist.github.com/rahatarmanahmed/0403b41e4eae8f5efda1650b0613e8a7 but then you need to integrate it in your build.
Another option is to write a custom eslint env or rule which will ignore global variables which starts with $
sign.
The most easy solution is to write eslint comments and specify which variables are global - https://eslint.org/docs/user-guide/configuring#specifying-globals
In theory we could do better right. The no-undef
rule must back trek to
see if a variable is actually defined. If would seem likely we can do the
same. Check that for a $foo variable there was a def('foo')
preceding it.
On Nov 16, 2017 6:17 AM, "Sergii Stotskyi" notifications@github.com wrote:
I guess there is no easy way for this.
What I was able to find is this - https://gist.github.com/rahatarmanahmed/ 0403b41e4eae8f5efda1650b0613e8a7 but then you need to integrate it in your build.
Another option is to write a custom eslint env or rule which will ignore global variables which starts with $ sign.
The most easy solution is to write eslint comments and specify which variables are global - https://eslint.org/docs/user- guide/configuring#specifying-globals
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stalniy/bdd-lazy-var/issues/17#issuecomment-344893279, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUCIDUR1NRQQ4RL2DxJcQ96H7u6I7KJks5s3BnIgaJpZM4J_JxZ .
Hey, thanks for the great plugin, much appreciated. I think the globals are the only thing annoying. If anyone has any quick patch, even if ugly that I can copy paste to fix this, it'll be appreciated!
I guess right now you can try to disable no-undef
rule and see whether it helps.
I’ll add a separate plugin or rule for eslint to handle this in #56
I did work around this issue by disabling the rule specifically for tests:
"overrides": [
{
"files": ["*.test.js"],
"rules": {
"no-undef": 0
}
}
],
in eslintrc.js
In theory we could do better right. The
no-undef
rule must back trek to see if a variable is actually defined. If would seem likely we can do the same. Check that for a $foo variable there was adef('foo')
preceding it. … On Nov 16, 2017 6:17 AM, "Sergii Stotskyi" @.***> wrote: I guess there is no easy way for this. What I was able to find is this - https://gist.github.com/rahatarmanahmed/ 0403b41e4eae8f5efda1650b0613e8a7 but then you need to integrate it in your build. Another option is to write a custom eslint env or rule which will ignore global variables which starts with $ sign. The most easy solution is to write eslint comments and specify which variables are global - https://eslint.org/docs/user- guide/configuring#specifying-globals — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#17 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUCIDUR1NRQQ4RL2DxJcQ96H7u6I7KJks5s3BnIgaJpZM4J_JxZ .
yeah, I think we should really have a eslint-plugin-bdd-lazy-var
, that could deal with the def declaration :thinking:
I don't have a clue on how to do it, tho :sweat_smile:
should I raise an issue for that? :thinking:
ops, super missed the https://github.com/stalniy/bdd-lazy-var/issues/56, just ignore my comment, sorry :bow:
Anyone know of a trick to prevent eslint from complaining that methods like
def
andget
are not defined?