widget-zone-must-be-string-literal - ESLint plugin rules
This rule requires the zone property in defineWidgetConfig to be a string literal or an array of string literals.
Severity#
error. This rule is enabled in the recommended preset.
What it Targets#
This rule targets files in your project's src/admin/widgets directory. It reports a zone property whose value isn't a string literal, an array of string literals, or a template literal without expressions.
The following code is reported by the rule:
Instead, use a string literal:
Why it's Important#
Medusa statically analyzes widget files to determine the zones a widget is injected into. A dynamic value can't be resolved at build time, so the widget may not render in the expected location.
Learn more in the Admin Development Constraints documentation.
Fixable#
This rule is auto-fixable. Run the linter with the --fix option to apply the fix automatically.