docs: auto-generate configuration options for each lint rule
currently, the website is missing almost all of the configuration options for lint rules generally, unless we remembered to include this in the description.
Since most lint rules have a configuration struct specific to the rule, and a struct field for each option, maybe we could auto-generate these?
Do you mean auto generating the doc comments for the option configuration by parsing the configuration struct for each rule? Or could we be using the test cases to generate the options docs?
@therewillbecode I'm not completely sure on this one yet, I don't think it's clear to me. I think something that like allowing annotations on a config struct, or perhaps a trait that can be implemented like:
pub struct RuleConfig {
/// Allows accepting some cases
///
/// Example: ...
#[rename = "someOption"]
#[type = bool, default = false]
some_option: serde_json::Value,
}
impl Rule for RuleName {
type Config = RuleConfig
// ...
}
and then using the Config type and generating the docs from that like:
## Option: `someOption` (default: false)
Allows accepting some cases.
Example: ...
Maybe there is a good way to use macros for this, but I'm not much of a macro expert. Or else we could use serde directly maybe? If anyone else has ideas on this, I'd be interested.
Looking forward to this, I was also looking at the rule doc seeing no option, then I had to go to the source of the rule to understand actually it was configurable and was supporting my usecase.
So indeed, would be much appreciated feature 🙌