Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing JSDoc not reported for generic object-type parameters in TypeScript #1186

Closed
ComradeVanti opened this issue Jan 13, 2024 · 1 comment · Fixed by #1187
Closed

Missing JSDoc not reported for generic object-type parameters in TypeScript #1186

ComradeVanti opened this issue Jan 13, 2024 · 1 comment · Fixed by #1187

Comments

@ComradeVanti
Copy link

Expected behavior

I have the following export in my TypeScript project:

/**
 * Command options for the login command
 */
export type LoginOptions = CmdOptions<{
  username?: string;
  password?: string;
  email?: string;
  basicAuth?: boolean;
  alwaysAuth?: boolean;
}>;

I expect to get a warning that JSDoc for properties is missing.

Actual behavior

I do not get a warning for the properties.

Notes

The properties get the expected warning if either:

  • I remove the JSDoc above the type declaration
  • I make the type a plain object type, ie. remove CmdOption< >

ESLint Config

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:jsdoc/recommended-typescript",
    "prettier",
  ],
  rules: {
    "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
    "jsdoc/require-jsdoc": [
      "warn",
      {
        publicOnly: { ancestorsOnly: true, cjs: true },
        contexts: [
          "TSTypeAliasDeclaration",
          "TSInterfaceDeclaration",
          "TSMethodSignature",
          "TSPropertySignature",
        ],
      },
    ],
    "jsdoc/require-throws": 1,
    "jsdoc/require-returns": 0,
  },
  parser: "@typescript-eslint/parser",
  plugins: ["@typescript-eslint", "jsdoc"],
};

Environment

  • Node version: 16.20.2
  • ESLint version: 8.51.0
  • TypeScript: 5.2.2
  • eslint-plugin-jsdoc version: 47.0.2
Copy link

🎉 This issue has been resolved in version 48.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants