Skip to content

Commit 516263d

Browse files
committed
fix: handle typed computed properties; fixes #1822
Also: - chore: update jsdoccomment, typescript-eslint/utils, devDeps
1 parent 4901870 commit 516263d

31 files changed

Lines changed: 1151 additions & 892 deletions

‎docs/rules/check-template-names.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,5 +492,11 @@ function quux (x) {}
492492
* @template B
493493
* @typedef {A} AssertExtends
494494
*/
495+
496+
/**
497+
* @template T
498+
* @param {{bar: string, [Symbol.dispose](): T}} Single
499+
*/
500+
function quux () {}
495501
````
496502

‎docs/rules/imports-as-dependencies.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ The following patterns are considered problems:
4545
* @type {null|import('sinon').SomeApi}
4646
*/
4747
// Message: import points to package which is not found in dependencies
48+
49+
/**
50+
* @type {null|{bar: string, [Symbol.dispose](): import('sth').SomeApi}}
51+
*/
52+
// Message: import points to package which is not found in dependencies
4853
````
4954

5055

‎docs/rules/reject-any-type.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ function quux () {}
4444
*/
4545
function quux () {}
4646
// Message: Prefer a more specific type to `*`
47+
48+
/**
49+
* @param {{bar: string, [Symbol.dispose](): any}}
50+
*/
51+
function quux () {}
52+
// Message: Prefer a more specific type to `any`
53+
54+
/**
55+
* @param {{bar: string, [Symbol.dispose](): any}}
56+
*/
57+
function quux () {}
58+
// Settings: {"jsdoc":{"mode":"permissive"}}
59+
// Message: Prefer a more specific type to `any`
4760
````
4861

4962

‎docs/rules/require-param.md‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,16 +1016,6 @@ function test(): (id: number) => string;
10161016
// "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
10171017
// Message: Missing JSDoc @param "id" declaration.
10181018

1019-
/**
1020-
* A function with return type
1021-
*/
1022-
let test = (): (id: number) => string =>
1023-
{
1024-
return (id) => `${id}`;
1025-
}
1026-
// "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
1027-
// Message: Missing JSDoc @param "id" declaration.
1028-
10291019
/**
10301020
* @param baz
10311021
* @param options
@@ -2023,5 +2013,14 @@ export async function fetchMarketstackEOD(
20232013
export function x(foo) {
20242014
console.log(foo);
20252015
}
2016+
2017+
/**
2018+
* A function with return type
2019+
*/
2020+
let test = (): (id: number) => string =>
2021+
{
2022+
return (id) => `${id}`;
2023+
}
2024+
// "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
20262025
````
20272026

‎docs/rules/require-returns-check.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,5 +1218,15 @@ function foo() {
12181218
}
12191219
}
12201220
}
1221+
1222+
/**
1223+
* Maybe return undefined.
1224+
* @returns {{bar: string, [Symbol.dispose](): void}|void} true, or undefined.
1225+
*/
1226+
function maybeTrue() {
1227+
if (Math.random() > 0.5) {
1228+
return true;
1229+
}
1230+
}
12211231
````
12221232

‎docs/rules/type-formatting.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,19 @@ The following patterns are considered problems:
538538
*/
539539
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldSeparator":"comma-and-linebreak","objectFieldSeparatorTrailingPunctuation":true,"objectTypeBracketSpacing":" ","trailingPunctuationMultilineOnly":true}]
540540
// Message: Inconsistent comma-and-linebreak separator usage
541+
542+
/**
543+
* @param {{a: string; b: {bar: string; [Symbol.dispose](): void}; c: boolean,}} cfg
544+
*/
545+
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldSeparator":"semicolon"}]
546+
// Message: Inconsistent semicolon separator usage
547+
548+
/**
549+
* @param {{a: string; b: {bar: string; [Symbol.dispose](): void}; c: boolean,}} cfg
550+
*/
551+
// Settings: {"jsdoc":{"mode":"permissive"}}
552+
// "jsdoc/type-formatting": ["error"|"warn", {"objectFieldSeparator":"semicolon"}]
553+
// Message: Inconsistent semicolon separator usage
541554
````
542555

543556

‎docs/rules/valid-types.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,5 +1014,22 @@ const MY_BITMASK_CONSTANT = {
10141014
* @template [T=Record<string, unknown>]
10151015
*/
10161016
function quux () {}
1017+
1018+
/**
1019+
* @type {{bar: string, [Symbol.dispose](): void}}
1020+
*/
1021+
using foo = {
1022+
bar: "baz",
1023+
[Symbol.dispose]: () => console.log("dispose")
1024+
};
1025+
1026+
/**
1027+
* @type {{bar: string, [Symbol.dispose](): void}}
1028+
*/
1029+
using foo = {
1030+
bar: "baz",
1031+
[Symbol.dispose]: () => console.log("dispose")
1032+
};
1033+
// Settings: {"jsdoc":{"mode":"permissive"}}
10171034
````
10181035

‎package.json‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"url": "http://gajus.com"
66
},
77
"dependencies": {
8-
"@es-joy/jsdoccomment": "~0.98.0",
8+
"@es-joy/escodegen": "^4.2.0",
9+
"@es-joy/jsdoccomment": "~0.100.0",
910
"@es-joy/resolve.exports": "1.2.0",
10-
"@typescript-eslint/utils": "^8.70.1",
11+
"@typescript-eslint/utils": "^8.72.0",
1112
"are-docs-informative": "^0.1.1",
1213
"comment-parser": "1.4.9",
1314
"debug": "^4.4.3",
@@ -24,11 +25,10 @@
2425
"description": "JSDoc linting rules for ESLint.",
2526
"devDependencies": {
2627
"@arethetypeswrong/cli": "^0.18.5",
27-
"@babel/core": "8.0.6",
28-
"@babel/eslint-parser": "8.0.5",
28+
"@babel/core": "8.0.7",
29+
"@babel/eslint-parser": "8.0.7",
2930
"@babel/plugin-transform-flow-strip-types": "8.0.1",
30-
"@babel/preset-env": "8.0.6",
31-
"@es-joy/escodegen": "^4.2.0",
31+
"@babel/preset-env": "8.0.7",
3232
"@es-joy/jsdoc-eslint-parser": "^0.29.0",
3333
"@eslint/core": "^1.2.1",
3434
"@hkdobrev/run-if-changed": "^0.9.0",
@@ -41,36 +41,36 @@
4141
"@types/estree": "^1.0.9",
4242
"@types/json-schema": "^7.0.15",
4343
"@types/mocha": "^10.0.10",
44-
"@types/node": "^26.6.2",
44+
"@types/node": "^26.6.5",
4545
"@types/semver": "^7.8.0",
4646
"@types/spdx-expression-parse": "^4.0.0",
47-
"@typescript-eslint/types": "8.70.1",
47+
"@typescript-eslint/types": "8.72.0",
4848
"babel-plugin-add-module-exports": "^1.0.4",
49-
"babel-plugin-transform-import-meta": "^3.0.0",
49+
"babel-plugin-transform-import-meta": "^3.1.0",
5050
"c8": "^12.0.0",
51-
"camelcase": "^9.0.0",
52-
"chai": "^6.2.2",
53-
"decamelize": "^6.0.1",
54-
"eslint": "10.11.0",
51+
"camelcase": "^10.0.0",
52+
"chai": "^6.3.0",
53+
"decamelize": "^7.0.0",
54+
"eslint": "10.13.0",
5555
"eslint-config-canonical": "^47.4.2",
5656
"gitdown": "^4.1.1",
5757
"glob": "^13.0.6",
58-
"globals": "^17.12.0",
58+
"globals": "^17.13.0",
5959
"husky": "^9.1.7",
60-
"jsdoc-type-pratt-parser": "^9.2.2",
60+
"jsdoc-type-pratt-parser": "^9.3.0",
6161
"json-schema": "^0.4.0",
6262
"json-schema-to-typescript": "^16.0.0",
63-
"lint-staged": "^17.5.1",
64-
"mocha": "^12.0.2",
63+
"lint-staged": "^17.6.0",
64+
"mocha": "^12.0.3",
6565
"open-editor": "^6.0.0",
66-
"playwright": "^1.63.0",
66+
"playwright": "^1.64.1",
6767
"replace": "^1.2.2",
6868
"rimraf": "^6.1.3",
6969
"semantic-release": "^25.0.9",
7070
"sinon": "^22.1.0",
7171
"ts-api-utils": "^2.5.0",
7272
"typescript": "6.0.3",
73-
"typescript-eslint": "8.70.1"
73+
"typescript-eslint": "8.72.0"
7474
},
7575
"engines": {
7676
"node": "^22.22.2 || >=24.15.0"

0 commit comments

Comments
 (0)