Skip to content

Question: [jsdoc/require-jsdoc] Debug / find correct context to apply #751

@Shinigami92

Description

@Shinigami92

I have following code:

import { defineComponent, PropType } from '@vue/composition-api';

export default defineComponent({
  setup() {
    return {};
  }
});

image

My config:

'jsdoc/require-jsdoc': [
  'warn',
  {
    contexts: [
      'ClassDeclaration',
      'ClassProperty:not([accessibility=/(private|protected)/])',
      'ExportNamedDeclaration:has(VariableDeclaration)',
      ':not([name="setup"]) ~ FunctionExpression', // <---
      'MethodDefinition:not([accessibility=/(private|protected)/]) > FunctionExpression',
      'TSEnumDeclaration',
      'TSInterfaceDeclaration',
      'TSMethodSignature',
      // 'TSPropertySignature',
      'TSTypeAliasDeclaration'
    ]
  }
]

I want to disable jsdoc/require-jsdoc if FunctionExpression has pre-sibling with name !== setup
Sadly it just turns off also for non setup 🙁 and it's kinda the same as just remove 'FunctionExpression' from contexts

Do you know how I can configure that?

This is needed cause I want to write JSDoc for functions that are written by us, but not for e.g. setup that is predefined by Vue and just need to be defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions