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

Setup check format in pipeline #1001

Closed
wants to merge 33 commits into from
Closed

Conversation

brenelz
Copy link
Collaborator

@brenelz brenelz commented Jan 3, 2025

  • I have read the Contribution guide
  • This PR references an issue (except for typos, broken links, or other minor problems)

Description(required)

Setup format files in CI
Run pnpm exec prettier . --write

Related issues & labels

Copy link

stackblitz bot commented Jan 3, 2025

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Jan 3, 2025

Deploy Preview for solid-docs ready!

Name Link
🔨 Latest commit 26c1cac
🔍 Latest deploy log https://app.netlify.com/sites/solid-docs/deploys/67c71d27813f720008f739b7
😎 Deploy Preview https://deploy-preview-1001--solid-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@amirhhashemi
Copy link
Collaborator

amirhhashemi commented Jan 3, 2025

This is a reminder that Prettier does not format fenced code blocks inside JSX unless the following conditions are met:

  1. There is a blank line at the top and bottom of the block.
  2. The block starts at the beginning of the line (with no indentation).

For example, Prettier does not recognize the fenced code block in this code:

<TabsCodeBlocks>
  <div id="npm">
    ```bash frame="none"
    npm install @macaron-css/core @macaron-css/solid
    ```
  </div>
</TabsCodeBlocks>

As a result, it formats it incorrectly like this:

<TabsCodeBlocks>
  <div id="npm">
    ```bash frame="none" npm install @macaron-css/core @macaron-css/solid ```
  </div>
</TabsCodeBlocks>

To resolve this issue, you need to manually check all fenced code blocks and ensure they meet the criteria mentioned above:

<TabsCodeBlocks>
<div id="npm">

```bash frame="none"
npm install @macaron-css/core @macaron-css/solid
```

</div>
</TabsCodeBlocks>

I have already addressed this in my own pull request, specifically in this commit. If you find it helpful, you can use git cherry-pick to incorporate it.

@LadyBluenotes LadyBluenotes added the in progress Someone is currently working on the issue. label Jan 10, 2025
@amirhhashemi
Copy link
Collaborator

@brenelz This PR has been inactive for a while. If you're busy, would you mind if I took it over? It's blocking some important changes.

@LadyBluenotes
Copy link
Member

this isn't actually blocking any changes atm @amirhhashemi

you're welcomed to assist (i'd assume @brenelz would be fine with the assist) just make sure he gets to give a review.

@amirhhashemi
Copy link
Collaborator

@LadyBluenotes This is a blocker. Any sort of change or refactor is a huge pain to do because of the unformatted files. For example, I was thinking about changing the structure of the component prop docs in the API references and I decided not to do it before this merges, because I don't have the nerve to save a file and deal with the unintended changes.

It's also going to be a huge problem when we wanted to migrate to the new site.

@amirhhashemi
Copy link
Collaborator

@LadyBluenotes Sorry, I've never taken over a PR :) Should I create a new PR or somehow push my changes to this PR?

@LadyBluenotes
Copy link
Member

Working within this one is good!

@amirhhashemi
Copy link
Collaborator

I can't push my commits to this PR. Whether it's because I don't have the write permission to this repo or the OP has un-checked "Allow edits by maintainers".

@LadyBluenotes
Copy link
Member

No, he has it checked. He has to add you to the branch itself, I guess. I reached out to ask if he could

@brenelz
Copy link
Collaborator Author

brenelz commented Feb 7, 2025

@amirhhashemi I think I invited you to collaborate on my solid-docs repo

Copy link
Collaborator

@amirhhashemi amirhhashemi left a comment

Choose a reason for hiding this comment

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

I went through all the MDX files and made sure they were formatted correctly to the best of my ability.

@amirhhashemi
Copy link
Collaborator

I added a "format" script that runs Prettier with the --write flag and used that in the CI workflow to improve the development cycle.

@brenelz brenelz marked this pull request as ready for review February 18, 2025 22:08
@brenelz
Copy link
Collaborator Author

brenelz commented Feb 18, 2025

Should probably get this merged so we don't keep having to maintain it

@brenelz brenelz changed the title WIP: Setup check format in pipeline Setup check format in pipeline Feb 18, 2025
@@ -70,4 +70,4 @@ jobs:
- name: ESLint check
run: pnpm check:lint
- name: Prettier check
run: pnpm check:format
run: pnpm format
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the --write won't work in CI tho will it?

@brenelz
Copy link
Collaborator Author

brenelz commented Feb 18, 2025

I added a "format" script that runs Prettier with the --write flag and used that in the CI workflow to improve the development cycle.

The CI won't actually write back to the github repo will it?

@amirhhashemi
Copy link
Collaborator

amirhhashemi commented Feb 19, 2025

The CI won't actually write back to the github repo will it?

You are right.

In the latest commit, I used git-auto-commit-action to commit the changes back to the pull requests branch or the main branch. It creates a commit with the message "ci: Format files" when there are changes.

EDIT: git-auto-commit-action can't create a commit on a PRs created from a fork. That's a github limitation. So I created a format workflow that only formats files in the main branch. Formatting is not enforced in PRs.

I also created an install action that is reused in both workflows to install pnpm and configure Node.js.

Comment on lines -10 to -27
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- run: pnpm i
- uses: actions/cache/save@v4
with:
path: |
node_modules
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
Copy link
Collaborator

@amirhhashemi amirhhashemi Mar 4, 2025

Choose a reason for hiding this comment

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

I'm not sure what's the goal in this job. It doesn't do anything useful that I can think of. So I removed it.

Comment on lines -22 to -27
- uses: actions/cache/save@v4
with:
path: |
node_modules
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is needed to cache pnpm dependencies. See the official example.

@LadyBluenotes
Copy link
Member

We merged in #1092 - I'm not sure how necessary this PR is now. @jer3m01 do you mind letting us know?

@brenelz
Copy link
Collaborator Author

brenelz commented Mar 5, 2025

Yeah I think it would be best to just close this with all the conflicts

@amirhhashemi
Copy link
Collaborator

@LadyBluenotes Seriously? How formatting is not necessary in a big project? You guys don't format your files (as a proper editor does automatically) and only edit on the website?

Conflicts are no reason to close this PR either. That's part of development, especially when a PR sits for two months. I fixed most of the problems a month ago and have been dealing with the conflicts since. It just needed someone to look at it for 15 minutes before the switch to SolidBase.

Twice, my efforts to format this repository have been dismissed. It's such a basic problem that I can't believe my time has been wasted on it.

I'm not sure I want to work on this project anymore.

@LadyBluenotes
Copy link
Member

@amirhhashemi I can understand the frustration and I apologize for the miscommunication on this front. You are correct, we do still need formatting and I was unsure of whether it was easier for you to address this within this PR or if it would've been easier for you to do so in a new one. This wasn't closed with the intention of never addressing it, I was going to reach out tomorrow to have a conversation with you if you didn't happen to see this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Someone is currently working on the issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Other]: Unformatted files
3 participants