-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(component sub-generator): `PropTypes` only imported from `prop-types` if it exists within project's package file - #105 * feat(sub-generators): `component`, `enhancer`, and `function` sub generators support [airbnb linting style](https://github.com/airbnb/javascript) - #105
- Loading branch information
1 parent
21b1d85
commit 24991dd
Showing
19 changed files
with
1,826 additions
and
1,379 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import <%= name %> from './<%= name %>';<% if (includeEnhancer) { %> | ||
import enhance from './<%= name %>.enhancer';<% } %> | ||
|
||
export default <% if (includeEnhancer) { %>enhance(<%= name %>)<% } else { %><%= name %><% } %>; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { compose } from 'redux'; | ||
import { withHandlers } from 'recompose'; | ||
|
||
export default compose( | ||
withHandlers({ | ||
// someHandler: props => value => {} | ||
}), | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<% if (hasPropTypes) { %>import React from 'react' | ||
import PropTypes from 'prop-types'<% } else { %>import React, { PropTypes } from 'react'<% } %>;<% if (addStyle) { %> | ||
import classes from './<%= name %>.scss';<%}%> | ||
|
||
export const <%= name %> = ({ <%= camelName %> }) => ( | ||
<% if (addStyle) { %><div className={classes.container}><% } else { %><div className='<%= name %>'><%}%> | ||
<span><%= name %> Component</span> | ||
<pre>{JSON.stringify(<%= camelName %>, null, 2)}</pre> | ||
</div> | ||
); | ||
|
||
<%= name %>.propTypes = { | ||
<%= camelName %>: PropTypes.object, <% if (includeEnhancer) { %> // from enhancer (firestoreConnect + connect)<% } %> | ||
}; | ||
|
||
export default <%= name %>; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types'<% if (addStyle) { %> | ||
<% if (hasPropTypes) { %>import React from 'react' | ||
import PropTypes from 'prop-types'<% } else { %>import React, { PropTypes } from 'react'<% } %><% if (addStyle) { %> | ||
import classes from './<%= name %>.scss'<%}%> | ||
|
||
export const <%= name %> = ({ <%= lowerName %> }) => ( | ||
<% if (addStyle) { %><div className={classes.container}><%} else { %><div className='<%= name %>'><%}%> | ||
export const <%= name %> = ({ <%= camelName %> }) => ( | ||
<% if (addStyle) { %><div className={classes.container}><% } else { %><div className='<%= name %>'><%}%> | ||
<span><%= name %> Component</span> | ||
<pre>{JSON.stringify(<%= lowerName %>, null, 2)}</pre> | ||
<pre>{JSON.stringify(<%= camelName %>, null, 2)}</pre> | ||
</div> | ||
) | ||
|
||
<%= name %>.propTypes = { | ||
<%= lowerName %>: PropTypes.object // from enhancer (firestoreConnect + connect) | ||
<%= camelName %>: PropTypes.object <% if (includeEnhancer) { %> // from enhancer (firestoreConnect + connect)<% } %> | ||
} | ||
|
||
export default <%= name %> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import <%= name %> from './<%= name %>'; | ||
import enhance from './<%= name %>.enhancer'; | ||
|
||
export default enhance(<%= name %>); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { compose } from 'redux'; | ||
import { connect } from 'react-redux'; | ||
import { <% if (usingFirestore) { %>firestoreConnect<% } %><% if (!usingFirestore) { %>firebaseConnect<% } %> } from 'react-redux-firebase'; | ||
|
||
export default compose( | ||
// create listener for <%= camelName %>, results go into redux state | ||
<% if (!usingFirestore) { %>firebaseConnect([{ path: '<%= camelName %>' }]),<% } %><% if (usingFirestore) { %>firestoreConnect([{ collection: '<%= camelName %>' }]),<% } %> | ||
// connect redux state to props | ||
connect(({ <% if (!usingFirestore) { %>firebase<% } else { %>firestore<% } %>: { data } }) => ({ | ||
<%= camelName %>: data.<%= camelName %>, | ||
})) | ||
); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import * as functions from 'firebase-functions'; | ||
// import * as admin from 'firebase-admin'; | ||
import * as functions from 'firebase-functions'<% if (airbnbLinting) { %>;<% } %> | ||
// import * as admin from 'firebase-admin'<% if (airbnbLinting) { %>;<% } %> | ||
|
||
<% if (functionsV1) { %>async function <%= camelName %>Event(userMetaData, context) { | ||
// const { creationTime, lastSignInTime } = userMetadata<% if (airbnbLinting) { %>;<% } %> | ||
}<% } else { %>function <%= camelName %>Event(event) { | ||
// const user = event.data<% if (airbnbLinting) { %>;<% } %> // The Firebase user | ||
// const { email, displayName } = user<% if (airbnbLinting) { %>;<% } %> | ||
}<% } %><% if (airbnbLinting) { %>;<% } %> | ||
|
||
/** | ||
* @name <%= camelName %> | ||
* Cloud Function triggered by Auth Event | ||
* @type {functions.CloudFunction} | ||
*/ | ||
export default functions.auth.user().<%= eventType %>(<%= camelName %>Event) | ||
|
||
<% if (functionsV1) { %>async function <%= camelName %>Event(userMetaData, context) { | ||
// const { creationTime, lastSignInTime } = userMetadata; | ||
}<% } else { %>function <%= camelName %>Event(event) { | ||
// const user = event.data; // The Firebase user | ||
// const { email, displayName } = user | ||
}<% } %> | ||
export default functions.auth.user().<%= eventType %>(<%= camelName %>Event)<% if (airbnbLinting) { %>;<% } %> |
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
Oops, something went wrong.