Skip to content

Commit

Permalink
Dont format if code is multiline
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Quadflieg committed Nov 16, 2019
1 parent 8478562 commit 49b4b4c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,17 @@ export const plugin: Plugin = {
}
let val = token.val;
try {
const valBackup = val;
val = format(val, {
parser: 'babel',
...codeInterpolationOptions,
semi: useSemi,
endOfLine: 'lf'
});
val = val.slice(0, -1);
if (val.includes('\n')) {
val = valBackup;
}
} catch (error) {
logger.warn(error);
}
Expand Down

0 comments on commit 49b4b4c

Please sign in to comment.