-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
suggestion: prefer test
or it
#12
Comments
Good idea! Should also be autofixable. Would you send a PR for it? 🙂 Couple of q's:
|
I think that could be nice. When using describe('myFunction()', () => {
it('does this thing')
it('does that thing')
// etc.
}) When not using test('does this thing')
test('does that thing') I've worked in codebases that have done one or the other, so being able to configure this could help ensure consistency in those codebases. |
I'm not sure what the default should be here. 🤔 Does a rule need a default, or could we force an option to be provided? (Perhaps that's not a best practice of ESLint rules?) The enum option I imagine with an example
{
"rules": {
"jest/always-test-or-it": ["error", "test"]
}
} I would like to contribute a PR for this unless anyone else would like to. |
I would like to force top level to be Not sure how to best formulate that. Feel free to send a PR, might be easier to decide once we have some code to look at 🙂 |
@ranyitz if you're interested in picking this up, that's cool with me! I hacked on it a little bit yesterday, mostly out of curiosity for how to implement a fixer for a rule. I pushed up macklinu@76acf1f, which handles renaming I'm happy to hand off this branch if you would like to take this issue. 🙂 |
Hey @macklinu That's really nice of you! 😊 I'll try to summarize the tasks, so it'll be easier to discuss what's needs to be done:
Also, I have a suggestion regarding the name, what do you say about |
|
Yeah either that or
@SimenB are you thinking there should only be two options?
Or should we split the |
I think 3 options makes sense. Can be an object instead of a single string as well. |
Suggest using
test
orit
(always-test-or-it)For consistency in code, always use
test
or always useit
.Rule details
When
test
is preferred, this rule triggers a warning for any instances ofit
.When
it
is preferred, this rule triggers a warning for any instances oftest
.This rule is not set by default.
Default configuration
The following pattern is considered warning:
The following pattern is not warning when
test
is set:The following pattern is not warning when
it
is set:The text was updated successfully, but these errors were encountered: