(code: string)
| 7 | } |
| 8 | |
| 9 | export const formatCode = async (code: string) => { |
| 10 | let formattedCode = `// 🚨 Your props contains invalid code` |
| 11 | |
| 12 | const prettier = await import('prettier/standalone') |
| 13 | const babylonParser = await import('prettier/parser-babylon') |
| 14 | |
| 15 | try { |
| 16 | formattedCode = prettier.format(code, { |
| 17 | parser: 'babel', |
| 18 | plugins: [babylonParser], |
| 19 | semi: false, |
| 20 | singleQuote: true, |
| 21 | }) |
| 22 | } catch (e) {} |
| 23 | |
| 24 | return formattedCode |
| 25 | } |
| 26 | |
| 27 | type BuildBlockParams = { |
| 28 | component: IComponent |
no outgoing calls
no test coverage detected