Roblox & Luau Rules
Rules for Roblox instances, Ianitor, Color3, UDim2, and other Roblox APIs.Browse all 25 rules in this category.
Showing 25 rules
No Array Constructor Index Assignment
Roblox & Luau Rulesno-array-constructor-index-assignmentDisallow new Array<T>() followed by contiguous index assignments; use an array literal instead.
- Suggestion
- Automatic fix
Ban Instances
Roblox & Luau Rulesban-instancesBan specified Roblox Instance classes and configured Instance properties.
- Problem
Enforce Ianitor Check Type
Roblox & Luau Rulesenforce-ianitor-check-typeEnforce Ianitor.Check<T> type annotations on complex TypeScript types
- Problem
No Array Constructor Elements
Roblox & Luau Rulesno-array-constructor-elementsDisallow array constructor element forms and enforce roblox-ts-aware constructor patterns.
- Problem
- Automatic fix and editor suggestions
No Array Size Assignment
Roblox & Luau Rulesno-array-size-assignmentDisallow array append assignments using array[array.size()] = value (roblox-ts) or array[array.length] = value (standard) and prefer push-based appends.
- Problem
- Automatic fix
No Async In System
Roblox & Luau Rulesno-async-in-systemDisallow yielding Roblox API calls in synchronous Planck system execution.
- Problem
No Color3 Constructor
Roblox & Luau Rulesno-color3-constructorBan new Color3(...) except new Color3() or new Color3(0, 0, 0). Use Color3.fromRGB() instead.
- Problem
- Automatic fix
No Events In Events Callback
Roblox & Luau Rulesno-events-in-events-callbackDisallow sending Events back to the same player inside an Events.connect callback; use Functions for request/response.
- Problem
No Ianitor In Function Body
Roblox & Luau Rulesno-ianitor-in-function-bodyDisallow Ianitor validator creation inside function bodies. Hoist to module scope to avoid recreating validators on every call.
- Problem
No Ianitor Success Access
Roblox & Luau Rulesno-ianitor-success-accessDisallow accessing `.success` on Ianitor check results when the full result object is not needed.
- Suggestion
No Instance Methods Without This
Roblox & Luau Rulesno-instance-methods-without-thisDetect instance methods that do not use 'this' and suggest converting them to standalone functions for better performance in roblox-ts.
- Problem
No Native Properties Spread
Roblox & Luau Rulesno-native-properties-spreadDisallow spreading static property bags into nativeProperties/*NativeProperties props and onto JSX elements via intermediate objects, because the spread creates a new copied table every render.
- Problem
No Print
Roblox & Luau Rulesno-printUse Log instead of print().
- Problem
No Redundant Aspect Ratio Constraint
Roblox & Luau Rulesno-redundant-aspect-ratio-constraintDisallow redundant uiaspectratioconstraint children inside components that already manage their own aspect ratio internally.
- Problem
No Table Create Map
Roblox & Luau Rulesno-table-create-mapDisallow map(...) directly on table.create(...) and new Array(...) constructor patterns in roblox-ts.
- Suggestion
No Task Wait
Roblox & Luau Rulesno-task-waitDisallow task.wait() and Promise.delay(...).await() calls.
- Problem
No Useless Default
Roblox & Luau Rulesno-useless-defaultDisallow Roblox JSX properties whose values already match the class defaults.
- Suggestion
- Automatic fix
No Warn
Roblox & Luau Rulesno-warnUse Log instead of warn().
- Problem
Prefer Idiv
Roblox & Luau Rulesprefer-idivPrefer .idiv() for integer division instead of math.floor(x / y).
- Suggestion
- Automatic fix
Prefer Math Min Max
Roblox & Luau Rulesprefer-math-min-maxPrefer math.min() and math.max() over simple clamp-like ternaries.
- Suggestion
- Automatic fix
Prefer Modding Inspect
Roblox & Luau Rulesprefer-modding-inspectPrefer Modding.inspect over manually enumerating every enum member in a Record<Enum, true>.
- Suggestion
- Automatic fix
Prefer Sequence Overloads
Roblox & Luau Rulesprefer-sequence-overloadsPrefer direct ColorSequence and NumberSequence overloads over identical direct arguments and two-keypoint arrays.
- Suggestion
- Automatic fix
Prefer Single World Query
Roblox & Luau Rulesprefer-single-world-queryEnforce combining multiple world.get() or world.has() calls into a single call for better Jecs performance.
- Suggestion
- Automatic fix
Prefer Udim2 Shorthand
Roblox & Luau Rulesprefer-udim2-shorthandPrefer UDim2.fromScale() or UDim2.fromOffset() over new UDim2() when all offsets or all scales are zero.
- Suggestion
- Automatic fix
Require Module Level Instantiation
Roblox & Luau Rulesrequire-module-level-instantiationRequire configured classes to be instantiated at module level only.
- Problem