i18next-scanner: As of 3.0.0, optional chaining in variables causes fatal errors.

{t('String {{string}}', { string: something.thing?.maybe })}

It won’t process this while 2.11.0 would

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 19 (4 by maintainers)

Most upvoted comments

A new version just published, this issue shall be resolved in v3.1.0

See https://www.npmjs.com/package/i18next-scanner for new versions

cc @justrealmilk @genesiscz @joshuaja @ShenHongFei @6uliver @jgoncalv

@cheton @justrealmilk I use i18next-scanner-typescript and it works quite well.

It seems the esprima-next fork contains all the latest ESM features from esprima and has frequent updates on NPM. I will move to esprima-next in PR #221 and publish a new release.

It’s a duplicate of this one: #178 You have to use at least 3.0.0 and should set “ecmaVersion” to 11 in the config.

Could you pretty please post an example?

Sure, I’m using this config for acorn in my i18next-scanner.config.js:

module.exports = {
  // ...
  options: {
    // ...
    trans: {
      // ...
      acorn: {
        ecmaVersion: 11,
        sourceType: 'module',
      },
    },
  },
}

It’s a duplicate of this one: https://github.com/i18next/i18next-scanner/issues/178 You have to use at least 3.0.0 and should set “ecmaVersion” to 11 in the config.