eslint-plugin-jsdoc 58.1.0 → 59.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -60
- package/dist/buildForbidRuleDefinition.cjs +0 -1
- package/dist/buildForbidRuleDefinition.cjs.map +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.cjs +7 -2
- package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
- package/dist/cjs/rules/convertToJsdocComments.d.ts +7 -0
- package/dist/generateDocs.cjs +129 -3
- package/dist/generateDocs.cjs.map +1 -1
- package/dist/generateRule.cjs +3 -1
- package/dist/generateRule.cjs.map +1 -1
- package/dist/generateRuleTypes.cjs +5 -5
- package/dist/generateRuleTypes.cjs.map +1 -1
- package/dist/index-cjs.cjs +30 -0
- package/dist/index-cjs.cjs.map +1 -1
- package/dist/index.cjs +30 -0
- package/dist/index.cjs.map +1 -1
- package/dist/rules/checkAccess.cjs +1 -1
- package/dist/rules/checkAccess.cjs.map +1 -1
- package/dist/rules/checkAlignment.cjs +4 -1
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkExamples.cjs +1 -1
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkIndentation.cjs +19 -0
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.cjs +25 -1
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +62 -1
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +6 -0
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +71 -0
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTypes.cjs +16 -1
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkValues.cjs +17 -1
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +48 -0
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.d.ts +7 -0
- package/dist/rules/emptyTags.cjs +10 -1
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/implementsOnClasses.cjs +15 -1
- package/dist/rules/implementsOnClasses.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +45 -0
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +14 -0
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +129 -0
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +30 -0
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +78 -6
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +11 -2
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
- package/dist/rules/noBlankBlocks.cjs +3 -1
- package/dist/rules/noBlankBlocks.cjs.map +1 -1
- package/dist/rules/noDefaults.cjs +19 -0
- package/dist/rules/noDefaults.cjs.map +1 -1
- package/dist/rules/noMissingSyntax.cjs +22 -2
- package/dist/rules/noMissingSyntax.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +29 -0
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.cjs +17 -1
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noTypes.cjs +17 -1
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +11 -1
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +28 -0
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescription.cjs +30 -1
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +27 -0
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireExample.cjs +26 -1
- package/dist/rules/requireExample.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +61 -0
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +20 -2
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +82 -3
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +213 -1
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParamDescription.cjs +21 -0
- package/dist/rules/requireParamDescription.cjs.map +1 -1
- package/dist/rules/requireParamName.cjs +16 -1
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireParamType.cjs +21 -1
- package/dist/rules/requireParamType.cjs.map +1 -1
- package/dist/rules/requirePropertyName.cjs +1 -1
- package/dist/rules/requirePropertyName.cjs.map +1 -1
- package/dist/rules/requirePropertyType.cjs +1 -1
- package/dist/rules/requirePropertyType.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +54 -1
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +22 -1
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.cjs +15 -1
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireReturnsType.cjs +15 -1
- package/dist/rules/requireReturnsType.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +17 -1
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireThrows.cjs +18 -1
- package/dist/rules/requireThrows.cjs.map +1 -1
- package/dist/rules/requireYields.cjs +50 -1
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.cjs +25 -7
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +200 -1
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +32 -2
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/textEscaping.cjs +5 -1
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/typeFormatting.cjs +64 -16
- package/dist/rules/typeFormatting.cjs.map +1 -1
- package/dist/rules/validTypes.cjs +8 -1
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/rules.d.ts +2130 -32
- package/package.json +1 -1
- package/src/buildForbidRuleDefinition.js +0 -1
- package/src/buildRejectOrPreferRuleDefinition.js +12 -2
- package/src/index-cjs.js +36 -0
- package/src/index.js +36 -0
- package/src/rules/checkAccess.js +1 -1
- package/src/rules/checkAlignment.js +3 -0
- package/src/rules/checkExamples.js +1 -1
- package/src/rules/checkIndentation.js +19 -0
- package/src/rules/checkLineAlignment.js +24 -0
- package/src/rules/checkParamNames.js +62 -1
- package/src/rules/checkPropertyNames.js +6 -0
- package/src/rules/checkTagNames.js +71 -0
- package/src/rules/checkTypes.js +16 -1
- package/src/rules/checkValues.js +16 -0
- package/src/rules/convertToJsdocComments.js +48 -0
- package/src/rules/emptyTags.js +10 -1
- package/src/rules/implementsOnClasses.js +15 -1
- package/src/rules/informativeDocs.js +45 -0
- package/src/rules/linesBeforeBlock.js +14 -0
- package/src/rules/matchDescription.js +129 -0
- package/src/rules/matchName.js +30 -0
- package/src/rules/multilineBlocks.js +77 -5
- package/src/rules/noBadBlocks.js +11 -2
- package/src/rules/noBlankBlockDescriptions.js +1 -1
- package/src/rules/noBlankBlocks.js +2 -0
- package/src/rules/noDefaults.js +19 -0
- package/src/rules/noMissingSyntax.js +22 -2
- package/src/rules/noMultiAsterisks.js +29 -0
- package/src/rules/noRestrictedSyntax.js +17 -1
- package/src/rules/noTypes.js +17 -1
- package/src/rules/noUndefinedTypes.js +11 -1
- package/src/rules/requireAsteriskPrefix.js +28 -0
- package/src/rules/requireDescription.js +30 -1
- package/src/rules/requireDescriptionCompleteSentence.js +27 -0
- package/src/rules/requireExample.js +26 -1
- package/src/rules/requireFileOverview.js +61 -0
- package/src/rules/requireHyphenBeforeParamDescription.js +19 -1
- package/src/rules/requireJsdoc.js +80 -1
- package/src/rules/requireParam.js +213 -1
- package/src/rules/requireParamDescription.js +21 -0
- package/src/rules/requireParamName.js +16 -1
- package/src/rules/requireParamType.js +21 -1
- package/src/rules/requirePropertyName.js +1 -1
- package/src/rules/requirePropertyType.js +1 -1
- package/src/rules/requireReturns.js +54 -1
- package/src/rules/requireReturnsCheck.js +22 -1
- package/src/rules/requireReturnsDescription.js +15 -1
- package/src/rules/requireReturnsType.js +15 -1
- package/src/rules/requireTemplate.js +17 -1
- package/src/rules/requireThrows.js +18 -1
- package/src/rules/requireYields.js +50 -1
- package/src/rules/requireYieldsCheck.js +25 -7
- package/src/rules/sortTags.js +200 -1
- package/src/rules/tagLines.js +30 -0
- package/src/rules/textEscaping.js +5 -1
- package/src/rules/typeFormatting.js +57 -19
- package/src/rules/validTypes.js +8 -1
- package/src/rules.d.ts +2130 -32
- package/typings/gitdown.d.ts +4 -0
package/package.json
CHANGED
|
@@ -59,7 +59,6 @@ export const buildForbidRuleDefinition = ({
|
|
|
59
59
|
description: description ?? contextName ?? 'Reports when certain comment structures are present.',
|
|
60
60
|
url: url ?? 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/advanced.md#user-content-advanced-creating-your-own-rules',
|
|
61
61
|
},
|
|
62
|
-
fixable: 'code',
|
|
63
62
|
schema: [],
|
|
64
63
|
type: 'suggestion',
|
|
65
64
|
},
|
|
@@ -111,7 +111,7 @@ const infoUC = {
|
|
|
111
111
|
export const buildRejectOrPreferRuleDefinition = ({
|
|
112
112
|
checkNativeTypes = null,
|
|
113
113
|
typeName,
|
|
114
|
-
description = typeName ?? 'Reports invalid
|
|
114
|
+
description = typeName ?? 'Reports types deemed invalid (customizable and with defaults, for preventing and/or recommending replacements).',
|
|
115
115
|
overrideSettings = null,
|
|
116
116
|
schema = [],
|
|
117
117
|
url = 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-types.md#repos-sticky-header',
|
|
@@ -463,7 +463,17 @@ export const buildRejectOrPreferRuleDefinition = ({
|
|
|
463
463
|
description,
|
|
464
464
|
url,
|
|
465
465
|
},
|
|
466
|
-
|
|
466
|
+
...(!overrideSettings || (Object.values(overrideSettings).some((os) => {
|
|
467
|
+
return os && typeof os === 'object' ?
|
|
468
|
+
/* c8 ignore next -- Ok */
|
|
469
|
+
os.replacement :
|
|
470
|
+
typeof os === 'string';
|
|
471
|
+
})) ?
|
|
472
|
+
{
|
|
473
|
+
fixable: 'code',
|
|
474
|
+
} :
|
|
475
|
+
{}
|
|
476
|
+
),
|
|
467
477
|
schema,
|
|
468
478
|
type: 'suggestion',
|
|
469
479
|
},
|
package/src/index-cjs.js
CHANGED
|
@@ -144,6 +144,17 @@ index.rules = {
|
|
|
144
144
|
'require-file-overview': requireFileOverview,
|
|
145
145
|
'require-hyphen-before-param-description': requireHyphenBeforeParamDescription,
|
|
146
146
|
'require-jsdoc': requireJsdoc,
|
|
147
|
+
'require-next-description': buildForbidRuleDefinition({
|
|
148
|
+
contexts: [
|
|
149
|
+
{
|
|
150
|
+
comment: 'JsdocBlock:has(JsdocTag[tag=next]:not([name!=""]))',
|
|
151
|
+
context: 'any',
|
|
152
|
+
message: '@next should have a description',
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
description: 'Requires a description for `@next` tags',
|
|
156
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-next-description.md#repos-sticky-header',
|
|
157
|
+
}),
|
|
147
158
|
'require-next-type': buildForbidRuleDefinition({
|
|
148
159
|
contexts: [
|
|
149
160
|
{
|
|
@@ -169,6 +180,17 @@ index.rules = {
|
|
|
169
180
|
'require-returns-type': requireReturnsType,
|
|
170
181
|
'require-template': requireTemplate,
|
|
171
182
|
'require-throws': requireThrows,
|
|
183
|
+
'require-throws-description': buildForbidRuleDefinition({
|
|
184
|
+
contexts: [
|
|
185
|
+
{
|
|
186
|
+
comment: 'JsdocBlock:has(JsdocTag[tag=throws]:not([description!=""]))',
|
|
187
|
+
context: 'any',
|
|
188
|
+
message: '@throws should have a description',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
description: 'Requires a description for `@throws` tags',
|
|
192
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-throws-description.md#repos-sticky-header',
|
|
193
|
+
}),
|
|
172
194
|
'require-throws-type': buildForbidRuleDefinition({
|
|
173
195
|
contexts: [
|
|
174
196
|
{
|
|
@@ -182,6 +204,17 @@ index.rules = {
|
|
|
182
204
|
}),
|
|
183
205
|
'require-yields': requireYields,
|
|
184
206
|
'require-yields-check': requireYieldsCheck,
|
|
207
|
+
'require-yields-description': buildForbidRuleDefinition({
|
|
208
|
+
contexts: [
|
|
209
|
+
{
|
|
210
|
+
comment: 'JsdocBlock:has(JsdocTag[tag=yields]:not([name!=""]))',
|
|
211
|
+
context: 'any',
|
|
212
|
+
message: '@yields should have a description',
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
description: 'Requires a description for `@yields` tags',
|
|
216
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields-description.md#repos-sticky-header',
|
|
217
|
+
}),
|
|
185
218
|
'require-yields-type': buildForbidRuleDefinition({
|
|
186
219
|
contexts: [
|
|
187
220
|
{
|
|
@@ -257,6 +290,7 @@ const createRecommendedRuleset = (warnOrError, flatName) => {
|
|
|
257
290
|
'jsdoc/require-file-overview': 'off',
|
|
258
291
|
'jsdoc/require-hyphen-before-param-description': 'off',
|
|
259
292
|
'jsdoc/require-jsdoc': warnOrError,
|
|
293
|
+
'jsdoc/require-next-description': 'off',
|
|
260
294
|
'jsdoc/require-next-type': warnOrError,
|
|
261
295
|
'jsdoc/require-param': warnOrError,
|
|
262
296
|
'jsdoc/require-param-description': warnOrError,
|
|
@@ -272,9 +306,11 @@ const createRecommendedRuleset = (warnOrError, flatName) => {
|
|
|
272
306
|
'jsdoc/require-returns-type': warnOrError,
|
|
273
307
|
'jsdoc/require-template': 'off',
|
|
274
308
|
'jsdoc/require-throws': 'off',
|
|
309
|
+
'jsdoc/require-throws-description': 'off',
|
|
275
310
|
'jsdoc/require-throws-type': warnOrError,
|
|
276
311
|
'jsdoc/require-yields': warnOrError,
|
|
277
312
|
'jsdoc/require-yields-check': warnOrError,
|
|
313
|
+
'jsdoc/require-yields-description': 'off',
|
|
278
314
|
'jsdoc/require-yields-type': warnOrError,
|
|
279
315
|
'jsdoc/sort-tags': 'off',
|
|
280
316
|
'jsdoc/tag-lines': warnOrError,
|
package/src/index.js
CHANGED
|
@@ -150,6 +150,17 @@ index.rules = {
|
|
|
150
150
|
'require-file-overview': requireFileOverview,
|
|
151
151
|
'require-hyphen-before-param-description': requireHyphenBeforeParamDescription,
|
|
152
152
|
'require-jsdoc': requireJsdoc,
|
|
153
|
+
'require-next-description': buildForbidRuleDefinition({
|
|
154
|
+
contexts: [
|
|
155
|
+
{
|
|
156
|
+
comment: 'JsdocBlock:has(JsdocTag[tag=next]:not([name!=""]))',
|
|
157
|
+
context: 'any',
|
|
158
|
+
message: '@next should have a description',
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
description: 'Requires a description for `@next` tags',
|
|
162
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-next-description.md#repos-sticky-header',
|
|
163
|
+
}),
|
|
153
164
|
'require-next-type': buildForbidRuleDefinition({
|
|
154
165
|
contexts: [
|
|
155
166
|
{
|
|
@@ -175,6 +186,17 @@ index.rules = {
|
|
|
175
186
|
'require-returns-type': requireReturnsType,
|
|
176
187
|
'require-template': requireTemplate,
|
|
177
188
|
'require-throws': requireThrows,
|
|
189
|
+
'require-throws-description': buildForbidRuleDefinition({
|
|
190
|
+
contexts: [
|
|
191
|
+
{
|
|
192
|
+
comment: 'JsdocBlock:has(JsdocTag[tag=throws]:not([description!=""]))',
|
|
193
|
+
context: 'any',
|
|
194
|
+
message: '@throws should have a description',
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
description: 'Requires a description for `@throws` tags',
|
|
198
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-throws-description.md#repos-sticky-header',
|
|
199
|
+
}),
|
|
178
200
|
'require-throws-type': buildForbidRuleDefinition({
|
|
179
201
|
contexts: [
|
|
180
202
|
{
|
|
@@ -188,6 +210,17 @@ index.rules = {
|
|
|
188
210
|
}),
|
|
189
211
|
'require-yields': requireYields,
|
|
190
212
|
'require-yields-check': requireYieldsCheck,
|
|
213
|
+
'require-yields-description': buildForbidRuleDefinition({
|
|
214
|
+
contexts: [
|
|
215
|
+
{
|
|
216
|
+
comment: 'JsdocBlock:has(JsdocTag[tag=yields]:not([name!=""]))',
|
|
217
|
+
context: 'any',
|
|
218
|
+
message: '@yields should have a description',
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
description: 'Requires a description for `@yields` tags',
|
|
222
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields-description.md#repos-sticky-header',
|
|
223
|
+
}),
|
|
191
224
|
'require-yields-type': buildForbidRuleDefinition({
|
|
192
225
|
contexts: [
|
|
193
226
|
{
|
|
@@ -263,6 +296,7 @@ const createRecommendedRuleset = (warnOrError, flatName) => {
|
|
|
263
296
|
'jsdoc/require-file-overview': 'off',
|
|
264
297
|
'jsdoc/require-hyphen-before-param-description': 'off',
|
|
265
298
|
'jsdoc/require-jsdoc': warnOrError,
|
|
299
|
+
'jsdoc/require-next-description': 'off',
|
|
266
300
|
'jsdoc/require-next-type': warnOrError,
|
|
267
301
|
'jsdoc/require-param': warnOrError,
|
|
268
302
|
'jsdoc/require-param-description': warnOrError,
|
|
@@ -278,9 +312,11 @@ const createRecommendedRuleset = (warnOrError, flatName) => {
|
|
|
278
312
|
'jsdoc/require-returns-type': warnOrError,
|
|
279
313
|
'jsdoc/require-template': 'off',
|
|
280
314
|
'jsdoc/require-throws': 'off',
|
|
315
|
+
'jsdoc/require-throws-description': 'off',
|
|
281
316
|
'jsdoc/require-throws-type': warnOrError,
|
|
282
317
|
'jsdoc/require-yields': warnOrError,
|
|
283
318
|
'jsdoc/require-yields-check': warnOrError,
|
|
319
|
+
'jsdoc/require-yields-description': 'off',
|
|
284
320
|
'jsdoc/require-yields-type': warnOrError,
|
|
285
321
|
'jsdoc/sort-tags': 'off',
|
|
286
322
|
'jsdoc/tag-lines': warnOrError,
|
package/src/rules/checkAccess.js
CHANGED
|
@@ -69,9 +69,12 @@ export default iterateJsdoc(({
|
|
|
69
69
|
properties: {
|
|
70
70
|
innerIndent: {
|
|
71
71
|
default: 1,
|
|
72
|
+
description: `Set to 0 if you wish to avoid the normal requirement for an inner indentation of
|
|
73
|
+
one space. Defaults to 1 (one space of normal inner indentation).`,
|
|
72
74
|
type: 'integer',
|
|
73
75
|
},
|
|
74
76
|
},
|
|
77
|
+
type: 'object',
|
|
75
78
|
},
|
|
76
79
|
],
|
|
77
80
|
type: 'layout',
|
|
@@ -536,7 +536,7 @@ export default iterateJsdoc(({
|
|
|
536
536
|
iterateAllJsdocs: true,
|
|
537
537
|
meta: {
|
|
538
538
|
docs: {
|
|
539
|
-
description: 'Ensures that (JavaScript)
|
|
539
|
+
description: 'Ensures that (JavaScript) samples within `@example` tags adhere to ESLint rules.',
|
|
540
540
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-examples.md#repos-sticky-header',
|
|
541
541
|
},
|
|
542
542
|
schema: [
|
|
@@ -60,6 +60,25 @@ export default iterateJsdoc(({
|
|
|
60
60
|
additionalProperties: false,
|
|
61
61
|
properties: {
|
|
62
62
|
excludeTags: {
|
|
63
|
+
description: `Array of tags (e.g., \`['example', 'description']\`) whose content will be
|
|
64
|
+
"hidden" from the \`check-indentation\` rule. Defaults to \`['example']\`.
|
|
65
|
+
|
|
66
|
+
By default, the whole JSDoc block will be checked for invalid padding.
|
|
67
|
+
That would include \`@example\` blocks too, which can get in the way
|
|
68
|
+
of adding full, readable examples of code without ending up with multiple
|
|
69
|
+
linting issues.
|
|
70
|
+
|
|
71
|
+
When disabled (by passing \`excludeTags: []\` option), the following code *will*
|
|
72
|
+
report a padding issue:
|
|
73
|
+
|
|
74
|
+
\`\`\`js
|
|
75
|
+
/**
|
|
76
|
+
* @example
|
|
77
|
+
* anArray.filter((a) => {
|
|
78
|
+
* return a.b;
|
|
79
|
+
* });
|
|
80
|
+
*/
|
|
81
|
+
\`\`\``,
|
|
63
82
|
items: {
|
|
64
83
|
pattern: '^\\S+$',
|
|
65
84
|
type: 'string',
|
|
@@ -319,6 +319,14 @@ export default iterateJsdoc(({
|
|
|
319
319
|
fixable: 'whitespace',
|
|
320
320
|
schema: [
|
|
321
321
|
{
|
|
322
|
+
description: `If the string value is
|
|
323
|
+
\`"always"\` then a problem is raised when the lines are not aligned.
|
|
324
|
+
If it is \`"never"\` then a problem should be raised when there is more than
|
|
325
|
+
one space between each line's parts. If it is \`"any"\`, no alignment is made.
|
|
326
|
+
Defaults to \`"never"\`.
|
|
327
|
+
|
|
328
|
+
Note that in addition to alignment, the "never" and "always" options will both
|
|
329
|
+
ensure that at least one space is present after the asterisk delimiter.`,
|
|
322
330
|
enum: [
|
|
323
331
|
'always', 'never', 'any',
|
|
324
332
|
],
|
|
@@ -329,38 +337,54 @@ export default iterateJsdoc(({
|
|
|
329
337
|
properties: {
|
|
330
338
|
customSpacings: {
|
|
331
339
|
additionalProperties: false,
|
|
340
|
+
description: `An object with any of the following spacing keys set to an integer.
|
|
341
|
+
If a spacing is not defined, it defaults to one.
|
|
342
|
+
`,
|
|
332
343
|
properties: {
|
|
333
344
|
postDelimiter: {
|
|
345
|
+
description: 'Affects spacing after the asterisk (e.g., `* @param`)',
|
|
334
346
|
type: 'integer',
|
|
335
347
|
},
|
|
336
348
|
postHyphen: {
|
|
349
|
+
description: 'Affects spacing after any hyphens in the description (e.g., `* @param {someType} name - A description`)',
|
|
337
350
|
type: 'integer',
|
|
338
351
|
},
|
|
339
352
|
postName: {
|
|
353
|
+
description: 'Affects spacing after the name (e.g., `* @param {someType} name `)',
|
|
340
354
|
type: 'integer',
|
|
341
355
|
},
|
|
342
356
|
postTag: {
|
|
357
|
+
description: 'Affects spacing after the tag (e.g., `* @param `)',
|
|
343
358
|
type: 'integer',
|
|
344
359
|
},
|
|
345
360
|
postType: {
|
|
361
|
+
description: 'Affects spacing after the type (e.g., `* @param {someType} `)',
|
|
346
362
|
type: 'integer',
|
|
347
363
|
},
|
|
348
364
|
},
|
|
365
|
+
type: 'object',
|
|
349
366
|
},
|
|
350
367
|
disableWrapIndent: {
|
|
368
|
+
description: 'Disables `wrapIndent`; existing wrap indentation is preserved without changes.',
|
|
351
369
|
type: 'boolean',
|
|
352
370
|
},
|
|
353
371
|
preserveMainDescriptionPostDelimiter: {
|
|
354
372
|
default: false,
|
|
373
|
+
description: `A boolean to determine whether to preserve the post-delimiter spacing of the
|
|
374
|
+
main description. If \`false\` or unset, will be set to a single space.`,
|
|
355
375
|
type: 'boolean',
|
|
356
376
|
},
|
|
357
377
|
tags: {
|
|
378
|
+
description: `Use this to change the tags which are sought for alignment changes. Defaults to an array of
|
|
379
|
+
\`['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template']\`.`,
|
|
358
380
|
items: {
|
|
359
381
|
type: 'string',
|
|
360
382
|
},
|
|
361
383
|
type: 'array',
|
|
362
384
|
},
|
|
363
385
|
wrapIndent: {
|
|
386
|
+
description: `The indent that will be applied for tag text after the first line.
|
|
387
|
+
Default to the empty string (no indent).`,
|
|
364
388
|
type: 'string',
|
|
365
389
|
},
|
|
366
390
|
},
|
|
@@ -433,7 +433,7 @@ export default iterateJsdoc(({
|
|
|
433
433
|
contextDefaults: allowedNodes,
|
|
434
434
|
meta: {
|
|
435
435
|
docs: {
|
|
436
|
-
description: '
|
|
436
|
+
description: 'Checks for dupe `@param` names, that nested param names have roots, and that parameter names in function declarations match JSDoc param names.',
|
|
437
437
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-param-names.md#repos-sticky-header',
|
|
438
438
|
},
|
|
439
439
|
fixable: 'code',
|
|
@@ -442,27 +442,88 @@ export default iterateJsdoc(({
|
|
|
442
442
|
additionalProperties: false,
|
|
443
443
|
properties: {
|
|
444
444
|
allowExtraTrailingParamDocs: {
|
|
445
|
+
description: `If set to \`true\`, this option will allow extra \`@param\` definitions (e.g.,
|
|
446
|
+
representing future expected or virtual params) to be present without needing
|
|
447
|
+
their presence within the function signature. Other inconsistencies between
|
|
448
|
+
\`@param\`'s and present function parameters will still be reported.`,
|
|
445
449
|
type: 'boolean',
|
|
446
450
|
},
|
|
447
451
|
checkDestructured: {
|
|
452
|
+
description: 'Whether to check destructured properties. Defaults to `true`.',
|
|
448
453
|
type: 'boolean',
|
|
449
454
|
},
|
|
450
455
|
checkRestProperty: {
|
|
456
|
+
description: `If set to \`true\`, will require that rest properties are documented and
|
|
457
|
+
that any extraneous properties (which may have been within the rest property)
|
|
458
|
+
are documented. Defaults to \`false\`.`,
|
|
451
459
|
type: 'boolean',
|
|
452
460
|
},
|
|
453
461
|
checkTypesPattern: {
|
|
462
|
+
description: `Defines a regular expression pattern to indicate which types should be
|
|
463
|
+
checked for destructured content (and that those not matched should not
|
|
464
|
+
be checked).
|
|
465
|
+
|
|
466
|
+
When one specifies a type, unless it is of a generic type, like \`object\`
|
|
467
|
+
or \`array\`, it may be considered unnecessary to have that object's
|
|
468
|
+
destructured components required, especially where generated docs will
|
|
469
|
+
link back to the specified type. For example:
|
|
470
|
+
|
|
471
|
+
\`\`\`js
|
|
472
|
+
/**
|
|
473
|
+
* @param {SVGRect} bbox - a SVGRect
|
|
474
|
+
*/
|
|
475
|
+
export const bboxToObj = function ({x, y, width, height}) {
|
|
476
|
+
return {x, y, width, height};
|
|
477
|
+
};
|
|
478
|
+
\`\`\`
|
|
479
|
+
|
|
480
|
+
By default \`checkTypesPattern\` is set to
|
|
481
|
+
\`/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v\`,
|
|
482
|
+
meaning that destructuring will be required only if the type of the \`@param\`
|
|
483
|
+
(the text between curly brackets) is a match for "Object" or "Array" (with or
|
|
484
|
+
without initial caps), "PlainObject", or "GenericObject", "GenericArray" (or
|
|
485
|
+
if no type is present). So in the above example, the lack of a match will
|
|
486
|
+
mean that no complaint will be given about the undocumented destructured
|
|
487
|
+
parameters.
|
|
488
|
+
|
|
489
|
+
Note that the \`/\` delimiters are optional, but necessary to add flags.
|
|
490
|
+
|
|
491
|
+
Defaults to using (only) the \`v\` flag, so to add your own flags, encapsulate
|
|
492
|
+
your expression as a string, but like a literal, e.g., \`/^object$/vi\`.
|
|
493
|
+
|
|
494
|
+
You could set this regular expression to a more expansive list, or you
|
|
495
|
+
could restrict it such that even types matching those strings would not
|
|
496
|
+
need destructuring.`,
|
|
454
497
|
type: 'string',
|
|
455
498
|
},
|
|
456
499
|
disableExtraPropertyReporting: {
|
|
500
|
+
description: `Whether to check for extra destructured properties. Defaults to \`false\`. Change
|
|
501
|
+
to \`true\` if you want to be able to document properties which are not actually
|
|
502
|
+
destructured. Keep as \`false\` if you expect properties to be documented in
|
|
503
|
+
their own types. Note that extra properties will always be reported if another
|
|
504
|
+
item at the same level is destructured as destructuring will prevent other
|
|
505
|
+
access and this option is only intended to permit documenting extra properties
|
|
506
|
+
that are available and actually used in the function.`,
|
|
457
507
|
type: 'boolean',
|
|
458
508
|
},
|
|
459
509
|
disableMissingParamChecks: {
|
|
510
|
+
description: 'Whether to avoid checks for missing `@param` definitions. Defaults to `false`. Change to `true` if you want to be able to omit properties.',
|
|
460
511
|
type: 'boolean',
|
|
461
512
|
},
|
|
462
513
|
enableFixer: {
|
|
514
|
+
description: `Set to \`true\` to auto-remove \`@param\` duplicates (based on identical
|
|
515
|
+
names).
|
|
516
|
+
|
|
517
|
+
Note that this option will remove duplicates of the same name even if
|
|
518
|
+
the definitions do not match in other ways (e.g., the second param will
|
|
519
|
+
be removed even if it has a different type or description).`,
|
|
463
520
|
type: 'boolean',
|
|
464
521
|
},
|
|
465
522
|
useDefaultObjectProperties: {
|
|
523
|
+
description: `Set to \`true\` if you wish to avoid reporting of child property documentation
|
|
524
|
+
where instead of destructuring, a whole plain object is supplied as default
|
|
525
|
+
value but you wish its keys to be considered as signalling that the properties
|
|
526
|
+
are present and can therefore be documented. Defaults to \`false\`.`,
|
|
466
527
|
type: 'boolean',
|
|
467
528
|
},
|
|
468
529
|
},
|
|
@@ -141,6 +141,12 @@ export default iterateJsdoc(({
|
|
|
141
141
|
additionalProperties: false,
|
|
142
142
|
properties: {
|
|
143
143
|
enableFixer: {
|
|
144
|
+
description: `Set to \`true\` to auto-remove \`@property\` duplicates (based on
|
|
145
|
+
identical names).
|
|
146
|
+
|
|
147
|
+
Note that this option will remove duplicates of the same name even if
|
|
148
|
+
the definitions do not match in other ways (e.g., the second property will
|
|
149
|
+
be removed even if it has a different type or description).`,
|
|
144
150
|
type: 'boolean',
|
|
145
151
|
},
|
|
146
152
|
},
|
|
@@ -291,18 +291,89 @@ export default iterateJsdoc(({
|
|
|
291
291
|
additionalProperties: false,
|
|
292
292
|
properties: {
|
|
293
293
|
definedTags: {
|
|
294
|
+
description: `Use an array of \`definedTags\` strings to configure additional, allowed tags.
|
|
295
|
+
The format is as follows:
|
|
296
|
+
|
|
297
|
+
\`\`\`json
|
|
298
|
+
{
|
|
299
|
+
"definedTags": ["note", "record"]
|
|
300
|
+
}
|
|
301
|
+
\`\`\``,
|
|
294
302
|
items: {
|
|
295
303
|
type: 'string',
|
|
296
304
|
},
|
|
297
305
|
type: 'array',
|
|
298
306
|
},
|
|
299
307
|
enableFixer: {
|
|
308
|
+
description: 'Set to `false` to disable auto-removal of types that are redundant with the [`typed` option](#typed).',
|
|
300
309
|
type: 'boolean',
|
|
301
310
|
},
|
|
302
311
|
jsxTags: {
|
|
312
|
+
description: `If this is set to \`true\`, all of the following tags used to control JSX output are allowed:
|
|
313
|
+
|
|
314
|
+
\`\`\`
|
|
315
|
+
jsx
|
|
316
|
+
jsxFrag
|
|
317
|
+
jsxImportSource
|
|
318
|
+
jsxRuntime
|
|
319
|
+
\`\`\`
|
|
320
|
+
|
|
321
|
+
For more information, see the [babel documentation](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx).`,
|
|
303
322
|
type: 'boolean',
|
|
304
323
|
},
|
|
305
324
|
typed: {
|
|
325
|
+
description: `If this is set to \`true\`, additionally checks for tag names that are redundant when using a type checker such as TypeScript.
|
|
326
|
+
|
|
327
|
+
These tags are always unnecessary when using TypeScript or similar:
|
|
328
|
+
|
|
329
|
+
\`\`\`
|
|
330
|
+
augments
|
|
331
|
+
callback
|
|
332
|
+
class
|
|
333
|
+
enum
|
|
334
|
+
implements
|
|
335
|
+
private
|
|
336
|
+
property
|
|
337
|
+
protected
|
|
338
|
+
public
|
|
339
|
+
readonly
|
|
340
|
+
this
|
|
341
|
+
type
|
|
342
|
+
typedef
|
|
343
|
+
\`\`\`
|
|
344
|
+
|
|
345
|
+
These tags are unnecessary except when inside a TypeScript \`declare\` context:
|
|
346
|
+
|
|
347
|
+
\`\`\`
|
|
348
|
+
abstract
|
|
349
|
+
access
|
|
350
|
+
class
|
|
351
|
+
constant
|
|
352
|
+
constructs
|
|
353
|
+
default
|
|
354
|
+
enum
|
|
355
|
+
export
|
|
356
|
+
exports
|
|
357
|
+
function
|
|
358
|
+
global
|
|
359
|
+
inherits
|
|
360
|
+
instance
|
|
361
|
+
interface
|
|
362
|
+
member
|
|
363
|
+
memberof
|
|
364
|
+
memberOf
|
|
365
|
+
method
|
|
366
|
+
mixes
|
|
367
|
+
mixin
|
|
368
|
+
module
|
|
369
|
+
name
|
|
370
|
+
namespace
|
|
371
|
+
override
|
|
372
|
+
property
|
|
373
|
+
requires
|
|
374
|
+
static
|
|
375
|
+
this
|
|
376
|
+
\`\`\``,
|
|
306
377
|
type: 'boolean',
|
|
307
378
|
},
|
|
308
379
|
},
|
package/src/rules/checkTypes.js
CHANGED
|
@@ -89,13 +89,24 @@ export default buildRejectOrPreferRuleDefinition({
|
|
|
89
89
|
additionalProperties: false,
|
|
90
90
|
properties: {
|
|
91
91
|
exemptTagContexts: {
|
|
92
|
+
description: 'Avoids reporting when a bad type is found on a specified tag.',
|
|
92
93
|
items: {
|
|
93
94
|
additionalProperties: false,
|
|
94
95
|
properties: {
|
|
95
96
|
tag: {
|
|
97
|
+
description: 'Set a key `tag` to the tag to exempt',
|
|
96
98
|
type: 'string',
|
|
97
99
|
},
|
|
98
100
|
types: {
|
|
101
|
+
description: `Set to \`true\` to indicate that any types on that tag will be allowed,
|
|
102
|
+
or to an array of strings which will only allow specific bad types.
|
|
103
|
+
If an array of strings is given, these must match the type exactly,
|
|
104
|
+
e.g., if you only allow \`"object"\`, it will not allow
|
|
105
|
+
\`"object<string, string>"\`. Note that this is different from the
|
|
106
|
+
behavior of \`settings.jsdoc.preferredTypes\`. This option is useful
|
|
107
|
+
for normally restricting generic types like \`object\` with
|
|
108
|
+
\`preferredTypes\`, but allowing \`typedef\` to indicate that its base
|
|
109
|
+
type is \`object\`.`,
|
|
99
110
|
oneOf: [
|
|
100
111
|
{
|
|
101
112
|
type: 'boolean',
|
|
@@ -114,10 +125,14 @@ export default buildRejectOrPreferRuleDefinition({
|
|
|
114
125
|
type: 'array',
|
|
115
126
|
},
|
|
116
127
|
noDefaults: {
|
|
128
|
+
description: `Insists that only the supplied option type
|
|
129
|
+
map is to be used, and that the default preferences (such as "string"
|
|
130
|
+
over "String") will not be enforced. The option's default is \`false\`.`,
|
|
117
131
|
type: 'boolean',
|
|
118
132
|
},
|
|
119
133
|
unifyParentAndChildTypeChecks: {
|
|
120
|
-
description:
|
|
134
|
+
description: `@deprecated Use the \`preferredTypes[preferredType]\` setting of the same name instead.
|
|
135
|
+
If this option is \`true\`, will currently override \`unifyParentAndChildTypeChecks\` on the \`preferredTypes\` setting.`,
|
|
121
136
|
type: 'boolean',
|
|
122
137
|
},
|
|
123
138
|
},
|
package/src/rules/checkValues.js
CHANGED
|
@@ -215,6 +215,8 @@ export default iterateJsdoc(({
|
|
|
215
215
|
additionalProperties: false,
|
|
216
216
|
properties: {
|
|
217
217
|
allowedAuthors: {
|
|
218
|
+
description: `An array of allowable author values. If absent, only non-whitespace will
|
|
219
|
+
be checked for.`,
|
|
218
220
|
items: {
|
|
219
221
|
type: 'string',
|
|
220
222
|
},
|
|
@@ -232,11 +234,25 @@ export default iterateJsdoc(({
|
|
|
232
234
|
type: 'boolean',
|
|
233
235
|
},
|
|
234
236
|
],
|
|
237
|
+
description: `An array of allowable license values or \`true\` to allow any license text.
|
|
238
|
+
If present as an array, will be used in place of [SPDX identifiers](https://spdx.org/licenses/).`,
|
|
235
239
|
},
|
|
236
240
|
licensePattern: {
|
|
241
|
+
description: `A string to be converted into a \`RegExp\` (with \`v\` flag) and whose first
|
|
242
|
+
parenthetical grouping, if present, will match the portion of the license
|
|
243
|
+
description to check (if no grouping is present, then the whole portion
|
|
244
|
+
matched will be used). Defaults to \`/([^\\n\\r]*)/gv\`, i.e., the SPDX expression
|
|
245
|
+
is expected before any line breaks.
|
|
246
|
+
|
|
247
|
+
Note that the \`/\` delimiters are optional, but necessary to add flags.
|
|
248
|
+
|
|
249
|
+
Defaults to using the \`v\` flag, so to add your own flags, encapsulate
|
|
250
|
+
your expression as a string, but like a literal, e.g., \`/^mit$/vi\`.`,
|
|
237
251
|
type: 'string',
|
|
238
252
|
},
|
|
239
253
|
numericOnlyVariation: {
|
|
254
|
+
description: `Whether to enable validation that \`@variation\` must be a number. Defaults to
|
|
255
|
+
\`false\`.`,
|
|
240
256
|
type: 'boolean',
|
|
241
257
|
},
|
|
242
258
|
},
|