@depup/eslint-plugin-jsdoc 64.3.9-depup.0 → 64.4.0-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) @ 64.3.9 |
17
- | Processed | 2026-09-10 |
16
+ | Original | [eslint-plugin-jsdoc](https://www.npmjs.com/package/eslint-plugin-jsdoc) @ 64.4.0 |
17
+ | Processed | 2026-09-14 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 2 |
20
20
 
package/changes.json CHANGED
@@ -9,6 +9,6 @@
9
9
  "to": "^1.4.9"
10
10
  }
11
11
  },
12
- "timestamp": "2026-09-10T16:09:48.569Z",
12
+ "timestamp": "2026-09-14T16:10:26.510Z",
13
13
  "totalUpdated": 2
14
14
  }
package/dist/rules.d.ts CHANGED
@@ -447,7 +447,7 @@ export interface Rules {
447
447
  /**
448
448
  * An array of prefixes to allow at the beginning of a comment.
449
449
  *
450
- * Defaults to `['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']`.
450
+ * Defaults to `['@ts-', '@license', '@license-end', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']`.
451
451
  *
452
452
  * Supplying your own value overrides the defaults.
453
453
  */
@@ -1060,8 +1060,11 @@ export interface Rules {
1060
1060
  * An array of directives that will not be reported if present at the beginning of
1061
1061
  * a multi-comment block and at-sign `/* @`.
1062
1062
  *
1063
- * Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']`
1064
- * (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).
1063
+ * Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck',
1064
+ * 'license', 'license-end', 'licstart', 'licend', 'source',]`
1065
+ *
1066
+ * (directives that are either [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)
1067
+ * or by the [LibreJS standard](https://www.gnu.org/software/librejs/free-your-javascript.html)).
1065
1068
  */
1066
1069
  ignore?: string[];
1067
1070
  /**
package/package.json CHANGED
@@ -162,7 +162,7 @@
162
162
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
163
163
  "test-index": "pnpm run test-no-cov test/rules/index.js"
164
164
  },
165
- "version": "64.3.9-depup.0",
165
+ "version": "64.4.0-depup.0",
166
166
  "depup": {
167
167
  "changes": {
168
168
  "@typescript-eslint/utils": {
@@ -176,8 +176,8 @@
176
176
  },
177
177
  "depsUpdated": 2,
178
178
  "originalPackage": "eslint-plugin-jsdoc",
179
- "originalVersion": "64.3.9",
180
- "processedAt": "2026-09-10T16:10:23.622Z",
179
+ "originalVersion": "64.4.0",
180
+ "processedAt": "2026-09-14T16:10:51.988Z",
181
181
  "smokeTest": "passed"
182
182
  }
183
183
  }
@@ -45,7 +45,8 @@ export default {
45
45
 
46
46
  const {
47
47
  allowedPrefixes = [
48
- '@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-',
48
+ '@ts-', '@license', '@license-end',
49
+ 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-',
49
50
  ],
50
51
  contexts = settings.contexts || [],
51
52
  contextsAfter = /** @type {string[]} */ ([]),
@@ -163,8 +164,11 @@ export default {
163
164
  * @param {import('eslint').Rule.Node} node
164
165
  * @param {AddComment} addComment
165
166
  * @param {import('../iterateJsdoc.js').Context[]} ctxts
167
+ * @param {Token} [locComment] Comment to anchor the report location to,
168
+ * e.g., the first comment of a stacked group of line comments, so the
169
+ * report does not read as though only the last line were at fault.
166
170
  */
167
- const reportings = (comment, node, addComment, ctxts) => {
171
+ const reportings = (comment, node, addComment, ctxts, locComment) => {
168
172
  const fixer = getFixer(node, comment, addComment, ctxts);
169
173
 
170
174
  if (comment.type === 'Block') {
@@ -181,33 +185,89 @@ export default {
181
185
  return;
182
186
  }
183
187
 
184
- report('lineCommentsJsdocStyle', comment, node, fixer);
188
+ report('lineCommentsJsdocStyle', locComment ?? comment, node, fixer);
185
189
  }
186
190
  };
187
191
 
192
+ /**
193
+ * Walks backward from a `//` comment which immediately precedes a node,
194
+ * collecting any directly adjacent (no intervening blank line) `//`
195
+ * comments stacked above it, so that the fixer can convert the whole
196
+ * run into a single JSDoc block instead of leaving all but the last
197
+ * line behind.
198
+ * @param {Token} comment
199
+ * @returns {Token[]}
200
+ */
201
+ const getPrecedingLineCommentGroup = (comment) => {
202
+ const group = [
203
+ comment,
204
+ ];
205
+ let current = comment;
206
+
207
+ for (;;) {
208
+ const prev = /** @type {Token|null} */ (
209
+ sourceCode.getTokenBefore(
210
+ /** @type {import('eslint').AST.Token} */ (current),
211
+ {
212
+ includeComments: true,
213
+ },
214
+ )
215
+ );
216
+
217
+ if (
218
+ !prev ||
219
+ prev.type !== 'Line' ||
220
+ // @ts-expect-error Ok
221
+ prev.loc.end.line !== current.loc.start.line - 1 ||
222
+ /** @type {string[]} */
223
+ (allowedPrefixes).some((prefix) => {
224
+ return prev.value.trimStart().startsWith(prefix);
225
+ })
226
+ ) {
227
+ break;
228
+ }
229
+
230
+ group.unshift(prev);
231
+ current = prev;
232
+ }
233
+
234
+ return group;
235
+ };
236
+
188
237
  /**
189
238
  * Builds the opening portion of the JSDoc comment, i.e. everything before
190
- * the closing delimiter.
239
+ * the closing delimiter. When more than one comment is supplied (e.g., a
240
+ * stacked group of `//` lines), each is rendered on its own JSDoc line.
191
241
  * @param {string} indent
192
- * @param {Token} comment
242
+ * @param {Token[]} comments
193
243
  * @param {boolean|undefined} inlineCommentBlock
194
244
  * @returns {string}
195
245
  */
196
- const getCommentOpening = (indent, comment, inlineCommentBlock) => {
246
+ const getCommentOpening = (indent, comments, inlineCommentBlock) => {
197
247
  if (inlineCommentBlock || enforceJsdocLineStyle === 'single') {
198
- return `/** ${comment.value.trim()} `;
248
+ return `/** ${comments.map((comment) => {
249
+ return comment.value.trim();
250
+ }).join(' ')} `;
199
251
  }
200
252
 
201
- const body = comment.value.trimEnd();
253
+ if (comments.length === 1) {
254
+ const body = comments[0].value.trimEnd();
255
+
256
+ // When the comment's text already begins on its own line (e.g. a
257
+ // multi-line block comment), there is no need for the fixer to add a
258
+ // leading blank `*` line.
259
+ if ((/^[ \t]*\n/v).test(body)) {
260
+ return `/**${body.replace(/^[ \t]+/v, '')}\n${indent}`;
261
+ }
202
262
 
203
- // When the comment's text already begins on its own line (e.g. a
204
- // multi-line block comment), there is no need for the fixer to add a
205
- // leading blank `*` line.
206
- if ((/^[ \t]*\n/v).test(body)) {
207
- return `/**${body.replace(/^[ \t]+/v, '')}\n${indent}`;
263
+ return `/**\n${indent}*${body}\n${indent}`;
208
264
  }
209
265
 
210
- return `/**\n${indent}*${body}\n${indent}`;
266
+ const inner = comments.map((comment) => {
267
+ return `${indent}*${comment.value.trimEnd()}`;
268
+ }).join('\n');
269
+
270
+ return `/**\n${inner}\n${indent}`;
211
271
  };
212
272
 
213
273
  /**
@@ -228,19 +288,29 @@ export default {
228
288
 
229
289
  reportingNonJsdoc = true;
230
290
 
291
+ const commentGroup = comment.type === 'Line' ?
292
+ getPrecedingLineCommentGroup(/** @type {Token} */ (comment)) :
293
+ [
294
+ /** @type {Token} */ (comment),
295
+ ];
296
+
231
297
  /** @type {AddComment} */
232
298
  const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {
233
- const insertion = getCommentOpening(indent, commentToAdd, inlineCommentBlock) +
299
+ const insertion = getCommentOpening(indent, commentGroup, inlineCommentBlock) +
234
300
  `*/${'\n'.repeat((lines || 1) - 1)}`;
235
301
 
236
- return fixer.replaceText(
237
- /** @type {import('eslint').AST.Token} */
238
- (commentToAdd),
302
+ return fixer.replaceTextRange(
303
+ [
304
+ /* c8 ignore next -- Guard */
305
+ commentGroup[0].range?.[0] ?? 0,
306
+ /* c8 ignore next -- Guard */
307
+ commentToAdd.range?.[1] ?? 0,
308
+ ],
239
309
  insertion,
240
310
  );
241
311
  };
242
312
 
243
- reportings(comment, node, addComment, contexts);
313
+ reportings(comment, node, addComment, contexts, commentGroup[0]);
244
314
  };
245
315
 
246
316
  /**
@@ -263,7 +333,9 @@ export default {
263
333
 
264
334
  /** @type {AddComment} */
265
335
  const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {
266
- const insertion = getCommentOpening(indent, commentToAdd, inlineCommentBlock) +
336
+ const insertion = getCommentOpening(indent, [
337
+ /** @type {Token} */ (commentToAdd),
338
+ ], inlineCommentBlock) +
267
339
  `*/${'\n'.repeat((lines || 1) - 1)}${lines ? `\n${indent.slice(1)}` : ' '}`;
268
340
 
269
341
  return [
@@ -328,7 +400,7 @@ export default {
328
400
  allowedPrefixes: {
329
401
  description: `An array of prefixes to allow at the beginning of a comment.
330
402
 
331
- Defaults to \`['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']\`.
403
+ Defaults to \`['@ts-', '@license', '@license-end', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']\`.
332
404
 
333
405
  Supplying your own value overrides the defaults.`,
334
406
  items: {
@@ -21,6 +21,11 @@ export default iterateJsdoc(({
21
21
  'ts-expect-error',
22
22
  'ts-ignore',
23
23
  'ts-nocheck',
24
+ 'license',
25
+ 'license-end',
26
+ 'licstart',
27
+ 'licend',
28
+ 'source',
24
29
  ],
25
30
  preventAllMultiAsteriskBlocks = false,
26
31
  } = {},
@@ -105,8 +110,11 @@ export default iterateJsdoc(({
105
110
  description: `An array of directives that will not be reported if present at the beginning of
106
111
  a multi-comment block and at-sign \`/* @\`.
107
112
 
108
- Defaults to \`['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']\`
109
- (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).`,
113
+ Defaults to \`['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck',
114
+ 'license', 'license-end', 'licstart', 'licend', 'source',]\`
115
+
116
+ (directives that are either [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)
117
+ or by the [LibreJS standard](https://www.gnu.org/software/librejs/free-your-javascript.html)).`,
110
118
  items: {
111
119
  type: 'string',
112
120
  },
package/src/rules.d.ts CHANGED
@@ -447,7 +447,7 @@ export interface Rules {
447
447
  /**
448
448
  * An array of prefixes to allow at the beginning of a comment.
449
449
  *
450
- * Defaults to `['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']`.
450
+ * Defaults to `['@ts-', '@license', '@license-end', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']`.
451
451
  *
452
452
  * Supplying your own value overrides the defaults.
453
453
  */
@@ -1060,8 +1060,11 @@ export interface Rules {
1060
1060
  * An array of directives that will not be reported if present at the beginning of
1061
1061
  * a multi-comment block and at-sign `/* @`.
1062
1062
  *
1063
- * Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']`
1064
- * (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).
1063
+ * Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck',
1064
+ * 'license', 'license-end', 'licstart', 'licend', 'source',]`
1065
+ *
1066
+ * (directives that are either [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)
1067
+ * or by the [LibreJS standard](https://www.gnu.org/software/librejs/free-your-javascript.html)).
1065
1068
  */
1066
1069
  ignore?: string[];
1067
1070
  /**