This repository has been archived by the owner on Jun 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make plugin idempotent by not removing description
- Loading branch information
Showing
1 changed file
with
1 addition
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4ba9be7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about splitting this into another plugin to remove the description & (optionally) defaultMessage entirely. Noticing there's definitely some cruft we could remove from our production builds.
4ba9be7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue is that Babel 6 makes it easy for people to accidentally run the same plugin multiple times. So what was happening is the translator message
description
props were pruned automatically and the option to enforce them was set. So the second time the plugin ran it would error.Even if you moved this to a separate plugin, we'd still have that same issue unless we marked the nodes as being process in the AST. This would work for a single plugin pass, but if
passPerPreset: true
is set then I'm not sure it would be seeing the same AST nodes or not — it probably does, but I haven't tested it.If you'd like to send a PR to add back the auto pruning of translator
description
props and a new option which when set removes thedefaultMessage
props that would be cool!