ESLint Plugin for MDX that enables linting and validation of MDX content with comprehensive support for JavaScript/JSX syntax and Markdown formatting.
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
ESLint rules for MDX content validation, including integration with remark-lint for markdown syntax checking. The rules provide comprehensive linting for both MDX-specific syntax and embedded remark plugins.
The main rule that integrates remark-lint plugins for markdown syntax validation within MDX files.
declare const remark: Rule.RuleModule;The remark rule provides:
Rule Configuration:
The rule is configured through ESLint parser options, not rule options:
interface ParserOptions {
extensions?: string[];
markdownExtensions?: string[];
ignoreRemarkConfig?: boolean;
remarkConfigPath?: string;
}Usage Examples:
// Basic usage in ESLint config
{
"rules": {
"mdx/remark": "warn"
}
}
// With specific configuration
{
"rules": {
"mdx/remark": "error"
},
"parserOptions": {
"extensions": [".mdx", ".md"],
"markdownExtensions": [".markdown"],
"ignoreRemarkConfig": false,
"remarkConfigPath": "./remark.config.js"
}
}
// Flat config usage
export default [
{
files: ["**/*.mdx"],
rules: {
"mdx/remark": "warn"
},
languageOptions: {
parserOptions: {
ignoreRemarkConfig: false
}
}
}
];All rules are available through a unified export object.
interface RulesExport {
remark: Rule.RuleModule;
}
declare const rules: RulesExport;interface WithParent {
parent: NodeWithParent;
}
type NodeWithParent = Node & WithParent;
interface ExpressionStatementWithParent extends ExpressionStatement, WithParent {}
interface RemarkLintMessage {
reason: string;
source: string;
ruleId: string;
severity: Linter.LintMessage['severity'];
}
// ESLint Rule module interface
interface RuleModule {
meta: {
type: 'problem' | 'suggestion' | 'layout';
docs: {
description: string;
category: string;
recommended: boolean;
};
fixable?: 'code' | 'whitespace';
schema?: any[];
};
create(context: Rule.RuleContext): Rule.RuleListener;
}The mdx/remark rule integrates with the remark ecosystem by:
Supported File Extensions:
.mdx (default), configurable via extensions option.md, .markdown, .mdown, .mkdn (default), configurable via markdownExtensions optionConfiguration Options:
// Parser options that affect rule behavior
interface ParserOptions {
extensions?: string[]; // Additional MDX file extensions
markdownExtensions?: string[]; // Additional Markdown file extensions
ignoreRemarkConfig?: boolean; // Skip remark configuration files
remarkConfigPath?: string; // Custom remark config file path
}Rule Metadata:
layout - Focuses on stylistic and formatting issuesStylistic Issuestrue - Included in recommended configurationscode - Can automatically fix certain violations