gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.1k stars 160 forks source link

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

Closed Taragryen closed 1 year ago

Taragryen commented 1 year 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 1 year ago
image

I followed the require-param example to configure it

brettz9 commented 1 year 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 1 year 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 1 year ago

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

Taragryen commented 1 year ago

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