You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I have a project that uses React + Flow. Because I have Flow in project scanner shows Unable to parse Trans component from error.
I have written this customTransform function to remove Flow types:
trans: {component: 'Trans',i18nKey: 'i18nKey',defaultsKey: 'defaults',extensions: ['.js','.jsx'],// <--- this line crash my app, if extensions not nullfallbackKey: function(ns,value){returnvalue;},acorn: {ecmaVersion: 10,// defaults to 10sourceType: 'module',// defaults to 'module'},},
Because it tries to parse code before the transformation, and Flow types crash it.
If I change extensions to null and modify customTransform function it will run first, and parser in function (parser.parseTransFromString) will work with transformed code and all is ok.
My final customTransform:
The text was updated successfully, but these errors were encountered:
gornyyvladimir
changed the title
Parser parse JSX before customTransform function execution
Parser parses JSX before customTransform function execution
Jan 31, 2020
Hello! I have a project that uses React + Flow. Because I have Flow in project scanner shows
Unable to parse Trans component from
error.I have written this customTransform function to remove Flow types:
However, if you have extensions array in trans options, this code will run and crash your app:
i18next-scanner/src/index.js
Line 35 in b19aa7b
Because it tries to parse code before the transformation, and Flow types crash it.
If I change extensions to null and modify customTransform function it will run first, and parser in function (parser.parseTransFromString) will work with transformed code and all is ok.
My final customTransform:
The text was updated successfully, but these errors were encountered: