chore(eslint): add md and mdx language block linting#15309
Open
chore(eslint): add md and mdx language block linting#15309
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces custom ESLint linting for code blocks in Markdown and MDX documentation files to prevent build failures caused by unsupported syntax highlighting languages.
Changes:
- Adds a new ESLint rule
valid-code-block-languagesthat validates code fence language identifiers against a whitelist of supported languages - Creates a minimal text parser for MDX/MD files to enable ESLint processing without requiring full AST parsing
- Configures ESLint to validate
docs/**/*.mdxanddocs/**/*.mdfiles with the new rule
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/eslint-plugin/index.mjs | Registers the new valid-code-block-languages rule in the plugin exports |
| packages/eslint-plugin/customRules/valid-code-block-languages.js | Implements the code block language validation rule with supported language whitelist and auto-fix for known unsupported languages |
| packages/eslint-plugin/customRules/mdx-text-parser.js | Provides a minimal ESLint parser that treats MDX/MD files as plain text for linting purposes |
| eslint.config.js | Configures ESLint to apply the new rule to documentation files using the custom parser |
| .vscode/settings.json | Enables ESLint validation for MDX and Markdown files in VS Code |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/eslint-plugin/customRules/valid-code-block-languages.js
Outdated
Show resolved
Hide resolved
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
AlessioGr
reviewed
Feb 5, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a new custom linting rule in .md and .mdx files so that code blocks can only use languages supported by our prism renderer.
We need this because if you put for example
csvas a language, it will be allowed to be committed without errors or warnings but it will crash building the website effectively blocking new deployments.Here it is in action:
Screen.Recording.2026-01-21.at.15.34.07.mov