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

Open
wants to merge 6 commits into
base: source
Choose a base branch
from

Conversation

sarahxsanders
Copy link

@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 ❌ Failed (Inspect) Apr 17, 2025 10:21am

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
Author

@benjie added a commit to build locally for link checking

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