eslint-plugin-jest-extended icon indicating copy to clipboard operation
eslint-plugin-jest-extended copied to clipboard

More suggestions

Open RettentoRectangle opened this issue 2 years ago • 3 comments

It'd be nice to have more suggestions:

expect(typeof x === 'string') -> expect(x).toBeString() expect(typeof x === 'boolean') -> expect(x).toBeBoolean() expect(typeof x === 'number') -> expect(x).toBeNumber() expect(x.includes(y)) -> expect(x).toInclude(y)

And so on.

RettentoRectangle avatar Apr 18 '23 07:04 RettentoRectangle

PRs are welcome, though these would be new rules rather than suggestions - I would prefer we have specific issues rather than one generic one like this though, because what you're effectively asking for here is every rule for every matcher which will take a while 😅

I think toInclude would be an easy one to start with - I had played with some more for ones like toBeNumber, but there are a bunch of cases to cover (which are also not even covered by our current rules) and not a lot of actual users of this plugin so I didn't take it very far.

I'm happy to review PRs though and continue maintaining with new rules, fixes, etc if interest picks up :)

G-Rath avatar Apr 18 '23 07:04 G-Rath

Sorry I mean autofix suggestions. :) Of course they are rules.

We are thinking about to write them by ourself, I'll get some time for that.

RettentoRectangle avatar Apr 18 '23 07:04 RettentoRectangle

Some overlap with my report in #219

geoffswift avatar Dec 08 '24 17:12 geoffswift