Skip to content

Commit

Permalink
Fix: When forcing the JS parser, use the modern name (#212)
Browse files Browse the repository at this point in the history
This avoids a deprecation notice
  • Loading branch information
BPScott committed Jul 4, 2019
1 parent bca77e6 commit 1385310
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion eslint-plugin-prettier.js
Expand Up @@ -210,7 +210,13 @@ module.exports = {
if (
parserBlocklist.indexOf(prettierFileInfo.inferredParser) !== -1
) {
initialOptions.parser = 'babylon';
// Prettier v1.16.0 renamed the `babylon` parser to `babel`
// Use the modern name if available
const supportBabelParser = prettier
.getSupportInfo()
.languages.some(language => language.parsers.includes('babel'));

initialOptions.parser = supportBabelParser ? 'babel' : 'babylon';
}

const prettierOptions = Object.assign(
Expand Down

0 comments on commit 1385310

Please sign in to comment.