From 6f0e80732b78fe0bb9bf60aad9bf2afdc9612b10 Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Wed, 2 Oct 2024 16:04:38 +0200 Subject: [PATCH] Add jsdoc to eslint config --- app/gui2/eslint.config.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/gui2/eslint.config.js b/app/gui2/eslint.config.js index 91420a71ae..9eeb2af849 100644 --- a/app/gui2/eslint.config.js +++ b/app/gui2/eslint.config.js @@ -1,5 +1,6 @@ import { FlatCompat } from '@eslint/eslintrc' import eslintJs from '@eslint/js' +import jsdoc from 'eslint-plugin-jsdoc' import * as path from 'node:path' import * as url from 'node:url' @@ -23,6 +24,7 @@ const conf = [ ...compat.extends('@vue/eslint-config-typescript', '@vue/eslint-config-prettier'), { // files: ['{**,src}/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}'], + plugins: { jsdoc }, languageOptions: { parserOptions: { tsconfigRootDir: DIR_NAME, @@ -51,6 +53,34 @@ const conf = [ 'vue/multi-word-component-names': 0, }, }, + // JsDoc lints for typescript - the recommended set with some modifications. + { + ignores: ['**/*.js'], + ...jsdoc.configs['flat/recommended-typescript'], + rules: { + ...jsdoc.configs['flat/recommended-typescript'].rules, + 'jsdoc/check-param-names': [ + 'warn', + { checkDestructured: false, disableMissingParamChecks: true }, + ], + 'jsdoc/require-jsdoc': [ + 'warn', + { + publicOnly: true, + require: { + FunctionDeclaration: true, + MethodDefinition: true, + ClassDeclaration: true, + ArrowFunctionExpression: false, + FunctionExpression: true, + }, + }, + ], + 'jsdoc/require-param': 'off', + 'jsdoc/require-returns': 'off', + 'jsdoc/require-yields': 'off', + }, + }, // We must make sure our E2E tests await all steps, otherwise they're flaky. { files: ['e2e/**/*.spec.ts'],