Skip to content

docs: add linting and code snippet validation #1983

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 8 commits into from
Apr 27, 2025

Conversation

sarahxsanders
Copy link
Contributor

@sarahxsanders sarahxsanders commented Apr 6, 2025

Description

This PR introduces linting and code snippet validation for GraphQL snippets. JS snippets are commented out on this PR, because I will modernize the JS code snippets first.

Changes

  • Updated ESLint config to lint Markdown and MDX files in the repository + special handling for documentation snippets.
  • Created a validate-snippets.js script that extracts code snippets from MDX files and validates them against parsers. Note, I temporarily commented out JS validation logic until those code snippets are modernized to meet the latest standards.
  • Set up docs validation workflow for GHA to run on PRs. This checks for broken links and code snippets.
  • Fix: Added <!-- snippet-ignore --> for GQL snippets causing errors

Comments

Review

Copy link

vercel bot commented Apr 6, 2025

@sarahxsanders is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

linux-foundation-easycla bot commented Apr 6, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@sarahxsanders sarahxsanders marked this pull request as ready for review April 6, 2025 22:48
Copy link

vercel bot commented Apr 8, 2025

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

Name Status Preview Comments Updated (UTC)
graphql-github-io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 24, 2025 9:03am

Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

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

This is awesome! I'm going to integrate some of the improvements here into my own software! 😁

I've left some small suggested tweaks below, but only 2 are potential blockers: the concern about adding a new page and linking to it from existing pages, and the one where operation is changed to mutation

@sarahxsanders sarahxsanders requested a review from benjie April 12, 2025 15:26
@sarahxsanders
Copy link
Contributor Author

@benjie added a commit to build locally for link checking

@sarahxsanders
Copy link
Contributor Author

hey @benjie just bumping this one for review!

@saihaj
Copy link
Member

saihaj commented Apr 23, 2025

need to see why the next build is failing here
CleanShot 2025-04-23 at 22 32 17@2x

@saihaj
Copy link
Member

saihaj commented Apr 24, 2025

I pushed up a commit @sarahxsanders hopefully that fixes failing builds

Copy link
Member

@saihaj saihaj left a comment

Choose a reason for hiding this comment

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

CI seems to be passing for our existing actions. We can't really run the new CI jobs from this PR so once we merge will have to see how they do it

@sarahxsanders
Copy link
Contributor Author

@saihaj feel free to merge this whenever for me! :) I don't have merge permissions (may need to get these for the rest of my incoming PRs as I open them)

@saihaj saihaj merged commit b1fb896 into graphql:source Apr 27, 2025
4 checks passed
@saihaj saihaj mentioned this pull request Apr 28, 2025
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.

3 participants