stalniy / bdd-lazy-var

Provides UI for testing frameworks such as mocha, jasmine and jest which allows to define lazy variables and subjects.
MIT License
162 stars 14 forks source link

Linter Support? #17

Closed ndelage closed 8 years ago

ndelage commented 8 years ago

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

stalniy commented 8 years ago

If it's eslint just add that vars to globals section in eslintrc file

ndelage commented 8 years ago

Yep! that work great. Thanks for the quick response.

jonspalmer commented 6 years ago

I know this is an old ticket but does anyone have bright ideas on how to stop linters complaining about the $foo variables?

stalniy commented 6 years ago

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

jonspalmer commented 6 years ago

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 .

mtomov commented 6 years ago

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!

stalniy commented 6 years ago

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

Kukunin commented 5 years ago

I did work around this issue by disabling the rule specifically for tests:

    "overrides": [
        {
            "files": ["*.test.js"],
            "rules": {
                "no-undef": 0
            }
        }
    ],

in eslintrc.js

vhoyer commented 4 years ago

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 :thinking:

I don't have a clue on how to do it, tho :sweat_smile:

vhoyer commented 4 years ago

should I raise an issue for that? :thinking:

vhoyer commented 4 years ago

ops, super missed the https://github.com/stalniy/bdd-lazy-var/issues/56, just ignore my comment, sorry :bow: