@depup/eslint-plugin-jsdoc 65.3.8-depup.0 → 65.3.12-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 +15 -0
- package/src/rules/checkTemplateNames.js +20 -1
- package/src/rules/noMissingSyntax.js +1 -1
- package/src/rules/noUndefinedTypes.js +17 -6
- package/src/rules/noUnnecessaryTypeAssertion.js +1 -2
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.12 |
|
|
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.12-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.12",
|
|
186
|
+
"processedAt": "2026-10-18T16:09:00.345Z",
|
|
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
|
@@ -1641,6 +1641,20 @@ const parseClosureTemplateTag = (tag) => {
|
|
|
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) {
|
|
@@ -914,13 +914,24 @@ export default iterateJsdoc(({
|
|
|
914
914
|
return;
|
|
915
915
|
}
|
|
916
916
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
917
|
+
// Type parameters of a function type or signature (e.g.,
|
|
918
|
+
// `<T>(x: T) => T` or `{<T>(x: T): T}`) are in scope anywhere
|
|
919
|
+
// within that function type
|
|
920
|
+
/**
|
|
921
|
+
* @type {import('jsdoc-type-pratt-parser').NonRootResult & {
|
|
922
|
+
* _parent?: import('jsdoc-type-pratt-parser').NonRootResult,
|
|
923
|
+
* typeParameters?: import('jsdoc-type-pratt-parser').TypeParameterResult[]
|
|
924
|
+
* }|undefined}
|
|
925
|
+
*/
|
|
926
|
+
let ancestor = parent;
|
|
927
|
+
while (ancestor) {
|
|
928
|
+
if (ancestor.typeParameters?.some((typeParam) => {
|
|
920
929
|
return value === typeParam.name.value;
|
|
921
|
-
})
|
|
922
|
-
|
|
923
|
-
|
|
930
|
+
})) {
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
ancestor = ancestor._parent;
|
|
924
935
|
}
|
|
925
936
|
|
|
926
937
|
if (parent?.type === 'JsdocTypeInfer' && value === parent.element.value) {
|
|
@@ -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');
|