-
Notifications
You must be signed in to change notification settings - Fork 239
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
feat: create prefer-to-be-for-literals
#821
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it!
We should support all literal types, such as And make its API defaults to: 'jest/prefer-to-be-for-literals': ['error', {
types: ['number', 'string', 'boolean']
}] Its full API: 'jest/prefer-to-be-for-literals': ['error', {
types: ['number', 'string', 'boolean', 'undefined', 'null', 'NaN']
}] What do you think? |
There's already
They're handled by the I assume that |
Another brainstorm: Deprecate Use a new rule 'jest/prefer-to-be': ['error', {
types: ['number', 'string', 'boolean', 'undefined', 'null', 'NaN']
}]
We could keep all of them for the current major version, including the |
Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
@SimenB cheers, good catch on that silly "too" 😅 |
@LitoMore as @razh said, I think doing it all via one @SimenB do you have any opinions on that? mainly around having it in our |
also, I just realised this errors on |
I've created |
🎉 This issue has been resolved in version 24.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 25.0.0-next.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves #801
I'm open to bikeshedding on the name:
prefer-to-be
- we've already had a rule named this, but maybe thats ok?prefer-to-be-for-literals
- a little wordy, arguably a little inaccurateprefer-to-be-for-primitive-literal
- wordier, but the most accurateI think this could be good to have in
styles
config when it comes time to do our next major.