eslint-plugin-jest-extended
eslint-plugin-jest-extended copied to clipboard
More suggestions
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.
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 :)
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.
Some overlap with my report in #219