-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Docs: WIP Guidelines for rule pages #5446
Comments
Here are the level-2 headings in rules pages in the order that they are used, if needed: Rule Details EDIT 2016-06-17: The The introduction is the content between the main level-1 heading and Rule Details. The |
If a rule page has a level-2 Options heading, then for each option which has examples there is a level-3 heading. The heading text is either:
For faster scanning, there is no additional punctuation (quotes) or formatting (code style indicated by backticks). The example sentences and eslint comments in the code specify the required syntax. If there are separate examples for values of an object property, then there are level-4 headings. A colon separates key from value, for example: EDIT 2016-06-17: We need a heading pattern for boolean properties which have incorrect/correct code for both |
Most rules (and options) have examples of code so people can achieve the following goals:
So people can recognize quickly how rules and options relate to their code, most examples consist of incorrect code followed by correct code. Examples of some options (for example, Examples of a few options (for example, Adapt the following patterns for sentences to precede the code fence for an example.
EDIT 2016-06-17: Suggesting bold (instead of italic) format for false negative or false positive. The The matching phrases now include Example singular in addition to Examples plural. If there is just one example of additional code, plural just reads wrong. In ordinary examples, plural seems to read okay even if there is only one example. Consistent structure of headings, order of incorrect/correct example, and wording of example paragraph (so the class is added) might allow side-by-side format for examples on wide screens. |
If a rule has options, then heading level 2 Options follows the Rule Details section. Look at the schema or meta.schema array in module.exports in the rule file: lib/rules/*.js For each “slot” in the array, include a sentence like one of the following to introduce a bulleted list. The brackets contain example rules for your further study. Do not include them, of course.
Here are recommended VERBS to use in list items. Try to limit each item to one sentence which begins with the option in code style (enclosed in backticks) and does not end with a period
list item for string option
list item for string options
list item for number option
list item for object option
useful phrases in list items
Here is a question we will answer as we go: how much description to repeat following a heading level 3 for an option preceding its example code? Initial opinion by Mark is usually none. EDIT 2016-06-17: If the effect of a boolean option is not an obvious on/off (analogous to a check box on a form) but two different things which need separate descriptions (analogous to two option buttons on a form) then use nested bullets. Here is an example from the
|
To remain consistent with the discussions for the process of deprecating rules (and simply for sanity's sake), docs for maintained rules (i.e. non-deprecated rules) should not list any deprecated rules in their "Related Rules" sections. |
Where options have been deprecated, examples should no longer reference the deprecated option, nor should the option be listed among the available options. However, a note with the following format should be placed at the bottom of its respective option summary: Deprecated: The object property |
|
The If we find any more, we can compare them and decide on a pattern. |
FYI: I've started work on ES6 rules. For removed, deprecated, changed options, we could use blockquotes to highlight the changes, eg:
|
@pedrottimark do you have an example doc showing the full headings, in particular the following h2 headings:
Also, IMO it would be better to rename the "When Not To Use It" heading to "Recommendations" so we can also give guidance on when to use it if desired. For example, the
We could potentially have a list of keywords associated with the meta goals of linting, and then in the recommendations section suggest options to use for different goals. Off the top of my head, I can think of the following meta reasons:
There are likely others. The meta terms could also be used when evaluating new rules or changes to existing rules, and as an aid to decision making could be mentioned in the contributing guidelines. |
Mockup of a rule page with revised headings, options, etc... |
Here are 11 examples of rules whose docs contain h2 headings you asked about. I put * at the left of 2 with unexpected order and r at the left of 1 with unexpected capitalization
|
With regards to this scenario:
I think we should also match those strings if used under a level-2 Examples heading - IMO the code samples should always live under Examples heading, even if the rule has no options - this keeps document structure consistent. |
Key notes from
Overall, I'm chomping at the bit to get cracking with more updates to the docs. Real blocker issues from my end are:
|
Another thing to consider - would it be worth having an optional h2.FAQ section on rule docs? For example, with some es6 stuff, people can get |
Noticed a fairly common anti-pattern - options section being spread throughout the examples.
A quick glance of the Options section could leave a reader thinking there were only I've moved all the options information in to a single h2 Options section and used headings throughout examples to highlight where each option is being discussed. |
1. Ensure each doc has "Examples" heading, and that each option-specific example pair also has a suitable heading. 2. Ensure text above examples is consistent as per #5446 This PR does not attempt to address issues other than those stated above; such issues will be dealt with on subsequent sweeps of the docs detailed in #6444.. Note: Skipped no-duplicate-imports due to #6455, will come back to that one at later date.
* Docs: Consistent example headings & text pt4 #5446 Final batch of es6 docs for this sweep! 1. Ensure each doc has "Examples" heading, and that each option-specific example pair also has a suitable heading. 2. Ensure text above examples is consistent as per #5446 This PR does not attempt to address issues other than those stated above; such issues will be dealt with on subsequent sweeps of the docs detailed in #6444.. * Docs: Fixed lint errors in doc docs/rules/sort-imports.md: 161: MD004 Unordered list style docs/rules/sort-imports.md: 162: MD004 Unordered list style docs/rules/sort-imports.md: 163: MD004 Unordered list style docs/rules/sort-imports.md: 164: MD004 Unordered list style docs/rules/sort-imports.md: 37: MD007 Unordered list indentation docs/rules/sort-imports.md: 37: MD010 Hard tabs docs/rules/sort-imports.md: 38: MD010 Hard tabs docs/rules/sort-imports.md: 39: MD010 Hard tabs docs/rules/sort-imports.md: 40: MD010 Hard tabs * Docs: List indentation should be 4, not 2 FYI: I've requested enhanced error reporting for markdown linter - e.g. to expose rule settings in error messages: DavidAnson/markdownlint#23 (comment) 171
* Docs: Consistent example headings & text pt3 #5446 Just a single doc in this batch due to variance in changes: Headings were already present, however they were over-complicated; I separated out the old (ES3/5) feature from the heading and put it in a block quote to distinguish it from the new (Reflect API) feature. As per previous batches, ensured text above examples is consistent as per #5446 This PR does not attempt to address issues other than those stated above; such issues will be dealt with on subsequent sweeps of the docs detailed in #6444. * Docs: space around fenced code * Docs: Remove blockquotes (refs #6492)
Closing because it doesn't look like there's enough interest to finish implementing this. |
This issue will accumulate the reusable patterns that emerge while the rules pages are edited to improve consistency. The result will become a template and guidelines (in a format yet to be determined) for future editing, especially new options and rules.
Goals: eslint/archive-website#186 (comment), eslint/archive-website#186 (comment), #5375 (comment)
Pull requests will have often discussion about specific occurrences which sometimes cause us to add generalized conclusions to this issue. This issue can also have questions, concerns, suggestions.
The text was updated successfully, but these errors were encountered: