CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-eslint-plugin-mdx

ESLint Plugin for MDX that enables linting and validation of MDX content with comprehensive support for JavaScript/JSX syntax and Markdown formatting.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

rules.mddocs/

Rules

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.

Capabilities

MDX Remark Rule

The main rule that integrates remark-lint plugins for markdown syntax validation within MDX files.

declare const remark: Rule.RuleModule;

The remark rule provides:

  • Integration with remark-lint ecosystem
  • Markdown syntax validation
  • Code block linting support
  • Configurable through parser options
  • Fixable violations where possible

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
      }
    }
  }
];

Rules Export

All rules are available through a unified export object.

interface RulesExport {
  remark: Rule.RuleModule;
}

declare const rules: RulesExport;

Rule Types

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;
}

Remark Integration

The mdx/remark rule integrates with the remark ecosystem by:

  1. Processing MDX Files: Identifies MDX and Markdown files based on extensions
  2. Remark Plugin Execution: Runs configured remark-lint plugins
  3. Message Translation: Converts remark-lint messages to ESLint messages
  4. Error Reporting: Reports violations with proper line/column information

Supported File Extensions:

  • MDX Extensions: .mdx (default), configurable via extensions option
  • Markdown Extensions: .md, .markdown, .mdown, .mkdn (default), configurable via markdownExtensions option

Configuration 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:

  • Type: layout - Focuses on stylistic and formatting issues
  • Category: Stylistic Issues
  • Recommended: true - Included in recommended configurations
  • Fixable: code - Can automatically fix certain violations

docs

configurations.md

helpers.md

index.md

processors.md

rules.md

tile.json