In our codebase, we'd like to re-export i18n functions from a common namespace, i.e. instead of using t, i18next.t, or <Trans>, we'd like to use something like Strings.get and <Strings.Text>. Although the JS and JSX lexers support custom functions and componentFunctions, they assume that the functions and components are TS identifiers, and are not able to match the names of property accessors.
To Reproduce
Given this config:
module.exports = {
lexers: {
js: [
{
lexer: 'JavascriptLexer',
functions: ['strings.for'], // Setting this to `'for'` works, but this will also match other functions named `for`, including `Symbol.for`.
},
],
jsx: [
{
lexer: 'JsxLexer',
functions: ['strings.for'],
componentFunctions: ['strings.Text'],
},
],
},
}
🐛 Bug Report
In our codebase, we'd like to re-export i18n functions from a common namespace, i.e. instead of using
t
,i18next.t
, or<Trans>
, we'd like to use something likeStrings.get
and<Strings.Text>
. Although the JS and JSX lexers support customfunctions
andcomponentFunctions
, they assume that the functions and components are TS identifiers, and are not able to match the names of property accessors.To Reproduce
Given this config:
And this code:
Expected behavior
Both keys should be matched and extracted.
Your Environment