Linter recommendations

Hello everyone, this month I started doing some research for linters so me and my teammates can all use the same code style for our project. I found these tools:

I was able to get the first 4 working with VScode (and seems to be atom extensions for them too) but I can’t make the scss-lint vscode extension work and I can’t find a way to use the htmlbeautifier gem with the code editor.

I’ve also found StandardJS (https://standardjs.com) for JS code but it doesn’t understand sprockets // require... syntax so I was planning to use it only for projects that uses webpacker.

So I was thinking, do you use code style linters? if so, do you have them integrated with your code editor? which editor? can you share your recommendations?

Thanks!

3 Likes

We use Rubocop but not as an editor extension. We set a precommit hook to run it every commit and only on modified Ruby files.

2 Likes

I use rufo. It’s highly opinionated, with little in the way of configuration options. If you’re looking for something that you can install and be productive with right away, then this is a good option. There is a VSCode extension.

I chose Rubocop because it is what Rails itself uses and has good documentation and easy configuration.

I chose ESLint for JavaScript because it’s plugins allowed for good compatibility and extra rules with Vue.

For ERB I haven’t found any of the solutions to be very good in terms of VSCode integration. htmlbeautifier seemed to work best though.

For Ruby code I use rubocop and I’ve been delaying trying others. My struggle is with erb, there’s erb-linter from Shopify, but there’s a pending PR that woud allow to use in the editor: Add --format option by andersonkrs · Pull Request #159 · Shopify/erb-lint · GitHub