Permalink
Browse files

Format improvements (#664)

* Reformat existing code that wasn't.

* Move prettier config option outside of script so other tools can use it
i.e. format on-save in editors.
  • Loading branch information...
okwolf authored and jorgebucaran committed Mar 26, 2018
1 parent 808f42d commit 538a93ed29792bf2d298d5f93434ecbc78ff29eb
Showing with 14 additions and 4 deletions.
  1. +3 −1 hyperapp.d.ts
  2. +4 −1 package.json
  3. +7 −2 test/ts/Component.tsx
View
@@ -18,7 +18,9 @@ export interface VNode<Attributes = {}> {
* @memberOf [VDOM]
*/
export interface Component<Attributes = {}, State = {}, Actions = {}> {
(attributes: Attributes, children: Array<VNode | string>): VNode<Attributes> | View<State, Actions>
(attributes: Attributes, children: Array<VNode | string>):
| VNode<Attributes>
| View<State, Actions>
}
/**
View
@@ -27,7 +27,7 @@
"bundle": "rollup -i src/index.js -o dist/hyperapp.js -m -f umd -n hyperapp",
"minify": "uglifyjs dist/hyperapp.js -o dist/hyperapp.js -mc pure_funcs=['Object.defineProperty'] --source-map includeSources,url=hyperapp.js.map",
"prepare": "npm run build",
"format": "prettier --semi false --write {src,test}/**/*.js {,test/ts/}*.{ts,tsx}",
"format": "prettier --write {src,test}/**/*.js {,test/ts/}*.{ts,tsx}",
"release": "npm run build && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
},
"babel": {
@@ -49,5 +49,8 @@
"rollup": "^0.55.3",
"typescript": "2.7.1",
"uglify-js": "3.3.9"
},
"prettier": {
"semi": false
}
}
View
@@ -9,16 +9,21 @@ interface Actions {
up(value: number): State
}
const Counter: Component<{ state: State, actions: Actions }> = ({ state, actions }) =>
const Counter: Component<{ state: State; actions: Actions }> = ({
state,
actions
}) => (
<div>
<div>{state.count}</div>
<button onclick={actions.down}>-</button>
<button onclick={actions.up}>+</button>
</div>
)
const LazyCounter: Component<{}, State, Actions> = () => (state, actions) =>
const LazyCounter: Component<{}, State, Actions> = () => (state, actions) => (
<div>
<div>{state.count}</div>
<button onclick={actions.down}>-</button>
<button onclick={actions.up}>+</button>
</div>
)

0 comments on commit 538a93e

Please sign in to comment.