This package has been deprecated

Author message:

Use ESLint configuration based on glob patterns (`overrides`). See https://eslint.org/docs/user-guide/configuring\#configuration-based-on-glob-patterns.

eslint-multiple-parsers
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

eslint-multiple-parsers

Build Status Greenkeeper badge JavaScript Style Guide

Use multiple parsers in one ESLint run.

DEPRECATION NOTICE

Superseded by ESLint configuration based on glob patterns.

What

ESLint can currently have configured only a single parser. If your code has multiple languages and thus requires multiple parsers, you’re out of luck.

Or, are you?

Usage

Install this package:

npm i --save-dev eslint-multiple-parsers

Specify this package as the parser and configure the multiple parsers like so:

.eslintrc.json:

{
  "parser": "eslint-multiple-parsers",
  "parserOptions": {
    "parsers": [
      {
        "test": ".*\\.js$",
        "path": "babel-eslint",
        "options": {
          "sourceType": "module"
        }
      },
      {
        "test": ".*\\.ts$",
        "path": "typescript-eslint-parser"
      }
    ]
  }
}

The test is a regular expression. It will be matched against the basename of the file path. The first matched parser will be used.

Of course, any specified parsers must be installed.

Notice: the parser path must be a package path. A relative path will not work. PR welcome.

Package Sidebar

Install

npm i eslint-multiple-parsers

Weekly Downloads

162

Version

1.0.1

License

ISC

Last publish

Collaborators

  • mightyiam