gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.09k stars 157 forks source link

`require-param` not working on angular component class methods #1166

Closed Taragryen closed 11 months ago

Taragryen commented 11 months ago

Expected behavior

Report an error: Missing JSDoc @param "btnState" declaration.

Actual behavior

No error reported

ESLint Config

"jsdoc/require-param": [
  "error",
  {
    "contexts": [
      "FunctionDeclaration",
      "TSFunctionType",
    ]
  }
], //not working on class methods

ESLint sample

this is an angular component class method
  /**
   * openConfirmModal
   * @memberof CreateEditTestWizardComponent
   */
  public openConfirmModal(btnState: string) {
    this.modalBtnState = btnState;
    this.openModal();
  }

Environment

Taragryen commented 11 months ago
image

I followed the require-param example to configure it

brettz9 commented 11 months ago

Use MethodDefinition instead of TSFunctionType.

In that example, it works because TSFunctionType is finding the type annotation (id: number) => string, not the method TestMethod.

Taragryen commented 11 months ago

Use MethodDefinition instead of TSFunctionType.

In that example, it works because TSFunctionType is finding the type annotation (id: number) => string, not the method TestMethod.

image

I tried MethodDefinition and it didn't work. Can only work on ordinary class, not angular component class🤔️

brettz9 commented 11 months ago

Can you provide a minimal example where it does not work?

Taragryen commented 11 months ago

After reinstalling the eslint extension, require-param is back to work now Sorry for taking up your time