-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
saihaj
merged 8 commits into
graphql:source
from
sarahxsanders:linting-and-code-validation
Apr 27, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5a8dad1
Add linting and code snippet validation for docs
sarahxsanders 9bd1543
Remove unused link checkers
sarahxsanders e6b5b29
Add link checking to CONTRIBUTING.md and remove package-lock.json
sarahxsanders 195e440
update pnpm lockfile to sync with package.json
sarahxsanders 4fe6cee
feedback from Benjie
sarahxsanders 60e1830
build docs locally to test broken links
sarahxsanders a829d13
fix failing build
saihaj c469154
fix another snippets ignore
saihaj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Docs validation workflow runs on each PR on main w/ broken link checker | ||
# and code snippet validation | ||
|
||
name: Docs validation | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
link-check: | ||
name: Broken link checker | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build static site | ||
run: pnpm build | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: Install lychee | ||
run: cargo install lychee | ||
|
||
- name: Check links | ||
run: lychee --verbose --no-progress './out/**/*.html' | ||
|
||
code-validate: | ||
name: Code snippet and GraphQL validation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Run validation w/ annotations | ||
run: pnpm lint:docs:ci | ||
|
||
- name: Validate code snippets | ||
run: pnpm validate:snippets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,18 @@ | |
"packageManager": "[email protected]", | ||
"scripts": { | ||
"build": "next build && next-image-export-optimizer", | ||
"check:links": "lychee --verbose --no-progress './src/pages/**/*.mdx' --base https://graphql.org", | ||
"dev": "next", | ||
"format": "pnpm format:check --write", | ||
"format:check": "prettier --cache --check .", | ||
"lint": "eslint --ignore-path .gitignore .", | ||
"lint:docs": "eslint --ignore-path .gitignore src/pages/learn --format stylish", | ||
"lint:docs:ci": "eslint --ignore-path .gitignore src/pages/learn --format eslint-formatter-github", | ||
"postbuild": "next-sitemap", | ||
"prebuild": "tsx src/get-github-info.ts", | ||
"start": "next start", | ||
"test": "echo \"no tests\" && exit 1" | ||
"test": "echo \"no tests\" && exit 1", | ||
"validate:snippets": "node scripts/validate-snippets.js" | ||
}, | ||
"dependencies": { | ||
"@graphql-tools/schema": "10.0.15", | ||
|
@@ -23,7 +27,7 @@ | |
"@tailwindcss/typography": "^0.5.10", | ||
"autoprefixer": "^10.4.17", | ||
"clsx": "^2.1.0", | ||
"codemirror": "5.65.1", | ||
"codemirror": "^5.65.19", | ||
"codemirror-graphql": "1.3.2", | ||
"date-fns": "^2.30.0", | ||
"fast-glob": "^3.3.2", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.