📝 Enforce using the built-in comparison matchers.
all config.
🔧 This rule is automatically fixable by the --fix CLI option.
This rule checks for comparisons in a test that could be replaced with one of the following built-in comparison matchers:
toBeGreaterThantoBeGreaterThanOrEqualtoBeLessThantoBeLessThanOrEqual
Examples of incorrect code for this rule:
expect(x > 5).toBe(true)
expect(x < 7).not.toEqual(true)
expect(x <= y).toStrictEqual(true)Examples of correct code for this rule:
expect(x).toBeGreaterThan(5)
expect(x).not.toBeLessThanOrEqual(7)
expect(x).toBeLessThanOrEqual(y)
// special case - see below
expect(x < 'Carl').toBe(true)
// Rule only works on inters and big integers