Skip to content

Commit 8886628

Browse files
authored
feat(type-formatting): add property, this, throws, and yields tags (#1496)
* docs(`type-formatting`): clarify * feat(`type-formatting`): add `property`, `this`, `throws`, and `yields` tags
1 parent 2644c6e commit 8886628

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

.README/rules/type-formatting.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,21 @@ Defaults to `"comma"`.
4949

5050
### `objectFieldIndent`
5151

52-
Indicates the whitespace to be added on each line preceding an object
53-
property-value field. Defaults to the empty string.
52+
A string indicating the whitespace to be added on each line preceding an
53+
object property-value field. Defaults to the empty string.
5454

5555
### `objectFieldSeparatorTrailingPunctuation`
5656

5757
If `separatorForSingleObjectField` is not in effect (i.e., if it is `false`
5858
or there are multiple property-value object fields present), this property
59-
will determine whether to add trailing punctuation corresponding to the
60-
`objectFieldSeparator`. Defaults to `false`.
59+
will determine whether to add punctuation corresponding to the
60+
`objectFieldSeparator` (e.g., a semicolon) to the final object field.
61+
Defaults to `false`.
6162

6263
### `separatorForSingleObjectField`
6364

64-
Whether to apply the `objectFieldSeparator` when there is only one
65-
property-value object field present. Defaults to `false`.
65+
Whether to apply the `objectFieldSeparator` (e.g., a semicolon) when there
66+
is only one property-value object field present. Defaults to `false`.
6667

6768
### `typeBracketSpacing`
6869

@@ -72,14 +73,14 @@ to the empty string.
7273

7374
### `unionSpacing`
7475

75-
Determines the spacing to add to unions (`|`). Defaults to a single space.
76+
Determines the spacing to add to unions (`|`). Defaults to a single space (`" "`).
7677

7778
|||
7879
|---|---|
7980
|Context|everywhere|
80-
|Tags|``|
81+
|Tags|`param`, `property`, `returns`, `this`, `throws`, `type`, `typedef`, `yields`|
8182
|Recommended|false|
82-
|Settings||
83+
|Settings|`mode`|
8384
|Options|`arrayBrackets`, `enableFixer`, `genericDot`, `objectFieldIndent`, `objectFieldQuote`, `objectFieldSeparator`, `objectFieldSeparatorTrailingPunctuation`, `propertyQuotes`, `separatorForSingleObjectField`, `stringQuotes`, `typeBracketSpacing`, `unionSpacing`|
8485

8586
## Failing examples

docs/rules/type-formatting.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,25 @@ Defaults to `"comma"`.
6969
<a name="type-formatting-options-objectfieldindent"></a>
7070
### <code>objectFieldIndent</code>
7171

72-
Indicates the whitespace to be added on each line preceding an object
73-
property-value field. Defaults to the empty string.
72+
A string indicating the whitespace to be added on each line preceding an
73+
object property-value field. Defaults to the empty string.
7474

7575
<a name="user-content-type-formatting-options-objectfieldseparatortrailingpunctuation"></a>
7676
<a name="type-formatting-options-objectfieldseparatortrailingpunctuation"></a>
7777
### <code>objectFieldSeparatorTrailingPunctuation</code>
7878

7979
If `separatorForSingleObjectField` is not in effect (i.e., if it is `false`
8080
or there are multiple property-value object fields present), this property
81-
will determine whether to add trailing punctuation corresponding to the
82-
`objectFieldSeparator`. Defaults to `false`.
81+
will determine whether to add punctuation corresponding to the
82+
`objectFieldSeparator` (e.g., a semicolon) to the final object field.
83+
Defaults to `false`.
8384

8485
<a name="user-content-type-formatting-options-separatorforsingleobjectfield"></a>
8586
<a name="type-formatting-options-separatorforsingleobjectfield"></a>
8687
### <code>separatorForSingleObjectField</code>
8788

88-
Whether to apply the `objectFieldSeparator` when there is only one
89-
property-value object field present. Defaults to `false`.
89+
Whether to apply the `objectFieldSeparator` (e.g., a semicolon) when there
90+
is only one property-value object field present. Defaults to `false`.
9091

9192
<a name="user-content-type-formatting-options-typebracketspacing"></a>
9293
<a name="type-formatting-options-typebracketspacing"></a>
@@ -100,14 +101,14 @@ to the empty string.
100101
<a name="type-formatting-options-unionspacing"></a>
101102
### <code>unionSpacing</code>
102103

103-
Determines the spacing to add to unions (`|`). Defaults to a single space.
104+
Determines the spacing to add to unions (`|`). Defaults to a single space (`" "`).
104105

105106
|||
106107
|---|---|
107108
|Context|everywhere|
108-
|Tags|``|
109+
|Tags|`param`, `property`, `returns`, `this`, `throws`, `type`, `typedef`, `yields`|
109110
|Recommended|false|
110-
|Settings||
111+
|Settings|`mode`|
111112
|Options|`arrayBrackets`, `enableFixer`, `genericDot`, `objectFieldIndent`, `objectFieldQuote`, `objectFieldSeparator`, `objectFieldSeparatorTrailingPunctuation`, `propertyQuotes`, `separatorForSingleObjectField`, `stringQuotes`, `typeBracketSpacing`, `unionSpacing`|
112113

113114
<a name="user-content-type-formatting-failing-examples"></a>

src/rules/typeFormatting.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,13 @@ export default iterateJsdoc(({
326326

327327
const tags = utils.getPresentTags([
328328
'param',
329+
'property',
329330
'returns',
331+
'this',
332+
'throws',
330333
'type',
331334
'typedef',
335+
'yields',
332336
]);
333337
for (const tag of tags) {
334338
if (tag.type) {

0 commit comments

Comments
 (0)