eslint-plugin-jsdoc 58.1.1 → 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 -62
- 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 +47 -10
- 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 +44 -7
- package/src/rules/validTypes.js +8 -1
- package/src/rules.d.ts +2130 -32
- package/typings/gitdown.d.ts +4 -0
package/src/rules/noDefaults.js
CHANGED
|
@@ -52,6 +52,20 @@ export default iterateJsdoc(({
|
|
|
52
52
|
additionalProperties: false,
|
|
53
53
|
properties: {
|
|
54
54
|
contexts: {
|
|
55
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
56
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
57
|
+
|
|
58
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
59
|
+
|
|
60
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
61
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
62
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
63
|
+
for finding function blocks not attached to a function declaration or
|
|
64
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
65
|
+
\`@method\`) (including those associated with an \`@interface\`).
|
|
66
|
+
|
|
67
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
68
|
+
section of our Advanced docs for more on the expected format.`,
|
|
55
69
|
items: {
|
|
56
70
|
anyOf: [
|
|
57
71
|
{
|
|
@@ -74,6 +88,11 @@ export default iterateJsdoc(({
|
|
|
74
88
|
type: 'array',
|
|
75
89
|
},
|
|
76
90
|
noOptionalParamNames: {
|
|
91
|
+
description: `Set this to \`true\` to report the presence of optional parameters. May be
|
|
92
|
+
used if the project is insisting on optionality being indicated by
|
|
93
|
+
the presence of ES6 default parameters (bearing in mind that such
|
|
94
|
+
"defaults" are only applied when the supplied value is missing or
|
|
95
|
+
\`undefined\` but not for \`null\` or other "falsey" values).`,
|
|
77
96
|
type: 'boolean',
|
|
78
97
|
},
|
|
79
98
|
},
|
|
@@ -101,7 +101,7 @@ export default iterateJsdoc(({
|
|
|
101
101
|
// Report when MISSING
|
|
102
102
|
contexts.some((cntxt) => {
|
|
103
103
|
const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;
|
|
104
|
-
const comment = typeof cntxt === 'string' ? '' : cntxt?.comment;
|
|
104
|
+
const comment = typeof cntxt === 'string' ? '' : cntxt?.comment ?? '';
|
|
105
105
|
|
|
106
106
|
const contextKey = contextStr === 'any' ? 'undefined' : contextStr;
|
|
107
107
|
|
|
@@ -153,12 +153,32 @@ export default iterateJsdoc(({
|
|
|
153
153
|
description: 'Reports when certain comment structures are always expected.',
|
|
154
154
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-missing-syntax.md#repos-sticky-header',
|
|
155
155
|
},
|
|
156
|
-
fixable: 'code',
|
|
157
156
|
schema: [
|
|
158
157
|
{
|
|
159
158
|
additionalProperties: false,
|
|
160
159
|
properties: {
|
|
161
160
|
contexts: {
|
|
161
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
162
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
163
|
+
|
|
164
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
165
|
+
|
|
166
|
+
Use the \`minimum\` property (defaults to 1) to indicate how many are required
|
|
167
|
+
for the rule to be reported.
|
|
168
|
+
|
|
169
|
+
Use the \`message\` property to indicate the specific error to be shown when an
|
|
170
|
+
error is reported for that context being found missing. You may use
|
|
171
|
+
\`{{context}}\` and \`{{comment}}\` with such messages. Defaults to
|
|
172
|
+
\`"Syntax is required: {{context}}"\`, or with a comment, to
|
|
173
|
+
\`"Syntax is required: {{context}} with {{comment}}"\`.
|
|
174
|
+
|
|
175
|
+
Set to \`"any"\` if you want the rule to apply to any JSDoc block throughout
|
|
176
|
+
your files (as is necessary for finding function blocks not attached to a
|
|
177
|
+
function declaration or expression, i.e., \`@callback\` or \`@function\` (or its
|
|
178
|
+
aliases \`@func\` or \`@method\`) (including those associated with an \`@interface\`).
|
|
179
|
+
|
|
180
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
181
|
+
section of our Advanced docs for more on the expected format.`,
|
|
162
182
|
items: {
|
|
163
183
|
anyOf: [
|
|
164
184
|
{
|
|
@@ -116,12 +116,41 @@ export default iterateJsdoc(({
|
|
|
116
116
|
additionalProperties: false,
|
|
117
117
|
properties: {
|
|
118
118
|
allowWhitespace: {
|
|
119
|
+
description: `Set to \`true\` if you wish to allow asterisks after a space (as with Markdown):
|
|
120
|
+
|
|
121
|
+
\`\`\`js
|
|
122
|
+
/**
|
|
123
|
+
* *bold* text
|
|
124
|
+
*/
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
Defaults to \`false\`.`,
|
|
119
128
|
type: 'boolean',
|
|
120
129
|
},
|
|
121
130
|
preventAtEnd: {
|
|
131
|
+
description: `Prevent the likes of this:
|
|
132
|
+
|
|
133
|
+
\`\`\`js
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
*
|
|
137
|
+
**/
|
|
138
|
+
\`\`\`
|
|
139
|
+
|
|
140
|
+
Defaults to \`true\`.`,
|
|
122
141
|
type: 'boolean',
|
|
123
142
|
},
|
|
124
143
|
preventAtMiddleLines: {
|
|
144
|
+
description: `Prevent the likes of this:
|
|
145
|
+
|
|
146
|
+
\`\`\`js
|
|
147
|
+
/**
|
|
148
|
+
*
|
|
149
|
+
**
|
|
150
|
+
*/
|
|
151
|
+
\`\`\`
|
|
152
|
+
|
|
153
|
+
Defaults to \`true\`.`,
|
|
125
154
|
type: 'boolean',
|
|
126
155
|
},
|
|
127
156
|
},
|
|
@@ -48,12 +48,28 @@ export default iterateJsdoc(({
|
|
|
48
48
|
description: 'Reports when certain comment structures are present.',
|
|
49
49
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-restricted-syntax.md#repos-sticky-header',
|
|
50
50
|
},
|
|
51
|
-
fixable: 'code',
|
|
52
51
|
schema: [
|
|
53
52
|
{
|
|
54
53
|
additionalProperties: false,
|
|
55
54
|
properties: {
|
|
56
55
|
contexts: {
|
|
56
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
57
|
+
\`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
58
|
+
|
|
59
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
60
|
+
|
|
61
|
+
Use the \`message\` property to indicate the specific error to be shown when an
|
|
62
|
+
error is reported for that context being found. Defaults to
|
|
63
|
+
\`"Syntax is restricted: {{context}}"\`, or with a comment, to
|
|
64
|
+
\`"Syntax is restricted: {{context}} with {{comment}}"\`.
|
|
65
|
+
|
|
66
|
+
Set to \`"any"\` if you want the rule to apply to any JSDoc block throughout
|
|
67
|
+
your files (as is necessary for finding function blocks not attached to a
|
|
68
|
+
function declaration or expression, i.e., \`@callback\` or \`@function\` (or its
|
|
69
|
+
aliases \`@func\` or \`@method\`) (including those associated with an \`@interface\`).
|
|
70
|
+
|
|
71
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
72
|
+
section of our Advanced docs for more on the expected format.`,
|
|
57
73
|
items: {
|
|
58
74
|
anyOf: [
|
|
59
75
|
{
|
package/src/rules/noTypes.js
CHANGED
|
@@ -54,7 +54,7 @@ export default iterateJsdoc(({
|
|
|
54
54
|
],
|
|
55
55
|
meta: {
|
|
56
56
|
docs: {
|
|
57
|
-
description: 'This rule reports types being used on `@param` or `@returns
|
|
57
|
+
description: 'This rule reports types being used on `@param` or `@returns` (redundant with TypeScript).',
|
|
58
58
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-types.md#repos-sticky-header',
|
|
59
59
|
},
|
|
60
60
|
fixable: 'code',
|
|
@@ -63,6 +63,22 @@ export default iterateJsdoc(({
|
|
|
63
63
|
additionalProperties: false,
|
|
64
64
|
properties: {
|
|
65
65
|
contexts: {
|
|
66
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
67
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
68
|
+
|
|
69
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
70
|
+
|
|
71
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
72
|
+
\`FunctionExpression\`, \`TSDeclareFunction\`, \`TSMethodSignature\`,
|
|
73
|
+
\`ClassDeclaration\`). Set to \`"any"\` if you want
|
|
74
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
75
|
+
for finding function blocks not attached to a function declaration or
|
|
76
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
77
|
+
\`@method\`) (including those associated with an \`@interface\`).
|
|
78
|
+
|
|
79
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
80
|
+
section of our Advanced docs for more on the expected format.
|
|
81
|
+
`,
|
|
66
82
|
items: {
|
|
67
83
|
anyOf: [
|
|
68
84
|
{
|
|
@@ -517,7 +517,7 @@ export default iterateJsdoc(({
|
|
|
517
517
|
iterateAllJsdocs: true,
|
|
518
518
|
meta: {
|
|
519
519
|
docs: {
|
|
520
|
-
description: '
|
|
520
|
+
description: 'Besides some expected built-in types, prohibits any types not specified as globals or within `@typedef`.',
|
|
521
521
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-undefined-types.md#repos-sticky-header',
|
|
522
522
|
},
|
|
523
523
|
schema: [
|
|
@@ -525,15 +525,25 @@ export default iterateJsdoc(({
|
|
|
525
525
|
additionalProperties: false,
|
|
526
526
|
properties: {
|
|
527
527
|
definedTypes: {
|
|
528
|
+
description: `This array can be populated to indicate other types which
|
|
529
|
+
are automatically considered as defined (in addition to globals, etc.).
|
|
530
|
+
Defaults to an empty array.`,
|
|
528
531
|
items: {
|
|
529
532
|
type: 'string',
|
|
530
533
|
},
|
|
531
534
|
type: 'array',
|
|
532
535
|
},
|
|
533
536
|
disableReporting: {
|
|
537
|
+
description: `Whether to disable reporting of errors. Defaults to
|
|
538
|
+
\`false\`. This may be set to \`true\` in order to take advantage of only
|
|
539
|
+
marking defined variables as used.`,
|
|
534
540
|
type: 'boolean',
|
|
535
541
|
},
|
|
536
542
|
markVariablesAsUsed: {
|
|
543
|
+
description: `Whether to mark variables as used for the purposes
|
|
544
|
+
of the \`no-unused-vars\` rule when they are not found to be undefined.
|
|
545
|
+
Defaults to \`true\`. May be set to \`false\` to enforce a practice of not
|
|
546
|
+
importing types unless used in code.`,
|
|
537
547
|
type: 'boolean',
|
|
538
548
|
},
|
|
539
549
|
},
|
|
@@ -149,6 +149,12 @@ export default iterateJsdoc(({
|
|
|
149
149
|
fixable: 'code',
|
|
150
150
|
schema: [
|
|
151
151
|
{
|
|
152
|
+
description: `If it is \`"always"\` then a problem is raised when there is no asterisk
|
|
153
|
+
prefix on a given JSDoc line. If it is \`"never"\` then a problem is raised
|
|
154
|
+
when there is an asterisk present.
|
|
155
|
+
|
|
156
|
+
The default value is \`"always"\`. You may also set the default to \`"any"\`
|
|
157
|
+
and use the \`tags\` option to apply to specific tags only.`,
|
|
152
158
|
enum: [
|
|
153
159
|
'always', 'never', 'any',
|
|
154
160
|
],
|
|
@@ -159,20 +165,42 @@ export default iterateJsdoc(({
|
|
|
159
165
|
properties: {
|
|
160
166
|
tags: {
|
|
161
167
|
additionalProperties: false,
|
|
168
|
+
description: `If you want different values to apply to specific tags, you may use
|
|
169
|
+
the \`tags\` option object. The keys are \`always\`, \`never\`, or \`any\` and
|
|
170
|
+
the values are arrays of tag names or the special value \`*description\`
|
|
171
|
+
which applies to the main JSDoc block description.
|
|
172
|
+
|
|
173
|
+
\`\`\`js
|
|
174
|
+
{
|
|
175
|
+
'jsdoc/require-asterisk-prefix': ['error', 'always', {
|
|
176
|
+
tags: {
|
|
177
|
+
always: ['*description'],
|
|
178
|
+
any: ['example', 'license'],
|
|
179
|
+
never: ['copyright']
|
|
180
|
+
}
|
|
181
|
+
}]
|
|
182
|
+
}
|
|
183
|
+
\`\`\`
|
|
184
|
+
`,
|
|
162
185
|
properties: {
|
|
163
186
|
always: {
|
|
187
|
+
description: `If it is \`"always"\` then a problem is raised when there is no asterisk
|
|
188
|
+
prefix on a given JSDoc line.`,
|
|
164
189
|
items: {
|
|
165
190
|
type: 'string',
|
|
166
191
|
},
|
|
167
192
|
type: 'array',
|
|
168
193
|
},
|
|
169
194
|
any: {
|
|
195
|
+
description: 'No problem is raised regardless of asterisk presence or non-presence.',
|
|
170
196
|
items: {
|
|
171
197
|
type: 'string',
|
|
172
198
|
},
|
|
173
199
|
type: 'array',
|
|
174
200
|
},
|
|
175
201
|
never: {
|
|
202
|
+
description: `If it is \`"never"\` then a problem is raised
|
|
203
|
+
when there is an asterisk present.`,
|
|
176
204
|
items: {
|
|
177
205
|
type: 'string',
|
|
178
206
|
},
|
|
@@ -99,7 +99,7 @@ export default iterateJsdoc(({
|
|
|
99
99
|
contextDefaults: true,
|
|
100
100
|
meta: {
|
|
101
101
|
docs: {
|
|
102
|
-
description: 'Requires that all functions have a description.',
|
|
102
|
+
description: 'Requires that all functions (and potentially other contexts) have a description.',
|
|
103
103
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-description.md#repos-sticky-header',
|
|
104
104
|
},
|
|
105
105
|
schema: [
|
|
@@ -108,17 +108,38 @@ export default iterateJsdoc(({
|
|
|
108
108
|
properties: {
|
|
109
109
|
checkConstructors: {
|
|
110
110
|
default: true,
|
|
111
|
+
description: `A value indicating whether \`constructor\`s should be
|
|
112
|
+
checked. Defaults to \`true\`.`,
|
|
111
113
|
type: 'boolean',
|
|
112
114
|
},
|
|
113
115
|
checkGetters: {
|
|
114
116
|
default: true,
|
|
117
|
+
description: `A value indicating whether getters should be checked.
|
|
118
|
+
Defaults to \`true\`.`,
|
|
115
119
|
type: 'boolean',
|
|
116
120
|
},
|
|
117
121
|
checkSetters: {
|
|
118
122
|
default: true,
|
|
123
|
+
description: `A value indicating whether setters should be checked.
|
|
124
|
+
Defaults to \`true\`.`,
|
|
119
125
|
type: 'boolean',
|
|
120
126
|
},
|
|
121
127
|
contexts: {
|
|
128
|
+
description: `Set to an array of strings representing the AST context
|
|
129
|
+
where you wish the rule to be applied (e.g., \`ClassDeclaration\` for ES6
|
|
130
|
+
classes).
|
|
131
|
+
|
|
132
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
133
|
+
|
|
134
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`,
|
|
135
|
+
\`FunctionDeclaration\`, \`FunctionExpression\`). Set to \`"any"\` if you want
|
|
136
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
137
|
+
for finding function blocks not attached to a function declaration or
|
|
138
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
139
|
+
\`@method\`) (including those associated with an \`@interface\`).
|
|
140
|
+
|
|
141
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
142
|
+
section of our Advanced docs for more on the expected format.`,
|
|
122
143
|
items: {
|
|
123
144
|
anyOf: [
|
|
124
145
|
{
|
|
@@ -141,12 +162,20 @@ export default iterateJsdoc(({
|
|
|
141
162
|
type: 'array',
|
|
142
163
|
},
|
|
143
164
|
descriptionStyle: {
|
|
165
|
+
description: `Whether to accept implicit descriptions (\`"body"\`) or
|
|
166
|
+
\`@description\` tags (\`"tag"\`) as satisfying the rule. Set to \`"any"\` to
|
|
167
|
+
accept either style. Defaults to \`"body"\`.`,
|
|
144
168
|
enum: [
|
|
145
169
|
'body', 'tag', 'any',
|
|
146
170
|
],
|
|
147
171
|
type: 'string',
|
|
148
172
|
},
|
|
149
173
|
exemptedBy: {
|
|
174
|
+
description: `Array of tags (e.g., \`['type']\`) whose presence on the
|
|
175
|
+
document block avoids the need for a \`@description\`. Defaults to an
|
|
176
|
+
array with \`inheritdoc\`. If you set this array, it will overwrite the
|
|
177
|
+
default, so be sure to add back \`inheritdoc\` if you wish its presence
|
|
178
|
+
to cause exemption of the rule.`,
|
|
150
179
|
items: {
|
|
151
180
|
type: 'string',
|
|
152
181
|
},
|
|
@@ -312,15 +312,42 @@ export default iterateJsdoc(({
|
|
|
312
312
|
additionalProperties: false,
|
|
313
313
|
properties: {
|
|
314
314
|
abbreviations: {
|
|
315
|
+
description: `You can provide an \`abbreviations\` options array to avoid such strings of text
|
|
316
|
+
being treated as sentence endings when followed by dots. The \`.\` is not
|
|
317
|
+
necessary at the end of the array items.`,
|
|
315
318
|
items: {
|
|
316
319
|
type: 'string',
|
|
317
320
|
},
|
|
318
321
|
type: 'array',
|
|
319
322
|
},
|
|
320
323
|
newlineBeforeCapsAssumesBadSentenceEnd: {
|
|
324
|
+
description: `When \`false\` (the new default), we will not assume capital letters after
|
|
325
|
+
newlines are an incorrect way to end the sentence (they may be proper
|
|
326
|
+
nouns, for example).`,
|
|
321
327
|
type: 'boolean',
|
|
322
328
|
},
|
|
323
329
|
tags: {
|
|
330
|
+
description: `If you want additional tags to be checked for their descriptions, you may
|
|
331
|
+
add them within this option.
|
|
332
|
+
|
|
333
|
+
\`\`\`js
|
|
334
|
+
{
|
|
335
|
+
'jsdoc/require-description-complete-sentence': ['error', {
|
|
336
|
+
tags: ['see', 'copyright']
|
|
337
|
+
}]
|
|
338
|
+
}
|
|
339
|
+
\`\`\`
|
|
340
|
+
|
|
341
|
+
The tags \`@param\`/\`@arg\`/\`@argument\` and \`@property\`/\`@prop\` will be properly
|
|
342
|
+
parsed to ensure that the checked "description" text includes only the text
|
|
343
|
+
after the name.
|
|
344
|
+
|
|
345
|
+
All other tags will treat the text following the tag name, a space, and
|
|
346
|
+
an optional curly-bracketed type expression (and another space) as part of
|
|
347
|
+
its "description" (e.g., for \`@returns {someType} some description\`, the
|
|
348
|
+
description is \`some description\` while for \`@some-tag xyz\`, the description
|
|
349
|
+
is \`xyz\`).
|
|
350
|
+
`,
|
|
324
351
|
items: {
|
|
325
352
|
type: 'string',
|
|
326
353
|
},
|
|
@@ -53,7 +53,7 @@ export default iterateJsdoc(({
|
|
|
53
53
|
contextDefaults: true,
|
|
54
54
|
meta: {
|
|
55
55
|
docs: {
|
|
56
|
-
description: 'Requires that all functions have examples.',
|
|
56
|
+
description: 'Requires that all functions (and potentially other contexts) have examples.',
|
|
57
57
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-example.md#repos-sticky-header',
|
|
58
58
|
},
|
|
59
59
|
fixable: 'code',
|
|
@@ -63,17 +63,33 @@ export default iterateJsdoc(({
|
|
|
63
63
|
properties: {
|
|
64
64
|
checkConstructors: {
|
|
65
65
|
default: true,
|
|
66
|
+
description: `A value indicating whether \`constructor\`s should be checked.
|
|
67
|
+
Defaults to \`true\`.`,
|
|
66
68
|
type: 'boolean',
|
|
67
69
|
},
|
|
68
70
|
checkGetters: {
|
|
69
71
|
default: false,
|
|
72
|
+
description: 'A value indicating whether getters should be checked. Defaults to `false`.',
|
|
70
73
|
type: 'boolean',
|
|
71
74
|
},
|
|
72
75
|
checkSetters: {
|
|
73
76
|
default: false,
|
|
77
|
+
description: 'A value indicating whether setters should be checked. Defaults to `false`.',
|
|
74
78
|
type: 'boolean',
|
|
75
79
|
},
|
|
76
80
|
contexts: {
|
|
81
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
82
|
+
optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
83
|
+
(e.g., \`ClassDeclaration\` for ES6 classes).
|
|
84
|
+
|
|
85
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
86
|
+
|
|
87
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
88
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want the rule to apply to any
|
|
89
|
+
JSDoc block throughout your files.
|
|
90
|
+
|
|
91
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
92
|
+
section of our Advanced docs for more on the expected format.`,
|
|
77
93
|
items: {
|
|
78
94
|
anyOf: [
|
|
79
95
|
{
|
|
@@ -97,9 +113,16 @@ export default iterateJsdoc(({
|
|
|
97
113
|
},
|
|
98
114
|
enableFixer: {
|
|
99
115
|
default: true,
|
|
116
|
+
description: `A boolean on whether to enable the fixer (which adds an empty \`@example\` block).
|
|
117
|
+
Defaults to \`true\`.`,
|
|
100
118
|
type: 'boolean',
|
|
101
119
|
},
|
|
102
120
|
exemptedBy: {
|
|
121
|
+
description: `Array of tags (e.g., \`['type']\`) whose presence on the document
|
|
122
|
+
block avoids the need for an \`@example\`. Defaults to an array with
|
|
123
|
+
\`inheritdoc\`. If you set this array, it will overwrite the default,
|
|
124
|
+
so be sure to add back \`inheritdoc\` if you wish its presence to cause
|
|
125
|
+
exemption of the rule.`,
|
|
103
126
|
items: {
|
|
104
127
|
type: 'string',
|
|
105
128
|
},
|
|
@@ -107,6 +130,8 @@ export default iterateJsdoc(({
|
|
|
107
130
|
},
|
|
108
131
|
exemptNoArguments: {
|
|
109
132
|
default: false,
|
|
133
|
+
description: `Boolean to indicate that no-argument functions should not be reported for
|
|
134
|
+
missing \`@example\` declarations.`,
|
|
110
135
|
type: 'boolean',
|
|
111
136
|
},
|
|
112
137
|
},
|
|
@@ -118,6 +118,67 @@ export default iterateJsdoc(({
|
|
|
118
118
|
additionalProperties: false,
|
|
119
119
|
properties: {
|
|
120
120
|
tags: {
|
|
121
|
+
description: `The keys of this object are tag names, and the values are configuration
|
|
122
|
+
objects indicating what will be checked for these whole-file tags.
|
|
123
|
+
|
|
124
|
+
Each configuration object has 3 potential boolean keys (which default
|
|
125
|
+
to \`false\` when this option is supplied).
|
|
126
|
+
|
|
127
|
+
1. \`mustExist\` - enforces that all files have a \`@file\`, \`@fileoverview\`, or \`@overview\` tag.
|
|
128
|
+
2. \`preventDuplicates\` - enforces that duplicate file overview tags within a given file will be reported
|
|
129
|
+
3. \`initialCommentsOnly\` - reports file overview tags which are not, as per
|
|
130
|
+
[the docs](https://jsdoc.app/tags-file.html), "at the beginning of
|
|
131
|
+
the file"–where beginning of the file is interpreted in this rule
|
|
132
|
+
as being when the overview tag is not preceded by anything other than
|
|
133
|
+
a comment.
|
|
134
|
+
|
|
135
|
+
When no \`tags\` is present, the default is:
|
|
136
|
+
|
|
137
|
+
\`\`\`json
|
|
138
|
+
{
|
|
139
|
+
"file": {
|
|
140
|
+
"initialCommentsOnly": true,
|
|
141
|
+
"mustExist": true,
|
|
142
|
+
"preventDuplicates": true,
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
\`\`\`
|
|
146
|
+
|
|
147
|
+
You can add additional tag names and/or override \`file\` if you supply this
|
|
148
|
+
option, e.g., in place of or in addition to \`file\`, giving other potential
|
|
149
|
+
file global tags like \`@license\`, \`@copyright\`, \`@author\`, \`@module\` or
|
|
150
|
+
\`@exports\`, optionally restricting them to a single use or preventing them
|
|
151
|
+
from being preceded by anything besides comments.
|
|
152
|
+
|
|
153
|
+
For example:
|
|
154
|
+
|
|
155
|
+
\`\`\`js
|
|
156
|
+
{
|
|
157
|
+
"license": {
|
|
158
|
+
"mustExist": true,
|
|
159
|
+
"preventDuplicates": true,
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
\`\`\`
|
|
163
|
+
|
|
164
|
+
This would require one and only one \`@license\` in the file, though because
|
|
165
|
+
\`initialCommentsOnly\` is absent and defaults to \`false\`, the \`@license\`
|
|
166
|
+
can be anywhere.
|
|
167
|
+
|
|
168
|
+
In the case of \`@license\`, you can use this rule along with the
|
|
169
|
+
\`check-values\` rule (with its \`allowedLicenses\` or \`licensePattern\` options),
|
|
170
|
+
to enforce a license whitelist be present on every JS file.
|
|
171
|
+
|
|
172
|
+
Note that if you choose to use \`preventDuplicates\` with \`license\`, you still
|
|
173
|
+
have a way to allow multiple licenses for the whole page by using the SPDX
|
|
174
|
+
"AND" expression, e.g., \`@license (MIT AND GPL-3.0)\`.
|
|
175
|
+
|
|
176
|
+
Note that the tag names are the main JSDoc tag name, so you should use \`file\`
|
|
177
|
+
in this configuration object regardless of whether you have configured
|
|
178
|
+
\`fileoverview\` instead of \`file\` on \`tagNamePreference\` (i.e., \`fileoverview\`
|
|
179
|
+
will be checked, but you must use \`file\` on the configuration object).
|
|
180
|
+
|
|
181
|
+
`,
|
|
121
182
|
patternProperties: {
|
|
122
183
|
'.*': {
|
|
123
184
|
additionalProperties: false,
|
|
@@ -149,12 +149,20 @@ export default iterateJsdoc(({
|
|
|
149
149
|
iterateAllJsdocs: true,
|
|
150
150
|
meta: {
|
|
151
151
|
docs: {
|
|
152
|
-
description: 'Requires a hyphen before the `@param` description.',
|
|
152
|
+
description: 'Requires a hyphen before the `@param` description (and optionally before `@property` descriptions).',
|
|
153
153
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-hyphen-before-param-description.md#repos-sticky-header',
|
|
154
154
|
},
|
|
155
155
|
fixable: 'code',
|
|
156
156
|
schema: [
|
|
157
157
|
{
|
|
158
|
+
description: `If the string is \`"always"\` then a problem is raised when there is no hyphen
|
|
159
|
+
before the description. If it is \`"never"\` then a problem is raised when there
|
|
160
|
+
is a hyphen before the description. The default value is \`"always"\`.
|
|
161
|
+
|
|
162
|
+
Even if hyphens are set to "always" appear after the tag name, they will
|
|
163
|
+
actually be forbidden in the event that they are followed immediately by
|
|
164
|
+
the end of a line (this will otherwise cause Visual Studio Code to display
|
|
165
|
+
incorrectly).`,
|
|
158
166
|
enum: [
|
|
159
167
|
'always', 'never',
|
|
160
168
|
],
|
|
@@ -162,6 +170,8 @@ export default iterateJsdoc(({
|
|
|
162
170
|
},
|
|
163
171
|
{
|
|
164
172
|
additionalProperties: false,
|
|
173
|
+
description: `The options object may have the following property to indicate behavior for
|
|
174
|
+
other tags besides the \`@param\` tag (or the \`@arg\` tag if so set).`,
|
|
165
175
|
properties: {
|
|
166
176
|
tags: {
|
|
167
177
|
anyOf: [
|
|
@@ -183,6 +193,14 @@ export default iterateJsdoc(({
|
|
|
183
193
|
type: 'string',
|
|
184
194
|
},
|
|
185
195
|
],
|
|
196
|
+
description: `Object whose keys indicate different tags to check for the
|
|
197
|
+
presence or absence of hyphens; the key value should be "always" or "never",
|
|
198
|
+
indicating how hyphens are to be applied, e.g., \`{property: 'never'}\`
|
|
199
|
+
to ensure \`@property\` never uses hyphens. A key can also be set as \`*\`, e.g.,
|
|
200
|
+
\`'*': 'always'\` to apply hyphen checking to any tag (besides the preferred
|
|
201
|
+
\`@param\` tag which follows the main string option setting and besides any
|
|
202
|
+
other \`tags\` entries).
|
|
203
|
+
`,
|
|
186
204
|
},
|
|
187
205
|
},
|
|
188
206
|
type: 'object',
|