Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
skoging authored and longlho committed Feb 12, 2021
1 parent 0172f46 commit 2d30402
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions packages/babel-plugin-formatjs/index.ts
Expand Up @@ -98,10 +98,10 @@ function getICUMessageValue(
return '';
}
let message = getMessageDescriptorValue(messagePath);
if (!preserveWhitespace) {
message = message.trim().replace(/\s+/gm, ' ');
}

if (!preserveWhitespace) {
message = message.trim().replace(/\s+/gm, ' ');
}

try {
parse(message);
Expand Down Expand Up @@ -200,9 +200,13 @@ function evaluateMessageDescriptor(
preserveWhitespace?: OptionsSchema['preserveWhitespace']
) {
let id = getMessageDescriptorValue(descriptorPath.id);
const defaultMessage = getICUMessageValue(descriptorPath.defaultMessage, {
isJSXSource,
}, preserveWhitespace);
const defaultMessage = getICUMessageValue(
descriptorPath.defaultMessage,
{
isJSXSource,
},
preserveWhitespace
);
const description = getMessageDescriptorValue(descriptorPath.description);

if (overrideIdFn) {
Expand Down Expand Up @@ -402,8 +406,8 @@ export default declare((api: any, options: OptionsSchema) => {
removeDefaultMessage,
idInterpolationPattern,
overrideIdFn,
ast,
preserveWhitespace,
ast,
preserveWhitespace,
} = opts;
if (wasExtracted(path)) {
return;
Expand Down Expand Up @@ -452,8 +456,8 @@ export default declare((api: any, options: OptionsSchema) => {
true,
filename,
idInterpolationPattern,
overrideIdFn,
preserveWhitespace
overrideIdFn,
preserveWhitespace
);

storeMessage(
Expand Down Expand Up @@ -548,8 +552,8 @@ export default declare((api: any, options: OptionsSchema) => {
idInterpolationPattern,
removeDefaultMessage,
additionalFunctionNames = [],
ast,
preserveWhitespace,
ast,
preserveWhitespace,
} = opts;
const callee = path.get('callee');

Expand Down Expand Up @@ -587,7 +591,7 @@ export default declare((api: any, options: OptionsSchema) => {
filename,
idInterpolationPattern,
overrideIdFn,
preserveWhitespace
preserveWhitespace
);
storeMessage(descriptor, messageDescriptor, opts, filename, messages);

Expand Down

0 comments on commit 2d30402

Please sign in to comment.