eslint-plugin icon indicating copy to clipboard operation
eslint-plugin copied to clipboard

no-expression-in-message for Trans tags

Open hugohutri opened this issue 1 year ago • 2 comments

When using the rule "no-expression-in-message", I would like to have warnings for <Trans> tags just like they warn when using t

image

hugohutri avatar Mar 17 '24 08:03 hugohutri

+1 to Trans tags, and also inside msg (and by extension, defineMessage function calls)

  const obj = { value: "the value" };
  const example = msg`Expression to the right ${_obj.value} and to the left.`; // no warning here

judeatmerit avatar May 01 '24 22:05 judeatmerit

We also want to see that. Contributions are welcome!

timofei-iatsenko avatar May 06 '24 08:05 timofei-iatsenko

@hugohutri i created a PR https://github.com/lingui/eslint-plugin/pull/60/files adressing this.

However, enforcing this rule in the JSX is tricky. I haven't thought through all the possible cases here, so will need community help to test it.

timofei-iatsenko avatar Oct 14 '24 22:10 timofei-iatsenko

+1 to Trans tags, and also inside msg (and by extension, defineMessage function calls)

  const obj = { value: "the value" };
  const example = msg`Expression to the right ${_obj.value} and to the left.`; // no warning here

implemented in https://github.com/lingui/eslint-plugin/pull/61

timofei-iatsenko avatar Oct 15 '24 08:10 timofei-iatsenko