Skip to content

linter: jest/expect-expect doesn't mention assertFunctionNames #16491

@ZAZPRO

Description

@ZAZPRO

What version of Oxlint are you using?

1.31.0

What command did you run?

oxlint --type-aware

What does your .oxlintrc.json config file look like?

{
  "plugins": [
    "typescript",
    "unicorn",
    "react",
    "react-perf",
    "oxc",
    "import",
    "promise",
    "vitest"
  ],
  "ignorePatterns": [
    "node_modules",
    "dist/**",
    "packages/protocol/dist/**",
    "packages/log-translator/dist/**"
  ],
  "rules": {
    "jest/expect-expect": [
      "warn",
      {
        "assertFunctionNames": [
          "expect",
          "test_text_with_page",
          "test_previous",
          "test_next",
          "test_pre_ellipsis",
          "test_post_ellipsis"
        ]
      }
    ],
    "jest/no-standalone-expect": [
      "error",
      {
        "additionalTestBlockFunctions": ["test.for"]
      }
    ],
    "typescript/unbound-method": "off",
    "typescript/no-floating-promises": "off",
    "typescript/no-redundant-type-constituents": "off"
  }
}

What happened?

Good day,

I am using some helper test functions in my test like test_previous and test_next I was getting an error that expect is not in the test. I have realized that I need to tell the linter which of my helper functions have expect in them.

Docs regarding this rule only mention assertFunctionNamesJest and assertFunctionNamesVitest. I have tried adding those helper functions into assertFunctionNamesJest, but that didn't work. (Might even be a separate bug)

Solution was to use just assertFunctionNames option. Which is not mentioned in the docs at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions