Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
This is one of my complaints about xml based anything:
It‘s practically impossible to make it look nice.
No matter which style you use, it‘s always an ugly mess.
And not all frontend devs have to deal with this crap. I certainly don‘t have to, anymore. -
@daniel-wu I mean, I can see that, but that doesn't do anything for me, it's just saving a few keystrokes. I can live with that
-
MadOgre402yAs much as that lone bracket irks you, having an unclosed indent is like torture for me
-
@phat-lasagna same, as long as it comes out as valid html, you always can run a formatter over the stuff with whatever you like
-
eo287539922yOh my formatter does that automatically. Do you have any recommendations for settings against that? (I’m VSCode)
-
nitnip18102y<div
class="a trillion classes"
aria-attribute-1="..."
aria-attribute-57="..."
data-attribute-1="..."
data-irrelevant="..."
>closing bracket with text immediately after</div>
-
It irks me when the HTML thinks there's a bajillion leading spaces in a text node because I tried to make the the markup more readable in my editor. -
Okay now put a single element inside the multiline one, and realize why the closing angle is on its own line.
-
@lorentz That's why I have that empty line between the last attribute plus closing tag and the single element. I've seen this in some Android code bases and I thought that was a good practice
-
@OzzyTheGiant Hmm, I think a blank line with no significance wrt. logical grouping is more jarring than a line with just a ">", but I could work with this.
-
@lorentz Some other reasoning behind this is for scoping out elements quickly while scrolling. Best practice usually dictates that components should be kept small, but most people don't do that, nor practice separation of concerns (all those callbacks inside the html 😒), so if I'm scrolling through a really long component, it's nice if elements are separated by lines.
-
KALALEX1112yAh I will tell you! As someone obsessed with syntax HEAR ME OUT!
The goals:
1. Ease of readability (my eye at least focuses easier to blocked segments of code)
2. Minimize git commit line changes easier to identify and make diffs.
3. Ease of element edit when adding removing attributes.
4. Easier multi line edit with multiple cursors.
Well these are the first that come to mind, but to me it’s not about preference or beauty but it’s about how practical it is. -
devtooBe72y@KALALEX @KALALEX as a newbie I spent a large amount of time on best practices as a front-end dev, so I’m enjoying this conversation. Thanks.
-
hack64142yDo you write your code blocks like this:
if (condition) {
statement }
or like this:
if (condition) {
statement
}
Basically what @Kernel said. -
@hack my gripe is only with <> characters. If it was braces or brackets that would be far better in my opinion, as those characters are bigger and stand out more.
Besides, in the Python world, devs don't even use any form of enclosures and the readability is far better than other languages, to my surprise. I think Python's formatting standards would benefit other types of code. Which is why I now try to use larger indentation, more empty spaces where it makes sense and where lines are really short, I try to condense them to one line, for example:
If (is true) return "something"
No braces, but two empty lines with that line in between -
@OzzyTheGiant Python can't have multi-line lambdas because of its debilitating lack of delimiters.
Related Rants
Why do front end developers like to write their HTML/Component markup like this:
<div
id="test"
class="test"
>
Test
</div>
That lone > bracket absolutely irks me! Looks ugly! I prefer the Android style:
<div
id="test"
class="test">
<span>Test</span>
</div>
👌clean
rant
html
vue
javascript
react
angular