selene icon indicating copy to clipboard operation
selene copied to clipboard

Add a lint for putting a comma/semicolon at the end of a table

Open Dekkonot opened this issue 5 years ago • 5 comments

It's good practice to put a comma/semicolon at the end of a table constructor even when there's no more fields. I often forget to do this, so it would be nice to have a lint that reminds me.

local foo = {
  "bar",
  "baz" -- It should lint here
}

Since this lint is stylistic in nature, it should be probably be turned off by default, but I think it would be a nice addition.

Dekkonot avatar Jul 08 '20 23:07 Dekkonot

I'm still thinking that the best course of action is to only implement style lints if we have fixers.

Kampfkarren avatar Jul 09 '20 06:07 Kampfkarren

I'm not sure what you mean by fixer. Do you mean something to automatically fix the problem? If so, that seems doable, though it might be better to put it in a separate project.

Dekkonot avatar Jul 09 '20 06:07 Dekkonot

Yeah, since style lints are just a nuisance since if your codebase doesn't comply, it's likely that you'll just have a million lints thrown at you, and you're guaranteed to just turn it off. Having lints off by default goes against the idea that you should have to configure selene as little as possible.

I'm not sure it would be better as a separate project, it's different from ecosystem to ecosystem. ESLint has fixers built in, while Rust splits Clippy and Rustfmt. If it was a separate project, the codebases would be very similar, and it would probably need its own configuration for things like Roblox specific stuff, which sounds like a pain.

Kampfkarren avatar Jul 09 '20 07:07 Kampfkarren

Since this issue was made, StyLua has since come out and proven stability. Is this still something you would want despite that?

Kampfkarren avatar May 09 '22 04:05 Kampfkarren

Ideally, yes, simply because there might be cases where someone runs Selene without StyLua. Though it's less of a priority now, obviously.

Dekkonot avatar May 12 '22 02:05 Dekkonot