Skip to content

Commit

Permalink
Dont format code on error
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Quadflieg committed Nov 16, 2019
1 parent 194f103 commit e105bae
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,16 @@ export const plugin: Plugin = {
useSemi = false;
}
let val = token.val;
val = format(val, {
parser: 'babel',
...codeInterpolationOptions,
semi: useSemi,
endOfLine: 'lf'
});
try {
val = format(val, {
parser: 'babel',
...codeInterpolationOptions,
semi: useSemi,
endOfLine: 'lf'
});
} catch (error) {
logger.warn(error);
}
val = val.slice(0, -1);
result += ` ${val}`;
break;
Expand Down

0 comments on commit e105bae

Please sign in to comment.