Skip to content

Commit

Permalink
ux(docs): enable eslint rule space-before-function-paren
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyiam committed Jun 18, 2020
1 parent 9f2d2d7 commit 23e7b87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module.exports = {
'no-undef': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'space-before-function-paren': 'off',
quotes: 'off',
semi: 'off',
},
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ Modules works by registering global listeners for [hooks](#hooks). A module is s

```mjs
var myModule = {
create: function(oldVnode, vnode) {
create: function (oldVnode, vnode) {
// invoked whenever a new virtual node is created
},
update: function(oldVnode, vnode) {
update: function (oldVnode, vnode) {
// invoked whenever a virtual node is updated
}
};
Expand Down Expand Up @@ -498,7 +498,7 @@ you want to listen to. The function will be called when the event
happens and will be passed the event object that belongs to it.

```mjs
function clickHandler(ev) {
function clickHandler (ev) {
console.log('got clicked');
}
h('div', { on: { click: clickHandler } });
Expand All @@ -518,7 +518,7 @@ first element in the array should be a function that will be invoked
with the value in the second element once the event occurs.

```mjs
function clickHandler(number) {
function clickHandler (number) {
console.log('button ' + number + ' was clicked!');
}
h('div', [
Expand All @@ -531,10 +531,10 @@ h('div', [
Each handler is called not only with the given arguments but also with the current event and vnode appended to the argument list. It also supports using multiple listeners per event by specifying an array of handlers:

```mjs
stopPropagation = function(ev) {
stopPropagation = function (ev) {
ev.stopPropagation()
}
sendValue = function(func, ev, vnode) {
sendValue = function (func, ev, vnode) {
func(vnode.elm.value)
}

Expand All @@ -555,7 +555,7 @@ In particular, you should **not** do something like this:
```mjs
// Does not work
var sharedHandler = {
change: function(e) { console.log('you chose: ' + e.target.value); }
change: function (e) { console.log('you chose: ' + e.target.value); }
};
h('div', [
h('input', {
Expand All @@ -578,7 +578,7 @@ Alternatively, simply make sure each node is passed unique `on` values:

```mjs
// Works
var sharedHandler = function(e) {
var sharedHandler = function (e) {
console.log('you chose: ' + e.target.value);
};
h('div', [
Expand Down Expand Up @@ -640,7 +640,7 @@ dealing with immutable data.
Consider a simple function for creating a virtual node based on a number.

```mjs
function numberView(n) {
function numberView (n) {
return h('div', 'Number is: ' + n);
}
```
Expand All @@ -651,7 +651,7 @@ vnode is wasteful. To avoid the overhead we can use the `thunk` helper
function.

```mjs
function render(state) {
function render (state) {
return thunk('num', numberView, [state.number]);
}
```
Expand Down

0 comments on commit 23e7b87

Please sign in to comment.