Skip to main content

ExcessiveSettingsCount

Identifies section or block schemas with more top-level settings than the configured maxSettings. This check counts only top-level settings with an id; it doesn't count presentation-only header or paragraph entries, or settings nested inside blocks.

Reducing the number of top-level settings helps keep sections and blocks easier to configure. When a schema exceeds the configured maximum, reduce the number of top-level settings with an id—for example, remove unused settings or move related settings into nested blocks. Adding a header or paragraph entry doesn't lower the count because those entries have no id.


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

In the following example, the schema declares 41 top-level settings with an id, which is greater than the default maximum of 40:

{% schema %}
{
"name": "Product details",
"settings": [
{ "type": "text", "id": "setting_1", "label": "Setting 1" },
{ "type": "text", "id": "setting_2", "label": "Setting 2" },
{ "type": "text", "id": "setting_3", "label": "Setting 3" },
{ "type": "text", "id": "setting_4", "label": "Setting 4" },
{ "type": "text", "id": "setting_5", "label": "Setting 5" },
{ "type": "text", "id": "setting_6", "label": "Setting 6" },
{ "type": "text", "id": "setting_7", "label": "Setting 7" },
{ "type": "text", "id": "setting_8", "label": "Setting 8" },
{ "type": "text", "id": "setting_9", "label": "Setting 9" },
{ "type": "text", "id": "setting_10", "label": "Setting 10" },
{ "type": "text", "id": "setting_11", "label": "Setting 11" },
{ "type": "text", "id": "setting_12", "label": "Setting 12" },
{ "type": "text", "id": "setting_13", "label": "Setting 13" },
{ "type": "text", "id": "setting_14", "label": "Setting 14" },
{ "type": "text", "id": "setting_15", "label": "Setting 15" },
{ "type": "text", "id": "setting_16", "label": "Setting 16" },
{ "type": "text", "id": "setting_17", "label": "Setting 17" },
{ "type": "text", "id": "setting_18", "label": "Setting 18" },
{ "type": "text", "id": "setting_19", "label": "Setting 19" },
{ "type": "text", "id": "setting_20", "label": "Setting 20" },
{ "type": "text", "id": "setting_21", "label": "Setting 21" },
{ "type": "text", "id": "setting_22", "label": "Setting 22" },
{ "type": "text", "id": "setting_23", "label": "Setting 23" },
{ "type": "text", "id": "setting_24", "label": "Setting 24" },
{ "type": "text", "id": "setting_25", "label": "Setting 25" },
{ "type": "text", "id": "setting_26", "label": "Setting 26" },
{ "type": "text", "id": "setting_27", "label": "Setting 27" },
{ "type": "text", "id": "setting_28", "label": "Setting 28" },
{ "type": "text", "id": "setting_29", "label": "Setting 29" },
{ "type": "text", "id": "setting_30", "label": "Setting 30" },
{ "type": "text", "id": "setting_31", "label": "Setting 31" },
{ "type": "text", "id": "setting_32", "label": "Setting 32" },
{ "type": "text", "id": "setting_33", "label": "Setting 33" },
{ "type": "text", "id": "setting_34", "label": "Setting 34" },
{ "type": "text", "id": "setting_35", "label": "Setting 35" },
{ "type": "text", "id": "setting_36", "label": "Setting 36" },
{ "type": "text", "id": "setting_37", "label": "Setting 37" },
{ "type": "text", "id": "setting_38", "label": "Setting 38" },
{ "type": "text", "id": "setting_39", "label": "Setting 39" },
{ "type": "text", "id": "setting_40", "label": "Setting 40" },
{ "type": "text", "id": "setting_41", "label": "Setting 41" }
]
}
{% endschema %}

In the following example, the header and paragraph entries don't count because they don't have an id:

{% schema %}
{
"name": "Product details",
"settings": [
{ "type": "header", "content": "Content" },
{ "type": "text", "id": "heading", "label": "Heading" },
{ "type": "paragraph", "content": "Shown above the product form." },
{ "type": "text", "id": "button_label", "label": "Button label" }
]
}
{% endschema %}

The following example contains the default configuration for this check:

ExcessiveSettingsCount:
enabled: true
severity: warning
maxSettings: 40
ParameterDescription
enabledWhether this check is enabled.
severityThe severity of the check.
maxSettingsThe maximum number of top-level schema settings with an id.

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended. If you can't avoid violating the rule, then you should disable the check using the comment syntax. This ensures that you intentionally disable the check for each instance.

{% # theme-check-disable ExcessiveSettingsCount %}
{% schema %}
{
"name": "Product details",
"settings": []
}
{% endschema %}
{% # theme-check-enable ExcessiveSettingsCount %}

Was this page helpful?