Skip to content

Commit

Permalink
fix(studio-ui-codegen-react): include babel parser for prettier (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Sep 16, 2021
1 parent f4f1b72 commit e28551c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 17,179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import ts, {
ObjectLiteralExpression,
} from 'typescript';
import prettier from 'prettier';
import parserBabel from 'prettier/parser-babel';
import { ImportCollection } from './import-collection';
import { ReactOutputManager } from './react-output-manager';
import {
Expand Down Expand Up @@ -182,10 +183,10 @@ export abstract class ReactStudioTemplateRenderer extends StudioTemplateRenderer
},
}).outputText;

return prettier.format(transpiledCode, { parser: 'babel' });
return prettier.format(transpiledCode, { parser: 'babel', plugins: [parserBabel] });
}

return prettier.format(code, { parser: 'babel' });
return prettier.format(code, { parser: 'babel', plugins: [parserBabel] });
}

private createPrinter() {
Expand Down
17 changes: 17 additions & 0 deletions packages/studio-ui-codegen-react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/studio-ui-codegen-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@amzn/amplify-ui-codegen-schema": "^0.0.1",
"@amzn/amplify-ui-react-types": "^0.0.1",
"@amzn/studio-ui-codegen": "^0.0.1",
"@babel/parser": "^7.15.6",
"framer-motion": "^4",
"prettier": "2.3.2",
"typescript": "^4.2.4"
Expand Down

0 comments on commit e28551c

Please sign in to comment.