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

Use prettier to format .md files #860

Merged
merged 2 commits into from
Mar 27, 2019
Merged

Conversation

webmaster128
Copy link
Contributor

First step for #829

The idea is to format code and text separatly

  • since different width is desired,
  • to avoid unnecessary build times during development.

@@ -18,6 +18,7 @@
"scripts": {
"bootstrap": "lerna bootstrap",
"format": "lerna run format",
Copy link
Contributor

Choose a reason for hiding this comment

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

I would expect the format script to cover the root as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default "format" implementation is prettier --write --loglevel warn \"./src/**/*.ts\", which does not do anything in the root dir. Thus I did not add it here.

@@ -18,6 +18,7 @@
"scripts": {
"bootstrap": "lerna bootstrap",
"format": "lerna run format",
"format-text": "prettier --write --prose-wrap always --print-width 80 \"./*.md\" \"./docs/**/*.md\" && lerna run format-text",
Copy link
Contributor

Choose a reason for hiding this comment

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

This recurses, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No:

lerna run <script>

Run an npm script in each package that contains that script

i.e. lerna run format-text runs yarn format-text for each folder in packages/ only.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, right. lerna run not yarn run.

Copy link
Contributor

@willclarktech willclarktech left a comment

Choose a reason for hiding this comment

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

Looks good, only thing is running it creates a change to docs/ROADMAP.md. There are a few situations where prettier requires more than one pass to reach a stable point, which is possibly what's happened here.

@webmaster128
Copy link
Contributor Author

There are a few situations where prettier requires more than one pass to reach a stable point, which is possibly what's happened here.

In this case the change from

------------------ Rough ideas not quite ready for backlog ------------------------

to

------------------ Rough ideas not quite ready for backlog
------------------------

caused the second run to interprete it as a h2. Will fix manually

@webmaster128 webmaster128 merged commit 7220cfa into 0.13 Mar 27, 2019
@webmaster128 webmaster128 deleted the use-prettier-to-format-text branch March 27, 2019 12:02
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