Skip to content
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

Support auto-generated rule options lists #481

Merged
merged 1 commit into from
Oct 12, 2023
Merged

Support auto-generated rule options lists #481

merged 1 commit into from
Oct 12, 2023

Conversation

bmish
Copy link
Owner

@bmish bmish commented Oct 8, 2023

Fixes #237. Similar to #480.

This is an optional feature for anyone who adds these marker comments to their rule docs, typically in a ## Config or ## Options section:

<!-- begin auto-generated rule options list -->
<!-- end auto-generated rule options list -->

Rendered example of the table/list that will be generated:

Name Description Type Choices Default Required Deprecated
bar Choose how to use the rule. String always, never always Yes
foo Enable some kind of behavior. Boolean false Yes

Based on this schema:

[{
    "type": "object",
    "properties": {
        "foo": {
            "type": "boolean",
            "description": "Enable some kind of behavior.",
            "deprecated": true,
            "default": false
        },
        "bar": {
            "description": "Choose how to use the rule.",
            "type": "string",
            "enum": ["always", "never"],
            "default": "always"
        }
    },
    "required": ["bar"],
    "additionalProperties": false
}]

Note that rule option lists are experimental / subject-to-change as we add support for more kinds and properties of schemas. To fully take advantage of them, you'll want to ensure your rules have the meta.schema property fleshed out with properties like description, type, enum, default, required, deprecated.

Future follow-up features to consider:

@bmish bmish added the enhancement New feature or request label Oct 8, 2023
@bmish bmish force-pushed the rule-options-list branch 4 times, most recently from af5ca49 to e2834c7 Compare October 12, 2023 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically generate missing options sections in rule docs
2 participants