bencodezen / vue-enterprise-boilerplate

An ever-evolving, very opinionated architecture and dev environment for new Vue SPA projects using Vue CLI.
7.77k stars 1.32k forks source link

HTML formatting and max 1 attr per line #192

Closed thedamon closed 4 years ago

thedamon commented 4 years ago

The linting docs say

HTML (in templates and JSX) is linted by ESLint

As far as I can tell, it is being formatted by prettier as well.

I was trying to use this setup retroactively in my own project because of this specific line.. happy to see a fully working lint/editor format setup without prettier because that would mean I can force attributes onto their own lines as recommended in the official styleguide.

Regrettably that doesn't seem to be happening for me (prettier is cramming attributes based on line length). Is that expected behaviour?

chrisvfritz commented 4 years ago

This is indeed expected behavior. I actually wrote that recommendation in the official styleguide, but since Prettier has no option to change this particular behavior, I personally find the consistency Prettier provides to be of greater benefit than this individual rule. You could gain maximum control by running ESLint (and any other linters you want) again after Prettier to override anything you don't like, but I don't find that slowdown in linting to be worth it personally.

thedamon commented 4 years ago

Thanks. I'm unendingly frustrating that prettier isn't on board to add that option because I think it makes lots of sense to do so. Probably worth just running with them until another option comes along.

escapedcat commented 4 years ago

We just went through this process as well. We didn't use prettier and then we started.
At first I was pretty annoyed by this as well. Prettier has its own rule when to put attributes on one line and when to split them into separate lines. Without checking the rule I would say it's between 3-4 attributes.
By now we feel pretty comfortable with this. Overall we prefer the gain we get by using prettier instead of not using it.

TL;DR We agree with Chris' opinion on this ;)

Just wanted to share our own experience with this.