2.0.0 • Published 4 years ago
jscodeshift-choose-parser v2.0.0
jscodeshift-choose-parser
chooseJSCodeshiftParser(file: string): string | Parser
const chooseJSCodeshiftParser = require('jscodeshift-choose-parser')
Intelligently chooses a parser for a given file. Basically:
- If extension is
.ts
or.tsx
return'ts'
/'tsx'
depending on extension - Else if
@babel/core
is installed, return parser that uses with@babel/core
using local babel config - Else return
undefined
The default babylon
parser in jscodeshift
does not use your local babel config AFAIK. This package
returns a parser that does use your local babel config.