Skip to content

[prefer-mock-return-shorthand]: option to only error on static values #1907

@lukpsaxo

Description

@lukpsaxo

Thanks for adding prefer-mock-return-shorthand - I tried enabling it autofix on our codebase and it simplified alot of test code.

However we have too many cases where it broke tests because a return from mockImplementation was dynamic - I'd rather not have eslint disable across these ~40 cases.

I was thinking it would be good if there was an option to only error on static values e.g. true/"test"/{static: true} and maybe an exception for Promise.resolve/Promise.reject.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions