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

Commit 4ba9be7

Browse files
committed
Make plugin idempotent by not removing description
Fixes #22 Fixes #25 Fixes #26
1 parent b41d947 commit 4ba9be7

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

src/index.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const FUNCTION_NAMES = [
2020

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

23-
export default function ({types: t}) {
23+
export default function () {
2424
function getModuleSourceName(opts) {
2525
return opts.moduleSourceName || 'react-intl';
2626
}
@@ -205,14 +205,6 @@ export default function ({types: t}) {
205205
// checked.
206206
if (descriptor.defaultMessage) {
207207
storeMessage(descriptor, path, state);
208-
209-
attributes
210-
.filter((attr) => {
211-
let keyPath = attr.get('name');
212-
let key = getMessageDescriptorKey(keyPath);
213-
return key === 'description';
214-
})
215-
.forEach((attr) => attr.remove());
216208
}
217209
}
218210
},
@@ -245,17 +237,6 @@ export default function ({types: t}) {
245237
}
246238

247239
storeMessage(descriptor, path, state);
248-
249-
messageObj.replaceWith(t.objectExpression([
250-
t.objectProperty(
251-
t.stringLiteral('id'),
252-
t.stringLiteral(descriptor.id)
253-
),
254-
t.objectProperty(
255-
t.stringLiteral('defaultMessage'),
256-
t.stringLiteral(descriptor.defaultMessage)
257-
),
258-
]));
259240
}
260241

261242
let callee = path.get('callee');

0 commit comments

Comments
 (0)