@depup/eslint-plugin-jsdoc 65.3.6-depup.0 → 65.3.11-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 +2 -2
- package/changes.json +1 -1
- package/dist/jsdocUtils.d.ts +7 -0
- package/package.json +3 -3
- package/src/iterateJsdoc.js +4 -2
- package/src/jsdocUtils.js +16 -1
- package/src/rules/checkTemplateNames.js +20 -1
- package/src/rules/noMissingSyntax.js +1 -1
- package/src/rules/noUnnecessaryTypeAssertion.js +1 -2
- package/src/rules/preferImportTag.js +8 -8
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.
|
|
17
|
-
| Processed | 2026-10-
|
|
16
|
+
| Original | [eslint-plugin-jsdoc](https://www.npmjs.com/package/eslint-plugin-jsdoc) @ 65.3.11 |
|
|
17
|
+
| Processed | 2026-10-18 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 2 |
|
|
20
20
|
|
package/changes.json
CHANGED
package/dist/jsdocUtils.d.ts
CHANGED
|
@@ -166,6 +166,13 @@ export function getAllTags(jsdoc: import("./iterateJsdoc.js").JsdocBlockWithInli
|
|
|
166
166
|
line?: number | undefined;
|
|
167
167
|
column?: number | undefined;
|
|
168
168
|
}))[];
|
|
169
|
+
/**
|
|
170
|
+
* Gets the default types of GCC Generic/Template types, e.g., `T[]` for
|
|
171
|
+
* `@template [U=T[]]`
|
|
172
|
+
* @param {import('comment-parser').Spec} tag
|
|
173
|
+
* @returns {string[]}
|
|
174
|
+
*/
|
|
175
|
+
export function getClosureTemplateTagDefaults(tag: import("comment-parser").Spec): string[];
|
|
169
176
|
/**
|
|
170
177
|
* @param {import('./iterateJsdoc.js').Context[]} contexts
|
|
171
178
|
* @param {import('./iterateJsdoc.js').CheckJsdoc} checkJsdoc
|
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.
|
|
171
|
+
"version": "65.3.11-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.
|
|
186
|
-
"processedAt": "2026-10-
|
|
185
|
+
"originalVersion": "65.3.11",
|
|
186
|
+
"processedAt": "2026-10-18T00:53:45.692Z",
|
|
187
187
|
"smokeTest": "passed"
|
|
188
188
|
}
|
|
189
189
|
}
|
package/src/iterateJsdoc.js
CHANGED
|
@@ -1891,7 +1891,7 @@ const getUtils = (
|
|
|
1891
1891
|
utils.findContext = (contexts, comment) => {
|
|
1892
1892
|
const foundContext = contexts.find((cntxt) => {
|
|
1893
1893
|
return typeof cntxt === 'string' ?
|
|
1894
|
-
esquery.matches(
|
|
1894
|
+
cntxt === 'any' || esquery.matches(
|
|
1895
1895
|
/** @type {Node} */ (node),
|
|
1896
1896
|
esquery.parse(cntxt),
|
|
1897
1897
|
undefined,
|
|
@@ -2667,7 +2667,9 @@ export default function iterateJsdoc (iterator, ruleConfig) {
|
|
|
2667
2667
|
return iterateAllJsdocs(
|
|
2668
2668
|
iterator,
|
|
2669
2669
|
ruleConfig,
|
|
2670
|
-
hasObjectAny
|
|
2670
|
+
hasObjectAny || ruleConfig.matchContext ?
|
|
2671
|
+
/** @type {ContextObject[]} */ (contexts) :
|
|
2672
|
+
null,
|
|
2671
2673
|
ruleConfig.matchContext,
|
|
2672
2674
|
).create(context);
|
|
2673
2675
|
}
|
package/src/jsdocUtils.js
CHANGED
|
@@ -1637,10 +1637,24 @@ const splitTopLevelCommas = (str) => {
|
|
|
1637
1637
|
const parseClosureTemplateTag = (tag) => {
|
|
1638
1638
|
return splitTopLevelCommas(tag.name)
|
|
1639
1639
|
.map((type) => {
|
|
1640
|
-
return type.trim().replace(/^\[
|
|
1640
|
+
return type.trim().replace(/^\[?\s*(?<name>.*?)\s*=.*$/v, '$<name>');
|
|
1641
1641
|
});
|
|
1642
1642
|
};
|
|
1643
1643
|
|
|
1644
|
+
/**
|
|
1645
|
+
* Gets the default types of GCC Generic/Template types, e.g., `T[]` for
|
|
1646
|
+
* `@template [U=T[]]`
|
|
1647
|
+
* @param {import('comment-parser').Spec} tag
|
|
1648
|
+
* @returns {string[]}
|
|
1649
|
+
*/
|
|
1650
|
+
const getClosureTemplateTagDefaults = (tag) => {
|
|
1651
|
+
return splitTopLevelCommas(tag.name)
|
|
1652
|
+
.map((type) => {
|
|
1653
|
+
return type.trim().replace(/^\[?[^=]*(?:=(?<dflt>.*?)\]?)?$/v, '$<dflt>').trim();
|
|
1654
|
+
})
|
|
1655
|
+
.filter(Boolean);
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1644
1658
|
/**
|
|
1645
1659
|
* @typedef {true|string[]} DefaultContexts
|
|
1646
1660
|
*/
|
|
@@ -2200,6 +2214,7 @@ export {
|
|
|
2200
2214
|
flattenRoots,
|
|
2201
2215
|
forEachPreferredTag,
|
|
2202
2216
|
getAllTags,
|
|
2217
|
+
getClosureTemplateTagDefaults,
|
|
2203
2218
|
getContextObject,
|
|
2204
2219
|
getDocumentNamepathDefiningTags,
|
|
2205
2220
|
getFunctionParameterNames,
|
|
@@ -2,6 +2,7 @@ import iterateJsdoc, {
|
|
|
2
2
|
parseComment,
|
|
3
3
|
} from '../iterateJsdoc.js';
|
|
4
4
|
import {
|
|
5
|
+
getClosureTemplateTagDefaults,
|
|
5
6
|
getTags,
|
|
6
7
|
} from '../jsdocUtils.js';
|
|
7
8
|
import {
|
|
@@ -46,13 +47,21 @@ export default iterateJsdoc(({
|
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
traverse(parsedType, (nde) => {
|
|
50
|
+
traverse(parsedType, (nde, parentNode) => {
|
|
50
51
|
const {
|
|
51
52
|
type,
|
|
52
53
|
value,
|
|
53
54
|
} = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);
|
|
54
55
|
if (type === 'JsdocTypeName') {
|
|
55
56
|
usedNames.add(value);
|
|
57
|
+
// An unquoted index of an indexed access type, e.g., `K` in `T[K]`
|
|
58
|
+
} else if (
|
|
59
|
+
type === 'JsdocTypeProperty' &&
|
|
60
|
+
parentNode?.type === 'JsdocTypeNamePath' &&
|
|
61
|
+
parentNode.pathType === 'property-brackets' &&
|
|
62
|
+
!(/** @type {import('jsdoc-type-pratt-parser').PropertyResult} */ (nde).meta.quote)
|
|
63
|
+
) {
|
|
64
|
+
usedNames.add(value);
|
|
56
65
|
}
|
|
57
66
|
});
|
|
58
67
|
};
|
|
@@ -76,6 +85,16 @@ export default iterateJsdoc(({
|
|
|
76
85
|
};
|
|
77
86
|
|
|
78
87
|
const checkTemplateTags = () => {
|
|
88
|
+
// A template name may be used only within the constraint or default of
|
|
89
|
+
// another template, e.g., `T` in `@template {keyof T} K` or
|
|
90
|
+
// `@template [U=T[]]`
|
|
91
|
+
for (const tag of templateTags) {
|
|
92
|
+
checkForUsedTypes(tag.type);
|
|
93
|
+
for (const defaultType of getClosureTemplateTagDefaults(tag)) {
|
|
94
|
+
checkForUsedTypes(defaultType);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
79
98
|
for (const tag of templateTags) {
|
|
80
99
|
const names = utils.parseClosureTemplateTag(tag);
|
|
81
100
|
for (const nme of names) {
|
|
@@ -77,11 +77,10 @@ export default iterateJsdoc(({
|
|
|
77
77
|
|
|
78
78
|
// eslint-disable-next-line no-console -- Warning user
|
|
79
79
|
console.warn('⚠️ typescript is not installed. `jsdoc/no-unnecessary-type-assertion` will not work. To disable this warning, you must disable the rule.');
|
|
80
|
+
return;
|
|
80
81
|
} finally {
|
|
81
82
|
tsAttempted = true;
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
-
return;
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
const types = utils.getTags('type');
|
|
@@ -204,11 +204,11 @@ export default iterateJsdoc(({
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
* @param {string}
|
|
207
|
+
* @param {string} matchingName An identifier (escape module specifiers
|
|
208
|
+
* with `toValidIdentifier` before passing them)
|
|
208
209
|
* @param {string[]} extrPathSegments
|
|
209
210
|
*/
|
|
210
|
-
const getFixer = (
|
|
211
|
-
const matchingName = toValidIdentifier(name);
|
|
211
|
+
const getFixer = (matchingName, extrPathSegments) => {
|
|
212
212
|
return () => {
|
|
213
213
|
/** @type {import('jsdoc-type-pratt-parser').NamePathResult|undefined} */
|
|
214
214
|
let node = nodes.at(0);
|
|
@@ -434,7 +434,7 @@ export default iterateJsdoc(({
|
|
|
434
434
|
'Inline `import()` found; prefer `@import`',
|
|
435
435
|
tag,
|
|
436
436
|
enableFixer ? (fixer) => {
|
|
437
|
-
getFixer(element.value, [])();
|
|
437
|
+
getFixer(toValidIdentifier(element.value), [])();
|
|
438
438
|
return createImportInserter(
|
|
439
439
|
`/** @import * as ${toValidIdentifier(element.value)} from '${element.value}'; */`,
|
|
440
440
|
)(fixer);
|
|
@@ -449,9 +449,9 @@ export default iterateJsdoc(({
|
|
|
449
449
|
'Inline `import()` found; prefer `@import`',
|
|
450
450
|
tag,
|
|
451
451
|
enableFixer ? (fixer) => {
|
|
452
|
-
getFixer(element.value, [])();
|
|
452
|
+
getFixer(toValidIdentifier(element.value), [])();
|
|
453
453
|
return createImportInserter(
|
|
454
|
-
`/** @import ${element.value} from '${element.value}'; */`,
|
|
454
|
+
`/** @import ${toValidIdentifier(element.value)} from '${element.value}'; */`,
|
|
455
455
|
)(fixer);
|
|
456
456
|
} : null,
|
|
457
457
|
);
|
|
@@ -463,12 +463,12 @@ export default iterateJsdoc(({
|
|
|
463
463
|
tag,
|
|
464
464
|
enableFixer ? (fixer) => {
|
|
465
465
|
if (outputType === 'namespaced-import') {
|
|
466
|
-
getFixer(element.value, [
|
|
466
|
+
getFixer(toValidIdentifier(element.value), [
|
|
467
467
|
...pathSegments,
|
|
468
468
|
])();
|
|
469
469
|
} else {
|
|
470
470
|
getFixer(
|
|
471
|
-
/** @type {string} */ (pathSegments.at(-1)),
|
|
471
|
+
toValidIdentifier(/** @type {string} */ (pathSegments.at(-1))),
|
|
472
472
|
pathSegments.slice(0, -1),
|
|
473
473
|
)();
|
|
474
474
|
}
|