Skip to content

Plugin shows TypeScript param types missing #663

@rlnt

Description

@rlnt

Expected behavior

The plugin shouldn't show missing param and return types for a function in TypeScript.
Param and return types are usually inferred from the function itself when IntelliSense is
provided and I often read that it could cause issues if you redefine them again in the JSDoc.

Actual behavior

It shows that there are missing param and return types for a function

ESLint Config

{
  "env": {
    "commonjs": true,
    "es6": true,
    "node": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:jsdoc/recommended"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "plugins": ["@typescript-eslint"],
  "rules": {
    "prefer-const": "warn",
    "no-empty-function": "warn",
    "no-unused-vars": "off"
  }
}

ESLint sample

/**
 * Returns true if the backend is successfully connected.
 *
 * @returns True if the backend is online
 */
function getIsOnline(): boolean {
    return isOnline;
}

Results in:

Missing JSDoc @returns type.

Environment

  • Node version: v15.4.0
  • ESLint version v7.16.0
  • eslint-plugin-jsdoc version: v30.7.9

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions