sb-edit
sb-edit copied to clipboard
Prevent naming collisions between custom blocks and scratch-js built-in methods
Example of issue is here: https://scratch.mit.edu/users/PullJosh/#comments-65746024
User has a custom block called mouse. this.mouse is colliding with the built-in this.mouse. sb-edit should have a blacklist of custom block names that are not allowed.
Current list of blacklisted names:
stagedirectionxypenDownpenColorvarscostumeNumbercostumemousetimertriggerscostumessizevisiblepenSizeaskAndWaitanswerparentclonesandCloneseffectsrotationStyle- Plus "private" stuff internal to scratch-js which is prefixed by an underscore. Not concerned about collisions because sb-edit already standardizes to camelCase, so underscores will be removed.
This will need to be kept in sync with scratch-js. Is there an easy way to enforce that? (Forgetting to add a new blacklisted keyword is the kind of bug that could go under the radar for a long time.)
Fixed in 68e306789d68aee6c9cbf547f117ea1cafc62d56
I think I'm going to leave this open for now as a constant reminder to keep the blacklist updated.
Vetoing your decision from 3+ years ago, I think we've mostly succeeded at failing to introduce more bugs this way without needing to refer back to this issue :P