Add jsdoc to eslint config

This commit is contained in:
Adam Obuchowicz 2024-10-02 16:04:38 +02:00
parent 5f1d32f1aa
commit 6f0e80732b
No known key found for this signature in database
GPG Key ID: 8A80F2A22CBB484F

View File

@ -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'],