Skip to content

Commit

Permalink
Dumb components default to block body style
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunsaker committed May 11, 2018
1 parent b9587e2 commit 509b616
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"object": true
}
],
"react/require-default-props": "off"
"react/require-default-props": "off",
"arrow-body-style": 0 // don't enforce arrow-body-style, block body (() => { ... }) and single expression (() => ...) depends on use case
},
"plugins": ["react", "react-native"],
"globals": {
Expand Down
12 changes: 7 additions & 5 deletions components/Example/Example.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const defaultProps = {
title: 'Title Text',
};

const Example = ({ title }) => (
<View style={styles.container}>
<Text style={styles.titleText}>{title}</Text>
</View>
);
const Example = ({ title }) => {
return (
<View style={styles.container}>
<Text style={styles.titleText}>{title}</Text>
</View>
);
};

Example.propTypes = propTypes;
Example.defaultProps = defaultProps;
Expand Down
4 changes: 3 additions & 1 deletion snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
"$2",
"const defaultProps ={};",
"$2",
"const $1 = ({ someProp }) => (",
"const $1 = ({ someProp }) => {",
"return (",
"<View style={styles.container}>",
" <View />",
"</View>",
");",
"}",
"$2",
"$1.propTypes = propTypes;",
"$1.defaultProps = defaultProps;",
Expand Down

0 comments on commit 509b616

Please sign in to comment.