Skip to content

LiquidDoc linters should report unused parameters #1024

@karreiro

Description

@karreiro

Is your feature request related to a problem? Please describe.

I would like to add a linter rule that detects parameters documented in Liquid files with {% doc %} that are never actually passed in any of the calls to the snippet across the codebase.

For example, consider this snippets/example.liquid:

{%- doc -%}
  Renders a card for displaying various resource types (products, collections, articles, pages).

  @param {object} resource - The resource to render
  @param {string} [style] - The style of the card. Can be 'default' or 'overlay'
{%- enddoc -%}
...

This example has an optional style parameter, and there might be code related to it. However, if no one ever renders snippets/example.liquid with the style parameter, we should lint for it. This could be an opportunity to refactor and simplify snippets/example.liquid.

Describe the solution you'd like

I'd like a new linter check to cover the case described above.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions