chore: eslint instead of standard

This commit is contained in:
Julien Fontanet
2017-11-21 11:47:21 +01:00
parent 4a6ba998d4
commit 5dfefe8d35
51 changed files with 603 additions and 896 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ import isObject from './is-object'
const {
create: createObject,
prototype: { hasOwnProperty }
prototype: { hasOwnProperty },
} = Object
export const ACTION_ADD = 'add'
@@ -269,7 +269,7 @@ export default class Collection extends EventEmitter {
const data = {
add: createObject(null),
remove: createObject(null),
update: createObject(null)
update: createObject(null),
}
for (const key in this._buffer) {
+19 -19
View File
@@ -261,58 +261,58 @@ describe('Collection', function () {
'add & update → add': [
[
['add', 'foo', 0],
['update', 'foo', 1]
['update', 'foo', 1],
],
{
add: {
foo: 1
}
}
foo: 1,
},
},
],
'add & remove → ∅': [
[
['add', 'foo', 0],
['remove', 'foo']
['remove', 'foo'],
],
{}
{},
],
'update & update → update': [
[
['update', 'bar', 1],
['update', 'bar', 2]
['update', 'bar', 2],
],
{
update: {
bar: 2
}
}
bar: 2,
},
},
],
'update & remove → remove': [
[
['update', 'bar', 1],
['remove', 'bar']
['remove', 'bar'],
],
{
remove: {
bar: undefined
}
}
bar: undefined,
},
},
],
'remove & add → update': [
[
['remove', 'bar'],
['add', 'bar', 0]
['add', 'bar', 0],
],
{
update: {
bar: 0
}
}
]
bar: 0,
},
},
],
}, ([operations, results], label) => {
it(label, function () {
forEach(operations, ([method, ...args]) => {
+4 -4
View File
@@ -6,7 +6,7 @@ import NotImplemented from './not-implemented'
import {
ACTION_ADD,
ACTION_UPDATE,
ACTION_REMOVE
ACTION_REMOVE,
} from './collection'
// ===================================================================
@@ -77,7 +77,7 @@ export default class Index {
const {
computeHash,
_itemsByHash: itemsByHash,
_keysToHash: keysToHash
_keysToHash: keysToHash,
} = this
for (const key in items) {
@@ -104,7 +104,7 @@ export default class Index {
const {
computeHash,
_itemsByHash: itemsByHash,
_keysToHash: keysToHash
_keysToHash: keysToHash,
} = this
for (const key in items) {
@@ -135,7 +135,7 @@ export default class Index {
_onRemove (items) {
const {
_itemsByHash: itemsByHash,
_keysToHash: keysToHash
_keysToHash: keysToHash,
} = this
for (const key in items) {
+30 -30
View File
@@ -29,18 +29,18 @@ describe('Index', function () {
let col, byGroup
const item1 = {
id: '2ccb8a72-dc65-48e4-88fe-45ef541f2cba',
group: 'foo'
group: 'foo',
}
const item2 = {
id: '7d21dc51-4da8-4538-a2e9-dd6f4784eb76',
group: 'bar'
group: 'bar',
}
const item3 = {
id: '668c1274-4442-44a6-b99a-512188e0bb09',
group: 'foo'
group: 'foo',
}
const item4 = {
id: 'd90b7335-e540-4a44-ad22-c4baae9cd0a9'
id: 'd90b7335-e540-4a44-ad22-c4baae9cd0a9',
}
beforeEach(function () {
@@ -61,19 +61,19 @@ describe('Index', function () {
byGroup: {
foo: {
[item1.id]: item1,
[item3.id]: item3
[item3.id]: item3,
},
bar: {
[item2.id]: item2
}
}
[item2.id]: item2,
},
},
})
})
it('works with added items', function () {
const item5 = {
id: '823b56c4-4b96-4f3a-9533-5d08177167ac',
group: 'baz'
group: 'baz',
}
col.add(item5)
@@ -83,15 +83,15 @@ describe('Index', function () {
byGroup: {
foo: {
[item1.id]: item1,
[item3.id]: item3
[item3.id]: item3,
},
bar: {
[item2.id]: item2
[item2.id]: item2,
},
baz: {
[item5.id]: item5
}
}
[item5.id]: item5,
},
},
})
})
})
@@ -99,7 +99,7 @@ describe('Index', function () {
it('works with updated items', function () {
const item1bis = {
id: item1.id,
group: 'bar'
group: 'bar',
}
col.update(item1bis)
@@ -108,13 +108,13 @@ describe('Index', function () {
expect(col.indexes).toEqual({
byGroup: {
foo: {
[item3.id]: item3
[item3.id]: item3,
},
bar: {
[item1.id]: item1bis,
[item2.id]: item2
}
}
[item2.id]: item2,
},
},
})
})
})
@@ -127,10 +127,10 @@ describe('Index', function () {
byGroup: {
foo: {
[item1.id]: item1,
[item3.id]: item3
[item3.id]: item3,
},
bar: {}
}
bar: {},
},
})
})
})
@@ -139,7 +139,7 @@ describe('Index', function () {
const item1bis = {
id: item1.id,
group: item1.group,
newProp: true
newProp: true,
}
col.update(item1bis)
@@ -149,12 +149,12 @@ describe('Index', function () {
byGroup: {
foo: {
[item1.id]: item1bis,
[item3.id]: item3
[item3.id]: item3,
},
bar: {
[item2.id]: item2
}
}
[item2.id]: item2,
},
},
})
})
})
@@ -170,9 +170,9 @@ describe('Index', function () {
byGroup: {
foo: {
[item1.id]: item1,
[item3.id]: item3
}
}
[item3.id]: item3,
},
},
})
})
})
+4 -4
View File
@@ -5,7 +5,7 @@ import NotImplemented from './not-implemented'
import {
ACTION_ADD,
ACTION_UPDATE,
ACTION_REMOVE
ACTION_REMOVE,
} from './collection'
// ===================================================================
@@ -66,7 +66,7 @@ export default class UniqueIndex {
const {
computeHash,
_itemByHash: itemByHash,
_keysToHash: keysToHash
_keysToHash: keysToHash,
} = this
for (const key in items) {
@@ -85,7 +85,7 @@ export default class UniqueIndex {
const {
computeHash,
_itemByHash: itemByHash,
_keysToHash: keysToHash
_keysToHash: keysToHash,
} = this
for (const key in items) {
@@ -110,7 +110,7 @@ export default class UniqueIndex {
_onRemove (items) {
const {
_itemByHash: itemByHash,
_keysToHash: keysToHash
_keysToHash: keysToHash,
} = this
for (const key in items) {
+16 -16
View File
@@ -29,14 +29,14 @@ describe('UniqueIndex', function () {
let col, byKey
const item1 = {
id: '2ccb8a72-dc65-48e4-88fe-45ef541f2cba',
key: '036dee1b-9a3b-4fb5-be8a-4f535b355581'
key: '036dee1b-9a3b-4fb5-be8a-4f535b355581',
}
const item2 = {
id: '7d21dc51-4da8-4538-a2e9-dd6f4784eb76',
key: '103cd893-d2cc-4d37-96fd-c259ad04c0d4'
key: '103cd893-d2cc-4d37-96fd-c259ad04c0d4',
}
const item3 = {
id: '668c1274-4442-44a6-b99a-512188e0bb09'
id: '668c1274-4442-44a6-b99a-512188e0bb09',
}
beforeEach(function () {
@@ -56,15 +56,15 @@ describe('UniqueIndex', function () {
expect(col.indexes).toEqual({
byKey: {
[item1.key]: item1,
[item2.key]: item2
}
[item2.key]: item2,
},
})
})
it('works with added items', function () {
const item4 = {
id: '823b56c4-4b96-4f3a-9533-5d08177167ac',
key: '1437af14-429a-40db-8a51-8a2f5ed03201'
key: '1437af14-429a-40db-8a51-8a2f5ed03201',
}
col.add(item4)
@@ -74,8 +74,8 @@ describe('UniqueIndex', function () {
byKey: {
[item1.key]: item1,
[item2.key]: item2,
[item4.key]: item4
}
[item4.key]: item4,
},
})
})
})
@@ -83,7 +83,7 @@ describe('UniqueIndex', function () {
it('works with updated items', function () {
const item1bis = {
id: item1.id,
key: 'e03d4a3a-0331-4aca-97a2-016bbd43a29b'
key: 'e03d4a3a-0331-4aca-97a2-016bbd43a29b',
}
col.update(item1bis)
@@ -92,8 +92,8 @@ describe('UniqueIndex', function () {
expect(col.indexes).toEqual({
byKey: {
[item1bis.key]: item1bis,
[item2.key]: item2
}
[item2.key]: item2,
},
})
})
})
@@ -104,8 +104,8 @@ describe('UniqueIndex', function () {
return waitTicks().then(() => {
expect(col.indexes).toEqual({
byKey: {
[item1.key]: item1
}
[item1.key]: item1,
},
})
})
})
@@ -114,7 +114,7 @@ describe('UniqueIndex', function () {
const item1bis = {
id: item1.id,
key: item1.key,
newProp: true
newProp: true,
}
col.update(item1bis)
@@ -123,8 +123,8 @@ describe('UniqueIndex', function () {
expect(col.indexes).toEqual({
byKey: {
[item1.key]: item1bis,
[item2.key]: item2
}
[item2.key]: item2,
},
})
})
})
+6 -6
View File
@@ -11,18 +11,18 @@ users.getKey = (user) => user.name
// Inserts some data.
users.add({
name: 'bob'
name: 'bob',
})
users.add({
name: 'clara',
active: true
active: true,
})
users.add({
name: 'ophelia'
name: 'ophelia',
})
users.add({
name: 'Steve',
active: true
active: true,
})
// -------------------------------------------------------------------
@@ -48,9 +48,9 @@ setTimeout(function () {
users.set({
name: 'ophelia',
active: true
active: true,
})
users.set({
name: 'Steve'
name: 'Steve',
})
}, 10)
+1 -1
View File
@@ -3,7 +3,7 @@ import { bind, forEach, iteratee as createCallback } from 'lodash'
import Collection, {
ACTION_ADD,
ACTION_UPDATE,
ACTION_REMOVE
ACTION_REMOVE,
} from './collection'
// ===================================================================