Skip to content

Commit 26ae169

Browse files
authored
fix(require-jsdoc): update jsdoccomment (and espree) to get comment-finding for overloaded functions; fixes #1369 (#1406)
1 parent fcc7b26 commit 26ae169

File tree

4 files changed

+552
-407
lines changed

4 files changed

+552
-407
lines changed

docs/rules/require-jsdoc.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,5 +1909,27 @@ class Abc {
19091909
}
19101910
}
19111911
// "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"ClassDeclaration":true}}]
1912+
1913+
/**
1914+
* Array map function with overload for NonEmptyArray
1915+
* @example
1916+
* const data = [{value: 'value'}] as const;
1917+
* const result1: NonEmptyReadonlyArray<'value'> = arrayMap(data, (value) => value.value); // pick type from data
1918+
* const result2: NonEmptyReadonlyArray<'value'> = arrayMap<'value', typeof data>(data, (value) => value.value); // enforce output type
1919+
* @template Target - The type of the array to map to
1920+
* @template Source - The type of the array to map from
1921+
* @param {Source} data - The array to map
1922+
* @param {MapCallback<Target, Source>} callback - Callback function to map data from the array
1923+
* @returns {AnyArrayType<Target>} Mapped array
1924+
* @since v0.2.0
1925+
*/
1926+
export function arrayMap<Target, Source extends NonEmptyArray<unknown> | NonEmptyReadonlyArray<unknown>>(
1927+
data: Source,
1928+
callback: MapCallback<Target, Source>,
1929+
): NonEmptyArray<Target>;
1930+
export function arrayMap<Target, Source extends Array<unknown>>(data: Source, callback: MapCallback<Target, Source>): Array<Target>;
1931+
export function arrayMap<Target, Source extends AnyArrayType>(data: Source, callback: MapCallback<Target, Source>): AnyArrayType<Target> {
1932+
return data.map(callback);
1933+
}
19121934
````
19131935

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"url": "http://gajus.com"
66
},
77
"dependencies": {
8-
"@es-joy/jsdoccomment": "~0.50.2",
8+
"@es-joy/jsdoccomment": "~0.51.1",
99
"are-docs-informative": "^0.0.2",
1010
"comment-parser": "1.4.1",
1111
"debug": "^4.4.1",
1212
"escape-string-regexp": "^4.0.0",
13-
"espree": "^10.3.0",
13+
"espree": "^10.4.0",
1414
"esquery": "^1.6.0",
1515
"parse-imports-exports": "^0.2.4",
1616
"semver": "^7.7.2",
@@ -20,7 +20,7 @@
2020
"devDependencies": {
2121
"@babel/cli": "^7.27.2",
2222
"@babel/core": "^7.27.4",
23-
"@babel/eslint-parser": "^7.27.1",
23+
"@babel/eslint-parser": "^7.27.5",
2424
"@babel/node": "^7.27.1",
2525
"@babel/plugin-syntax-class-properties": "^7.12.13",
2626
"@babel/plugin-transform-flow-strip-types": "^7.27.1",
@@ -36,39 +36,39 @@
3636
"@types/eslint": "^9.6.1",
3737
"@types/espree": "^10.1.0",
3838
"@types/esquery": "^1.5.4",
39-
"@types/estree": "^1.0.7",
39+
"@types/estree": "^1.0.8",
4040
"@types/json-schema": "^7.0.15",
4141
"@types/lodash.defaultsdeep": "^4.6.9",
4242
"@types/mocha": "^10.0.10",
43-
"@types/node": "^22.15.29",
43+
"@types/node": "^24.0.3",
4444
"@types/semver": "^7.7.0",
4545
"@types/spdx-expression-parse": "^3.0.5",
46-
"@typescript-eslint/types": "^8.33.0",
46+
"@typescript-eslint/types": "^8.34.1",
4747
"babel-plugin-add-module-exports": "^1.0.4",
4848
"babel-plugin-istanbul": "^7.0.0",
49-
"babel-plugin-transform-import-meta": "^2.3.2",
49+
"babel-plugin-transform-import-meta": "^2.3.3",
5050
"c8": "^10.1.3",
5151
"camelcase": "^8.0.0",
5252
"chai": "^5.2.0",
5353
"cross-env": "^7.0.3",
5454
"decamelize": "^6.0.0",
55-
"eslint": "9.28.0",
55+
"eslint": "9.29.0",
5656
"eslint-config-canonical": "~44.9.5",
5757
"gitdown": "^4.1.1",
58-
"glob": "^11.0.2",
58+
"glob": "^11.0.3",
5959
"globals": "^16.2.0",
6060
"husky": "^9.1.7",
6161
"jsdoc-type-pratt-parser": "^4.1.0",
6262
"json-schema": "^0.4.0",
63-
"lint-staged": "^16.1.0",
63+
"lint-staged": "^16.1.2",
6464
"lodash.defaultsdeep": "^4.6.1",
65-
"mocha": "^11.5.0",
65+
"mocha": "^11.7.0",
6666
"open-editor": "^5.1.0",
6767
"replace": "^1.2.2",
6868
"rimraf": "^6.0.1",
6969
"semantic-release": "^24.2.5",
7070
"typescript": "5.8.3",
71-
"typescript-eslint": "^8.33.0"
71+
"typescript-eslint": "^8.34.1"
7272
},
7373
"engines": {
7474
"node": ">=20.11.0"

0 commit comments

Comments
 (0)