Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Make plugin idempotent by not removing description #28

Merged
merged 1 commit into from
Jan 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const FUNCTION_NAMES = [

const DESCRIPTOR_PROPS = new Set(['id', 'description', 'defaultMessage']);

export default function ({types: t}) {
export default function () {
function getModuleSourceName(opts) {
return opts.moduleSourceName || 'react-intl';
}
Expand Down Expand Up @@ -205,14 +205,6 @@ export default function ({types: t}) {
// checked.
if (descriptor.defaultMessage) {
storeMessage(descriptor, path, state);

attributes
.filter((attr) => {
let keyPath = attr.get('name');
let key = getMessageDescriptorKey(keyPath);
return key === 'description';
})
.forEach((attr) => attr.remove());
}
}
},
Expand Down Expand Up @@ -245,17 +237,6 @@ export default function ({types: t}) {
}

storeMessage(descriptor, path, state);

messageObj.replaceWith(t.objectExpression([
t.objectProperty(
t.stringLiteral('id'),
t.stringLiteral(descriptor.id)
),
t.objectProperty(
t.stringLiteral('defaultMessage'),
t.stringLiteral(descriptor.defaultMessage)
),
]));
}

let callee = path.get('callee');
Expand Down