-
Notifications
You must be signed in to change notification settings - Fork 150
refactor: automatically generate all configs #358
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
refactor: automatically generate all configs #358
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.
Oh, I forgot that consistent-data-testid
wasn't using our custom rule creator. When I refactored that rule for v4 I originally added an option to skip the reporting checks. You can see that in the original PR. I added a new detectionOptions
property to createTestingLibraryRule
so we could pass skipRuleReportingCheck
to avoid preventing rules to be reported with the mechanism at the very bottom of detect-testing-library-utils.ts
(this wasn't implemented).
I eventually reverted the mechanism since I didn't get any advantage using our custom rule creator in that rule. I think what we can do is to get that idea back, tweaking it as we need and implementing the actual skip in detect-testing-library-utils.ts
(I can give you more details if you are not really sure about this).
Apart from that, the PR looks really nice! I've left a couple of comments for some small tweaks. We also need to mention this recommendedConfig
property in CONTRIBUTING.md
@Belco90 I'll create a new PR where I refactor Once that's merged, I can rebase this one and fix all the comments. |
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.
This is looking great! ✨
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.
Fantastic work @MichaelDeBoey 💯
The last thing would be referencing recommendedConfig
in CONTRIBUTING.md
file, can you add some doc about it please?
🎉 This PR is included in version 4.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Personally I think it's simpler to dynamically generate objects in the package, and it avoids issues with the generated files getting out of date in version control. Would you be interested in an additional PR for that? |
@nickmccurdy that's how I assumed it would work at the beginning, but I'm happy with the current implementation so we can include the generated files in the repo and check the expected config in CI. Thanks anyway! |
@nickmccurdy That's how I wanted to implement it at first. |
You can use |
I first tried to re-use
recommended
and let that be an object that has the supported testing frameworks as keys and as value either just'error'
,'warn'
orfalse
or a tuple that has one of these values as first value and the possible config as second.This way each plugin can have totally different config options (as seen in
no-dom-import
.When automatically generating all configs (see 252b0b9), I got empty
rules
objects as we are now hardcodingrecommended
tofalse
increateTestingLibraryRule
(even though the input has it in the new way).That's why I decided to use a new
recommendedConfig
key in the meta docs.Everything is working as it should be now, except for
consistent-data-testid
.Since we're not using
createTestingLibraryRule
there, TS is complaining when adding the newrecommendedConfig
key in the meta docs.I've seen why we're not using
createTestingLibraryRule
, but can we switch to it either way or should we look into a totally different solution?This PR is only generating configs.
I'll create follow-up PRs for generating docs tables in README and other docs related tables in the rules specific docs once this one's merged.
Closes #187