How to use the @lingui/babel-plugin-transform-react/transformer function in @lingui/babel-plugin-transform-react

To help you get started, we’ve selected a few @lingui/babel-plugin-transform-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lingui / js-lingui / packages / macro / src / index.js View on Github external
function macro({ references, state, babel }) {
  const { types: t } = babel

  const transformer = makeJsTransformer(babel)
  const jsxTransformer = new JSXTransformer(babel)
  const reactImportsToCarryOver = ["DateFormat", "NumberFormat"]
  const reactImports = []

  Object.keys(references).forEach(tagName => {
    const tags = references[tagName]
    const macroType = getMacroType(tagName)

    if (macroType === "jsx") {
      if (!reactImports.includes("Trans")) {
        reactImports.push("Trans")
      }

      if (reactImportsToCarryOver.includes(tagName)) {
        reactImports.push(tagName)
      }

@lingui/babel-plugin-transform-react

Transform React components to ICU message format

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis