Skip to content

Commit

Permalink
Fix scalable-react#75: Update template for stateless components
Browse files Browse the repository at this point in the history
The `{{else if ...}}` construct is not supported prior to handlebars v3.0.0. Based on yarn.lock, seems like plop is
using handlebars 2.0.0.

* Replace `{{else if ...}}` with a nested `if/else` block
* Remove unnecessary branch point on `{{#unless wantFlowTypes}}` which will never be reached since that condition is
  already checked in an earlier `if` condition.
  • Loading branch information
mwolson committed Feb 15, 2017
1 parent 24f0405 commit ffbfef5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/generators/component/stateless.js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ function {{ properCase name }}(props: {}) {
</Box>
);
}
{{else if wantPropTypes}}
{{#unless wantFlowTypes}}
{{else}}
{{#if wantPropTypes}}
function {{ properCase name }}(props) {
return (
<Box>

</Box>
);
}
{{/unless}}
{{else}}
function {{ properCase name }}() {
return (
Expand All @@ -45,6 +44,7 @@ function {{ properCase name }}() {
);
}
{{/if}}
{{/if}}

{{#if wantPropTypes}}
{{ properCase name }}.propTypes = {
Expand Down

0 comments on commit ffbfef5

Please sign in to comment.