ESLint Merge Processors

raw JSON →
2.0.0 verified Sat Apr 25 auth: no javascript

A utility to combine multiple ESLint processors into a single processor, enabling parallel linting of different file types within one ESLint configuration. Current stable version is 2.0.0, which is ESM-only and requires ESLint flat config. Maintained by Anthony Fu, it differentiates from manual chaining by providing a clean merge function and a pass-through processor for original files. It is commonly used with eslint-plugin-markdown to lint both the markdown file and its embedded code snippets.

error Cannot find module 'eslint-merge-processors'
cause Package not installed or version mismatch in older npm/yarn.
fix
Run 'npm install eslint-merge-processors' in your project root.
error require() of ES Module not supported
cause Using require() to import an ESM-only package in CommonJS.
fix
Use dynamic import: const { mergeProcessors } = await import('eslint-merge-processors'); or convert your project to ESM.
error Property 'mergeProcessors' does not exist on type 'typeof import("eslint-merge-processors")'
cause TypeScript not recognizing the export due to wrong import syntax or missing type declarations.
fix
Ensure you are using named imports: import { mergeProcessors } from 'eslint-merge-processors'. Check tsconfig.json for 'moduleResolution' set to 'node' or 'node16'.
breaking v2.0.0 drops CommonJS (CJS) support; the package is now ESM-only. Attempting to require() will throw a ModuleError.
fix Switch to import syntax or use dynamic import() in CommonJS. Update your ESLint config to use flat config (ESLint >=9).
gotcha The order of processors in the array matters. Processors are applied in sequence; later processors will see the already-modified file from earlier processors.
fix Ensure processorPassThrough is first if you want to lint the original file alongside other processors.
gotcha Not all ESLint processors are compatible with merging. Some processors may assume they have exclusive control over the file and may conflict.
fix Test the combination thoroughly; consider filing issues upstream for incompatible processors.
npm install eslint-merge-processors
yarn add eslint-merge-processors
pnpm add eslint-merge-processors

Shows how to combine a pass-through processor with eslint-plugin-markdown's processor to lint both the .md file and its code snippets.

import { mergeProcessors, processorPassThrough } from 'eslint-merge-processors';
import markdown from 'eslint-plugin-markdown';

export default [
  {
    files: ['**/*.md'],
    plugins: {
      markdown
    },
    processor: mergeProcessors([
      processorPassThrough,
      markdown.processors.markdown
    ])
  }
];