Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gajus/eslint-plugin-jsdoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v34.4.0
Choose a base ref
...
head repository: gajus/eslint-plugin-jsdoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v34.5.0
Choose a head ref
  • 1 commit
  • 8 files changed
  • 1 contributor

Commits on May 15, 2021

  1. feat(multiline-blocks): allow control of how and whether jsdoc bloc…

    …ks can be expressed as single or multiple line blocks
    brettz9 committed May 15, 2021
    Copy the full SHA
    06bbf37 View commit details
Showing with 1,421 additions and 78 deletions.
  1. +1 −0 .README/README.md
  2. +84 −0 .README/rules/multiline-blocks.md
  3. +408 −76 README.md
  4. +3 −0 src/index.js
  5. +16 −2 src/iterateJsdoc.js
  6. +261 −0 src/rules/multilineBlocks.js
  7. +647 −0 test/rules/assertions/multilineBlocks.js
  8. +1 −0 test/rules/ruleNames.json
1 change: 1 addition & 0 deletions .README/README.md
Original file line number Diff line number Diff line change
@@ -552,6 +552,7 @@ selector).
{"gitdown": "include", "file": "./rules/empty-tags.md"}
{"gitdown": "include", "file": "./rules/implements-on-classes.md"}
{"gitdown": "include", "file": "./rules/match-description.md"}
{"gitdown": "include", "file": "./rules/multiline-blocks.md"}
{"gitdown": "include", "file": "./rules/newline-after-description.md"}
{"gitdown": "include", "file": "./rules/no-bad-blocks.md"}
{"gitdown": "include", "file": "./rules/no-defaults.md"}
84 changes: 84 additions & 0 deletions .README/rules/multiline-blocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
### `multiline-blocks`

Controls how and whether jsdoc blocks can be expressed as single or multiple
line blocks.

Note that if you set `noSingleLineBlocks` and `noMultilineBlocks` to `true`
and configure them in a certain manner, you might effectively be prohibiting
all jsdoc blocks!

#### Options

A single options object with the following properties.

##### `noZeroLineText` (defaults to `true`)

For multiline blocks, any non-whitespace text immediately after the `/**` and
space will be reported. (Text after a newline is not reported.)

`noMultilineBlocks` will have priority over this rule if it applies.

##### `noSingleLineBlocks` (defaults to `false`)

If this is `true`, any single line blocks will be reported, except those which
are whitelisted in `singleLineTags`.

##### `singleLineTags` (defaults to `['lends', 'type']`)

An array of tags which can nevertheless be allowed as single line blocks when
`noSingleLineBlocks` is set. You may set this to a empty array to
cause all single line blocks to be reported. If `'*'` is present, then
the presence of a tag will allow single line blocks (but not if a tag is
missing).

##### `noMultilineBlocks` (defaults to `false`)

Requires that jsdoc blocks are restricted to single lines only unless impacted
by the options `minimumLengthForMultiline`, `multilineTags`, or
`allowMultipleTags`.

##### `minimumLengthForMultiline` (defaults to not being in effect)

If `noMultilineBlocks` is set with this numeric option, multiline blocks will
be permitted if containing at least the given amount of text.

If not set, multiline blocks will not be permitted regardless of length unless
a relevant tag is present and `multilineTags` is set.

##### `multilineTags` (defaults to `['*']`)

If `noMultilineBlocks` is set with this option, multiline blocks may be allowed
regardless of length as long as a tag or a tag of a certain type is present.

If `*` is included in the array, the presence of a tags will allow for
multiline blocks (but not when without any tags unless the amount of text is
over an amount specified by `minimumLengthForMultiline`).

If the array does not include `*` but lists certain tags, the presence of
such a tag will cause multiline blocks to be allowed.

You may set this to an empty array to prevent any tag from permitting multiple
lines.

##### `allowMultipleTags` (defaults to `true`)

If `noMultilineBlocks` is set to `true` with this option and multiple tags are
found in a block, an error will not be reported.

Since multiple-tagged lines cannot be collapsed into a single line, this option
prevents them from being reported. Set to `false` if you really want to report
any blocks.

This option will also be applied when there is a block description and a single
tag (since a description cannot precede a tag on a single line, and also
cannot be reliably added after the tag either).

|||
|---|---|
|Context|everywhere|
|Tags|Any (though `singleLineTags` and `multilineTags` control the application)|
|Recommended|true|
|Settings||
|Options|`noZeroLineText`, `noSingleLineBlocks`, `singleLineTags`, `noMultilineBlocks`, `minimumLengthForMultiline`, `multilineTags`, `allowMultipleTags`|

<!-- assertions multilineBlocks -->
Loading