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

Improve Prettier, formatting enforcement #102

Merged
merged 9 commits into from
Dec 21, 2023

Conversation

sammoore
Copy link
Member

@sammoore sammoore commented Dec 6, 2023

This PR updates prettier, runs it on the pre-commit hook, and updates the VSCode/editorconfig files to ensure settings are used regardless of the workspace used in the editor.

  • Prettier: Use lint-staged to run Prettier on the relevant committed files upon git commit.
    • The previous Husky commit hook was utilizing pretty-quick, which hasn't been updated in about 18 months and does not work with Prettier v3, which the majority of this project does/did utilize (see next bullet).
  • Move VSCode settings (i.e. from cli/.vscode/settings.json) to .vscode/settings.json
  • Create symlinks from {cli,docs,www}/.vscode/settings.json to the top level settings.json, to ensure the settings are used regardless of the folder that's opened as the workspace.
  • Add .vscode/extensions.json for recommended/unwanted extensions, and use similar symlinks as above for sub-projects.
  • Added .editorconfig for generic editor support for line endings and tab style/sizing.

@sammoore sammoore requested a review from danstepanov December 6, 2023 23:48
Copy link

vercel bot commented Dec 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
create-expo-stack-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 21, 2023 10:35pm
create-expo-stack-landing-page ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 21, 2023 10:35pm

Copy link

vercel bot commented Dec 6, 2023

@sammoore is attempting to deploy a commit to the ronin-tech Team on Vercel.

A member of the Team first needs to authorize it.

@danstepanov
Copy link
Collaborator

@sammoore can you elaborate on the purpose of upgrading from v2 to v3 of Prettier?

Copy link
Collaborator

@danstepanov danstepanov left a comment

Choose a reason for hiding this comment

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

Will want to get those build steps to succeed before merging

.gitignore Outdated Show resolved Hide resolved
.husky/.gitignore Outdated Show resolved Hide resolved
.lintstagedrc.js Show resolved Hide resolved
@sammoore
Copy link
Member Author

sammoore commented Dec 7, 2023

@sammoore can you elaborate on the purpose of upgrading from v2 to v3 of Prettier?

@danstepanov Thought it made sense to get everything up to date and on the same version, since doc/ and www/ was already on v3, just cli/ was behind.

If we're running Prettier on commit or from our editors, it's possible in these scenarios only one version or the other will be used. So by upgrading, we avoid the possibility that an unexpected version (for either project) is used by upgrading so they are all using v3.

@sammoore
Copy link
Member Author

sammoore commented Dec 15, 2023

Rebased and updated with my latest changes and with the builds resolved (I think by upgrading bun and then updating the lockb file?).

A few pending things:

  • Top-level package.json's format run-script could be more exhaustive & based on my findings while creating the .prettierignore.
  • This commit needs a different name or to be removed
    • I accidentally gave it another name during some sort of commit cleanup.
    • It might not be necessary anymore, it was an attempt to fix the build process in CI but I don't think it was the solution.
  • Remove the commit of removing package-lock.json from .gitignore and the revert of that commit.
  • PR has a lot of separate but related changes now; might be worth separating them?

@sammoore sammoore removed the request for review from ernestoresende December 15, 2023 05:23
@danstepanov
Copy link
Collaborator

@sammoore yea can you break the PR up if it addresses different things?

@sammoore
Copy link
Member Author

"Half" of this PR (Husky fixes & the automated bun run changeset) is now in #125

After that's merged, will rebase and update this PR with just the Prettier/tabSize/etc changes.

@sammoore
Copy link
Member Author

sammoore commented Dec 18, 2023

For the curious: updating the PR with rebased commits (against the other portion of this original PR that have been merged in #125).

Still need to:

  • update description,
  • verify locally,
  • check tests / CI

@sammoore
Copy link
Member Author

sammoore commented Dec 18, 2023

I've moved the cli/ prettier version bump to #126 since (a) I'm able to verify the changes easier, (b) the rationale around the upgrade needed clarification, and (c) it simplifies this PR, removing changes unrelated to the core description.

This PR description is updated, but the PR will need to be rebased again after #126 is merged.

@sammoore
Copy link
Member Author

Rebased against #126 and #125. Still need to verify changes locally (empty checkbox here) and make sure nothing else is needed.

@sammoore
Copy link
Member Author

Removed the change from tabs to 2 spaces. Will include in the PR that actually applies the switch.

Also, updated the PR description to mention .editorconfig.

Rebased and ready for review.

Copy link
Collaborator

@danstepanov danstepanov left a comment

Choose a reason for hiding this comment

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

LGTM

@danstepanov danstepanov merged commit 556a5d7 into roninoss:main Dec 21, 2023
2 checks passed
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