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

feat(resume): support JSON comments #18

Merged
merged 3 commits into from
Jan 28, 2025
Merged

Conversation

bennycode
Copy link
Contributor

To make resumed the most convenient resume builder for developers, I implemented support for comments in JSON! 💫

Use-Case:

There are certain properties in my CV that I prefer not to render, so I occasionally comment out less important details. For example:

        {
            "highlights": [
                "Millions of sites use the CDN in production",
                "Larger market share than Yahoo's, Microsoft's and Google's javascript content distribution networks",
                "We serve hundreds of billions request a month",
                "Contains over 3000 popular Javascript libraries",
                "Millions of developers visit the site per year"
            ],
            "description": "Following Google's CDN for jQuery, we decided to start a CDN for the less popular Javascript frameworks. The CDN is community moderated and open source on GitHub. We secured a partnership with Cloudflare who now supports the infrastructure.",
            "website": "http://www.cdnjs.com",
            "name": "Cdnjs",
            "startDate": "2011-01-08"
        }
    ],
    // "languages": [
    //     {
    //         "language": "English",
    //         "fluency": "Native speaker"
    //     }
    // ],

Without my PR, this would break the rendering process:

SyntaxError: Expected double-quoted property name in JSON
at JSON.parse

Using JSON5, we can support JSON that has comments inside. It may also be useful for people who just want to add comments to specific sections.

@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@9e3e0db). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff            @@
##             main       #18   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         5           
  Lines           ?        99           
  Branches        ?        15           
========================================
  Hits            ?        99           
  Misses          ?         0           
  Partials        ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rbardini
Copy link
Owner

I like this! What do you think of using strip-json-comments instead? It simply replaces comments with whitespaces, rather than implementing all JSON5 features, so it's a lot smaller.

@bennycode
Copy link
Contributor Author

@rbardini I exchanged the JSON5 library and added a test for parsing out a comment :)

@rbardini rbardini added the enhancement New feature or request label Jan 28, 2025
@rbardini rbardini changed the title feat: support JSON comments feat(resume): support JSON comments Jan 28, 2025
@rbardini
Copy link
Owner

Awesome, thank you!

@rbardini rbardini merged commit b5b4e58 into rbardini:main Jan 28, 2025
2 checks passed
Copy link

🎉 This PR is included in version 4.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants