Skip to main content

ValidDocParamTypes

Each parameter defined in LiquidDoc should be string, number, boolean, object, or any liquid object that isn't exclusively a global object. Parameter types are optional, and are surrounded by curly braces. Add square brackets,[], after the type to denote a typed array.


The following examples contain code snippets that either fail or pass this check.

The following example shows multiple parameters with invalid types:

{% doc %}
@param {custom} param1
@param {fake} param2
{% enddoc %}

The following example shows multidimensional arrays:

{% doc %}
@param {string[][]} string_matrix
{% enddoc %}

The following example shows multiple parameters with valid basic types:

{% doc %}
@param {string} some_str
@param {number} some_num
@param {boolean} some_bool
@param {object} some_obj
@param some_untyped
{% enddoc %}

The following example shows multiple parameters with valid liquid objects as their type:

{% doc %}
@param {product} special_product
@param {color} favorite_color
@param {currency} preferred_currency
{% enddoc %}

The following example shows parameter types with arrays:

{% doc %}
@param {product[]} special_products
@param {string[]} array_of_strings
{% enddoc %}

The following example contains the default configuration for this check:

ValidDocParamTypes:
enabled: true
severity: error
ParameterDescription
enabledWhether this check is enabled.
severityThe severity of the check.

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended.


Was this page helpful?