eslint-plugin-jsdoc 56.0.0 → 56.0.1

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.
Files changed (73) hide show
  1. package/package.json +4 -4
  2. package/dist/cjs/WarnSettings.js +0 -30
  3. package/dist/cjs/alignTransform.js +0 -285
  4. package/dist/cjs/defaultTagOrder.js +0 -152
  5. package/dist/cjs/exportParser.js +0 -754
  6. package/dist/cjs/getDefaultTagStructureForMode.js +0 -840
  7. package/dist/cjs/getJsdocProcessorPlugin.cjs +0 -4
  8. package/dist/cjs/getJsdocProcessorPlugin.js +0 -553
  9. package/dist/cjs/index-cjs.js +0 -492
  10. package/dist/cjs/index.cjs.cjs +0 -6
  11. package/dist/cjs/iterateJsdoc.cjs +0 -38
  12. package/dist/cjs/iterateJsdoc.js +0 -1981
  13. package/dist/cjs/jsdocUtils.js +0 -1470
  14. package/dist/cjs/rules/checkAccess.js +0 -35
  15. package/dist/cjs/rules/checkAlignment.js +0 -63
  16. package/dist/cjs/rules/checkExamples.js +0 -486
  17. package/dist/cjs/rules/checkIndentation.js +0 -66
  18. package/dist/cjs/rules/checkLineAlignment.js +0 -297
  19. package/dist/cjs/rules/checkParamNames.js +0 -320
  20. package/dist/cjs/rules/checkPropertyNames.js +0 -105
  21. package/dist/cjs/rules/checkSyntax.js +0 -27
  22. package/dist/cjs/rules/checkTagNames.js +0 -252
  23. package/dist/cjs/rules/checkTemplateNames.js +0 -189
  24. package/dist/cjs/rules/checkTypes.js +0 -421
  25. package/dist/cjs/rules/checkValues.js +0 -163
  26. package/dist/cjs/rules/convertToJsdocComments.js +0 -313
  27. package/dist/cjs/rules/emptyTags.js +0 -79
  28. package/dist/cjs/rules/implementsOnClasses.js +0 -63
  29. package/dist/cjs/rules/importsAsDependencies.js +0 -105
  30. package/dist/cjs/rules/informativeDocs.js +0 -153
  31. package/dist/cjs/rules/linesBeforeBlock.js +0 -106
  32. package/dist/cjs/rules/matchDescription.js +0 -240
  33. package/dist/cjs/rules/matchName.js +0 -122
  34. package/dist/cjs/rules/multilineBlocks.js +0 -339
  35. package/dist/cjs/rules/noBadBlocks.js +0 -88
  36. package/dist/cjs/rules/noBlankBlockDescriptions.js +0 -56
  37. package/dist/cjs/rules/noBlankBlocks.js +0 -41
  38. package/dist/cjs/rules/noDefaults.js +0 -84
  39. package/dist/cjs/rules/noMissingSyntax.js +0 -164
  40. package/dist/cjs/rules/noMultiAsterisks.js +0 -83
  41. package/dist/cjs/rules/noRestrictedSyntax.js +0 -75
  42. package/dist/cjs/rules/noTypes.js +0 -88
  43. package/dist/cjs/rules/noUndefinedTypes.js +0 -451
  44. package/dist/cjs/rules/requireAsteriskPrefix.js +0 -144
  45. package/dist/cjs/rules/requireDescription.js +0 -136
  46. package/dist/cjs/rules/requireDescriptionCompleteSentence.js +0 -258
  47. package/dist/cjs/rules/requireExample.js +0 -103
  48. package/dist/cjs/rules/requireFileOverview.js +0 -117
  49. package/dist/cjs/rules/requireHyphenBeforeParamDescription.js +0 -144
  50. package/dist/cjs/rules/requireJsdoc.js +0 -629
  51. package/dist/cjs/rules/requireParam.js +0 -480
  52. package/dist/cjs/rules/requireParamDescription.js +0 -77
  53. package/dist/cjs/rules/requireParamName.js +0 -52
  54. package/dist/cjs/rules/requireParamType.js +0 -77
  55. package/dist/cjs/rules/requireProperty.js +0 -44
  56. package/dist/cjs/rules/requirePropertyDescription.js +0 -22
  57. package/dist/cjs/rules/requirePropertyName.js +0 -22
  58. package/dist/cjs/rules/requirePropertyType.js +0 -22
  59. package/dist/cjs/rules/requireReturns.js +0 -197
  60. package/dist/cjs/rules/requireReturnsCheck.js +0 -108
  61. package/dist/cjs/rules/requireReturnsDescription.js +0 -58
  62. package/dist/cjs/rules/requireReturnsType.js +0 -52
  63. package/dist/cjs/rules/requireTemplate.js +0 -173
  64. package/dist/cjs/rules/requireThrows.js +0 -101
  65. package/dist/cjs/rules/requireYields.js +0 -172
  66. package/dist/cjs/rules/requireYieldsCheck.js +0 -164
  67. package/dist/cjs/rules/sortTags.js +0 -392
  68. package/dist/cjs/rules/tagLines.js +0 -259
  69. package/dist/cjs/rules/textEscaping.js +0 -125
  70. package/dist/cjs/rules/typeFormatting.js +0 -328
  71. package/dist/cjs/rules/validTypes.js +0 -333
  72. package/dist/cjs/tagNames.js +0 -209
  73. package/dist/cjs/utils/hasReturnValue.js +0 -469
package/package.json CHANGED
@@ -91,7 +91,7 @@
91
91
  },
92
92
  "require": {
93
93
  "types": "./dist/cjs/index.cjs.d.cts",
94
- "default": "./dist/cjs/index.cjs.cts"
94
+ "default": "./dist/index-cjs.cjs"
95
95
  }
96
96
  },
97
97
  "./getJsdocProcessorPlugin.js": {
@@ -101,7 +101,7 @@
101
101
  },
102
102
  "require": {
103
103
  "types": "./dist/cjs/getJsdocProcessorPlugin.d.cts",
104
- "default": "./dist/cjs/getJsdocProcessorPlugin.cjs"
104
+ "default": "./dist/getJsdocProcessorPlugin.cjs"
105
105
  }
106
106
  },
107
107
  "./iterateJsdoc.js": {
@@ -111,7 +111,7 @@
111
111
  },
112
112
  "require": {
113
113
  "types": "./dist/cjs/iterateJsdoc.d.cts",
114
- "default": "./dist/cjs/iterateJsdoc.cjs"
114
+ "default": "./dist/iterateJsdoc.cjs"
115
115
  }
116
116
  }
117
117
  },
@@ -171,5 +171,5 @@
171
171
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
172
172
  "test-index": "pnpm run test-no-cov test/rules/index.js"
173
173
  },
174
- "version": "56.0.0"
174
+ "version": "56.0.1"
175
175
  }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const WarnSettings = function () {
4
- /** @type {WeakMap<object, Set<string>>} */
5
- const warnedSettings = new WeakMap();
6
- return {
7
- /**
8
- * Warn only once for each context and setting
9
- * @param {{}} context
10
- * @param {string} setting
11
- * @returns {boolean}
12
- */
13
- hasBeenWarned(context, setting) {
14
- return warnedSettings.has(context) && /** @type {Set<string>} */ (warnedSettings.get(context)).has(setting);
15
- },
16
- /**
17
- * @param {{}} context
18
- * @param {string} setting
19
- * @returns {void}
20
- */
21
- markSettingAsWarned(context, setting) {
22
- // c8 ignore else
23
- if (!warnedSettings.has(context)) {
24
- warnedSettings.set(context, new Set());
25
- }
26
- /** @type {Set<string>} */ (warnedSettings.get(context)).add(setting);
27
- },
28
- };
29
- };
30
- exports.default = WarnSettings;
@@ -1,285 +0,0 @@
1
- "use strict";
2
- /**
3
- * Transform based on https://github.com/syavorsky/comment-parser/blob/master/src/transforms/align.ts
4
- *
5
- * It contains some customizations to align based on the tags, and some custom options.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const comment_parser_1 = require("comment-parser");
9
- /**
10
- * @typedef {{
11
- * hasNoTypes: boolean,
12
- * maxNamedTagLength: import('./iterateJsdoc.js').Integer,
13
- * maxUnnamedTagLength: import('./iterateJsdoc.js').Integer
14
- * }} TypelessInfo
15
- */
16
- const { rewireSource, } = comment_parser_1.util;
17
- /**
18
- * @typedef {{
19
- * name: import('./iterateJsdoc.js').Integer,
20
- * start: import('./iterateJsdoc.js').Integer,
21
- * tag: import('./iterateJsdoc.js').Integer,
22
- * type: import('./iterateJsdoc.js').Integer
23
- * }} Width
24
- */
25
- /** @type {Width} */
26
- const zeroWidth = {
27
- name: 0,
28
- start: 0,
29
- tag: 0,
30
- type: 0,
31
- };
32
- /**
33
- * @param {string[]} tags
34
- * @param {import('./iterateJsdoc.js').Integer} index
35
- * @param {import('comment-parser').Line[]} source
36
- * @returns {boolean}
37
- */
38
- const shouldAlign = (tags, index, source) => {
39
- const tag = source[index].tokens.tag.replace('@', '');
40
- const includesTag = tags.includes(tag);
41
- if (includesTag) {
42
- return true;
43
- }
44
- if (tag !== '') {
45
- return false;
46
- }
47
- for (let iterator = index; iterator >= 0; iterator--) {
48
- const previousTag = source[iterator].tokens.tag.replace('@', '');
49
- if (previousTag !== '') {
50
- if (tags.includes(previousTag)) {
51
- return true;
52
- }
53
- return false;
54
- }
55
- }
56
- return true;
57
- };
58
- /**
59
- * @param {string[]} tags
60
- * @returns {(
61
- * width: Width,
62
- * line: {
63
- * tokens: import('comment-parser').Tokens
64
- * },
65
- * index: import('./iterateJsdoc.js').Integer,
66
- * source: import('comment-parser').Line[]
67
- * ) => Width}
68
- */
69
- const getWidth = (tags) => {
70
- return (width, { tokens, }, index, source) => {
71
- if (!shouldAlign(tags, index, source)) {
72
- return width;
73
- }
74
- return {
75
- name: Math.max(width.name, tokens.name.length),
76
- start: tokens.delimiter === '/**' ? tokens.start.length : width.start,
77
- tag: Math.max(width.tag, tokens.tag.length),
78
- type: Math.max(width.type, tokens.type.length),
79
- };
80
- };
81
- };
82
- /**
83
- * @param {{
84
- * description: string;
85
- * tags: import('comment-parser').Spec[];
86
- * problems: import('comment-parser').Problem[];
87
- * }} fields
88
- * @returns {TypelessInfo}
89
- */
90
- const getTypelessInfo = (fields) => {
91
- const hasNoTypes = fields.tags.every(({ type, }) => {
92
- return !type;
93
- });
94
- const maxNamedTagLength = Math.max(...fields.tags.map(({ name, tag, }) => {
95
- return name.length === 0 ? -1 : tag.length;
96
- }).filter((length) => {
97
- return length !== -1;
98
- })) + 1;
99
- const maxUnnamedTagLength = Math.max(...fields.tags.map(({ name, tag, }) => {
100
- return name.length === 0 ? tag.length : -1;
101
- }).filter((length) => {
102
- return length !== -1;
103
- })) + 1;
104
- return {
105
- hasNoTypes,
106
- maxNamedTagLength,
107
- maxUnnamedTagLength,
108
- };
109
- };
110
- /**
111
- * @param {import('./iterateJsdoc.js').Integer} len
112
- * @returns {string}
113
- */
114
- const space = (len) => {
115
- return ''.padStart(len, ' ');
116
- };
117
- /**
118
- * @param {{
119
- * customSpacings: import('../src/rules/checkLineAlignment.js').CustomSpacings,
120
- * tags: string[],
121
- * indent: string,
122
- * preserveMainDescriptionPostDelimiter: boolean,
123
- * wrapIndent: string,
124
- * disableWrapIndent: boolean,
125
- * }} cfg
126
- * @returns {(
127
- * block: import('comment-parser').Block
128
- * ) => import('comment-parser').Block}
129
- */
130
- const alignTransform = ({ customSpacings, disableWrapIndent, indent, preserveMainDescriptionPostDelimiter, tags, wrapIndent, }) => {
131
- let intoTags = false;
132
- /** @type {Width} */
133
- let width;
134
- /**
135
- * @param {import('comment-parser').Tokens} tokens
136
- * @param {TypelessInfo} typelessInfo
137
- * @returns {import('comment-parser').Tokens}
138
- */
139
- const alignTokens = (tokens, typelessInfo) => {
140
- const nothingAfter = {
141
- delim: false,
142
- name: false,
143
- tag: false,
144
- type: false,
145
- };
146
- if (tokens.description === '') {
147
- nothingAfter.name = true;
148
- tokens.postName = '';
149
- if (tokens.name === '') {
150
- nothingAfter.type = true;
151
- tokens.postType = '';
152
- if (tokens.type === '') {
153
- nothingAfter.tag = true;
154
- tokens.postTag = '';
155
- /* c8 ignore next: Never happens because the !intoTags return. But it's here for consistency with the original align transform */
156
- if (tokens.tag === '') {
157
- nothingAfter.delim = true;
158
- }
159
- }
160
- }
161
- }
162
- let untypedNameAdjustment = 0;
163
- let untypedTypeAdjustment = 0;
164
- if (typelessInfo.hasNoTypes) {
165
- nothingAfter.tag = true;
166
- tokens.postTag = '';
167
- if (tokens.name === '') {
168
- untypedNameAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;
169
- }
170
- else {
171
- untypedNameAdjustment = typelessInfo.maxNamedTagLength > typelessInfo.maxUnnamedTagLength ? 0 :
172
- Math.max(0, typelessInfo.maxUnnamedTagLength - (tokens.tag.length + tokens.name.length + 1));
173
- untypedTypeAdjustment = typelessInfo.maxNamedTagLength - tokens.tag.length;
174
- }
175
- }
176
- // Todo: Avoid fixing alignment of blocks with multiline wrapping of type
177
- if (tokens.tag === '' && tokens.type) {
178
- return tokens;
179
- }
180
- const spacings = {
181
- postDelimiter: customSpacings?.postDelimiter || 1,
182
- postName: customSpacings?.postName || 1,
183
- postTag: customSpacings?.postTag || 1,
184
- postType: customSpacings?.postType || 1,
185
- };
186
- tokens.postDelimiter = nothingAfter.delim ? '' : space(spacings.postDelimiter);
187
- if (!nothingAfter.tag) {
188
- tokens.postTag = space(width.tag - tokens.tag.length + spacings.postTag);
189
- }
190
- if (!nothingAfter.type) {
191
- tokens.postType = space(width.type - tokens.type.length + spacings.postType + untypedTypeAdjustment);
192
- }
193
- if (!nothingAfter.name) {
194
- // If post name is empty for all lines (name width 0), don't add post name spacing.
195
- tokens.postName = width.name === 0 ? '' : space(width.name - tokens.name.length + spacings.postName + untypedNameAdjustment);
196
- }
197
- return tokens;
198
- };
199
- /**
200
- * @param {import('comment-parser').Line} line
201
- * @param {import('./iterateJsdoc.js').Integer} index
202
- * @param {import('comment-parser').Line[]} source
203
- * @param {TypelessInfo} typelessInfo
204
- * @param {string|false} indentTag
205
- * @returns {import('comment-parser').Line}
206
- */
207
- const update = (line, index, source, typelessInfo, indentTag) => {
208
- /** @type {import('comment-parser').Tokens} */
209
- const tokens = {
210
- ...line.tokens,
211
- };
212
- if (tokens.tag !== '') {
213
- intoTags = true;
214
- }
215
- const isEmpty = tokens.tag === '' &&
216
- tokens.name === '' &&
217
- tokens.type === '' &&
218
- tokens.description === '';
219
- // dangling '*/'
220
- if (tokens.end === '*/' && isEmpty) {
221
- tokens.start = indent + ' ';
222
- return {
223
- ...line,
224
- tokens,
225
- };
226
- }
227
- switch (tokens.delimiter) {
228
- case '*':
229
- tokens.start = indent + ' ';
230
- break;
231
- case '/**':
232
- tokens.start = indent;
233
- break;
234
- default:
235
- tokens.delimiter = '';
236
- // compensate delimiter
237
- tokens.start = indent + ' ';
238
- }
239
- if (!intoTags) {
240
- if (tokens.description === '') {
241
- tokens.postDelimiter = '';
242
- }
243
- else if (!preserveMainDescriptionPostDelimiter) {
244
- tokens.postDelimiter = ' ';
245
- }
246
- return {
247
- ...line,
248
- tokens,
249
- };
250
- }
251
- const postHyphenSpacing = customSpacings?.postHyphen ?? 1;
252
- const hyphenSpacing = /^\s*-\s+/v;
253
- tokens.description = tokens.description.replace(hyphenSpacing, '-' + ''.padStart(postHyphenSpacing, ' '));
254
- // Not align.
255
- if (shouldAlign(tags, index, source)) {
256
- alignTokens(tokens, typelessInfo);
257
- if (!disableWrapIndent && indentTag) {
258
- tokens.postDelimiter += wrapIndent;
259
- }
260
- }
261
- return {
262
- ...line,
263
- tokens,
264
- };
265
- };
266
- return ({ source, ...fields }) => {
267
- width = source.reduce(getWidth(tags), {
268
- ...zeroWidth,
269
- });
270
- const typelessInfo = getTypelessInfo(fields);
271
- let tagIndentMode = false;
272
- return rewireSource({
273
- ...fields,
274
- source: source.map((line, index) => {
275
- const indentTag = !disableWrapIndent && tagIndentMode && !line.tokens.tag && line.tokens.description;
276
- const ret = update(line, index, source, typelessInfo, indentTag);
277
- if (!disableWrapIndent && line.tokens.tag) {
278
- tagIndentMode = true;
279
- }
280
- return ret;
281
- }),
282
- });
283
- };
284
- };
285
- exports.default = alignTransform;
@@ -1,152 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const defaultTagOrder = [
4
- {
5
- tags: [
6
- // Brief descriptions
7
- 'summary',
8
- 'typeSummary',
9
- // Module/file-level
10
- 'module',
11
- 'exports',
12
- 'file',
13
- 'fileoverview',
14
- 'overview',
15
- 'import',
16
- // Identifying (name, type)
17
- 'template',
18
- 'typedef',
19
- 'interface',
20
- 'record',
21
- 'name',
22
- 'kind',
23
- 'type',
24
- 'alias',
25
- 'external',
26
- 'host',
27
- 'callback',
28
- 'func',
29
- 'function',
30
- 'method',
31
- 'class',
32
- 'constructor',
33
- // Relationships
34
- 'modifies',
35
- 'mixes',
36
- 'mixin',
37
- 'mixinClass',
38
- 'mixinFunction',
39
- 'namespace',
40
- 'borrows',
41
- 'constructs',
42
- 'lends',
43
- 'implements',
44
- 'requires',
45
- // Long descriptions
46
- 'desc',
47
- 'description',
48
- 'classdesc',
49
- 'tutorial',
50
- 'copyright',
51
- 'license',
52
- // Simple annotations
53
- // TypeScript
54
- 'internal',
55
- 'overload',
56
- 'const',
57
- 'constant',
58
- 'final',
59
- 'global',
60
- 'readonly',
61
- 'abstract',
62
- 'virtual',
63
- 'var',
64
- 'member',
65
- 'memberof',
66
- 'memberof!',
67
- 'inner',
68
- 'instance',
69
- 'inheritdoc',
70
- 'inheritDoc',
71
- 'override',
72
- 'hideconstructor',
73
- // Core function/object info
74
- 'param',
75
- 'arg',
76
- 'argument',
77
- 'prop',
78
- 'property',
79
- 'return',
80
- 'returns',
81
- // Important behavior details
82
- 'async',
83
- 'generator',
84
- 'default',
85
- 'defaultvalue',
86
- 'enum',
87
- 'augments',
88
- 'extends',
89
- 'throws',
90
- 'exception',
91
- 'yield',
92
- 'yields',
93
- 'event',
94
- 'fires',
95
- 'emits',
96
- 'listens',
97
- 'this',
98
- // TypeScript
99
- 'satisfies',
100
- // Access
101
- 'static',
102
- 'private',
103
- 'protected',
104
- 'public',
105
- 'access',
106
- 'package',
107
- '-other',
108
- // Supplementary descriptions
109
- 'see',
110
- 'example',
111
- // METADATA
112
- // Other Closure (undocumented) metadata
113
- 'closurePrimitive',
114
- 'customElement',
115
- 'expose',
116
- 'hidden',
117
- 'idGenerator',
118
- 'meaning',
119
- 'ngInject',
120
- 'owner',
121
- 'wizaction',
122
- // Other Closure (documented) metadata
123
- 'define',
124
- 'dict',
125
- 'export',
126
- 'externs',
127
- 'implicitCast',
128
- 'noalias',
129
- 'nocollapse',
130
- 'nocompile',
131
- 'noinline',
132
- 'nosideeffects',
133
- 'polymer',
134
- 'polymerBehavior',
135
- 'preserve',
136
- 'struct',
137
- 'suppress',
138
- 'unrestricted',
139
- // @homer0/prettier-plugin-jsdoc metadata
140
- 'category',
141
- // Non-Closure metadata
142
- 'ignore',
143
- 'author',
144
- 'version',
145
- 'variation',
146
- 'since',
147
- 'deprecated',
148
- 'todo',
149
- ],
150
- },
151
- ];
152
- exports.default = defaultTagOrder;