@depup/eslint-plugin-jsdoc 65.3.4-depup.0 → 65.3.8-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.4 |
17
- | Processed | 2026-10-15 |
16
+ | Original | [eslint-plugin-jsdoc](https://www.npmjs.com/package/eslint-plugin-jsdoc) @ 65.3.8 |
17
+ | Processed | 2026-10-16 |
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-15T00:29:27.540Z",
12
+ "timestamp": "2026-10-16T16:10:29.118Z",
13
13
  "totalUpdated": 2
14
14
  }
@@ -15,7 +15,6 @@ export type CreatedNode = {
15
15
  special?: true;
16
16
  globalVars?: CreatedNode;
17
17
  exported?: boolean;
18
- ANONYMOUS_DEFAULT?: import("eslint").Rule.Node;
19
18
  };
20
19
  export type CreateSymbol = (node: import("eslint").Rule.Node | null, globals: CreatedNode, value: import("eslint").Rule.Node | import("@typescript-eslint/types").TSESTree.Node | null, scope?: CreatedNode | undefined, isGlobal?: boolean | SymbolOptions | undefined) => CreatedNode | null;
21
20
  export type SymbolOptions = {
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.4-depup.0",
171
+ "version": "65.3.8-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.4",
186
- "processedAt": "2026-10-15T00:29:54.759Z",
185
+ "originalVersion": "65.3.8",
186
+ "processedAt": "2026-10-16T16:10:53.200Z",
187
187
  "smokeTest": "passed"
188
188
  }
189
189
  }
@@ -20,8 +20,7 @@ const debug = debugModule('requireExportJsdoc');
20
20
  * },
21
21
  * special?: true,
22
22
  * globalVars?: CreatedNode,
23
- * exported?: boolean,
24
- * ANONYMOUS_DEFAULT?: import('eslint').Rule.Node
23
+ * exported?: boolean
25
24
  * }} CreatedNode
26
25
  */
27
26
 
@@ -519,12 +518,19 @@ const mapVariables = function (node, globals, opt, isExport) {
519
518
  );
520
519
  if (symbol) {
521
520
  symbol.exported = true;
522
- /* c8 ignore next 6 */
523
521
  } else {
524
- // if (!node.id) {
525
- globals.ANONYMOUS_DEFAULT = /** @type {import('eslint').Rule.Node} */ (
526
- node.declaration
522
+ // Anonymous default export, e.g., `export default class {}` or
523
+ // `export default {}`; `default` cannot be a variable name
524
+ const anonymousSymbol = getSymbol(
525
+ /** @type {import('eslint').Rule.Node} */
526
+ (node.declaration),
527
+ globals,
528
+ globals,
527
529
  );
530
+ if (anonymousSymbol) {
531
+ anonymousSymbol.exported = true;
532
+ globals.props.default = anonymousSymbol;
533
+ }
528
534
  }
529
535
 
530
536
  break;
@@ -804,7 +810,11 @@ const findExportedNode = function (block, node, cache) {
804
810
  for (const propval of Object.values(props)) {
805
811
  const pval = /** @type {CreatedNode} */ (propval);
806
812
  blockCache.push(pval);
807
- if (pval.exported && (node === pval.value || findNode(node, pval.value))) {
813
+ if (pval.exported && (
814
+ node === pval.value || findNode(node, pval.value) ||
815
+ // Object literals, e.g., `export const obj = {method () {}}`
816
+ findNode(node, pval)
817
+ )) {
808
818
  return true;
809
819
  }
810
820
 
package/src/jsdocUtils.js CHANGED
@@ -1637,7 +1637,7 @@ const splitTopLevelCommas = (str) => {
1637
1637
  const parseClosureTemplateTag = (tag) => {
1638
1638
  return splitTopLevelCommas(tag.name)
1639
1639
  .map((type) => {
1640
- return type.trim().replace(/^\[?(?<name>.*?)=.*$/v, '$<name>');
1640
+ return type.trim().replace(/^\[?\s*(?<name>.*?)\s*=.*$/v, '$<name>');
1641
1641
  });
1642
1642
  };
1643
1643
 
@@ -77,6 +77,17 @@ export default iterateJsdoc(({
77
77
  */
78
78
  const createImportInserter = (importText) => {
79
79
  return (fixer) => {
80
+ // A hashbang (`#!`) must stay on the first line
81
+ const hashbang = (/^#!.*(?:\r\n|\n)/v).exec(sourceCode.text);
82
+ if (hashbang) {
83
+ return fixer.insertTextAfterRange(
84
+ [
85
+ 0, hashbang[0].length,
86
+ ],
87
+ `${importText}${hashbang[0].endsWith('\r\n') ? '\r\n' : '\n'}`,
88
+ );
89
+ }
90
+
80
91
  const programNode = sourceCode.ast;
81
92
  const commentNodes = sourceCode.getCommentsBefore(programNode);
82
93
 
@@ -193,11 +204,11 @@ export default iterateJsdoc(({
193
204
  }
194
205
 
195
206
  /**
196
- * @param {string} name
207
+ * @param {string} matchingName An identifier (escape module specifiers
208
+ * with `toValidIdentifier` before passing them)
197
209
  * @param {string[]} extrPathSegments
198
210
  */
199
- const getFixer = (name, extrPathSegments) => {
200
- const matchingName = toValidIdentifier(name);
211
+ const getFixer = (matchingName, extrPathSegments) => {
201
212
  return () => {
202
213
  /** @type {import('jsdoc-type-pratt-parser').NamePathResult|undefined} */
203
214
  let node = nodes.at(0);
@@ -423,7 +434,7 @@ export default iterateJsdoc(({
423
434
  'Inline `import()` found; prefer `@import`',
424
435
  tag,
425
436
  enableFixer ? (fixer) => {
426
- getFixer(element.value, [])();
437
+ getFixer(toValidIdentifier(element.value), [])();
427
438
  return createImportInserter(
428
439
  `/** @import * as ${toValidIdentifier(element.value)} from '${element.value}'; */`,
429
440
  )(fixer);
@@ -438,9 +449,9 @@ export default iterateJsdoc(({
438
449
  'Inline `import()` found; prefer `@import`',
439
450
  tag,
440
451
  enableFixer ? (fixer) => {
441
- getFixer(element.value, [])();
452
+ getFixer(toValidIdentifier(element.value), [])();
442
453
  return createImportInserter(
443
- `/** @import ${element.value} from '${element.value}'; */`,
454
+ `/** @import ${toValidIdentifier(element.value)} from '${element.value}'; */`,
444
455
  )(fixer);
445
456
  } : null,
446
457
  );
@@ -452,12 +463,12 @@ export default iterateJsdoc(({
452
463
  tag,
453
464
  enableFixer ? (fixer) => {
454
465
  if (outputType === 'namespaced-import') {
455
- getFixer(element.value, [
466
+ getFixer(toValidIdentifier(element.value), [
456
467
  ...pathSegments,
457
468
  ])();
458
469
  } else {
459
470
  getFixer(
460
- /** @type {string} */ (pathSegments.at(-1)),
471
+ toValidIdentifier(/** @type {string} */ (pathSegments.at(-1))),
461
472
  pathSegments.slice(0, -1),
462
473
  )();
463
474
  }