Skip to content

Commit b380100

Browse files
committed
docs: generate docs
1 parent 45b2443 commit b380100

File tree

1 file changed

+74
-5
lines changed

1 file changed

+74
-5
lines changed

README.md

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ syntax highlighting). The following options determine whether a given
491491
so you may wish to use `(?:...)` groups where you do not wish the
492492
first such group treated as one to include. If no parenthetical group
493493
exists or matches, the whole matching expression will be used.
494-
An example might be ````"^```(?:js|javascript)([\\s\\S]*)```$"````
494+
An example might be ````"^```(?:js|javascript)([\\s\\S]*)```\s*$"````
495495
to only match explicitly fenced JavaScript blocks.
496496
* `rejectExampleCodeRegex` - Regex blacklist which rejects
497497
non-lintable examples (has priority over `exampleCodeRegex`). An example
@@ -502,6 +502,25 @@ If neither is in use, all examples will be matched. Note also that even if
502502
`captionRequired` is not set, any initial `<caption>` will be stripped out
503503
before doing the regex matching.
504504

505+
<a name="eslint-plugin-jsdoc-rules-options-paddedindent"></a>
506+
#### <code>paddedIndent</code>
507+
508+
This integer property allows one to add a fixed amount of whitespace at the
509+
beginning of the second or later lines of the example to be stripped so as
510+
to avoid linting issues with the decorative whitespace. For example, if set
511+
to a value of `4`, the initial whitespace below will not trigger `indent`
512+
rule errors as the extra 4 spaces on each subsequent line will be stripped
513+
out before evaluation.
514+
515+
```js
516+
/**
517+
* @example
518+
* anArray.filter((a) => {
519+
* return a.b;
520+
* });
521+
*/
522+
```
523+
505524
<a name="eslint-plugin-jsdoc-rules-options-reportunuseddisabledirectives"></a>
506525
#### <code>reportUnusedDisableDirectives</code>
507526

@@ -604,6 +623,7 @@ function quux () {
604623

605624
/**
606625
* @example
626+
*
607627
* ```js alert('hello'); ```
608628
*/
609629
function quux () {
@@ -644,7 +664,7 @@ function quux () {
644664
function quux2 () {
645665

646666
}
647-
// Options: [{"baseConfig":{"rules":{"semi":["error","never"]}},"eslintrcForExamples":false,"rejectExampleCodeRegex":"^\\s*<.*>$"}]
667+
// Options: [{"baseConfig":{"rules":{"semi":["error","never"]}},"eslintrcForExamples":false,"rejectExampleCodeRegex":"^\\s*<.*>\\s*$"}]
648668
// Message: @example error (semi): Extra semicolon.
649669

650670
/**
@@ -696,7 +716,7 @@ function quux () {}
696716

697717
/**
698718
* @example const i = 5;
699-
* quux2()
719+
* quux2()
700720
*/
701721
function quux2 () {
702722

@@ -706,7 +726,18 @@ function quux2 () {
706726

707727
/**
708728
* @example const i = 5;
709-
* quux2()
729+
* quux2()
730+
*/
731+
function quux2 () {
732+
733+
}
734+
// Options: [{"paddedIndent":2}]
735+
// Message: @example warning (id-length): Identifier name 'i' is too short (< 2).
736+
737+
/**
738+
* @example
739+
* const i = 5;
740+
* quux2()
710741
*/
711742
function quux2 () {
712743

@@ -715,7 +746,7 @@ function quux2 () {
715746

716747
/**
717748
* @example const i = 5;
718-
* quux2()
749+
* quux2()
719750
*/
720751
function quux2 () {
721752

@@ -825,6 +856,15 @@ var quux = {
825856

826857
};
827858
// Options: [{"baseConfig":{"rules":{"semi":["error","never"]}},"eslintrcForExamples":false,"exampleCodeRegex":"```js([\\s\\S]*)```"}]
859+
860+
/**
861+
* @example
862+
* foo(function (err) {
863+
* throw err;
864+
* });
865+
*/
866+
function quux () {}
867+
// Options: [{"baseConfig":{"rules":{"indent":["error"]}},"eslintrcForExamples":false,"noDefaultExampleRules":false}]
828868
````
829869

830870

@@ -3139,6 +3179,23 @@ function quux () {
31393179
}
31403180
// Options: ["never"]
31413181
// Message: There must be no newline after the description of the JSDoc block.
3182+
3183+
/**
3184+
* A.
3185+
*
3186+
* @typedef {Object} A
3187+
* @prop {boolean} a A.
3188+
*/
3189+
// Options: ["never"]
3190+
// Message: There must be no newline after the description of the JSDoc block.
3191+
3192+
/**
3193+
* A.
3194+
* @typedef {Object} A
3195+
* @prop {boolean} a A.
3196+
*/
3197+
// Options: ["always"]
3198+
// Message: There must be a newline after the description of the JSDoc block.
31423199
````
31433200

31443201
The following patterns are not considered problems:
@@ -3370,6 +3427,14 @@ class Bar {
33703427
}
33713428
}
33723429
// Message: The type 'TEMPLATE_TYPE' is undefined.
3430+
3431+
/**
3432+
* @type {strnig}
3433+
*/
3434+
var quux = {
3435+
3436+
};
3437+
// Message: The type 'strnig' is undefined.
33733438
````
33743439

33753440
The following patterns are not considered problems:
@@ -5981,6 +6046,8 @@ export class SomeClass {
59816046

59826047
Checks if the return expression exists in function body and in the comment.
59836048

6049+
Will also report if multiple `@returns` tags are present.
6050+
59846051
|||
59856052
|---|---|
59866053
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
@@ -6440,6 +6507,8 @@ function quux () {
64406507

64416508
Requires returns are documented.
64426509

6510+
Will also report if multiple `@returns` tags are present.
6511+
64436512
<a name="eslint-plugin-jsdoc-rules-require-returns-options-11"></a>
64446513
#### Options
64456514

0 commit comments

Comments
 (0)