-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Autogenerate many rule options list with eslint-doc-generator #2917
base: main
Are you sure you want to change the base?
Conversation
70f909c
to
1ee4458
Compare
1ee4458
to
4c019c7
Compare
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.
Looks like a great start :-)
| `importFunctions` | String[] | | ||
| `webpackChunknameFormat` | String | |
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.
string
should be lowercase, i think
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.
Do you know of any related example / precedent for displaying variable/data types one way or the other, or have any other reasoning behind your preference? I'm open to considering a change.
The current reasoning is that arbitrary, user-defined values like the name of an option are displayed in backticks, whereas values from a fixed set like variable types are simply capitalized.
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.
Here's a comprehensive example that shows how we format different kinds of values: https://github.com/bmish/eslint-doc-generator/blob/main/docs/examples/eslint-plugin-test/docs/rules/no-foo.md#options
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.
String
means an object - the constructor - and string
means a primitive. It's what typeof
produces for primitives as well.
TypeScript follows this convention as well.
| `ignoreTypeImports` | Boolean | `false` | | ||
| `max` | Number | `10` | |
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.
same with all the primitive types
I'm trying out this new feature I implemented that generates the lists of rule options from the rule schemas. More info:
This requires quite a bit of cleanup including:
I noticed that many rules do not even mention their options in their docs today, or do so incompletely.
Since there are so many rules with options, I haven't quite fully filled out and perfected all the schemas/docs yet, but it's a start.
Note that I avoided adding the auto-generated lists to rules with complex option formats which aren't all supported yet by eslint-doc-generator.