Less noise
obj.property is shorter and easier to scan than obj["property"] when both mean the same thing.
Write object.property instead of object["property"] when dot notation works.
Bracket access with a string literal is noisier than dot notation and easy to miss in review. This rule converts those
cases to dot notation, keeps the standard escape hatches from ESLint and TypeScript ESLint, and adds an opt-in
roblox-ts mode for situations where obj["value"] compiles but obj.value would fail.
The default options cover standard TypeScript. Add the roblox-ts options only if your project uses bracket access for members that dot syntax can’t reach.
| Option | Type | Default | What it does |
|---|---|---|---|
allowKeywords | boolean | true | Allow bracket notation for reserved keywords like obj["class"]. |
allowPattern | string | "" | Regex pattern for property names that can stay in bracket notation. |
allowPrivateClassPropertyAccess | boolean | false | Allow bracket notation for private class members. |
allowProtectedClassPropertyAccess | boolean | false | Allow bracket notation for protected class members. |
allowIndexSignaturePropertyAccess | boolean | false | Allow bracket notation for properties accessed through a string index. |
environment | "standard" | "roblox-ts" | "standard" | Set to "roblox-ts" to enable the compiler-aware escape. |
allowInaccessibleClassPropertyAccess | boolean | false | Allow brackets when dot notation would fail type checking at that site. |
interface PublicBox { name: number;}
function incrementValue(object: PublicBox): void { object["name"] += 1;}interface PublicBox { name: number;}
function incrementValue(object: PublicBox): void { object.name += 1;}
// Bracket access is fine when the member is privatefunction incrementHidden(object: ExampleClass): void { object["value"] += 1;}
class ExampleClass { private value = 0;}Less noise
obj.property is shorter and easier to scan than obj["property"] when both mean the same thing.
Compiler-aware
In roblox-ts, the rule leaves bracket access alone when converting it would break type checking.
Auto-fixable
Most violations get cleaned up automatically with eslint --fix.