Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ClaytonAndTheClayTones opened this issue Feb 7, 2023 · 0 comments

Comments

@ClaytonAndTheClayTones
Copy link

ClaytonAndTheClayTones commented Feb 7, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant