-
Notifications
You must be signed in to change notification settings - Fork 148
Autogenerate configs from rule files #187
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
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Is this something you'd still like help with? |
Hey @nickmccurdy! Yes, for sure. I'll go back to this definitely when couple of extra rules are released. Anyway I had a couple of ideas around this, so I'll try to put them here later to see what we can do. Thanks! |
I've been playing around with this idea too lately. My idea was to add some sort of |
Oh sorry, I didn't realized it was closed by stale-bot!
Yes, this is one of the things I had in mind, but we don't need to add an extra key for it: we can reuse const ruleConfig = {
meta: {
docs: {
description: string, // existing - small description of the rule --> used for rule doc md file + README rules table
category: 'Possible Errors' | 'Best Practices' | 'Style Guidelines', // reused - categories for our plugin rather than ESLint categories --> used for rule doc md file
recommended: string[], // reused - list of framework presets where this rule is enabled rather than ESLint recommended or not --> used for rule doc md file + README rules table
onlyFor: string[] // new - frameworks this rule applies exclusively --> used for rule doc md file
},
},
}; When "rule doc md file" means a new small table at the top of each rule doc file for indicating category, recommended presets, and if it's exclusive for some frameworks. What do you think? |
I would keep For I like the idea of having the distinction of saying "this framework supports it" and "we should include it in the config for this framework", but I'm not sure about the naming. So what I would propose to do is: const ruleConfig = {
meta: {
docs: {
// existing
description: string,
// existing
category: 'Possible Errors' | 'Best Practices' | 'Style Guidelines',
// existing
recommended: string,
// list of frameworks that are supported by this rule, like your `onlyFor` so we explicitly say what frameworks are supported
supportedTestingFrameworks: ('dom' | 'angular' | 'react' | 'vue')[],
// list of framework configs this rule is included
recommendedFor: ('dom' | 'angular' | 'react' | 'vue')[],
},
},
}; Showing the supported frameworks and what config the rule is included in in the docs MD of the rule sounds like a great idea too. |
I'm confused about Anyway, both ways are meant to indicate if the rule has to be included in the With this idea we wouldn't need
That's the point of my suggestion: since we are not interested in default ESLint categories, we override it with our own ( |
That's indeed even a better idea 👍, since we can then have
I'm not 100% convinced about this one tbh. |
We can debate about the categories themselves for sure! Another idea I had for that was just defining categories as priorities level as in Common mistakes with React Testing Library post, so we would have Anyway, this was just an idea to use |
Thinking about this a bit more: we could even keep it as it is and make it recommended for all frameworks (with the specified value) if it's not an object. |
I'd avoid enabling the rule for all frameworks if For instance: rule
In cases like this, explicit is better than implicit. |
🎉 This issue has been resolved in version 4.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
See extended discussion in #182
The text was updated successfully, but these errors were encountered: