komposable / komponent

An opinionated way of organizing front-end code in Ruby on Rails, based on components
http://komponent.io
MIT License
427 stars 31 forks source link

Add .editorconfig and cleanup syntax #105

Closed nicolas-brousse closed 4 years ago

nicolas-brousse commented 6 years ago

This PR does the following:

Spone commented 6 years ago

Enforce to use single quotes on the code (default on rubocop)

I know it's the default on Rubocop but personally, I prefer to use double quotes. What do you think @florentferry?

nicolas-brousse commented 6 years ago

I also prefer double, but since most of ruby dev seems to use single in OSS, I used single here to start. Just let me know your point of vue.

florentferry commented 6 years ago

Ok for single quote.

Spone commented 6 years ago

Rails uses double quotes btw: https://github.com/rubocop-hq/rubocop/issues/5306#issuecomment-354273615

Spone commented 6 years ago

@nicolas-brousse after discussing it over lunch with @florentferry: we think we can stick with single-quotes, but it would be great to trigger rubocop --auto-correct on the generated component directory (just after generating a component), so the partial is corrected with the project preferred style. What do you think?

nicolas-brousse commented 6 years ago
nicolas-brousse commented 6 years ago

Also it's not a behavior I already so in other generation system. May be it is for a good reason? (real question)

florentferry commented 6 years ago

Rails generates project with double quotes, and generates scaffold with double quotes. If you install Rubocop with default config on top of that, you need to change several files from double quotes to single quote. Use rubocop with -a option do the trick.

Spone commented 6 years ago

Also it's not a behavior I already so in other generation system. May be it is for a good reason? (real question)

It's a good question. I'm doing some research, I'll let you know if I find something.

Spone commented 6 years ago

I did not find any other library doing that.

Maybe we could add it as an option?

config.generators do |g|
  g.komponent rubocop: true # this would be false by default
end

In this case rubocop -a would be run after the generator.

What do you think?

Spone commented 4 years ago

I'm closing this stale PR, there are too many conflicts now. Feel free to reopen another one.