Documentation Index
Fetch the complete documentation index at: https://mintlify.com/aurelienbobenrieth/gadget/llms.txt
Use this file to discover all available pages before exploring further.
This rule disallows scheduler triggers in model action options. Model actions do not support scheduler triggers - scheduler functionality should be moved to a global action instead.
Rule Details
This rule checks the triggers array in model action options and reports an error if any trigger has type: "scheduler". Model actions can only be triggered by API calls or model lifecycle events.
Severity: Error
Auto-fixable: Yes
Examples
Incorrect
// Scheduler trigger in model action
export const options: ActionOptions = {
triggers: [{ type: "scheduler" }],
};
// Mixed triggers including scheduler
export const options: ActionOptions = {
triggers: [
{ type: "api" },
{ type: "scheduler" }
],
};
Correct
// Non-scheduler triggers are valid
export const options: ActionOptions = {
triggers: [{ type: "api" }],
};
// No triggers property
export const options: ActionOptions = {
returnType: true
};
Auto-fixes
The rule automatically removes scheduler triggers:
// Before - scheduler is the only trigger
export const options: ActionOptions = {
triggers: [{ type: "scheduler" }],
};
// After auto-fix - entire triggers property is removed
export const options: ActionOptions = {
};
// Before - mixed triggers
export const options: ActionOptions = {
triggers: [
{ type: "api" },
{ type: "scheduler" }
],
};
// After auto-fix - scheduler element is removed
export const options: ActionOptions = {
triggers: [{ type: "api" }],
};
If you need scheduler functionality, move the action to api/actions/ as a global action where scheduler triggers are supported.
When to Use
This rule is included in the recommended config and should always be enabled for Gadget projects. It prevents configuration errors by catching invalid triggers at development time.