Skip to content

About

Merge multiple ESLint processors to behave like one

Resources

Code of conduct

Contributing

Stars

22 stars

Watchers

1 watching

Forks

Repository files navigation

eslint-merge-processors

npm version npm downloads bundle JSDocs License

Merge multiple ESLint processors to behave like one

Install

npm i eslint-merge-processors
import { mergeProcessors } from 'eslint-merge-processors'

const processor = mergeProcessors([
  processorA,
  processorB,
  // ...
])

Examples

Markdown

Lint .md files with eslint-plugin-markdown.

By default, eslint-plugin-markdown's processor will create a virtual file for each code snippet in the markdown file, but not the original .md file itself. This means the original .md file will not be linted.

With this package, along with the processorPassThrough processor, you can now fix that:

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

// ESlint Flat config
export default [
  {
    files: ['**/*.md'],
    plugins: {
      markdown
    },
    processor: mergeProcessors([
      // This allow the original `.md` file to be linted
      processorPassThrough,
      // The markdown processor
      markdown.processors.markdown,
      // other processors if needed
    ])
  }
]

Sponsors

License

MIT License © 2023-PRESENT Anthony Fu

About

Merge multiple ESLint processors to behave like one

Resources

Code of conduct

Contributing

Stars

22 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages