rokucommunity / bslint

A linter for BrightScript and BrighterScript.
MIT License
27 stars 14 forks source link

Rule for making sure keys properly maintain case when being set #83

Open triwav opened 1 year ago

triwav commented 1 year ago

In a Roku app if you do the following:

aa = {}
aa.myCamelCaseKey = "myCamelCaseValue"

myCamelCaseKey is now stored as mycamelcasekey.

If you instead set the value like:

aa = {}
aa["myCamelCaseKey"] = "myCamelCaseValue"

then it properly maintains its casing.

It would be great if there was a bslint rule that could have the options of either always requiring values to be set with the brackets instead of dot or only when the value contains a capital character or off.

Another rule related to this would be with requiring quotes when specifying keys while creating an AA. As an example:

aa = {
  "myCamelCaseKey": "myCamelCaseValue"
}

Will properly maintain casing while if quotes are not used it won't. This could have the same options of either always requiring values to be set with the brackets instead of dot or only when the value contains a capital character or off.