From e0efa13db0953a9c449e3b4b6c5b90601e0b3b1f Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Sat, 1 Mar 2025 12:14:58 +0100 Subject: [PATCH] Update `jsdoc/require-jsdoc` to require documentation for more things --- packages/base/rules-snapshot.json | 19 ++++++++++++++++++- packages/base/src/index.d.mts | 4 ++++ packages/base/src/index.mjs | 19 ++++++++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/packages/base/rules-snapshot.json b/packages/base/rules-snapshot.json index e37c4f11..e301a5a8 100644 --- a/packages/base/rules-snapshot.json +++ b/packages/base/rules-snapshot.json @@ -176,7 +176,24 @@ "always", { "tags": { "returns": "never", "template": "always", "throws": "never" } } ], - "jsdoc/require-jsdoc": "error", + "jsdoc/require-jsdoc": [ + "error", + { + "require": { + "ArrowFunctionExpression": true, + "ClassDeclaration": true, + "FunctionDeclaration": true, + "FunctionExpression": true, + "MethodDefinition": true + }, + "contexts": [ + "TSInterfaceDeclaration", + "TSTypeAliasDeclaration", + "TSEnumDeclaration", + "TSPropertySignature" + ] + } + ], "jsdoc/require-param": ["error", { "unnamedRootBase": ["options"] }], "jsdoc/require-param-description": "error", "jsdoc/require-param-name": "error", diff --git a/packages/base/src/index.d.mts b/packages/base/src/index.d.mts index 98df94e8..df20e921 100644 --- a/packages/base/src/index.d.mts +++ b/packages/base/src/index.d.mts @@ -11,6 +11,10 @@ declare module '@metamask/eslint-config' { * can only be used with the {@link createConfig} function. */ type ConfigWithExtends = Config & { + /** + * The configuration(s) to extend. This can be a single configuration, an + * array of configurations, or an array of arrays of configurations. + */ extends?: Config | Config[] | Config[][]; }; diff --git a/packages/base/src/index.mjs b/packages/base/src/index.mjs index 9ce28b08..8d6219fb 100644 --- a/packages/base/src/index.mjs +++ b/packages/base/src/index.mjs @@ -393,7 +393,24 @@ const rules = createConfig({ 'always', { tags: { returns: 'never', template: 'always', throws: 'never' } }, ], - 'jsdoc/require-jsdoc': 'error', + 'jsdoc/require-jsdoc': [ + 'error', + { + require: { + ArrowFunctionExpression: true, + ClassDeclaration: true, + FunctionDeclaration: true, + FunctionExpression: true, + MethodDefinition: true, + }, + contexts: [ + 'TSInterfaceDeclaration', + 'TSTypeAliasDeclaration', + 'TSEnumDeclaration', + 'TSPropertySignature', + ], + }, + ], 'jsdoc/require-param-name': 'error', 'jsdoc/require-param': ['error', { unnamedRootBase: ['options'] }], 'jsdoc/require-param-description': 'error',