eslint-multiple-parsers
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.