@depup/eslint-plugin-jsdoc 65.3.2-depup.0 → 65.3.4-depup.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 CHANGED
@@ -13,8 +13,8 @@ npm install @depup/eslint-plugin-jsdoc
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [eslint-plugin-jsdoc](https://www.npmjs.com/package/eslint-plugin-jsdoc) @ 65.3.2 |
17
- | Processed | 2026-10-13 |
16
+ | Original | [eslint-plugin-jsdoc](https://www.npmjs.com/package/eslint-plugin-jsdoc) @ 65.3.4 |
17
+ | Processed | 2026-10-15 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 2 |
20
20
 
package/changes.json CHANGED
@@ -9,6 +9,6 @@
9
9
  "to": "^8.71.2"
10
10
  }
11
11
  },
12
- "timestamp": "2026-10-13T16:10:58.556Z",
12
+ "timestamp": "2026-10-15T00:29:27.540Z",
13
13
  "totalUpdated": 2
14
14
  }
package/dist/rules.d.ts CHANGED
@@ -334,16 +334,23 @@ export interface Rules {
334
334
  * class
335
335
  * enum
336
336
  * implements
337
- * private
338
337
  * property
339
- * protected
340
- * public
341
338
  * readonly
342
339
  * this
343
340
  * type
344
341
  * typedef
345
342
  * ```
346
343
  *
344
+ * These tags are unnecessary on class members (where TypeScript has access
345
+ * modifiers), but are allowed elsewhere (e.g., the `@public` release tag of
346
+ * TSDoc/API Extractor on an exported function):
347
+ *
348
+ * ```
349
+ * private
350
+ * protected
351
+ * public
352
+ * ```
353
+ *
347
354
  * These tags are unnecessary except when inside a TypeScript `declare` context:
348
355
  *
349
356
  * ```
package/package.json CHANGED
@@ -168,7 +168,7 @@
168
168
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
169
169
  "test-index": "pnpm run test-no-cov test/rules/index.js"
170
170
  },
171
- "version": "65.3.2-depup.0",
171
+ "version": "65.3.4-depup.0",
172
172
  "depup": {
173
173
  "changes": {
174
174
  "@es-joy/jsdoccomment": {
@@ -182,8 +182,8 @@
182
182
  },
183
183
  "depsUpdated": 2,
184
184
  "originalPackage": "eslint-plugin-jsdoc",
185
- "originalVersion": "65.3.2",
186
- "processedAt": "2026-10-13T16:11:24.215Z",
185
+ "originalVersion": "65.3.4",
186
+ "processedAt": "2026-10-15T00:29:54.759Z",
187
187
  "smokeTest": "passed"
188
188
  }
189
189
  }
package/src/jsdocUtils.js CHANGED
@@ -1083,18 +1083,34 @@ const isNameOrNamepathDefiningTag = (tag, tagMap = tagStructure) => {
1083
1083
  tagStruct.get('namepathRole')));
1084
1084
  };
1085
1085
 
1086
+ /**
1087
+ * The parsed JSDoc blocks of each file (and fix pass), keyed by its
1088
+ * `SourceCode` object. Rules such as `no-undefined-types` and
1089
+ * `require-returns-check` ask for all blocks of the file once per JSDoc
1090
+ * block they check, so without this, every comment of the file was parsed
1091
+ * again for each block (quadratic time on larger files).
1092
+ * @type {WeakMap<import('eslint').SourceCode, import('@es-joy/jsdoccomment').JsdocBlockWithInline[]>}
1093
+ */
1094
+ const jsdocCommentBlocksCache = new WeakMap();
1095
+
1086
1096
  /**
1087
1097
  * @param {import('eslint').SourceCode} sourceCode
1088
1098
  * @returns {import('@es-joy/jsdoccomment').JsdocBlockWithInline[]}
1089
1099
  */
1090
1100
  const getJSDocCommentBlocks = (sourceCode) => {
1091
- return sourceCode.getAllComments()
1092
- .filter((comment) => {
1093
- return (/^\*(?!\*)/v).test(comment.value);
1094
- })
1095
- .map((commentNode) => {
1096
- return parseComment(commentNode, '');
1097
- });
1101
+ let blocks = jsdocCommentBlocksCache.get(sourceCode);
1102
+ if (!blocks) {
1103
+ blocks = sourceCode.getAllComments()
1104
+ .filter((comment) => {
1105
+ return (/^\*(?!\*)/v).test(comment.value);
1106
+ })
1107
+ .map((commentNode) => {
1108
+ return parseComment(commentNode, '');
1109
+ });
1110
+ jsdocCommentBlocksCache.set(sourceCode, blocks);
1111
+ }
1112
+
1113
+ return blocks;
1098
1114
  };
1099
1115
 
1100
1116
  /**
@@ -29,6 +29,20 @@ const typedTagsNeedingName = new Set([
29
29
  'template',
30
30
  ]);
31
31
 
32
+ const accessTags = new Set([
33
+ 'private',
34
+ 'protected',
35
+ 'public',
36
+ ]);
37
+
38
+ /**
39
+ * @param {import('eslint').Rule.Node|null} node
40
+ * @returns {boolean}
41
+ */
42
+ const isClassMember = (node) => {
43
+ return node?.parent?.type === 'ClassBody';
44
+ };
45
+
32
46
  const typedTagsUnnecessaryOutsideDeclare = new Set([
33
47
  'abstract',
34
48
  'access',
@@ -201,7 +215,13 @@ export default iterateJsdoc(({
201
215
  * @returns {boolean}
202
216
  */
203
217
  const checkTagForTypedValidity = (jsdocTag, tagIndex) => {
204
- if (typedTagsAlwaysUnnecessary.has(jsdocTag.tag)) {
218
+ if (
219
+ typedTagsAlwaysUnnecessary.has(jsdocTag.tag) &&
220
+ // TypeScript only has syntax for these on class members; elsewhere they
221
+ // are not redundant (e.g., TSDoc/API Extractor release tag `@public`,
222
+ // TypeDoc's `@private`/`@protected` visibility, Knip's `@public`)
223
+ (!accessTags.has(jsdocTag.tag) || isClassMember(node))
224
+ ) {
205
225
  reportWithTagRemovalFixer(
206
226
  `'@${jsdocTag.tag}' is redundant when using a type system.`,
207
227
  jsdocTag,
@@ -361,16 +381,23 @@ callback
361
381
  class
362
382
  enum
363
383
  implements
364
- private
365
384
  property
366
- protected
367
- public
368
385
  readonly
369
386
  this
370
387
  type
371
388
  typedef
372
389
  \`\`\`
373
390
 
391
+ These tags are unnecessary on class members (where TypeScript has access
392
+ modifiers), but are allowed elsewhere (e.g., the \`@public\` release tag of
393
+ TSDoc/API Extractor on an exported function):
394
+
395
+ \`\`\`
396
+ private
397
+ protected
398
+ public
399
+ \`\`\`
400
+
374
401
  These tags are unnecessary except when inside a TypeScript \`declare\` context:
375
402
 
376
403
  \`\`\`
package/src/rules.d.ts CHANGED
@@ -334,16 +334,23 @@ export interface Rules {
334
334
  * class
335
335
  * enum
336
336
  * implements
337
- * private
338
337
  * property
339
- * protected
340
- * public
341
338
  * readonly
342
339
  * this
343
340
  * type
344
341
  * typedef
345
342
  * ```
346
343
  *
344
+ * These tags are unnecessary on class members (where TypeScript has access
345
+ * modifiers), but are allowed elsewhere (e.g., the `@public` release tag of
346
+ * TSDoc/API Extractor on an exported function):
347
+ *
348
+ * ```
349
+ * private
350
+ * protected
351
+ * public
352
+ * ```
353
+ *
347
354
  * These tags are unnecessary except when inside a TypeScript `declare` context:
348
355
  *
349
356
  * ```