Kampfkarren / selene

A blazing-fast modern Lua linter written in Rust
https://kampfkarren.github.io/selene/
Mozilla Public License 2.0
615 stars 78 forks source link

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

Open Dekkonot opened 4 years ago

Dekkonot commented 4 years ago

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.

Kampfkarren commented 4 years ago

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

Dekkonot commented 4 years ago

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.

Kampfkarren commented 4 years ago

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 commented 2 years ago

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

Dekkonot commented 2 years ago

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