Shopify / Shopify/theme-tools

LiquidDoc linters should report unused parameters

Open
#1,024 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement theme-check
Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use snippets/example.liquid as the behavioral example, then locate the existing LiquidDoc linter checks and the entry point that can inspect snippet calls across the codebase. Done means the new check reports documented parameters that are never passed, including the optional style parameter in the example.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.