stalniy/bdd-lazy-var

Linter Support?

Closed this issue ยท 11 comments

Anyone know of a trick to prevent eslint from complaining that methods like def and get are not defined?

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

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 a def('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 ๐Ÿค”

I don't have a clue on how to do it, tho ๐Ÿ˜…

should I raise an issue for that? ๐Ÿค”

ops, super missed the #56, just ignore my comment, sorry ๐Ÿ™‡