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: replace yamllint with prettier #305

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

lengau
Copy link
Contributor

@lengau lengau commented Dec 17, 2024

Lints and formats YAML, JSON, JSON5, Markdown and CSS files with prettier.

Cannot do TOML right now due to:
prettier/prettier#15141

Fixes #273
CRAFT-3626

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run tox?

@lengau lengau requested review from medubelko and a team as code owners December 17, 2024 22:41
Lints and formats YAML, JSON, JSON5, Markdown and CSS files with prettier.

Cannot do TOML right now due to:
prettier/prettier#15141

Fixes #273
CRAFT-3626
Automatically format files with new formatters
@lengau lengau force-pushed the work/273/CRAFT-3626 branch from 41f0ae4 to 578b0cd Compare December 17, 2024 22:42
@medubelko
Copy link
Contributor

@lengau I'd need some extra time to test this against Markdown and CSS (if that's desired). Does this need merging ASAP?

@lengau
Copy link
Contributor Author

lengau commented Dec 17, 2024

@medubelko not really, but all that happened here to the CSS file was it got auto-formatted. Prettier shouldn't make any changes that don't get parsed the same.

Copy link
Contributor

@upils upils left a comment

Choose a reason for hiding this comment

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

Should we also:

  • remove yamllint from the tox.ini file?
  • replace the call to yamllint in the precommit hook by a call to prettier?
  • remove the .yamllint.yaml file?

@@ -13,6 +13,9 @@ else
APT := apt-get
endif

PRETTIER=npm exec --package=prettier -- prettier
PRETTIER_FILES=**.yaml **.yml **.json **.json5 **.css **.md
Copy link
Contributor

Choose a reason for hiding this comment

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

That is a bit sad that prettier does not support reStructuredText (nor any of the community plugins). That would be great to have one because we tend to mess our .rst files (currently the README.rst looks wrong on GitHub).
Did you look into it? (I took a very quick look and did not find anything serious)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did for unrelated reasons. There's no prettier plugin for it, but docstrfmt looks promising. For the particular use case of our README though, it gives:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've raised this as a question for the new year: #308

common.mk Show resolved Hide resolved
@lengau lengau requested a review from upils December 20, 2024 20:46
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.

Replace yamllint with prettier
3 participants