Skip to content

style: run prettier on webassembly #20405

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

Merged
merged 1 commit into from
Sep 10, 2022
Merged

Conversation

nschonni
Copy link
Contributor

@nschonni nschonni commented Sep 7, 2022

Mostly spacing after the metadata, but manually adjusted some list spacing after it added extra line breaks

@nschonni nschonni requested a review from a team as a code owner September 7, 2022 21:12
@nschonni nschonni requested review from hamishwillee and removed request for a team September 7, 2022 21:12
@github-actions github-actions bot added the Content:wasm WebAssembly docs label Sep 7, 2022
@github-actions

This comment was marked as resolved.

@nschonni nschonni requested a review from a team as a code owner September 7, 2022 21:36
- [`Count leading zeros`](/en-US/docs/WebAssembly/Reference/Numeric/Count_leading_zeros)
- Count the amount of leading zeros in a numbers binary representation.

- : Count the amount of leading zeros in a numbers binary representation.
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't create a dl—not every element has a :. Just use a normal ul.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I could use a <-- --> above this to split the list into a UL then a DL. Looking at the rest of the page it seemed like it was supposed to be DL elements, but the ones in here hadn't been stubbed out

Copy link
Member

Choose a reason for hiding this comment

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

That would be a bit weird, since we would have a ul and a dl sitting side-by-side. Maybe we could add a very brief intro for each of the operations above 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.

I stubbed in some DDs from the article opening paragraphs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like that. The benefit of a DL is the auto creation of an anchor in the page.

.prettierrc.json Outdated
@@ -1,3 +1,4 @@
{
"bracketSameLine": true
"bracketSameLine": true,
"trailingComma": "all"
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO a change like this should be mentioned in the PR title, as "run prettier on webassembly" doesn't imply this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it wasn't part of the original changes, but was requested on the review of one of the docs

Copy link
Contributor

Choose a reason for hiding this comment

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

I want to be sure we have a consensus on this, and I'm fairly confident we can have it. This has a consequence much wider than this PR, and I wouldn't want it to be reversed later, leading to undoing what has been requested here.

Can you create a PR with just this change so that we get a wide set of reviewers approving it?

Then, we can rebase this one and merge it.

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

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

Lots to love, nothing to hate.

I'm approving but leaving open as there were comments from others.

How can I run this locally? I'm thinking of updating the learn express and django docs, but I want to make sure I run the same thing for both the docs and the source code.

@nschonni
Copy link
Contributor Author

nschonni commented Sep 8, 2022

How can I run this locally? I'm thinking of updating the learn express and django docs, but I want to make sure I run the same thing for both the docs and the source code.

Currently you can run with yarn prettier -w files/en-us/learn/server-side/django/. If the default ignore lands in #20397 it will be a little different, and you'd need to op the folder in with the .prettierignore

@Josh-Cena
Copy link
Member

@hamishwillee the express guide is a bit more involved, because there are a lot of "code pieces" that are not valid grammar standalone. Both the linter and the formatter choke on them, and I don't know what to do about them yet. If you could figure out a way to make every code block parsable JavaScript it would be great.

@hamishwillee
Copy link
Collaborator

THanks @nschonni @Josh-Cena . I might wait until the default ignore goes in.

Re code pieces that are not valid grammar "we will see". I think I need to start by running prettier on the source code (following yari prettier rules) then copying in, and slowly working through to something that no longer chokes our tools.

Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

The .prettier should be in its own PR, so that we can track that we have a consensus.

@nschonni nschonni force-pushed the prettier-webassembly branch from b337207 to 028efda Compare September 9, 2022 05:22
@nschonni nschonni force-pushed the prettier-webassembly branch from 028efda to 8677693 Compare September 9, 2022 05:25
@nschonni
Copy link
Contributor Author

nschonni commented Sep 9, 2022

@Josh-Cena I've backed out the trailing comma config changes and fixes. I'll let you submit a separate PR to introduce that

@nschonni nschonni requested a review from teoli2003 September 9, 2022 05:27
Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

This looks great to me. Thanks, @nschonni. (Approving, but leaving it to the others to merge it)

@teoli2003
Copy link
Contributor

@Josh-Cena I've backed out the trailing comma config changes and fixes. I'll let you submit a separate PR to introduce that

Created: #20405 (and we'll be able to check if we have a consensus in it)

@nschonni
Copy link
Contributor Author

I don't think there are any other blockers on this one. The trailing commas can be fixed later if the config PR lands

@teoli2003
Copy link
Contributor

Agreed.

@teoli2003 teoli2003 merged commit c18f911 into mdn:main Sep 10, 2022
@nschonni nschonni deleted the prettier-webassembly branch September 10, 2022 06:57
himanshugarg pushed a commit to himanshugarg/content that referenced this pull request Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:wasm WebAssembly docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants