cflint / CFLint

Static code analysis for CFML (a linter)
BSD 3-Clause "New" or "Revised" License
174 stars 84 forks source link

Report trailing comma after last array element #620

Open dominikbraun opened 5 years ago

dominikbraun commented 5 years ago

This feature proposal refers to the issue i submitted to vscode-cfml. Since the issue my proposal addresses is engine-specific, it is rather an improvement for CFLint than for the CFML plugin.

In CFScript, the last element of an array isn't allowed to have a trailing comma. Trailing commas after the last element are considered as a syntax error in Adobe ColdFusion.

coffee = [ "Cappuccino", "Espresso", "Latte macchiato", ];

This code will result in an error (except for Lucee/Railo). Would it be great effort to highlight/underline the closing bracket in order to indicate that the trailing comma is not valid?

KamasamaK commented 5 years ago

I propose that the rule(s) be configurable with values always and never.

ryaneberly commented 5 years ago

Is having a trailing comma a style that some prefer?

On Wed, Mar 20, 2019 at 3:51 AM KamasamaK notifications@github.com wrote:

I propose that the rule(s) be configurable with values always and never.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cflint/CFLint/issues/620#issuecomment-474723111, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtZu8ciTuH-ZWDrRmLjxuWmoeheVbJRks5vYeiCgaJpZM4b-o3G .

KamasamaK commented 5 years ago

@ryaneberly Yes, it is. Here's an example of the ESLint Rule: comma-dangle.

Based on #263 and #365, it seems likely that @mpaluchowski (or someone on their team) is one of those people who prefer it.

dominikbraun commented 5 years ago

@ryaneberly Having a trailing comma is preferred by some (or many?) Lucee users since it makes adding and shifting lines easier. However, it's simply invalid in Adobe ColdFusion and this feature was requested by the Lucee community.

dominikbraun commented 5 years ago

What's the current state of this issue? :smile: