Replies: 4 comments
-
hmm yeah we can support this & ofc PR's always welcome :) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Cool, I can work on a PR for this. Currently when {
"trailing.ws": {
"col": 21,
"defaultMessage": "Some whitespace",
"description": "Whitespace",
"end": 650,
"file": "defineMessages/actual.js",
"line": 20,
"start": 545,
"meta" : {
"baz": "1",
"foo": "bar"
}
}
} Instead, should we output something like this? {
"trailing.ws": {
"defaultMessage": "Some whitespace",
"description": "Whitespace",
"locations": [
{
"col": 21,
"end": 650,
"file": "defineMessages/actual.js",
"line": 20,
"start": 545,
"meta" : {
"baz": "1",
"foo": "bar"
}
}
]
}
} This seems like it would be the correct API. It would be a breaking change. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yeah sgtm we can bump major |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Which package?
cli
Describe the bug
When using
formatjs extract
with the--extract-source-location
flag, if the same defaultMessage is used multiple places (and thus the id is the same), the extracted file will only have the source location for one of the locations.Reproducible Steps/Repo
Steps to reproduce the behavior:
intl.formatMessage({ defaultMessage: 'Hello world'});
formatjs extract --extract-source-location
on the filesExpected behavior
It would be great to have an array of source location data per message.
Looks like the multiple messages with different source location data are being overwritten here: https://github.com/formatjs/formatjs/blob/main/packages/cli/src/extract.ts#L223
Beta Was this translation helpful? Give feedback.
All reactions