Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Fix invalid html or Prettier html parsing errors #1181

Merged
merged 4 commits into from
Aug 18, 2024

Conversation

echoix
Copy link
Member

@echoix echoix commented Aug 18, 2024

Also in relation to #1174. Prettier was complaining about parsing errors even without reformatted files.

So I investigated each one to fix them. Even if I might end up disabling the formatted for now, these were valid errors that needed to be addressed.

examples are bad or missing closing tags, bad order of closing tags, html attributes not quoted that resulted in parsing errors etc.

I extracted these changes so they don’t interfere with formatting

@echoix
Copy link
Member Author

echoix commented Aug 18, 2024

I did a bad rebase apparently (during a reorder) and lost a couple of changes that fixed some files, so I added them back here in other commits.

@echoix echoix merged commit f9d320e into OSGeo:grass8 Aug 18, 2024
7 checks passed
@echoix echoix deleted the fix-html-parsing-errors branch August 18, 2024 20:05
@neteler
Copy link
Member

neteler commented Aug 18, 2024

Is there a way to additionally break long HTML lines with the tool?

@echoix
Copy link
Member Author

echoix commented Aug 19, 2024

Is there a way to additionally break long HTML lines with the tool?

@neteler Yes. Prettier can also do that, plus some indenting.
Prettier is a pretty mature tool (read old) in the web development space, and is really great when you have a web project or a package.json (JavaScript and all). It works very well in VSCode, and since it is written in JavaScript, runs well in browser environments too. There are plugins for many many languages.

Problem is, I didn't find an easy way to have it configured in pre commit. I found a archived repo of a pre-commit mirrored repo for prettier, used an old version to get started faster, but manually applied formatting with vscode (prettier being set as the default formatted for that language). But it's not as flawless than I would hope.

Otherwise we could look if .editorconfig files work well with HTML, I'm not sure, but it could help a bit too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants