Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Change sanitization rules for script names generation - #110

Merged
willeastcott merged 1 commit into
playcanvas:mainfrom
meta-space-org:script-name
Nov 11, 2025
Merged

willeastcott merged 1 commit into
playcanvas:mainfrom
meta-space-org:script-name

Conversation

@Maksims

@Maksims Maksims commented Nov 11, 2025 •

Copy link
Copy Markdown
Collaborator

Current sanitization rules lead to some weird results as discussed here: playcanvas/editor#1511
And is generally too strict, benefiting those who uses file-name-dash-notation.js for naming files, but some users might use FileNamingLikeClasses.js, and current rules will change it too much, leading to some lower cases letters where unexpected and preventing capital letters in a row (although this is withing Googles Coding Standards which PlayCanvas relies on).

Here is an example of current sanitization results:

file-name ClassName scriptName ok?
ASDASD.js Asdasd asdasd ❓
asdasd.js Asdasd asdasd ✅
TestScriptA.js TestScripta testScripta ❓
test-script-a.js TestScriptA testScriptA ✅
TestAIScript.js TestAiscript testAiscript ❓
test-ai-script.js TestAiScript testAiScript ✅
testAiAiAi.js TestAiaiAi testAiaiAi ❓
test-ai-ai-ai.js TestAiAiAi testAiAiAi ✅
testScriptA.js TestScripta testScripta ❓
test-script-a.js TestScriptA testScriptA ✅
testScript.js TestScript testScript ✅
test-script.js TestScript testScript ✅
helloAI.js HelloAi helloAi ❓
hello-AI.js HelloAi helloAi ❓
hello-ai.js HelloAi helloAi ✅

And here after this PR:

file-name ClassName scriptName ok?
ASDASD.js ASDASD aSDASD
asdasd.js Asdasd asdasd ✅
TestScriptA.js TestScriptA testScriptA ✅
test-script-a.js TestScriptA testScriptA ✅
TestAIScript.js TestAIScript testAIScript ✅
test-ai-script.js TestAiScript testAiScript ✅
testAiAiAi.js TestAiAiAi testAiAiAi ✅
test-ai-ai-ai.js TestAiAiAi testAiAiAi ✅
testScriptA.js TestScriptA testScriptA ✅
test-script-a.js TestScriptA testScriptA ✅
testScript.js TestScript testScript ✅
test-script.js TestScript testScript ✅
helloAI.js HelloAI helloAI ✅
hello-AI.js HelloAI helloAI ✅
hello-ai.js HelloAi helloAi ✅

Fixes playcanvas/editor#1511

@willeastcott
willeastcott merged commit 39a3c66 into playcanvas:main Nov 11, 2025
3 checks passed
@albertvanveen

Copy link
Copy Markdown

Thanks! 👌

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Script name casing not fully respected when creating new script

3 participants