Skip to content

Comments

feat(prefer-mock-return-shorthand): greatly improve checking if mutable variables are used#1914

Merged
G-Rath merged 17 commits intomainfrom
prefer-shorthand-fix-again
Dec 30, 2025
Merged

feat(prefer-mock-return-shorthand): greatly improve checking if mutable variables are used#1914
G-Rath merged 17 commits intomainfrom
prefer-shorthand-fix-again

Conversation

@G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Dec 30, 2025

Resolves #1907 (again, mostly)

I'm pretty sure this is just about everything, though I expect there are still some edge cases where the rule still isn't actually safe, but hopefully there should be a lot less of them now.

We still currently treat objects as immuable which is technically unsafe but I think should be pretty reasonable since public object mutation is usually a bad idea - we can explore changing that later (either by default or via an option) based on how much feedback we get from users.

This should also be applied to prefer-mock-promise-shorthand as well, which I'll do "later"

@G-Rath G-Rath merged commit 13bbd20 into main Dec 30, 2025
21 checks passed
@G-Rath G-Rath deleted the prefer-shorthand-fix-again branch December 30, 2025 22:54
github-actions bot pushed a commit that referenced this pull request Dec 30, 2025
# [29.12.0](v29.11.4...v29.12.0) (2025-12-30)

### Features

* **prefer-mock-return-shorthand:** greatly improve checking if mutable variables are used ([#1914](#1914)) ([13bbd20](13bbd20))
@github-actions
Copy link

🎉 This PR is included in version 29.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant