mattphillips/jest-expect-message

Eslint rule override for jest/valid-expect is not working in newest versions of TS/eslint/jest-expect-message

ClaytonAndTheClayTones opened this issue · 0 comments

Bug

  • package version: 1.1.3
  • node version: 16.15.1
  • npm (or yarn) version: 8.11.0
  • eslint version: 8.33.0
  • typescript version: 4.9.5

What you did:

Followed the instructions per the repo readme, installed jest-expect-message and added the 'jest-expect-message' package to my jest config:

   setupFilesAfterEnv: ['./src/jestSetup.ts', 'jest-expect-message'],

At this time the behaviour, as expected, is that intellisense/lint both do NOT like expect(x, "hello world") as it does not know there is a second arg now allowed. If I don't do that, everything still transpiles and lints fine, but I want that second param to be honored...

So, as suggested by the readme I added the following to my eslintrc.json:

    "jest/valid-expect": [ 
      "error",
      {
        "maxArgs": 2
      }
   ]

The expected outcome is that lint, at least, will respect that override, but instead all of my files now fail lint with the following error:

 1: 1 error  Definition for rule 'jest/valid-expect' was not found 

The definition is definitely there in the eslintrc, so I'm not sure what is going wrong but it's a shame because I've used this library in the past and it is excellent but something has gone awry in some recent version of something.

What happened (please provide anything you think will help):

Described above. Cannot get eslint to respect the setting listed in your readme.

Reproduction repository (if possible):

also listed above, all versioning may be pertinent