Details
-
Task
-
Status: Closed
-
Minor
-
Resolution: Completed
-
None
-
7.2.x, 7.1.x, 7.0.x
-
Committed
Description
Problem:
- We use a regular expression to substitute Liferay.Language.get calls
- Prettier may break code up across lines if it exceeds a certain length
- The line breaks prevent the regular expression from matching and the substitution doesn't get performed
Proposed solution:
- Update the code that preforms the substitution to tolerate whitespace (including linebreaks and leading indentaion) between the parentheses of the Liferay.Language.get call and its string parameter.
I believe the pattern in question is here:
For more context and some other possible solutions see:
https://github.com/brianchandotcom/liferay-portal/pull/74563#issuecomment-502786377
Note that that PR fixes a few places where `Liferay.Language.get()` calls have been broken up across multiple lines, but a `git grep` shows that there are still others in the codebase. This is pretty high priority. Until we address this issue, Prettier is going to keep putting the line breaks in there and cause substitution to fail, and anywhere where we manually patch it like that PR does, Prettier will just revert it right back on the next SF (unless we add `// prettier-ignore` comments), which we don't want to do.