@@ -79,13 +79,19 @@ property-value field. Defaults to the empty string.
79
79
Whether to apply the ` objectFieldSeparator ` when there is only one
80
80
property-value object field present. Defaults to ` false ` .
81
81
82
+ <a name =" user-content-type-formatting-options-unionspacing " ></a >
83
+ <a name =" type-formatting-options-unionspacing " ></a >
84
+ ### <code >unionSpacing</code >
85
+
86
+ Determines the spacing to add to unions (` | ` ). Defaults to a single space.
87
+
82
88
|||
83
89
| ---| ---|
84
90
| Context| everywhere|
85
91
| Tags| ``|
86
92
| Recommended| false|
87
93
| Settings||
88
- | Options| ` arrayBrackets ` , ` enableFixer ` , ` genericDot ` , ` objectFieldIndent ` , ` objectFieldQuote ` , ` objectFieldSeparator ` , ` propertyQuotes ` , ` separatorForSingleObjectField ` , ` stringQuotes ` |
94
+ | Options| ` arrayBrackets ` , ` enableFixer ` , ` genericDot ` , ` objectFieldIndent ` , ` objectFieldQuote ` , ` objectFieldSeparator ` , ` propertyQuotes ` , ` separatorForSingleObjectField ` , ` stringQuotes ` , ` unionSpacing ` |
89
95
90
96
<a name =" user-content-type-formatting-failing-examples " ></a >
91
97
<a name =" type-formatting-failing-examples " ></a >
@@ -98,32 +104,32 @@ The following patterns are considered problems:
98
104
* @param {{a: string; b: number; c: boolean,}} cfg
99
105
*/
100
106
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldSeparator":"semicolon"}]
101
- // Message: Inconsistent semicolon usage
107
+ // Message: Inconsistent semicolon separator usage
102
108
103
109
/**
104
110
* @param {{a: string; b: number; c: boolean,}} cfg
105
111
*/
106
112
// Settings: {"jsdoc":{"mode":"permissive"}}
107
113
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldSeparator":"semicolon"}]
108
- // Message: Inconsistent semicolon usage
114
+ // Message: Inconsistent semicolon separator usage
109
115
110
116
/**
111
117
* @param {{a: string; b: number; c: boolean,}} cfg
112
118
*/
113
119
// "jsdoc/type-formatting": ["error"|"warn", {"enableFixer":false,"objectFieldSeparator":"semicolon"}]
114
- // Message: Inconsistent semicolon usage
120
+ // Message: Inconsistent semicolon separator usage
115
121
116
122
/**
117
123
* @param {{a: string, b: number; c: boolean;}} cfg
118
124
*/
119
125
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldSeparator":"comma"}]
120
- // Message: Inconsistent comma usage
126
+ // Message: Inconsistent comma separator usage
121
127
122
128
/**
123
129
* @param {{a: string, b: number; c: boolean,}} cfg
124
130
*/
125
131
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldIndent":" ","objectFieldSeparator":"linebreak"}]
126
- // Message: Inconsistent linebreak usage
132
+ // Message: Inconsistent linebreak separator usage
127
133
128
134
/**
129
135
* @param {{
@@ -133,7 +139,7 @@ The following patterns are considered problems:
133
139
* }} cfg
134
140
*/
135
141
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldIndent":" ","objectFieldSeparator":"linebreak"}]
136
- // Message: Inconsistent linebreak usage
142
+ // Message: Inconsistent linebreak separator usage
137
143
138
144
/**
139
145
* @param {'abc'} cfg
@@ -170,21 +176,21 @@ The following patterns are considered problems:
170
176
* description
171
177
*/
172
178
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldIndent":" ","objectFieldSeparator":"semicolon","separatorForSingleObjectField":true}]
173
- // Message: Inconsistent semicolon usage
179
+ // Message: Inconsistent semicolon separator usage
174
180
175
181
/** @param {{a: string, b: number; c: boolean,}} cfg */
176
182
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldIndent":" ","objectFieldSeparator":"linebreak"}]
177
- // Message: Inconsistent linebreak usage
183
+ // Message: Inconsistent linebreak separator usage
178
184
179
185
/**
180
186
* @param {{a: string, b: number; c: boolean,}} cfg */
181
187
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldIndent":" ","objectFieldSeparator":"linebreak"}]
182
- // Message: Inconsistent linebreak usage
188
+ // Message: Inconsistent linebreak separator usage
183
189
184
190
/** @param {{a: string, b: number; c: boolean,}} cfg
185
191
*/
186
192
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldIndent":" ","objectFieldSeparator":"linebreak"}]
187
- // Message: Inconsistent linebreak usage
193
+ // Message: Inconsistent linebreak separator usage
188
194
189
195
/**
190
196
* @param {{
@@ -194,7 +200,27 @@ The following patterns are considered problems:
194
200
* description
195
201
*/
196
202
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldIndent":" ","objectFieldSeparator":"semicolon-and-linebreak"}]
197
- // Message: Inconsistent semicolon-and-linebreak usage
203
+ // Message: Inconsistent semicolon-and-linebreak separator usage
204
+
205
+ /**
206
+ * @param {ab | cd} cfg
207
+ */
208
+ // "jsdoc/type-formatting": ["error"|"warn", {"unionSpacing":""}]
209
+ // Message: Inconsistent "" union spacing usage
210
+
211
+ /**
212
+ * @param {ab|cd} cfg
213
+ */
214
+ // "jsdoc/type-formatting": ["error"|"warn", {"unionSpacing":" "}]
215
+ // Message: Inconsistent " " union spacing usage
216
+
217
+ /**
218
+ * Due to jsdoc-type-pratt-parser representing the separator at the
219
+ * object level, the exact error will not be reported.
220
+ * @param {{a: string, b: number; c: boolean,}} cfg
221
+ */
222
+ // "jsdoc/type-formatting": ["error"|"warn", {"objectFieldSeparator":"comma"}]
223
+ // Message: There was an error with type formatting
198
224
````
199
225
200
226
@@ -226,13 +252,6 @@ The following patterns are not considered problems:
226
252
*/
227
253
// "jsdoc/type-formatting": ["error"|"warn", {"genericDot":true}]
228
254
229
- /**
230
- * Due to jsdoc-type-pratt-parser representing the separator at the
231
- * object level, this will not be reported.
232
- * @param {{a: string, b: number; c: boolean,}} cfg
233
- */
234
- // "jsdoc/type-formatting": ["error"|"warn", {"objectFieldSeparator":"comma"}]
235
-
236
255
/**
237
256
* @param {A<} badParam
238
257
*/
@@ -251,6 +270,16 @@ The following patterns are not considered problems:
251
270
*/
252
271
// "jsdoc/type-formatting": ["error"|"warn", {"propertyQuotes":null}]
253
272
273
+ /**
274
+ * @param {ab | cd} cfg
275
+ */
276
+ // "jsdoc/type-formatting": ["error"|"warn", {"unionSpacing":" "}]
277
+
278
+ /**
279
+ * @param {ab|cd} cfg
280
+ */
281
+ // "jsdoc/type-formatting": ["error"|"warn", {"unionSpacing":""}]
282
+
254
283
/**
255
284
* @param cfg
256
285
*/
0 commit comments