Skip to content

Type definitions missing in eslint-plugin-jsdoc v53+, plugin imported as any #1449

@yunarch

Description

@yunarch

Expected behavior

In previous version 52.0.4, eslint-plugin-jsdoc exported complete TypeScript type definitions for the plugin, including ConfigGroups, ConfigVariants, ErrorLevelVariants, and a strongly-typed configs object.
Importing the plugin provided accurate type information instead of falling back to any.

Example from v52.0.4:

// index.d.ts
export type ConfigGroups = "recommended" | "stylistic" | "contents" | "logical" | "requirements";
export type ConfigVariants = "" | "-typescript" | "-typescript-flavor";
export type ErrorLevelVariants = "" | "-error";

/**
 * @type {import('eslint').ESLint.Plugin & {
 *   configs: Record<`flat/${ConfigGroups}${ConfigVariants}${ErrorLevelVariants}`, import('eslint').Linter.Config>
 * }}
 */
declare const index: import("eslint").ESLint.Plugin & {
  configs: Record<`flat/${ConfigGroups}${ConfigVariants}${ErrorLevelVariants}`, import("eslint").Linter.Config>;
};

export default index;

This allowed full IntelliSense and type safety.

Actual behavior

In v53+, the type definitions were reduced to:

// index.d.ts
import plugin_default from "./plugin.js";
export { plugin_default as default };

This removes the ConfigGroups, ConfigVariants, ErrorLevelVariants, and configs typings, causing the plugin to be imported as any, breaking type safety and editor IntelliSense.

Reproducible example

import jsdoc from "eslint-plugin-jsdoc";

jsdoc.nonExistentProperty; // no TS error but should produce an error as for v52.0.4

You should see an error such as:

Property 'nonExistentProperty' does not exist on type 'Plugin & { configs: Record<"flat/recommended" | "flat/recommended-error" | "flat/recommended-typescript" | "flat/recommended-typescript-error" | "flat/recommended-typescript-flavor" | ... 24 more ... | "flat/requirements-typescript-flavor-error", Config<...>>; }'.ts(2339)

tsconfig if need it:

{
"compilerOptions": {
    "target": "ESNext",
    "module": "Preserve",
    "composite": false,
    "skipLibCheck": true,
    "moduleResolution": "Bundler",
    "isolatedModules": true,
    "inlineSources": false,
    "esModuleInterop": true,
    "declarationMap": true,
    "noEmit": true,
    "allowImportingTsExtensions": true,
    "strict": true,
    "strictNullChecks": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "forceConsistentCasingInFileNames": true,
    "declaration": true,
    "preserveWatchOutput": true
  },
  "exclude": ["node_modules"]
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions