Skip to content

require-param fixer inserts new tags inside preceding @example blocks #1530

@mvarchdev

Description

@mvarchdev
  • Title: require-param fixer inserts new tags inside preceding @example blocks
  • Expected behavior: Running eslint --fix on a docblock with multiple @example tags followed by @param tags should insert any missing params alongside the existing @param block (i.e., after the examples).
  • Actual behavior: The fixer inserts the missing @param lines inside the first @example fence, so every run adds another copy. The resulting docblock moves the @param block above the @examples and the examples keep accumulating duplicate @param lines.
// eslint.config.mjs (minimal) import { jsdoc, getJsdocProcessorPlugin } from 'eslint-plugin-jsdoc'; import tsParser from 'typescript-eslint'; export default [ jsdoc({ config: 'flat/requirements-typescript-error' }), { files: ['**/*.ts'], languageOptions: { parser: tsParser.parser }, plugins: { examples: getJsdocProcessorPlugin({ parser: tsParser.parser }) }, processor: 'examples/examples', }, { files: ['**/*.md/*.ts'], languageOptions: { parser: tsParser.parser }, rules: { 'jsdoc/require-param': 'error' }, }, ];
/**  * @example  * ```ts  * app.use(checkResourceOwnership({ entryPoint: 'seller_product' }));  * ```  *  * @example  * ```ts  * app.use(checkResourceOwnership({ entryPoint: 'service_zone' }));  * ```  *  * @param options - configuration  * @param options.entryPoint  * @param options.filterField  * @param options.paramIdField  */ export const checkResourceOwnership = ({ entryPoint, filterField, paramIdField, resourceId = () => '' }) => {};

Running eslint --fix repeatedly places the missing options.resourceId tag inside the example block each time.

  • Node version: 24.6.0
  • ESLint version: 9.34.0
  • eslint-plugin-jsdoc version: 59.0.1 (patched locally via portal resolution)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions