Skip to content

ban-instances

Ban specific Roblox Instance classes in new Instance() and JSX.

Stops you from creating specific Roblox Instance classes. Configure the banned list and (optionally) attach a short reason so the error message tells people what to use instead.

  1. Choose Targets Select the Roblox Instance classes you want to restrict (e.g., Script, LocalScript, Frame).

  2. Define Penalties Decide if you want a simple ban or an explanatory error message for your team.

  3. Update Config Add the rule to your eslint.config.js using either the array or object format.

  4. Verify JSX Ensure your JSX components use PascalCase (e.g., <Button />) to distinguish them from lowercase Roblox Instances (e.g., <frame />).

Incorrect

Bans creation of instances specified in your configuration.

// If 'Part' and 'Script' are banned:
const part = new Instance("Part");
<script Source={...} />
// Also checks case-insensitive string literals
const alsoPart = new Instance("part");
Correct

Use modern or specialized instances that satisfy your project requirements.

const mesh = new Instance("MeshPart");
<folder />
<textlabel Text="Hello" />

The rule accepts an object with a bannedInstances property, which can be an array or a map.

Just a list of strings. Uses a generic error message.

{
"bannedInstances": ["Part", "Frame", "Script"]
}

JSX Detection

Flags lowercase elements like <part /> which represent Roblox Instances.

Constructor Check

Inspects new Instance("Name") calls, even with complex expressions.

Case Insensitivity

Matches “Part”, “part”, and “PART” identically to avoid bypasses.

React Safety

Ignores PascalCase elements like <Part /> as they are React components.