rails / jsbundling-rails

Bundle and transpile JavaScript in Rails with esbuild, rollup.js, or Webpack.
MIT License
831 stars 143 forks source link

Add JS Linter by default #195

Closed MSILycanthropy closed 2 months ago

MSILycanthropy commented 2 months ago

Originally an issue in rails (https://github.com/rails/rails/issues/50529). @dhh had mentioned this work should be kicked over here. Didn't see an issue for it in the repo, so figured I'd create one for it to get some discussion going.

A little context, rails is currently shipping a nice default Rubocop setup for Ruby linting, but nothing for JS. This is because rails doesn't ship with node by default anymore and sadly there's really no node-free JS linting solution. This leads to the the current experience being a bit odd since you end up with nice Ruby linting out of the box without having to do anything, but then in JS-land you're left to your own devices.

Lots of great options here with reasonable defaults. My personal preference has always been eslint + prettier on their default settings. Great reasonable defaults with relatively easy setup.

I'm of the opinion that if it's reasonable to add some default linter here, it should probably be done. Curious on other opinions though.

dhh commented 2 months ago

Thinking about this more, I don't think it's a good fit to put something like this in here by default. Jsbundling is about adding the integration needed for a bundler, but taking no position on what you use it for. We're not setting up React for you or anything else.

That's very different from Ruby. This is a Ruby framework, so including Rubocop by default is completely inline with everything else we already include out of the box for Ruby.