Skip to content

Ban Instances

ErrorRoblox
small-rules/ban-instances

Ban specified Roblox Instance classes and configured Instance properties.

Rationale

Some Roblox Instances are just useless and actively break things. I ban UITextSizeConstraint because it breaks high resolution displays, and UISizeConstraint.MaxSize because it breaks scaling. This rule is how I keep that out of the codebase.

You list the classes you hate and the rule flags any new, variable, or JSX element that uses them. Works through variables too — const p = new UITextSizeConstraint() gets caught even if the new is far from the declaration.

Hate a specific property but not the whole class? Use bannedProperties to block just UISizeConstraint.MaxSize and leave the rest alone.

Diagnostic Messages

bannedInstance
Instance class '{{className}}' is banned by project configuration. This class may cause performance issues, is deprecated, or has a better alternative. Check project guidelines for the recommended replacement.
bannedInstanceCustom
{{customMessage}}
bannedProperty
Property '{{propertyName}}' on Instance class '{{className}}' is banned by project configuration. This property may cause performance issues, is deprecated, or has a better alternative. Check project guidelines for the recommended replacement.
bannedPropertyCustom
{{customMessage}}

Configuration

This rule accepts one options object after the severity.

bannedInstancesOptional

Map of banned class names to custom messages, or an array of class names.

bannedPropertiesOptional

Map of banned class names to maps of banned property names and custom messages.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/ban-instances": [
"error",
{
"bannedInstances": [
"Part"
],
"bannedProperties": {
"UISizeConstraint": {
"MaxSize": "Use a different constraint shape."
}
}
}
]
}
}

Examples

banned instance construction
new Instance("Part");
unlisted instance class
new Instance("MeshPart");