noInstanceMethodWithoutThisMethod '{{methodName}}' does not use 'this' and creates unnecessary metatable overhead in roblox-ts. Convert it to a standalone function for better performance.thissmall-rules/no-instance-methods-without-thisDetect instance methods that do not use 'this' and suggest converting them to standalone functions for better performance in roblox-ts.
If a method never touches this, it shouldn’t be a method. In roblox-ts, instance methods carry metatable
overhead even when they don’t use the instance. A standalone function is just faster.
This catches any non-static method that doesn’t reference this or super anywhere in its body. You can
scope it with checkPrivate, checkProtected, and checkPublic if you only care about some visibility
levels.
Won’t fire on static methods or constructors – those are fine. Only flags genuine instance methods that could be free functions.
noInstanceMethodWithoutThisMethod '{{methodName}}' does not use 'this' and creates unnecessary metatable overhead in roblox-ts. Convert it to a standalone function for better performance.This rule accepts one options object after the severity.
class MyClass { private notifyChanges(value: number): void { print(value); }}class MyClass { static helper(): void { print("static"); }}