Skip to content

No Async In System

ErrorRoblox
small-rules/no-async-in-system

Disallow yielding Roblox API calls in synchronous Planck system execution.

Diagnostic Messages

noAsyncInSystem
Do not call a yielding Roblox API from a synchronous Planck system.

Configuration

This rule accepts one options object after the severity.

additionalSystemTypeNamesOptional

No description available.

callbackParameterTypesOptional

No description available.

synchronousCallbacksOptional

No description available.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/no-async-in-system": [
"error",
{
"additionalSystemTypeNames": [
"value"
],
"callbackParameterTypes": [
{
"callbackArgumentIndex": 0,
"className": "Part",
"imported": "value",
"memberPath": [
"value"
],
"parameterIndex": 0,
"source": "value"
}
],
"synchronousCallbacks": [
{
"callbackArgumentIndexes": [
0
],
"calleePath": [
"value"
]
}
]
}
]
}
}

Examples

async service call in system
import { Players as RobloxPlayers } from "@rbxts/services";
const socialSystem: SystemFunction = () => RobloxPlayers.GetFriendsAsync(userId);
async call in event callback
import { Players } from "@rbxts/services";
const system: SystemFunction = () => {
world.added(PlayerComponent, () => Players.GetFriendsAsync(userId));
};

Rationale

Planck systems run synchronously. A yielding Roblox API call can pause a system midway through a world update, so this rule reports those calls from the active system function.

The rule recognizes functions typed as PlanckSystem, System, SystemFunction,SystemReturn, or SystemTableLike. It also checks functions returned by system factories and the system property of objects typed with, or satisfying, one of those system types.

Yielding members come from the Roblox API catalog bundled with the plugin. The rule resolves services imported from @rbxts/services, services returned by game.GetService(), and Roblox class names supplied by type annotations.

Use additionalSystemTypeNames for project-specific Planck wrappers. synchronousCallbacks identifies callback arguments that run before the surrounding call returns. callbackParameterTypes describes callback parameter types supplied by imported APIs when TypeScript syntax does not include them.