Skip to content

Commit

Permalink
fix: closes vuejs#25, jscodeshift failed to parse some files with spe…
Browse files Browse the repository at this point in the history
…cial

syntax
  • Loading branch information
Alanscut committed Jun 25, 2021
1 parent a820620 commit aa252e6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/wrapAstTransformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ export default function astTransformationToJSCodeshiftModule<Params = any>(
): Transform {
const transform: Transform = (file, api, options: Params) => {
const j = api.jscodeshift
const root = j(file.source)
let root
try {
root = j(file.source)
} catch (err) {
console.error(
`JSCodeshift failed to parse ${file.path},` +
` please check whether the syntax is valid`
)
return
}

transformAST({ root, j, filename: file.path }, options)

Expand Down

0 comments on commit aa252e6

Please sign in to comment.