standard / ts-standard

Typescript style guide, linter, and formatter using StandardJS
https://www.npmjs.com/package/ts-standard
MIT License
464 stars 36 forks source link

Support eslint-env and global #170

Closed jessebmiller closed 3 years ago

jessebmiller commented 3 years ago

Version: "^10.0.0"

Problem

In my jest tests, I'm getting 'test' is not defined. and 'expect' is not defined.

I'd like to allow those globals in my jest files in the same way I do using standardjs by adding /* eslint-env jest */ or listing the globals in the file /* globals test expect */ rather than allowing those globals in all files.

Solution

Implement the behavior of standardjs as described here and here

I'd be willing to work on this, but I'd need a lot of help understanding this repo and how standardjs handles this.

theoludwig commented 3 years ago

Hey! :wave: @jessebmiller

To make jest tests work with ts-standard, you can put that config in your package.json :

{
  "ts-standard": {
    "envs": ["jest"]
  }
}

That being said, /* eslint-env jest */ should work, if not, that's more related to eslint than standard or ts-standard.

Does that solve your issue?

theoludwig commented 3 years ago

Please reopen if this issue persists, closing as for now.