Skip to main content
This rule enforces that the options export in Gadget action files contains only valid JSON-serializable literal values. The options object is serialized and stored by Gadget, so it cannot contain computed expressions, variables, or other non-JSON values.

Rule Details

This rule reports errors when the options export contains:
  • Computed property keys
  • Shorthand properties
  • Variable references or expressions
  • Template literals (even static ones)
  • Numeric separators
  • Spread operators
  • Any non-literal values
The rule validates nested objects and arrays recursively to ensure all values are JSON-serializable. Severity: Error Auto-fixable: Yes (for some violations)

Examples

Incorrect

Correct

Auto-fixes

The rule can automatically fix:
  • Numeric separators - removes underscores
  • Static binary expressions - evaluates to the computed value
  • Static template literals - converts to string literals
Variable references, computed keys, and shorthand properties cannot be auto-fixed and must be corrected manually.

When to Use

This rule is included in the recommended config and should always be enabled for Gadget projects. The options export must be valid JSON for Gadget to parse and store it correctly.