feat(naming): add opt-in allowedWords for Roblox names - #662
Conversation
strictCamelCase and StrictPascalCase reject two capitals in a row, so a
CFrame had to be stored in targetCframe and the identifier stopped
matching the type it held. flawless 1.7.0 adds allowedWords, which lets
listed words keep their own casing while the rest of the name is still
checked.
Bumps flawless 1.5.1 -> 1.7.0 and adds `naming: { allowedWords }`, off by
default. `true` uses the generated Roblox list, an array uses exactly
those words. Set once as settings.flawless.namingConvention.allowedWords
on isentinel/naming/setup, so it reaches the TS and TSX blocks and any
user selectors; a selector opts out with its own `allowedWords: []`.
The list is generated, not hand-maintained. Only names holding two
capitals in a row can trip the strict formats, which is 82 of the 1534
names @rbxts/types declares. Pruning names a shorter word already
resolves - CFrame absorbs CFrameValue, CFrameConstructor and UserCFrame,
UDim absorbs UDim2 - leaves 67. roblox-allowed-words-shared.ts mirrors
flawless's own applyAllowedWords so the pruning asks the question the
rule asks at lint time.
@rbxts/types is a devDependency and the scrape runs at build time: a
consumer may pin a different version, or none, and parsing ~4MB of .d.ts
on every config load to answer a question that only changes on a bump is
not worth it. `nr check:roblox-words` runs in CI before the build, since
`pnpm gen` would otherwise repair a stale snapshot in place and the drift
would never be reported.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
✅ Deploy Preview for beamish-daffodil-b0f61d ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
Next review available in: 15 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (12)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why
strictCamelCaseandStrictPascalCasereject two capitals in a row, which puts them at odds with Roblox's own casing. ACFramehad to be stored intargetCframe, so the identifier stopped matching the type it held. The existing escapes are too blunt:filterskips a whole config,customonly adds constraints.eslint-plugin-flawless@1.7.0addsallowedWords, which lets listed words keep their own casing while the rest of the name is still checked. This wires that up for Roblox, off by default.What changed
Plugin bump —
eslint-plugin-flawless1.5.1 → 1.7.0.pnpm genpicksallowedWordsout of the rule schema, soNamingSelectorgains it with no manual type work. 1.6.0/1.6.1 ride along; no snapshot drift.New option —
naming: { allowedWords }, defaultfalse.trueuses the generated Roblox list; an array uses exactly those words.ROBLOX_ALLOWED_WORDSis exported so a consumer can spread it to extend rather than replace.It is set once as
settings.flawless.namingConvention.allowedWordson theisentinel/naming/setupitem, rather than copied onto ~10 selectors across the TS and TSX blocks. That also means it reaches selectors passed throughnaming.selectors; a selector opts out with its ownallowedWords: []. Thesettingskey is spread in conditionally, so the default emits no new config surface and existing snapshots are untouched.Generated word list —
scripts/roblox-allowed-words-gen.tsscrapes@rbxts/typesand writessrc/generated/roblox-allowed-words.ts.Why the list is 67 words, not thousands
Only names holding two capitals in a row can trip the strict formats. That is 82 of the 1534 names
@rbxts/typesdeclares (datatypes, Instance classes,Enum.*namespaces). Pruning names a shorter word already resolves —CFrameabsorbsCFrameValue,CFrameConstructorandUserCFrame;UDimabsorbsUDim2— leaves 67.For comparison, the raw Roblox
API-Dump.jsonyields 400. The extra ~320 are member and enum-item names, which are property accesses (Enum.TextXAlignment.Center) rather than declared identifiers, sonaming-conventionnever sees them.@rbxts/typesis the surface that actually produces identifier names in roblox-ts.The existing
@isentinel/dict-robloxcould not be reused — it is case-flattened (cframe, notCFrame).roblox-allowed-words-shared.tsmirrors flawless's ownapplyAllowedWords, so the pruning asks exactly the question the rule asks at lint time. Sorting is by code unit rather thanlocaleCompare, so the output does not depend on the host locale.Reviewer notes
@rbxts/typesis a devDependency and the scrape runs at build time. A consumer may pin a different version, or none, and parsing ~4MB of.d.tson every config load to answer a question that only changes on a bump is not worth it. Same rationale asstylistic-gen.tsandtype-aware-gen.ts.nr check:roblox-wordsruns in CI before the build, sincepnpm genwould otherwise repair a stale snapshot in place and the drift would never be reported.test/roblox-allowed-words.spec.tsre-derives from the installed package and fails on drift.flawless/naming-conventionis pinned to ESLint insrc/oxlint/routing.ts.QDir,QFont,RBXObject,ILegacyStudioBridge,DebuggerUIService). Filtering them would mean hand-maintaining a denylist — the only non-generated part of the pipeline. They are harmless, so they stayed. Happy to add the denylist if preferred.Verification
pnpm gen,pnpm typecheck,pnpm build,pnpm lintandpnpm testall pass locally (39 files, 558 tests, no type errors).test/naming-allowed-words.spec.tslints through the real setup item:targetCFrameerrors by default and passes when enabled, whiletarget_CFrameandtargetXCFramestill error.🤖 Generated with Claude Code