rokucommunity / bslint

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

AA style #30

Open elsassph opened 3 years ago

elsassph commented 3 years ago

What options do we want for AA literals?

a = {
  a1: 1
  a2: 2
}
b = { b1: 1, b2: 2 }

What about commas? Commas are optional - I'm thinking options could be:

Does that work both for multi-line/one-line literals?

Other things related to linting? I don't think using quotes should be enforced as it changes the semantics of the AA.

chrisdp commented 3 years ago

I think the options you have for trailing comas is good. Keep in mind this can also apply for arrays so a more general rule for trailing comas might be good.

Comas are required for single line or same line values. Again this also applies to arrays.

For quotes I can still see value in a rule for it. I would think by default the rule would be no enforcement. And if you want a never rule then case can be enforced in code with something like:

myAa = {}
myAa["A"] = 1

I have had this as a rule for many projects.

georgejecook commented 3 years ago

this seems right to me.

elsassph commented 3 years ago

@chrisdp ok so AA keys options to optionally enforce quote / no-quote (and obviously off)?

chrisdp commented 3 years ago

@elsassph Yes that sounds right.

elsassph commented 2 years ago

Reopning because we still want AA key quotes rules.