template-literals.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. foo(`a long string ${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 } with expr`);
  2. const x = `a long string ${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( function() {return 3 })() + 3 + 2 + 3 + 2 + 3 } with expr`;
  3. foo(`a long string ${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( function() {
  4. const x = 5;
  5. return x;
  6. })() + 3 + 2 + 3 + 2 + 3 } with expr`);
  7. pipe.write(
  8. `\n ${chalk.dim(`\u203A and ${more} more ${more} more ${more} more ${more}`)}`,
  9. );
  10. // https://github.com/prettier/prettier/issues/1662#issue-230406820
  11. const content = `
  12. const env = ${ JSON.stringify({
  13. assetsRootUrl: env.assetsRootUrl,
  14. env: env.env,
  15. role: "client",
  16. adsfafa: "sdfsdff",
  17. asdfasff: "wefwefw",
  18. fefef: "sf sdfs fdsfdsf s dfsfds"
  19. }, null, "\t") });
  20. `;
  21. // https://github.com/prettier/prettier/issues/821#issue-210557749
  22. f(`${{
  23. a: 4,
  24. b: 9,
  25. }}`);
  26. // https://github.com/prettier/prettier/issues/1183#issue-220863505
  27. const makeBody = (store, assets, html) =>
  28. `<!doctype html>${
  29. ReactDOMServer.renderToStaticMarkup(
  30. <Html
  31. headScripts={compact([ assets.javascript.head ])}
  32. headStyles={compact([ assets.styles.body, assets.styles.head ])}
  33. bodyScripts={compact([ assets.javascript.body ])}
  34. bodyStyles={[]}
  35. stringScripts={[
  36. `window.__INITIAL_STATE__ = ${
  37. JSON.stringify(store.getState(), null, 2)
  38. };`,
  39. ]}
  40. content={[
  41. { id: 'app-container', dangerouslySetInnerHTML: { __html: html } },
  42. ]}
  43. />
  44. )
  45. }`
  46. // https://github.com/prettier/prettier/issues/1626#issue-229655106
  47. const Bar = styled.div`
  48. color: ${props => (props.highlight.length > 0 ? palette(['text', 'dark', 'tertiary'])(props) : palette(['text', 'dark', 'primary'])(props))} !important;
  49. `