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

Enable Prettier formatting for documentation #10597

Closed
wants to merge 1 commit into from

Conversation

lb-
Copy link
Member

@lb- lb- commented Jun 24, 2023

@lb- lb- added Documentation status:Needs Review DX Developer eXperience and removed DX Developer eXperience labels Jun 24, 2023
@lb-
Copy link
Member Author

lb- commented Jun 24, 2023

Happy to add something that also reports the exact files that need changing and how, this is a long standing gap in Prettier but there is a work around.

prettier/prettier#6885 (comment)

I understand the main concern for this is that it adds friction for contributors, but think it's still worth doing.

@lb- lb- force-pushed the feature/prettier-format-docs branch from f9e0794 to 2ff0cde Compare June 24, 2023 11:40
@squash-labs
Copy link

squash-labs bot commented Jun 28, 2023

Manage this branch in Squash

Test this branch here: https://lb-featureprettier-format-docs-i1e0m.squash.io

.prettierignore Outdated
@@ -8,7 +8,8 @@ coverage/
static
_build
# File types which Prettier supports but we don’t want auto-formatting.
*.md
.github/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure about this one. Perhaps we should format it all by default and use <!-- prettier-ignore --> comments for parts of the files that have very specific formatting?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be very weird to see that comment in the pull request and issue templates though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can just ignore the one specific file that we have added multiple line-breaks to

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried the comment and it did not seem to work.
Used syntax as per https://prettier.io/docs/en/ignore.html#markdown

client/scss/components/_chooser.scss Outdated Show resolved Hide resolved
- Exclude release notes as these are long lived and not currently aligned with Prettier preferences
- Exclude the pull request template as we want multiple line breaks in this file
- Upgrade prettier version & re-format
@lb-
Copy link
Member Author

lb- commented Jul 1, 2023

Rebased this, only ignoring one file in the github folder now (Pull Request template) and also ignoring the contributors.md file.

I did some further investigation into a script to try a git diff output but I think this would not work in our CI.

You do get an output with at least the file name though, for example.

> prettier --check "**/?(.)*.{css,scss,js,ts,tsx,json,yaml,yml,md}"

Checking formatting...
[warn] docs/extending/index.md
[warn] Code style issues found in the above file(s). Forgot to run Prettier?

@lb-
Copy link
Member Author

lb- commented Jul 17, 2023

Going to mark this as a draft, may not be worth pursuing at this time but still keen on feedback from the Google Summer of Docs side of things - @activus-d

@lb- lb- marked this pull request as draft July 17, 2023 11:54
@lb-
Copy link
Member Author

lb- commented Jul 24, 2023

Closing this, maintaining this PR is a bit annoying.

Still think it's worth a discussion but I'll bring this up at a core team meeting instead.

@lb- lb- closed this Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants