diff --git a/.README/rules/require-jsdoc.md b/.README/rules/require-jsdoc.md index ef5abc59..bd5bd209 100644 --- a/.README/rules/require-jsdoc.md +++ b/.README/rules/require-jsdoc.md @@ -113,6 +113,22 @@ apply to any context; see `contexts` for line counts per context. An optional message to add to the inserted JSDoc block. Defaults to the empty string. +### `skipInterveningOverloadedDeclarations` + +If `true`, will skip above uncommented overloaded functions to check +for a comment block (e.g., at the top of a set of overloaded functions). + +If `false`, will force each overloaded function to be checked for a +comment block. + +Defaults to `true`. + +### `exemptOverloadedImplementations` + +If set to `true` will avoid checking an overloaded function's implementation. + +Defaults to `false`. + ## Context and settings ||| @@ -120,7 +136,7 @@ empty string. |Context|`ArrowFunctionExpression`, `ClassDeclaration`, `ClassExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled| |Tags|N/A| |Recommended|true| -|Options|`publicOnly`, `require`, `contexts`, `exemptEmptyConstructors`, `exemptEmptyFunctions`, `enableFixer`, `minLineCount`, `fixerMessage`| +|Options|`publicOnly`, `require`, `contexts`, `exemptEmptyConstructors`, `exemptEmptyFunctions`, `enableFixer`, `minLineCount`, `fixerMessage`, `skipInterveningOverloadedDeclarations`| ## Failing examples diff --git a/docs/rules/require-jsdoc.md b/docs/rules/require-jsdoc.md index f54f21ad..1d5ca1e4 100644 --- a/docs/rules/require-jsdoc.md +++ b/docs/rules/require-jsdoc.md @@ -15,6 +15,8 @@ * [`enableFixer`](#user-content-require-jsdoc-options-enablefixer) * [`minLineCount`](#user-content-require-jsdoc-options-minlinecount) * [`fixerMessage`](#user-content-require-jsdoc-options-fixermessage) + * [`skipInterveningOverloadedDeclarations`](#user-content-require-jsdoc-options-skipinterveningoverloadeddeclarations) + * [`exemptOverloadedImplementations`](#user-content-require-jsdoc-options-exemptoverloadedimplementations) * [Context and settings](#user-content-require-jsdoc-context-and-settings) * [Failing examples](#user-content-require-jsdoc-failing-examples) * [Passing examples](#user-content-require-jsdoc-passing-examples) @@ -157,6 +159,26 @@ apply to any context; see `contexts` for line counts per context. An optional message to add to the inserted JSDoc block. Defaults to the empty string. + + +### skipInterveningOverloadedDeclarations + +If `true`, will skip above uncommented overloaded functions to check +for a comment block (e.g., at the top of a set of overloaded functions). + +If `false`, will force each overloaded function to be checked for a +comment block. + +Defaults to `true`. + + + +### exemptOverloadedImplementations + +If set to `true` will avoid checking an overloaded function's implementation. + +Defaults to `false`. + ## Context and settings @@ -166,7 +188,7 @@ empty string. |Context|`ArrowFunctionExpression`, `ClassDeclaration`, `ClassExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled| |Tags|N/A| |Recommended|true| -|Options|`publicOnly`, `require`, `contexts`, `exemptEmptyConstructors`, `exemptEmptyFunctions`, `enableFixer`, `minLineCount`, `fixerMessage`| +|Options|`publicOnly`, `require`, `contexts`, `exemptEmptyConstructors`, `exemptEmptyFunctions`, `enableFixer`, `minLineCount`, `fixerMessage`, `skipInterveningOverloadedDeclarations`| @@ -1041,6 +1063,56 @@ export class B implements A, B { } // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["MethodDefinition"]}] // Message: Missing JSDoc comment. + +/** + * Test function with param. + * @param foo - Test param. + */ +function myFunction(foo: string): void; +/** + * Test function without param. + */ +function myFunction(): void; +function myFunction(foo?: string) {} +// "jsdoc/require-jsdoc": ["error"|"warn", {"skipInterveningOverloadedDeclarations":false}] +// Message: Missing JSDoc comment. + +/** + * Test function without param. + */ +function myFunction(): void; +/** + * Test function with param. + * @param foo - Test param. + */ +function myFunction(foo: string): void; +function myFunction(foo?: string) {} +// "jsdoc/require-jsdoc": ["error"|"warn", {"skipInterveningOverloadedDeclarations":false}] +// Message: Missing JSDoc comment. + +/** + * Test function with param. + * @param foo - Test param. + */ +function myFunction(foo: string): void; +function myFunction(): void; +/** + * Function implementation + * @param foo + */ +function myFunction(foo?: string) {} +// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSDeclareFunction"],"exemptOverloadedImplementations":false,"skipInterveningOverloadedDeclarations":false}] +// Message: Missing JSDoc comment. + +/** + * Test function with param. + * @param foo - Test param. + */ +function myFunction(foo: string): void; +function myFunction(): void; +function myFunction(foo?: string) {} +// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSDeclareFunction"],"exemptOverloadedImplementations":true,"skipInterveningOverloadedDeclarations":false}] +// Message: Missing JSDoc comment. ```` @@ -1944,6 +2016,30 @@ export function arrayMap>(data: Source, ca export function arrayMap(data: Source, callback: MapCallback): AnyArrayType { return data.map(callback); } +// "jsdoc/require-jsdoc": ["error"|"warn", {"skipInterveningOverloadedDeclarations":true}] + +/** + * Array map function with overload for NonEmptyArray + * @example + * const data = [{value: 'value'}] as const; + * const result1: NonEmptyReadonlyArray<'value'> = arrayMap(data, (value) => value.value); // pick type from data + * const result2: NonEmptyReadonlyArray<'value'> = arrayMap<'value', typeof data>(data, (value) => value.value); // enforce output type + * @template Target - The type of the array to map to + * @template Source - The type of the array to map from + * @param {Source} data - The array to map + * @param {MapCallback} callback - Callback function to map data from the array + * @returns {AnyArrayType} Mapped array + * @since v0.2.0 + */ +export function arrayMap | NonEmptyReadonlyArray>( + data: Source, + callback: MapCallback, +): NonEmptyArray; +export function arrayMap>(data: Source, callback: MapCallback): Array; +export function arrayMap(data: Source, callback: MapCallback): AnyArrayType { + return data.map(callback); +} +// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSDeclareFunction"],"exemptOverloadedImplementations":false,"skipInterveningOverloadedDeclarations":true}] export interface A { a: string; @@ -1960,5 +2056,51 @@ export class B implements A { } } // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["MethodDefinition"]}] + +/** + * Test function with param. + * @param foo - Test param. + */ +function myFunction(foo: string): void; +/** + * Test function without param. + */ +function myFunction(): void; +function myFunction(foo?: string) {} + +/** + * Test function with param. + * @param foo - Test param. + */ +function myFunction(foo: string): void; +/** + * Test function without param. + */ +function myFunction(): void; +function myFunction(foo?: string) {} +// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSDeclareFunction"],"exemptOverloadedImplementations":true,"skipInterveningOverloadedDeclarations":false}] + +/** + * Test function with param. + * @param foo - Test param. + */ +export function myFunction(foo: string): void; +/** + * Test function without param. + */ +export function myFunction(): void; +export function myFunction(foo?: string) {} +// "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSDeclareFunction"],"exemptOverloadedImplementations":true,"skipInterveningOverloadedDeclarations":false}] + +/** + * + */ +const quux = () => { + /** + * + */ + function myFunction(foo?: string) {} +}; +// "jsdoc/require-jsdoc": ["error"|"warn", {"exemptOverloadedImplementations":true,"require":{"ArrowFunctionExpression":true}}] ```` diff --git a/docs/rules/require-param.md b/docs/rules/require-param.md index 84d3dcb8..281c7190 100644 --- a/docs/rules/require-param.md +++ b/docs/rules/require-param.md @@ -1842,5 +1842,16 @@ const inner = (c: number, d: string): void => { */ function quux (a, b) {} // "jsdoc/require-param": ["error"|"warn", {"ignoreWhenAllParamsMissing":true}] + +/** + * Test function with param. + * @param foo - Test param. + */ +function myFunction(foo: string): void; +/** + * Test function without param. + */ +function myFunction(): void; +function myFunction(foo?: string) {} ```` diff --git a/package.json b/package.json index a25fda05..87d8209a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://gajus.com" }, "dependencies": { - "@es-joy/jsdoccomment": "~0.53.0", + "@es-joy/jsdoccomment": "~0.54.1", "are-docs-informative": "^0.0.2", "comment-parser": "1.4.1", "debug": "^4.4.1", @@ -29,7 +29,7 @@ "@es-joy/jsdoc-eslint-parser": "^0.22.0", "@hkdobrev/run-if-changed": "^0.6.3", "@semantic-release/commit-analyzer": "^13.0.1", - "@semantic-release/github": "^11.0.4", + "@semantic-release/github": "^11.0.5", "@semantic-release/npm": "^12.0.2", "@types/chai": "^5.2.2", "@types/debug": "^4.1.12", @@ -42,7 +42,7 @@ "@types/node": "^24.3.0", "@types/semver": "^7.7.0", "@types/spdx-expression-parse": "^3.0.5", - "@typescript-eslint/types": "^8.41.0", + "@typescript-eslint/types": "^8.42.0", "babel-plugin-add-module-exports": "^1.0.4", "babel-plugin-istanbul": "^7.0.0", "babel-plugin-transform-import-meta": "^2.3.3", @@ -58,15 +58,15 @@ "husky": "^9.1.7", "jsdoc-type-pratt-parser": "^4.8.0", "json-schema": "^0.4.0", - "lint-staged": "^16.1.5", + "lint-staged": "^16.1.6", "lodash.defaultsdeep": "^4.6.1", - "mocha": "^11.7.1", + "mocha": "^11.7.2", "open-editor": "^5.1.0", "replace": "^1.2.2", "rimraf": "^6.0.1", "semantic-release": "^24.2.7", "typescript": "5.9.2", - "typescript-eslint": "^8.41.0" + "typescript-eslint": "^8.42.0" }, "engines": { "node": ">=20.11.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f1e57be9..266a7d96 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@es-joy/jsdoccomment': - specifier: ~0.53.0 - version: 0.53.0 + specifier: ~0.54.1 + version: 0.54.1 are-docs-informative: specifier: ^0.0.2 version: 0.0.2 @@ -73,8 +73,8 @@ importers: specifier: ^13.0.1 version: 13.0.1(semantic-release@24.2.7(typescript@5.9.2)) '@semantic-release/github': - specifier: ^11.0.4 - version: 11.0.4(semantic-release@24.2.7(typescript@5.9.2)) + specifier: ^11.0.5 + version: 11.0.5(semantic-release@24.2.7(typescript@5.9.2)) '@semantic-release/npm': specifier: ^12.0.2 version: 12.0.2(semantic-release@24.2.7(typescript@5.9.2)) @@ -112,8 +112,8 @@ importers: specifier: ^3.0.5 version: 3.0.5 '@typescript-eslint/types': - specifier: ^8.41.0 - version: 8.41.0 + specifier: ^8.42.0 + version: 8.42.0 babel-plugin-add-module-exports: specifier: ^1.0.4 version: 1.0.4 @@ -140,7 +140,7 @@ importers: version: 9.34.0(jiti@2.5.1) eslint-config-canonical: specifier: ~45.0.0 - version: 45.0.0(@types/eslint@9.6.1)(@types/node@24.3.0)(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + version: 45.0.0(@types/eslint@9.6.1)(@types/node@24.3.0)(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) gitdown: specifier: ^4.1.1 version: 4.1.1(re2@1.20.9) @@ -160,14 +160,14 @@ importers: specifier: ^0.4.0 version: 0.4.0 lint-staged: - specifier: ^16.1.5 - version: 16.1.5 + specifier: ^16.1.6 + version: 16.1.6 lodash.defaultsdeep: specifier: ^4.6.1 version: 4.6.1 mocha: - specifier: ^11.7.1 - version: 11.7.1 + specifier: ^11.7.2 + version: 11.7.2 open-editor: specifier: ^5.1.0 version: 5.1.0 @@ -184,8 +184,8 @@ importers: specifier: 5.9.2 version: 5.9.2 typescript-eslint: - specifier: ^8.41.0 - version: 8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + specifier: ^8.42.0 + version: 8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) packages: @@ -774,14 +774,14 @@ packages: resolution: {integrity: sha512-YAdE/IJSpwbOTiaURNCKECdAwqrJuFiZhylmesBcIRawtYKnBR2wxPhoIewMg+Yu+QuYvHfJNReWpoxGBKOChA==} engines: {node: '>=18'} - '@es-joy/jsdoccomment@0.53.0': - resolution: {integrity: sha512-Wyed8Wfn3vMNVwrZrgLMxmqwmlcCE1/RfUAOHFzMJb3QLH03mi9Yv1iOCZjif0yx5EZUeJ+17VD1MHPka9IQjQ==} - engines: {node: '>=20.11.0'} - '@es-joy/jsdoccomment@0.54.0': resolution: {integrity: sha512-r+DsSLA9rhdL9+IXySvqi/4VfhVwMlMztv7xJCxki82DvcTSlk4AT878sUKxizUwSJ8UieuCbjjbNi1OL5by+Q==} engines: {node: '>=20.11.0'} + '@es-joy/jsdoccomment@0.54.1': + resolution: {integrity: sha512-2hJOXWybEqoA10KrQlP9XFV5luQpYZrAOIZzn2/0b0jLnLMxiRMnFz535HcoxFN1DkUWOV7B8qPbHp52VuKMeg==} + engines: {node: '>=20.11.0'} + '@eslint-community/eslint-utils@4.7.0': resolution: {integrity: sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -1138,8 +1138,8 @@ packages: resolution: {integrity: sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==} engines: {node: '>=18'} - '@semantic-release/github@11.0.4': - resolution: {integrity: sha512-fU/nLSjkp9DmB0h7FVO5imhhWJMvq2LjD4+3lz3ZAzpDLY9+KYwC+trJ+g7LbZeJv9y3L9fSFSg2DduUpiT6bw==} + '@semantic-release/github@11.0.5': + resolution: {integrity: sha512-wJamzHteXwBdopvkTD6BJjPz1UHLm20twlVCSMA9zpd3B5KrOQX137jfTbNJT6ZVz3pXtg0S1DroQl4wifJ4WQ==} engines: {node: '>=20.8.1'} peerDependencies: semantic-release: '>=24.1.0' @@ -1245,6 +1245,14 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/eslint-plugin@8.42.0': + resolution: {integrity: sha512-Aq2dPqsQkxHOLfb2OPv43RnIvfj05nw8v/6n3B2NABIPpHnjQnaLo9QGMTvml+tv4korl/Cjfrb/BYhoL8UUTQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + '@typescript-eslint/parser': ^8.42.0 + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/parser@8.41.0': resolution: {integrity: sha512-gTtSdWX9xiMPA/7MV9STjJOOYtWwIJIYxkQxnSV1U3xcE+mnJSH3f6zI0RYP+ew66WSlZ5ed+h0VCxsvdC1jJg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1252,6 +1260,13 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/parser@8.42.0': + resolution: {integrity: sha512-r1XG74QgShUgXph1BYseJ+KZd17bKQib/yF3SR+demvytiRXrwd12Blnz5eYGm8tXaeRdd4x88MlfwldHoudGg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/project-service@8.39.1': resolution: {integrity: sha512-8fZxek3ONTwBu9ptw5nCKqZOSkXshZB7uAxuFF0J/wTMkKydjXCzqqga7MlFMpHi9DoG4BadhmTkITBcg8Aybw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1264,6 +1279,12 @@ packages: peerDependencies: typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/project-service@8.42.0': + resolution: {integrity: sha512-vfVpLHAhbPjilrabtOSNcUDmBboQNrJUiNAGoImkZKnMjs2TIcWG33s4Ds0wY3/50aZmTMqJa6PiwkwezaAklg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/scope-manager@8.39.1': resolution: {integrity: sha512-RkBKGBrjgskFGWuyUGz/EtD8AF/GW49S21J8dvMzpJitOF1slLEbbHnNEtAHtnDAnx8qDEdRrULRnWVx27wGBw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1272,6 +1293,10 @@ packages: resolution: {integrity: sha512-n6m05bXn/Cd6DZDGyrpXrELCPVaTnLdPToyhBoFkLIMznRUQUEQdSp96s/pcWSQdqOhrgR1mzJ+yItK7T+WPMQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/scope-manager@8.42.0': + resolution: {integrity: sha512-51+x9o78NBAVgQzOPd17DkNTnIzJ8T/O2dmMBLoK9qbY0Gm52XJcdJcCl18ExBMiHo6jPMErUQWUv5RLE51zJw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/tsconfig-utils@8.39.1': resolution: {integrity: sha512-ePUPGVtTMR8XMU2Hee8kD0Pu4NDE1CN9Q1sxGSGd/mbOtGZDM7pnhXNJnzW63zk/q+Z54zVzj44HtwXln5CvHA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1284,6 +1309,12 @@ packages: peerDependencies: typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/tsconfig-utils@8.42.0': + resolution: {integrity: sha512-kHeFUOdwAJfUmYKjR3CLgZSglGHjbNTi1H8sTYRYV2xX6eNz4RyJ2LIgsDLKf8Yi0/GL1WZAC/DgZBeBft8QAQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/type-utils@8.39.1': resolution: {integrity: sha512-gu9/ahyatyAdQbKeHnhT4R+y3YLtqqHyvkfDxaBYk97EcbfChSJXyaJnIL3ygUv7OuZatePHmQvuH5ru0lnVeA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1298,6 +1329,13 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/type-utils@8.42.0': + resolution: {integrity: sha512-9KChw92sbPTYVFw3JLRH1ockhyR3zqqn9lQXol3/YbI6jVxzWoGcT3AsAW0mu1MY0gYtsXnUGV/AKpkAj5tVlQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/types@8.39.1': resolution: {integrity: sha512-7sPDKQQp+S11laqTrhHqeAbsCfMkwJMrV7oTDvtDds4mEofJYir414bYKUEb8YPUm9QL3U+8f6L6YExSoAGdQw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1306,6 +1344,10 @@ packages: resolution: {integrity: sha512-9EwxsWdVqh42afLbHP90n2VdHaWU/oWgbH2P0CfcNfdKL7CuKpwMQGjwev56vWu9cSKU7FWSu6r9zck6CVfnag==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/types@8.42.0': + resolution: {integrity: sha512-LdtAWMiFmbRLNP7JNeY0SqEtJvGMYSzfiWBSmx+VSZ1CH+1zyl8Mmw1TT39OrtsRvIYShjJWzTDMPWZJCpwBlw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/typescript-estree@8.39.1': resolution: {integrity: sha512-EKkpcPuIux48dddVDXyQBlKdeTPMmALqBUbEk38McWv0qVEZwOpVJBi7ugK5qVNgeuYjGNQxrrnoM/5+TI/BPw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1318,6 +1360,12 @@ packages: peerDependencies: typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/typescript-estree@8.42.0': + resolution: {integrity: sha512-ku/uYtT4QXY8sl9EDJETD27o3Ewdi72hcXg1ah/kkUgBvAYHLwj2ofswFFNXS+FL5G+AGkxBtvGt8pFBHKlHsQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/utils@8.39.1': resolution: {integrity: sha512-VF5tZ2XnUSTuiqZFXCZfZs1cgkdd3O/sSYmdo2EpSyDlC86UM/8YytTmKnehOW3TGAlivqTDT6bS87B/GQ/jyg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1332,6 +1380,13 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/utils@8.42.0': + resolution: {integrity: sha512-JnIzu7H3RH5BrKC4NoZqRfmjqCIS1u3hGZltDYJgkVdqAezl4L9d1ZLw+36huCujtSBSAirGINF/S4UxOcR+/g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/visitor-keys@8.39.1': resolution: {integrity: sha512-W8FQi6kEh2e8zVhQ0eeRnxdvIoOkAp/CPAahcNio6nO9dsIwb9b34z90KOlheoyuVf6LSOEdjlkxSkapNEc+4A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1340,6 +1395,10 @@ packages: resolution: {integrity: sha512-+GeGMebMCy0elMNg67LRNoVnUFPIm37iu5CmHESVx56/9Jsfdpsvbv605DQ81Pi/x11IdKUsS5nzgTYbCQU9fg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/visitor-keys@8.42.0': + resolution: {integrity: sha512-3WbiuzoEowaEn8RSnhJBrxSwX8ULYE9CXaPepS2C2W3NSA5NNIvBaslpBSBElPq0UGr0xVJlXFWOAKIkyylydQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@unrs/resolver-binding-android-arm-eabi@1.11.1': resolution: {integrity: sha512-ppLRUgHVaGRWUx0R0Ut06Mjo9gBaBkg3v/8AxusGLhsIotbBLuRk51rAzqLC8gq6NyyAojEXglNjzf6R948DNw==} cpu: [arm] @@ -1776,6 +1835,10 @@ packages: resolution: {integrity: sha512-1tm8DTaJhPBG3bIkVeZt1iZM9GfSX2lzOeDVZH9R9ffRHpmHvxZ/QhgQH/aDTkswQVt+YHdXAdS/In/30OjCbg==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + chalk@5.6.0: + resolution: {integrity: sha512-46QrSQFyVSEyYAgQ22hQ+zDa60YHA4fBstHmtSApj1Y5vKtG27fWowW03jCk5KcbXEWPZUIR894aARCA/G1kfQ==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + change-case@5.4.4: resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==} @@ -3476,8 +3539,8 @@ packages: lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - lint-staged@16.1.5: - resolution: {integrity: sha512-uAeQQwByI6dfV7wpt/gVqg+jAPaSp8WwOA8kKC/dv1qw14oGpnpAisY65ibGHUGDUv0rYaZ8CAJZ/1U8hUvC2A==} + lint-staged@16.1.6: + resolution: {integrity: sha512-U4kuulU3CKIytlkLlaHcGgKscNfJPNTiDF2avIUGFCv7K95/DCYQ7Ra62ydeRWmgQGg9zJYw2dzdbztwJlqrow==} engines: {node: '>=20.17'} hasBin: true @@ -3485,8 +3548,8 @@ packages: resolution: {integrity: sha512-LWzX2KsqcB1wqQ4AHgYb4RsDXauQiqhjLk+6hjbaeHG4zpjjVAB6wC/gz6X0l+Du1cN3pUB5ZlrvTbhGSNnUQQ==} engines: {node: '>=18.0.0'} - listr2@9.0.1: - resolution: {integrity: sha512-SL0JY3DaxylDuo/MecFeiC+7pedM0zia33zl0vcjgwcq1q1FWWF1To9EIauPbl8GbMCU0R2e0uJ8bZunhYKD2g==} + listr2@9.0.3: + resolution: {integrity: sha512-0aeh5HHHgmq1KRdMMDHfhMWQmIT/m7nRDTlxlFqni2Sp0had9baqsjJRvDGdlvgd6NmPE0nPloOipiQJGFtTHQ==} engines: {node: '>=20.0.0'} load-json-file@4.0.0: @@ -3726,8 +3789,8 @@ packages: engines: {node: '>=10'} hasBin: true - mocha@11.7.1: - resolution: {integrity: sha512-5EK+Cty6KheMS/YLPPMJC64g5V61gIR25KsRItHw6x4hEKT6Njp1n9LOlH4gpevuwMVS66SXaBBpg+RWZkza4A==} + mocha@11.7.2: + resolution: {integrity: sha512-lkqVJPmqqG/w5jmmFtiRvtA2jkDyNVUcefFJKb2uyX4dekk8Okgqop3cgbFiaIvj8uCRJVTP5x9dfxGyXm2jvQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true @@ -4859,8 +4922,8 @@ packages: resolution: {integrity: sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==} engines: {node: '>= 0.4'} - typescript-eslint@8.41.0: - resolution: {integrity: sha512-n66rzs5OBXW3SFSnZHr2T685q1i4ODm2nulFJhMZBotaTavsS8TrI3d7bDlRSs9yWo7HmyWrN9qDu14Qv7Y0Dw==} + typescript-eslint@8.42.0: + resolution: {integrity: sha512-ozR/rQn+aQXQxh1YgbCzQWDFrsi9mcg+1PM3l/z5o1+20P7suOIaNg515bpr/OYt6FObz/NHcBstydDLHWeEKg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -5926,23 +5989,23 @@ snapshots: '@es-joy/jsdoccomment@0.50.2': dependencies: '@types/estree': 1.0.8 - '@typescript-eslint/types': 8.41.0 + '@typescript-eslint/types': 8.42.0 comment-parser: 1.4.1 esquery: 1.6.0 jsdoc-type-pratt-parser: 4.1.0 - '@es-joy/jsdoccomment@0.53.0': + '@es-joy/jsdoccomment@0.54.0': dependencies: '@types/estree': 1.0.8 - '@typescript-eslint/types': 8.41.0 + '@typescript-eslint/types': 8.42.0 comment-parser: 1.4.1 esquery: 1.6.0 jsdoc-type-pratt-parser: 4.8.0 - '@es-joy/jsdoccomment@0.54.0': + '@es-joy/jsdoccomment@0.54.1': dependencies: '@types/estree': 1.0.8 - '@typescript-eslint/types': 8.41.0 + '@typescript-eslint/types': 8.42.0 comment-parser: 1.4.1 esquery: 1.6.0 jsdoc-type-pratt-parser: 4.8.0 @@ -6430,7 +6493,7 @@ snapshots: '@semantic-release/error@4.0.0': {} - '@semantic-release/github@11.0.4(semantic-release@24.2.7(typescript@5.9.2))': + '@semantic-release/github@11.0.5(semantic-release@24.2.7(typescript@5.9.2))': dependencies: '@octokit/core': 7.0.3 '@octokit/plugin-paginate-rest': 13.1.1(@octokit/core@7.0.3) @@ -6590,6 +6653,23 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/eslint-plugin@8.42.0(@typescript-eslint/parser@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2)': + dependencies: + '@eslint-community/regexpp': 4.12.1 + '@typescript-eslint/parser': 8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + '@typescript-eslint/scope-manager': 8.42.0 + '@typescript-eslint/type-utils': 8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + '@typescript-eslint/utils': 8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + '@typescript-eslint/visitor-keys': 8.42.0 + eslint: 9.34.0(jiti@2.5.1) + graphemer: 1.4.0 + ignore: 7.0.5 + natural-compare: 1.4.0 + ts-api-utils: 2.1.0(typescript@5.9.2) + typescript: 5.9.2 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2)': dependencies: '@typescript-eslint/scope-manager': 8.41.0 @@ -6602,10 +6682,22 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/parser@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2)': + dependencies: + '@typescript-eslint/scope-manager': 8.42.0 + '@typescript-eslint/types': 8.42.0 + '@typescript-eslint/typescript-estree': 8.42.0(typescript@5.9.2) + '@typescript-eslint/visitor-keys': 8.42.0 + debug: 4.4.1(supports-color@8.1.1) + eslint: 9.34.0(jiti@2.5.1) + typescript: 5.9.2 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/project-service@8.39.1(typescript@5.9.2)': dependencies: '@typescript-eslint/tsconfig-utils': 8.39.1(typescript@5.9.2) - '@typescript-eslint/types': 8.41.0 + '@typescript-eslint/types': 8.42.0 debug: 4.4.1(supports-color@8.1.1) typescript: 5.9.2 transitivePeerDependencies: @@ -6614,7 +6706,16 @@ snapshots: '@typescript-eslint/project-service@8.41.0(typescript@5.9.2)': dependencies: '@typescript-eslint/tsconfig-utils': 8.41.0(typescript@5.9.2) - '@typescript-eslint/types': 8.41.0 + '@typescript-eslint/types': 8.42.0 + debug: 4.4.1(supports-color@8.1.1) + typescript: 5.9.2 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/project-service@8.42.0(typescript@5.9.2)': + dependencies: + '@typescript-eslint/tsconfig-utils': 8.42.0(typescript@5.9.2) + '@typescript-eslint/types': 8.42.0 debug: 4.4.1(supports-color@8.1.1) typescript: 5.9.2 transitivePeerDependencies: @@ -6630,6 +6731,11 @@ snapshots: '@typescript-eslint/types': 8.41.0 '@typescript-eslint/visitor-keys': 8.41.0 + '@typescript-eslint/scope-manager@8.42.0': + dependencies: + '@typescript-eslint/types': 8.42.0 + '@typescript-eslint/visitor-keys': 8.42.0 + '@typescript-eslint/tsconfig-utils@8.39.1(typescript@5.9.2)': dependencies: typescript: 5.9.2 @@ -6638,6 +6744,10 @@ snapshots: dependencies: typescript: 5.9.2 + '@typescript-eslint/tsconfig-utils@8.42.0(typescript@5.9.2)': + dependencies: + typescript: 5.9.2 + '@typescript-eslint/type-utils@8.39.1(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2)': dependencies: '@typescript-eslint/types': 8.39.1 @@ -6662,10 +6772,24 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/type-utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2)': + dependencies: + '@typescript-eslint/types': 8.42.0 + '@typescript-eslint/typescript-estree': 8.42.0(typescript@5.9.2) + '@typescript-eslint/utils': 8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + debug: 4.4.1(supports-color@8.1.1) + eslint: 9.34.0(jiti@2.5.1) + ts-api-utils: 2.1.0(typescript@5.9.2) + typescript: 5.9.2 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/types@8.39.1': {} '@typescript-eslint/types@8.41.0': {} + '@typescript-eslint/types@8.42.0': {} + '@typescript-eslint/typescript-estree@8.39.1(typescript@5.9.2)': dependencies: '@typescript-eslint/project-service': 8.39.1(typescript@5.9.2) @@ -6698,6 +6822,22 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/typescript-estree@8.42.0(typescript@5.9.2)': + dependencies: + '@typescript-eslint/project-service': 8.42.0(typescript@5.9.2) + '@typescript-eslint/tsconfig-utils': 8.42.0(typescript@5.9.2) + '@typescript-eslint/types': 8.42.0 + '@typescript-eslint/visitor-keys': 8.42.0 + debug: 4.4.1(supports-color@8.1.1) + fast-glob: 3.3.3 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.7.2 + ts-api-utils: 2.1.0(typescript@5.9.2) + typescript: 5.9.2 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/utils@8.39.1(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2)': dependencies: '@eslint-community/eslint-utils': 4.7.0(eslint@9.34.0(jiti@2.5.1)) @@ -6720,6 +6860,17 @@ snapshots: transitivePeerDependencies: - supports-color + '@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2)': + dependencies: + '@eslint-community/eslint-utils': 4.7.0(eslint@9.34.0(jiti@2.5.1)) + '@typescript-eslint/scope-manager': 8.42.0 + '@typescript-eslint/types': 8.42.0 + '@typescript-eslint/typescript-estree': 8.42.0(typescript@5.9.2) + eslint: 9.34.0(jiti@2.5.1) + typescript: 5.9.2 + transitivePeerDependencies: + - supports-color + '@typescript-eslint/visitor-keys@8.39.1': dependencies: '@typescript-eslint/types': 8.39.1 @@ -6730,6 +6881,11 @@ snapshots: '@typescript-eslint/types': 8.41.0 eslint-visitor-keys: 4.2.1 + '@typescript-eslint/visitor-keys@8.42.0': + dependencies: + '@typescript-eslint/types': 8.42.0 + eslint-visitor-keys: 4.2.1 + '@unrs/resolver-binding-android-arm-eabi@1.11.1': optional: true @@ -7159,6 +7315,8 @@ snapshots: chalk@5.5.0: {} + chalk@5.6.0: {} + change-case@5.4.4: {} char-regex@1.0.2: {} @@ -7685,7 +7843,7 @@ snapshots: eslint: 9.34.0(jiti@2.5.1) semver: 7.7.2 - eslint-config-canonical@45.0.0(@types/eslint@9.6.1)(@types/node@24.3.0)(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2): + eslint-config-canonical@45.0.0(@types/eslint@9.6.1)(@types/node@24.3.0)(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2): dependencies: '@graphql-eslint/eslint-plugin': 4.4.0(@types/node@24.3.0)(eslint@9.34.0(jiti@2.5.1))(graphql@16.11.0)(typescript@5.9.2) '@next/eslint-plugin-next': 15.5.2 @@ -7695,14 +7853,14 @@ snapshots: '@vitest/eslint-plugin': 1.3.4(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) eslint: 9.34.0(jiti@2.5.1) eslint-config-prettier: 10.1.8(eslint@9.34.0(jiti@2.5.1)) - eslint-import-resolver-typescript: 4.4.4(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)) + eslint-import-resolver-typescript: 4.4.4(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)) eslint-plugin-ava: 15.1.0(eslint@9.34.0(jiti@2.5.1)) - eslint-plugin-canonical: 5.1.3(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + eslint-plugin-canonical: 5.1.3(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) eslint-plugin-eslint-comments: 3.2.0(eslint@9.34.0(jiti@2.5.1)) eslint-plugin-fp: 2.3.0(eslint@9.34.0(jiti@2.5.1)) eslint-plugin-functional: 9.0.2(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) - eslint-plugin-import: eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) - eslint-plugin-jest: 28.14.0(@typescript-eslint/eslint-plugin@8.41.0(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + eslint-plugin-import: eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) + eslint-plugin-jest: 28.14.0(@typescript-eslint/eslint-plugin@8.41.0(@typescript-eslint/parser@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) eslint-plugin-jsdoc: 50.8.0(eslint@9.34.0(jiti@2.5.1)) eslint-plugin-jsonc: 2.20.1(eslint@9.34.0(jiti@2.5.1)) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.34.0(jiti@2.5.1)) @@ -7723,7 +7881,7 @@ snapshots: graphql: 16.11.0 prettier: 3.6.2 ramda: 0.30.1 - typescript-eslint: 8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + typescript-eslint: 8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) yaml-eslint-parser: 1.3.0 transitivePeerDependencies: - '@apollo/subgraph' @@ -7766,7 +7924,7 @@ snapshots: - supports-color optional: true - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)): + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.1(supports-color@8.1.1) @@ -7777,12 +7935,12 @@ snapshots: tinyglobby: 0.2.14 unrs-resolver: 1.11.1 optionalDependencies: - eslint-plugin-import: eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) - eslint-plugin-import-x: 4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) + eslint-plugin-import: eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) + eslint-plugin-import-x: 4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@4.4.4(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)): + eslint-import-resolver-typescript@4.4.4(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)): dependencies: debug: 4.4.1(supports-color@8.1.1) eslint: 9.34.0(jiti@2.5.1) @@ -7793,8 +7951,8 @@ snapshots: tinyglobby: 0.2.14 unrs-resolver: 1.11.1 optionalDependencies: - eslint-plugin-import: eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) - eslint-plugin-import-x: 4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) + eslint-plugin-import: eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) + eslint-plugin-import-x: 4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)) transitivePeerDependencies: - supports-color @@ -7804,14 +7962,14 @@ snapshots: esquery: 1.6.0 jsonc-eslint-parser: 2.4.0 - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) eslint: 9.34.0(jiti@2.5.1) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)) transitivePeerDependencies: - supports-color @@ -7827,14 +7985,14 @@ snapshots: pkg-dir: 5.0.0 resolve-from: 5.0.0 - eslint-plugin-canonical@5.1.3(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2): + eslint-plugin-canonical@5.1.3(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2): dependencies: '@typescript-eslint/utils': 8.39.1(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) array-includes: 3.1.9 debug: 4.4.1(supports-color@8.1.1) doctrine: 3.0.0 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)) - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)))(eslint@9.34.0(jiti@2.5.1)) is-get-set-prop: 1.0.0 is-js-type: 2.0.0 is-obj-prop: 1.0.0 @@ -7889,9 +8047,9 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)): + eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.34.0(jiti@2.5.1)): dependencies: - '@typescript-eslint/types': 8.41.0 + '@typescript-eslint/types': 8.42.0 comment-parser: 1.4.1 debug: 4.4.1(supports-color@8.1.1) eslint: 9.34.0(jiti@2.5.1) @@ -7902,12 +8060,12 @@ snapshots: stable-hash-x: 0.2.0 unrs-resolver: 1.11.1 optionalDependencies: - '@typescript-eslint/utils': 8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + '@typescript-eslint/utils': 8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-plugin-jest@28.14.0(@typescript-eslint/eslint-plugin@8.41.0(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2): + eslint-plugin-jest@28.14.0(@typescript-eslint/eslint-plugin@8.41.0(@typescript-eslint/parser@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2): dependencies: '@typescript-eslint/utils': 8.39.1(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) eslint: 9.34.0(jiti@2.5.1) @@ -7999,7 +8157,7 @@ snapshots: eslint-plugin-perfectionist@4.15.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2): dependencies: - '@typescript-eslint/types': 8.41.0 + '@typescript-eslint/types': 8.42.0 '@typescript-eslint/utils': 8.39.1(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) eslint: 9.34.0(jiti@2.5.1) natural-orderby: 5.0.0 @@ -9138,13 +9296,13 @@ snapshots: lines-and-columns@1.2.4: {} - lint-staged@16.1.5: + lint-staged@16.1.6: dependencies: - chalk: 5.5.0 + chalk: 5.6.0 commander: 14.0.0 debug: 4.4.1(supports-color@8.1.1) lilconfig: 3.1.3 - listr2: 9.0.1 + listr2: 9.0.3 micromatch: 4.0.8 nano-spawn: 1.0.2 pidtree: 0.6.0 @@ -9162,7 +9320,7 @@ snapshots: rfdc: 1.4.1 wrap-ansi: 9.0.0 - listr2@9.0.1: + listr2@9.0.3: dependencies: cli-truncate: 4.0.0 colorette: 2.0.20 @@ -9401,7 +9559,7 @@ snapshots: mkdirp@1.0.4: optional: true - mocha@11.7.1: + mocha@11.7.2: dependencies: browser-stdout: 1.3.1 chokidar: 4.0.3 @@ -10079,7 +10237,7 @@ snapshots: dependencies: '@semantic-release/commit-analyzer': 13.0.1(semantic-release@24.2.7(typescript@5.9.2)) '@semantic-release/error': 4.0.0 - '@semantic-release/github': 11.0.4(semantic-release@24.2.7(typescript@5.9.2)) + '@semantic-release/github': 11.0.5(semantic-release@24.2.7(typescript@5.9.2)) '@semantic-release/npm': 12.0.2(semantic-release@24.2.7(typescript@5.9.2)) '@semantic-release/release-notes-generator': 14.0.3(semantic-release@24.2.7(typescript@5.9.2)) aggregate-error: 5.0.0 @@ -10598,12 +10756,12 @@ snapshots: possible-typed-array-names: 1.1.0 reflect.getprototypeof: 1.0.10 - typescript-eslint@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2): + typescript-eslint@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2): dependencies: - '@typescript-eslint/eslint-plugin': 8.41.0(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) - '@typescript-eslint/parser': 8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) - '@typescript-eslint/typescript-estree': 8.41.0(typescript@5.9.2) - '@typescript-eslint/utils': 8.41.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + '@typescript-eslint/eslint-plugin': 8.42.0(@typescript-eslint/parser@8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + '@typescript-eslint/parser': 8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) + '@typescript-eslint/typescript-estree': 8.42.0(typescript@5.9.2) + '@typescript-eslint/utils': 8.42.0(eslint@9.34.0(jiti@2.5.1))(typescript@5.9.2) eslint: 9.34.0(jiti@2.5.1) typescript: 5.9.2 transitivePeerDependencies: diff --git a/src/index.js b/src/index.js index d26b80b5..569ceb9c 100644 --- a/src/index.js +++ b/src/index.js @@ -137,7 +137,7 @@ const index = { /** * @param {"warn"|"error"} warnOrError * @param {string} [flatName] - * @returns {import('eslint').Linter.FlatConfig} + * @returns {import('eslint').Linter.Config} */ const createRecommendedRuleset = (warnOrError, flatName) => { return { @@ -216,7 +216,7 @@ const createRecommendedRuleset = (warnOrError, flatName) => { /** * @param {"warn"|"error"} warnOrError * @param {string} [flatName] - * @returns {import('eslint').Linter.FlatConfig} + * @returns {import('eslint').Linter.Config} */ const createRecommendedTypeScriptRuleset = (warnOrError, flatName) => { const ruleset = createRecommendedRuleset(warnOrError, flatName); @@ -244,7 +244,7 @@ const createRecommendedTypeScriptRuleset = (warnOrError, flatName) => { /** * @param {"warn"|"error"} warnOrError * @param {string} [flatName] - * @returns {import('eslint').Linter.FlatConfig} + * @returns {import('eslint').Linter.Config} */ const createRecommendedTypeScriptFlavorRuleset = (warnOrError, flatName) => { const ruleset = createRecommendedRuleset(warnOrError, flatName); @@ -267,7 +267,7 @@ const createStandaloneRulesetFactory = (ruleNames) => { /** * @param {"warn"|"error"} warnOrError * @param {string} [flatName] - * @returns {import('eslint').Linter.FlatConfig} + * @returns {import('eslint').Linter.Config} */ return (warnOrError, flatName) => { return { @@ -411,7 +411,7 @@ index.configs['flat/stylistic-typescript-error'] = createStylisticTypeScriptRule index.configs['flat/stylistic-typescript-flavor'] = createStylisticTypeScriptFlavorRuleset('warn', 'flat/stylistic-typescript-flavor'); index.configs['flat/stylistic-typescript-flavor-error'] = createStylisticTypeScriptFlavorRuleset('error', 'flat/stylistic-typescript-error-flavor'); -index.configs.examples = /** @type {import('eslint').Linter.FlatConfig[]} */ ([ +index.configs.examples = /** @type {import('eslint').Linter.Config[]} */ ([ { files: [ '**/*.js', @@ -465,7 +465,7 @@ index.configs.examples = /** @type {import('eslint').Linter.FlatConfig[]} */ ([ }, ]); -index.configs['default-expressions'] = /** @type {import('eslint').Linter.FlatConfig[]} */ ([ +index.configs['default-expressions'] = /** @type {import('eslint').Linter.Config[]} */ ([ { files: [ '**/*.js', @@ -502,7 +502,7 @@ index.configs['default-expressions'] = /** @type {import('eslint').Linter.FlatCo }, ]); -index.configs['examples-and-default-expressions'] = /** @type {import('eslint').Linter.FlatConfig[]} */ ([ +index.configs['examples-and-default-expressions'] = /** @type {import('eslint').Linter.Config[]} */ ([ { name: 'jsdoc/examples-and-default-expressions', plugins: { diff --git a/src/rules/requireJsdoc.js b/src/rules/requireJsdoc.js index 23d34254..527ce193 100644 --- a/src/rules/requireJsdoc.js +++ b/src/rules/requireJsdoc.js @@ -104,6 +104,10 @@ const OPTIONS_SCHEMA = { default: false, type: 'boolean', }, + exemptOverloadedImplementations: { + default: false, + type: 'boolean', + }, fixerMessage: { default: '', type: 'string', @@ -169,6 +173,10 @@ const OPTIONS_SCHEMA = { }, type: 'object', }, + skipInterveningOverloadedDeclarations: { + default: true, + type: 'boolean', + }, }, type: 'object', }; @@ -302,6 +310,8 @@ const getOption = (context, baseObject, option, key) => { * enableFixer: boolean, * exemptEmptyConstructors: boolean, * exemptEmptyFunctions: boolean, + * skipInterveningOverloadedDeclarations: boolean, + * exemptOverloadedImplementations: boolean, * fixerMessage: string, * minLineCount: undefined|import('../iterateJsdoc.js').Integer, * publicOnly: boolean|{[key: string]: boolean|undefined} @@ -314,9 +324,11 @@ const getOptions = (context, settings) => { enableFixer = true, exemptEmptyConstructors = true, exemptEmptyFunctions = false, + exemptOverloadedImplementations = false, fixerMessage = '', minLineCount = undefined, publicOnly, + skipInterveningOverloadedDeclarations = true, } = context.options[0] || {}; return { @@ -324,6 +336,7 @@ const getOptions = (context, settings) => { enableFixer, exemptEmptyConstructors, exemptEmptyFunctions, + exemptOverloadedImplementations, fixerMessage, minLineCount, publicOnly: ((baseObj) => { @@ -386,9 +399,52 @@ const getOptions = (context, settings) => { /** @type {import('json-schema').JSONSchema4Object} */ (OPTIONS_SCHEMA.properties).require, ), + skipInterveningOverloadedDeclarations, }; }; +/** + * @param {ESLintOrTSNode} node + */ +const isFunctionWithOverload = (node) => { + if (node.type !== 'FunctionDeclaration') { + return false; + } + + let parent; + let child; + + if (node.parent?.type === 'Program') { + parent = node.parent; + child = node; + } else if (node.parent?.type === 'ExportNamedDeclaration' && + node.parent?.parent.type === 'Program') { + parent = node.parent?.parent; + child = node.parent; + } + + if (!child || !parent) { + return false; + } + + const functionName = node.id.name; + + const idx = parent.body.indexOf(child); + const prevSibling = parent.body[idx - 1]; + + return ( + // @ts-expect-error Should be ok + (prevSibling?.type === 'TSDeclareFunction' && + // @ts-expect-error Should be ok + functionName === prevSibling.id.name) || + (prevSibling?.type === 'ExportNamedDeclaration' && + // @ts-expect-error Should be ok + prevSibling.declaration?.type === 'TSDeclareFunction' && + // @ts-expect-error Should be ok + prevSibling.declaration?.id?.name === functionName) + ); +}; + /** @type {import('eslint').Rule.RuleModule} */ export default { create (context) { @@ -408,9 +464,11 @@ export default { enableFixer, exemptEmptyConstructors, exemptEmptyFunctions, + exemptOverloadedImplementations, fixerMessage, minLineCount, require: requireOption, + skipInterveningOverloadedDeclarations, } = opts; const publicOnly = @@ -476,7 +534,15 @@ export default { } } - const jsDocNode = getJSDocComment(sourceCode, node, settings); + if (exemptOverloadedImplementations && isFunctionWithOverload(node)) { + return; + } + + const jsDocNode = getJSDocComment( + sourceCode, node, settings, { + checkOverloads: skipInterveningOverloadedDeclarations, + }, + ); if (jsDocNode) { return; diff --git a/test/rules/assertions/requireJsdoc.js b/test/rules/assertions/requireJsdoc.js index 156d941a..bbd20335 100644 --- a/test/rules/assertions/requireJsdoc.js +++ b/test/rules/assertions/requireJsdoc.js @@ -4296,6 +4296,182 @@ function quux (foo) { } `, }, + { + code: ` + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + /** + * Test function without param. + */ + function myFunction(): void; + function myFunction(foo?: string) {} + `, + errors: [ + { + line: 11, + message: 'Missing JSDoc comment.', + }, + ], + languageOptions: { + parser: typescriptEslintParser, + }, + options: [ + { + skipInterveningOverloadedDeclarations: false, + }, + ], + output: ` + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + /** + * Test function without param. + */ + function myFunction(): void; + /** + * + */ + function myFunction(foo?: string) {} + `, + }, + { + code: ` + /** + * Test function without param. + */ + function myFunction(): void; + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + function myFunction(foo?: string) {} + `, + errors: [ + { + line: 11, + message: 'Missing JSDoc comment.', + }, + ], + languageOptions: { + parser: typescriptEslintParser, + }, + options: [ + { + skipInterveningOverloadedDeclarations: false, + }, + ], + output: ` + /** + * Test function without param. + */ + function myFunction(): void; + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + /** + * + */ + function myFunction(foo?: string) {} + `, + }, + { + code: ` + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + function myFunction(): void; + /** + * Function implementation + * @param foo + */ + function myFunction(foo?: string) {} + `, + errors: [ + { + line: 7, + message: 'Missing JSDoc comment.', + }, + ], + languageOptions: { + parser: typescriptEslintParser, + }, + options: [ + { + contexts: [ + 'TSDeclareFunction', + ], + exemptOverloadedImplementations: false, + skipInterveningOverloadedDeclarations: false, + }, + ], + output: ` + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + /** + * + */ + function myFunction(): void; + /** + * Function implementation + * @param foo + */ + function myFunction(foo?: string) {} + `, + }, + { + code: ` + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + function myFunction(): void; + function myFunction(foo?: string) {} + `, + errors: [ + { + line: 7, + message: 'Missing JSDoc comment.', + }, + ], + languageOptions: { + parser: typescriptEslintParser, + }, + options: [ + { + contexts: [ + 'TSDeclareFunction', + ], + exemptOverloadedImplementations: true, + skipInterveningOverloadedDeclarations: false, + }, + ], + output: ` + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + /** + * + */ + function myFunction(): void; + function myFunction(foo?: string) {} + `, + }, ], valid: [ { @@ -6442,6 +6618,48 @@ function quux (foo) { languageOptions: { parser: typescriptEslintParser, }, + options: [ + { + skipInterveningOverloadedDeclarations: true, + }, + ], + }, + { + code: ` + /** + * Array map function with overload for NonEmptyArray + * @example + * const data = [{value: 'value'}] as const; + * const result1: NonEmptyReadonlyArray<'value'> = arrayMap(data, (value) => value.value); // pick type from data + * const result2: NonEmptyReadonlyArray<'value'> = arrayMap<'value', typeof data>(data, (value) => value.value); // enforce output type + * @template Target - The type of the array to map to + * @template Source - The type of the array to map from + * @param {Source} data - The array to map + * @param {MapCallback} callback - Callback function to map data from the array + * @returns {AnyArrayType} Mapped array + * @since v0.2.0 + */ + export function arrayMap | NonEmptyReadonlyArray>( + data: Source, + callback: MapCallback, + ): NonEmptyArray; + export function arrayMap>(data: Source, callback: MapCallback): Array; + export function arrayMap(data: Source, callback: MapCallback): AnyArrayType { + return data.map(callback); + } + `, + languageOptions: { + parser: typescriptEslintParser, + }, + options: [ + { + contexts: [ + 'TSDeclareFunction', + ], + exemptOverloadedImplementations: false, + skipInterveningOverloadedDeclarations: true, + }, + ], }, { code: ` @@ -6471,5 +6689,98 @@ function quux (foo) { }, ], }, + { + code: ` + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + /** + * Test function without param. + */ + function myFunction(): void; + function myFunction(foo?: string) {} + `, + languageOptions: { + parser: typescriptEslintParser, + }, + }, + { + code: ` + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + /** + * Test function without param. + */ + function myFunction(): void; + function myFunction(foo?: string) {} + `, + languageOptions: { + parser: typescriptEslintParser, + }, + options: [ + { + contexts: [ + 'TSDeclareFunction', + ], + exemptOverloadedImplementations: true, + skipInterveningOverloadedDeclarations: false, + }, + ], + }, + { + code: ` + /** + * Test function with param. + * @param foo - Test param. + */ + export function myFunction(foo: string): void; + /** + * Test function without param. + */ + export function myFunction(): void; + export function myFunction(foo?: string) {} + `, + languageOptions: { + parser: typescriptEslintParser, + }, + options: [ + { + contexts: [ + 'TSDeclareFunction', + ], + exemptOverloadedImplementations: true, + skipInterveningOverloadedDeclarations: false, + }, + ], + }, + { + code: ` + /** + * + */ + const quux = () => { + /** + * + */ + function myFunction(foo?: string) {} + }; + `, + languageOptions: { + parser: typescriptEslintParser, + }, + options: [ + { + exemptOverloadedImplementations: true, + require: { + ArrowFunctionExpression: true, + }, + }, + ], + }, ], }); diff --git a/test/rules/assertions/requireParam.js b/test/rules/assertions/requireParam.js index 73c5cff7..5d4d13d5 100644 --- a/test/rules/assertions/requireParam.js +++ b/test/rules/assertions/requireParam.js @@ -3677,5 +3677,23 @@ export default /** @type {import('../index.js').TestCases} */ ({ }, ], }, + { + code: ` + /** + * Test function with param. + * @param foo - Test param. + */ + function myFunction(foo: string): void; + /** + * Test function without param. + */ + function myFunction(): void; + function myFunction(foo?: string) {} + `, + languageOptions: { + parser: typescriptEslintParser, + sourceType: 'module', + }, + }, ], });