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

chore: Add Prettier formatter #432

Closed
wants to merge 2 commits into from
Closed

chore: Add Prettier formatter #432

wants to merge 2 commits into from

Conversation

germartinez
Copy link
Member

Context

This PR:

  • Adds Prettier dependency and the format script
  • Formats the docs (.md, .mdx, .json) and the code snippets

@germartinez germartinez requested a review from louis-md April 11, 2024 08:37
Copy link

Overall readability score: 68.28 (🟢 +0)

File Readability
404.md 93.49 (🟢 +0)
api-rpc-requirements.md 60.65 (🟢 +0)
api-service-architecture.md 52.31 (🟢 +0)
api-supported-networks.md 100 (🟢 +0)
smart-account-audits.md 86.28 (🟢 +0)
smart-account-bug-bounty.md 55.56 (🟢 +0)
smart-account-overview.md 43.43 (🟢 +0)
smart-account-signatures.md 37.79 (🟢 +0)
smart-account-supported-networks.md 57.12 (🟢 +0)
v1.0.0.md 100 (🟢 +0)
v1.1.1.md 100 (🟢 +0)
v1.2.0.md 100 (🟢 +0)
v1.3.0.md 100 (🟢 +0)
v1.4.1.md 100 (🟢 +0)
glossary.md 55.56 (🟢 +0)
4337-supported-networks.md 35.41 (🟢 +0)
reference.md 75.95 (🟢 +0)
migrating-to-v1.md 67.43 (🟢 +0)
migrating-to-v2.md 62.94 (🟢 +0)
safe-auth.md 52.65 (🟢 +0)
auth-kit-base-pack.md 64.93 (🟢 +0)
safe-auth-pack.md 55.36 (🟢 +0)
monerium.md 73.97 (🟢 +0)
stripe.md 73 (🟢 +0)
reference.md 76.28 (🟢 +0)
stripe-pack.md 65.34 (🟢 +0)
signatures.md 62.73 (🟢 +0)
migrating-to-v2.md 70.41 (🟢 +0)
safe-factory.md 56.75 (🟢 +0)
safe.md 69.63 (🟢 +0)
gelato-relay.md 75.37 (🟢 +0)
migrating-to-v2.md 20.34 (🟢 +0)
View detailed metrics

🟢 - Shows an increase in readability
🔴 - Shows a decrease in readability

File Readability FRE GF ARI CLI DCRS
404.md 93.49 86.71 6 6 6 6.24
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
api-rpc-requirements.md 60.65 54.63 10.31 11.9 11.66 7.36
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
api-service-architecture.md 52.31 40.04 9.67 13.2 14.96 7.51
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
api-supported-networks.md 100 100 6 6 6 4.9
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
smart-account-audits.md 86.28 78.45 6.37 6 7.17 7.35
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
smart-account-bug-bounty.md 55.56 39.43 10.78 11.8 12.75 7.48
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
smart-account-overview.md 43.43 38.62 11.37 13.7 15.25 8.94
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
smart-account-signatures.md 37.79 40.69 12.63 18.6 17.11 7.1
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
smart-account-supported-networks.md 57.12 54.83 11.44 11.5 11.95 7.92
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
v1.0.0.md 100 100 6 6 6 4.9
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
v1.1.1.md 100 100 6 6 6 4.9
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
v1.2.0.md 100 100 6 6 6 4.9
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
v1.3.0.md 100 100 6 6 6 4.9
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
v1.4.1.md 100 100 6 6 6 4.9
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
glossary.md 55.56 40.35 9.8 12.2 13.68 7.46
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
4337-supported-networks.md 35.41 35.44 13.72 12.6 16.04 10.17
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
reference.md 75.95 53.27 6.91 8.4 11.4 6.04
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
migrating-to-v1.md 67.43 46.03 8.5 9.3 12.32 6.66
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
migrating-to-v2.md 62.94 48.6 11.03 9.5 10.72 7.45
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
safe-auth.md 52.65 41.36 11.21 11.4 13.15 8.26
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
auth-kit-base-pack.md 64.93 50.23 8.71 10.1 12.05 7.3
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
safe-auth-pack.md 55.36 47.38 10.24 12.7 13.39 7.55
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
monerium.md 73.97 57.37 8.25 8.9 10.14 6.48
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
stripe.md 73 60.11 8.15 8.6 10.71 6.86
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
reference.md 76.28 65.83 8.17 8.2 9.1 7.01
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
stripe-pack.md 65.34 56.96 9.37 10.4 11.71 7.18
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
signatures.md 62.73 55.44 9.92 12 12.41 6.59
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
migrating-to-v2.md 70.41 59.09 10.7 7.1 8.34 7.97
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
safe-factory.md 56.75 46.78 11.04 11.7 12.12 7.67
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
safe.md 69.63 42.48 7.15 10.6 12.63 5.79
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
gelato-relay.md 75.37 64 8.63 8.9 9.39 6.51
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
migrating-to-v2.md 20.34 0 14.74 17.3 19 9.07
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0

Averages:

  Readability FRE GF ARI CLI DCRS
Average 68.28 58.77 9.23 9.96 10.81 7.02
  🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0 🟢 +0
View metric targets
Metric Range Ideal score
Flesch Reading Ease 100 (very easy read) to 0 (extremely difficult read) 60
Gunning Fog 6 (very easy read) to 17 (extremely difficult read) 8 or less
Auto. Read. Index 6 (very easy read) to 14 (extremely difficult read) 8 or less
Coleman Liau Index 6 (very easy read) to 17 (extremely difficult read) 8 or less
Dale-Chall Readability 4.9 (very easy read) to 9.9 (extremely difficult read) 6.9 or less

@@ -0,0 +1,7 @@
{
"printWidth": 80,
"semi": false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd leave that to true, it might become super confusing when coding with standard.js and then use different rules for code inside markdown

Copy link
Member Author

Choose a reason for hiding this comment

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

All the code we have in TypeScript doesn't use semicolons (all the kits in the SDK included)

@@ -9,6 +9,7 @@
"validate-resources": "node .github/scripts/validateResources.js",
"linkcheck": "find ./pages -name '*.md*' -print0 | xargs -0 -n1 pnpm markdown-link-check --quiet --progress --config linkchecker-config.json",
"lint": "eslint . && vale pages/ --minAlertLevel=error",
"format": "prettier --write \"pages/**/*.{md,mdx,json}\"",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to use standard --fix instead? Since it is already configured for the rest of the project

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to run prettier with our configuration of standard.js (in eslint.rc)?

@germartinez germartinez deleted the format branch August 22, 2024 11:41
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