Which package?
//crates/formatjs_cli
Describe the bug
The formatjs CLI does not identify messages like this:
// Case 6: formatMessage nested in a callback inside an optional chain.
getUsers()?.map(() =>
intl.formatMessage(
{
defaultMessage: 'In a callback inside an optional chain',
description: 'Test callbacks inside an optional chain',
},
),
).join(', ')
To Reproduce
Codesandbox URL
N/A
Reproducible Steps/Repo
Steps to reproduce the behavior:
- Go to
packages/ts-transformer/tests/fixtures/optionalChaining.tsx
- Add the failing test case to the fixture
- Go to
crates/formatjs_cli/src/extractor.rs
- Add the expected message to the test:
MessageDescriptor {
id: None,
default_message: Some("In a callback inside an optional chain".to_string()),
description: Some(Value::String("Test callbacks inside an optional chain".to_string())),
file: None,
start: None,
end: None,
},
- Run
bazel test //crates/formatjs_cli:formatjs_cli_test
- Observe that the test fails
Expected behavior
Expected behavior is that the Rust CLI extracts the message.
Screenshots
N/A
Desktop (please complete the following information):
- OS: [e.g. iOS] MacOS
- Browser [e.g. chrome, safari] Chrome
- Version [e.g. 22]
master (c281a36db86d4f8e3370010bc568dc9852b59e5e)
Additional context
Initially encountered while using [email protected]
Which package?
//crates/formatjs_cliDescribe the bug
The formatjs CLI does not identify messages like this:
To Reproduce
Codesandbox URL
N/A
Reproducible Steps/Repo
Steps to reproduce the behavior:
packages/ts-transformer/tests/fixtures/optionalChaining.tsxcrates/formatjs_cli/src/extractor.rsbazel test //crates/formatjs_cli:formatjs_cli_testExpected behavior
Expected behavior is that the Rust CLI extracts the message.
Screenshots
N/A
Desktop (please complete the following information):
master(c281a36db86d4f8e3370010bc568dc9852b59e5e)Additional context
Initially encountered while
using [email protected]