Skip to content

Commit

Permalink
🔧 add prettier formatting to scripts + configs for linting
Browse files Browse the repository at this point in the history
yarn format works now + prettier configs and js component btholt#1
  • Loading branch information
lisaross committed Aug 14, 2018
1 parent 003e9e0 commit fed0da7
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 120,
"singleQuote": true,
"parser": "flow",
"eslintIntegration": true,
"trailingComma":"all",
"tabWidth":2,
"bracketSpacing": true,
"jsxBracketSameLine": false,
"useTabs": false,
"semi": true
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"prettier.eslintIntegration": true,
"prettier.printWidth": 120,
"prettier.singleQuote": true
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<div id="app"></div>
<script src="node_modules/react/dist/react.js"></script>
<script src="node_modules/react-dom/dist/react-dom.js"></script>
<script></script>
</body>

</html>
17 changes: 17 additions & 0 deletions js/clientApp.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const ce = React.createElement;

const MyTitle = function(props) {
return ce('div', null, ce('h1', { style: { color: props.color } }, props.title));
};

const MyFirstComponent = function() {
return ce(
'div',
{ id: 'my-first-component' },
ce(MyTitle, { title: 'Game of thrones', color: 'peru' }),
ce(MyTitle, { title: 'Stranger things', color: 'orange' }),
ce(MyTitle, { title: 'Rick and Morty', color: 'greenyellow' })
);
};

ReactDOM.render(ce(MyFirstComponent), document.getElementById('app'));
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"scripts": {
"api": "node ratingsAPI.js"
"api": "node ratingsAPI.js",
"format": "prettier --write --single-quote --print-width=120 --parser=flow --tab-width=2 \"js/**/*.{js,jsx}\""
},
"dependencies": {
"axios": "0.16.1",
Expand Down

0 comments on commit fed0da7

Please sign in to comment.